grub/geninit.sh
robertmh daf0f0ba3e 2007-07-22 Robert Millan <rmh@aybabtu.com>
* geninitheader.sh: Process file specified in first parameter rather
	than hardcoding grub_modules_init.lst.
	* geninit.sh: Likewise.  Also, construct header name dynamicaly rather
	than hardcoding grub_modules_init.h.

	* conf/common.rmk: Rename grub_modules_init.[ch] files associated with
	grub-emu to grub_emu_init.[ch].  Add rules to build analogous
	grub_probe_init.[ch] and grub_setup_init.[ch].

	* conf/powerpc-ieee1275.rmk (grub_emu_DEPENDENCIES): Replace
	grub_modules_init.h with grub_emu_init.h.
	(grub_probe_DEPENDENCIES, grub_probe_SOURCES): Add new
	grub_probe_init.[ch] files.
	* conf/i386-efi.rmk: Likewise.
	* conf/i386-pc.rmk: Likewise.
	(grub_setup_DEPENDENCIES, grub_setup_SOURCES): Add new
	grub_setup_init.[ch] files.

	* util/grub-emu.c: Replace grub_modules_init.h with grub_emu_init.h.
	* util/grub-probe.c: Include grub_probe_init.h.  Use grub_init_all()
	to initialize modules rather than a list of hardcoded functions.
	* util/i386/pc/grub-setup.c: Include grub_setup_init.h.  Use
	grub_init_all() to initialize modules rather than a list of hardcoded
	functions.
2007-07-22 19:17:27 +00:00

75 lines
1.9 KiB
Bash

#! /bin/sh
#
# Copyright (C) 2002,2005,2007 Free Software Foundation, Inc.
#
# This gensymlist.sh is free software; the author
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
lst="$1"
shift
header=`echo "${lst}" | sed -e "s/\.lst$/.h/g"`
cat <<EOF
/* This file is automatically generated by geninit.sh. DO NOT EDIT! */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2005,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <$header>
EOF
cat <<EOF
void
grub_init_all (void)
{
EOF
while read line; do
file=`echo $line | cut -f1 -d:`
if echo $@ | grep $file >/dev/null; then
echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init ();/'
fi
done < ${lst}
cat <<EOF
}
EOF
cat <<EOF
void
grub_fini_all (void)
{
EOF
while read line; do
file=`echo $line | cut -f1 -d:`
if echo $@ | grep $file >/dev/null; then
echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_fini ();/'
fi
done < ${lst}
cat <<EOF
}
EOF