]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2005-01-31 Marco Gerards <metgerards@student.han.nl>
authormarco_g <marco_g@localhost>
Mon, 31 Jan 2005 21:44:35 +0000 (21:44 +0000)
committermarco_g <marco_g@localhost>
Mon, 31 Jan 2005 21:44:35 +0000 (21:44 +0000)
* include/grub/powerpc/ieee1275/loader.h (grub_load_linux):
Removed prototype.
(grub_rescue_cmd_linux): New prototype.
(grub_rescue_cmd_initrd): Likewise.
* powerpc/ieee1275/linux.c (grub_linux_boot): Remove struct
`bi_rec'.
(grub_linux_release_mem): Release the memory for the initrd.
(grub_load_linux): Renamed from this...
(grub_rescue_cmd_linux): ...To this.  Changed all callers.
Changed `entry' not to be static.  Loop over memory regions to
find another one when the default fails.
(grub_rescue_cmd_initrd): New function.
(grub_linux_init): Remove function.
(grub_linux_fini): Likewise.
(GRUB_MOD_INIT): Register `initrd'.
(GRUB_MOD_FINI): Unregister `initrd'.
* powerpc/ieee1275/linux_normal.c (grub_linux_normal_init):
Function removed.
(grub_linux_normal_fini): Likewise.
(GRUB_MOD_INIT): Register `initrd'.
(GRUB_MOD_FINI): Unregister `initrd'.

ChangeLog
conf/i386-pc.mk
conf/powerpc-ieee1275.mk
include/grub/powerpc/ieee1275/loader.h
loader/powerpc/ieee1275/linux.c
loader/powerpc/ieee1275/linux_normal.c

index 5ef2c0182925fecba6e698dddac7a13342d01fe7..a0330e341414e66950feb5f63ad4a2f8874c63a1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2005-01-31  Marco Gerards  <metgerards@student.han.nl>
+
+       * include/grub/powerpc/ieee1275/loader.h (grub_load_linux):
+       Removed prototype.
+       (grub_rescue_cmd_linux): New prototype.
+       (grub_rescue_cmd_initrd): Likewise.
+       * powerpc/ieee1275/linux.c (grub_linux_boot): Remove struct
+       `bi_rec'.
+       (grub_linux_release_mem): Release the memory for the initrd.
+       (grub_load_linux): Renamed from this...
+       (grub_rescue_cmd_linux): ...To this.  Changed all callers.
+       Changed `entry' not to be static.  Loop over memory regions to
+       find another one when the default fails.
+       (grub_rescue_cmd_initrd): New function.
+       (grub_linux_init): Remove function.
+       (grub_linux_fini): Likewise.
+       (GRUB_MOD_INIT): Register `initrd'.
+       (GRUB_MOD_FINI): Unregister `initrd'.
+       * powerpc/ieee1275/linux_normal.c (grub_linux_normal_init):
+       Function removed.
+       (grub_linux_normal_fini): Likewise.
+       (GRUB_MOD_INIT): Register `initrd'.
+       (GRUB_MOD_FINI): Unregister `initrd'.
+
 2005-01-31  Marco Gerards  <metgerards@student.han.nl>
 
        * commands/help.c: New file.
index d349de9c78ce59973458e68d41c42e4797c150f3..3334aaa846f893155aadc3261d8e29466737ab6e 100644 (file)
@@ -505,11 +505,12 @@ grub_emu_SOURCES = kern/main.c kern/device.c fs/fshelp.c          \
        commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c               \
        util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/iso9660.c \
        normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c      \
-       util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c disk/loopback.c
-CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-kern_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-disk_loopback.o
-MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-fs_fshelp.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-kern_partition.d grub_emu-kern_env.d grub_emu-commands_ls.d grub_emu-partmap_amiga.d grub_emu-partmap_pc.d grub_emu-partmap_apple.d grub_emu-commands_terminal.d grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_arg.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d grub_emu-disk_loopback.d
+       util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c commands/help.c \
+       disk/loopback.c
+CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-kern_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-commands_help.o grub_emu-disk_loopback.o
+MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-fs_fshelp.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-kern_partition.d grub_emu-kern_env.d grub_emu-commands_ls.d grub_emu-partmap_amiga.d grub_emu-partmap_pc.d grub_emu-partmap_apple.d grub_emu-commands_terminal.d grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_arg.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d grub_emu-commands_help.d grub_emu-disk_loopback.d
 
-grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-kern_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-disk_loopback.o
+grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-kern_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-commands_help.o grub_emu-disk_loopback.o
        $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
 
 grub_emu-kern_main.o: kern/main.c
@@ -824,6 +825,14 @@ grub_emu-util_i386_pc_getroot.d: util/i386/pc/getroot.c
 
 -include grub_emu-util_i386_pc_getroot.d
 
+grub_emu-commands_help.o: commands/help.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-commands_help.d: commands/help.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,help\.o[ :]*,grub_emu-commands_help.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+
+-include grub_emu-commands_help.d
+
 grub_emu-disk_loopback.o: disk/loopback.c
        $(BUILD_CC) -Idisk -I$(srcdir)/disk $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
@@ -855,7 +864,7 @@ genmoddep-util_genmoddep.d: util/genmoddep.c
 pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
        hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
        boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod \
-       amiga.mod apple.mod pc.mod loopback.mod
+       amiga.mod apple.mod pc.mod loopback.mod reboot.mod halt.mod help.mod
 
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -1605,6 +1614,123 @@ cat_mod-commands_cat.d: commands/cat.c
 
 cat_mod_CFLAGS = $(COMMON_CFLAGS)
 
+# For help.mod.
+help_mod_SOURCES = commands/help.c
+CLEANFILES += help.mod mod-help.o mod-help.c pre-help.o help_mod-commands_help.o def-help.lst und-help.lst
+MOSTLYCLEANFILES += help_mod-commands_help.d
+DEFSYMFILES += def-help.lst
+UNDSYMFILES += und-help.lst
+
+help.mod: pre-help.o mod-help.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-help.o: help_mod-commands_help.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-help.o: mod-help.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(help_mod_CFLAGS) -c -o $@ $<
+
+mod-help.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'help' $< > $@ || (rm -f $@; exit 1)
+
+def-help.lst: pre-help.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 help/' > $@
+
+und-help.lst: pre-help.o
+       echo 'help' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+help_mod-commands_help.o: commands/help.c
+       $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(help_mod_CFLAGS) -c -o $@ $<
+
+help_mod-commands_help.d: commands/help.c
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(help_mod_CFLAGS) -M $<    | sed 's,help\.o[ :]*,help_mod-commands_help.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+
+-include help_mod-commands_help.d
+
+help_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For reboot.mod.
+reboot_mod_SOURCES = commands/i386/pc/reboot.c
+CLEANFILES += reboot.mod mod-reboot.o mod-reboot.c pre-reboot.o reboot_mod-commands_i386_pc_reboot.o def-reboot.lst und-reboot.lst
+MOSTLYCLEANFILES += reboot_mod-commands_i386_pc_reboot.d
+DEFSYMFILES += def-reboot.lst
+UNDSYMFILES += und-reboot.lst
+
+reboot.mod: pre-reboot.o mod-reboot.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-reboot.o: reboot_mod-commands_i386_pc_reboot.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-reboot.o: mod-reboot.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(reboot_mod_CFLAGS) -c -o $@ $<
+
+mod-reboot.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'reboot' $< > $@ || (rm -f $@; exit 1)
+
+def-reboot.lst: pre-reboot.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 reboot/' > $@
+
+und-reboot.lst: pre-reboot.o
+       echo 'reboot' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+reboot_mod-commands_i386_pc_reboot.o: commands/i386/pc/reboot.c
+       $(CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(CPPFLAGS) $(CFLAGS) $(reboot_mod_CFLAGS) -c -o $@ $<
+
+reboot_mod-commands_i386_pc_reboot.d: commands/i386/pc/reboot.c
+       set -e;           $(CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(CPPFLAGS) $(CFLAGS) $(reboot_mod_CFLAGS) -M $<          | sed 's,reboot\.o[ :]*,reboot_mod-commands_i386_pc_reboot.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
+
+-include reboot_mod-commands_i386_pc_reboot.d
+
+reboot_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For halt.mod.
+halt_mod_SOURCES = commands/i386/pc/halt.c
+CLEANFILES += halt.mod mod-halt.o mod-halt.c pre-halt.o halt_mod-commands_i386_pc_halt.o def-halt.lst und-halt.lst
+MOSTLYCLEANFILES += halt_mod-commands_i386_pc_halt.d
+DEFSYMFILES += def-halt.lst
+UNDSYMFILES += und-halt.lst
+
+halt.mod: pre-halt.o mod-halt.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-halt.o: halt_mod-commands_i386_pc_halt.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-halt.o: mod-halt.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(halt_mod_CFLAGS) -c -o $@ $<
+
+mod-halt.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'halt' $< > $@ || (rm -f $@; exit 1)
+
+def-halt.lst: pre-halt.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 halt/' > $@
+
+und-halt.lst: pre-halt.o
+       echo 'halt' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+halt_mod-commands_i386_pc_halt.o: commands/i386/pc/halt.c
+       $(CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(CPPFLAGS) $(CFLAGS) $(halt_mod_CFLAGS) -c -o $@ $<
+
+halt_mod-commands_i386_pc_halt.d: commands/i386/pc/halt.c
+       set -e;           $(CC) -Icommands/i386/pc -I$(srcdir)/commands/i386/pc $(CPPFLAGS) $(CFLAGS) $(halt_mod_CFLAGS) -M $<    | sed 's,halt\.o[ :]*,halt_mod-commands_i386_pc_halt.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+
+-include halt_mod-commands_i386_pc_halt.d
+
+halt_mod_CFLAGS = $(COMMON_CFLAGS)
+
 # For vga.mod.
 vga_mod_SOURCES = term/i386/pc/vga.c
 CLEANFILES += vga.mod mod-vga.o mod-vga.c pre-vga.o vga_mod-term_i386_pc_vga.o def-vga.lst und-vga.lst
index 8372fad27b4a028f410c0bf769e305ea940be1d4..b9fb22198735fd51115af762c6370015b27ab774 100644 (file)
@@ -71,12 +71,12 @@ grub_emu_SOURCES = kern/main.c kern/device.c                                \
        normal/cmdline.c normal/command.c normal/main.c normal/menu.c   \
        normal/arg.c kern/partition.c   \
        util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c \
-       kern/env.c disk/loopback.c commands/ls.c                \
+       kern/env.c disk/loopback.c commands/ls.c commands/help.c        \
        commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c
-CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-fs_fshelp.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-kern_partition.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o grub_emu-disk_loopback.o grub_emu-commands_ls.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
-MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-partmap_amiga.d grub_emu-partmap_pc.d grub_emu-partmap_apple.d grub_emu-fs_fshelp.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_arg.d grub_emu-kern_partition.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d grub_emu-kern_env.d grub_emu-disk_loopback.d grub_emu-commands_ls.d grub_emu-commands_terminal.d grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d
+CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-fs_fshelp.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-kern_partition.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o grub_emu-disk_loopback.o grub_emu-commands_ls.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
+MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-partmap_amiga.d grub_emu-partmap_pc.d grub_emu-partmap_apple.d grub_emu-fs_fshelp.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_arg.d grub_emu-kern_partition.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d grub_emu-kern_env.d grub_emu-disk_loopback.d grub_emu-commands_ls.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d
 
-grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-fs_fshelp.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-kern_partition.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o grub_emu-disk_loopback.o grub_emu-commands_ls.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
+grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-fs_fshelp.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-kern_partition.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o grub_emu-disk_loopback.o grub_emu-commands_ls.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
        $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
 
 grub_emu-kern_main.o: kern/main.c
@@ -367,6 +367,14 @@ grub_emu-commands_ls.d: commands/ls.c
 
 -include grub_emu-commands_ls.d
 
+grub_emu-commands_help.o: commands/help.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-commands_help.d: commands/help.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | sed 's,help\.o[ :]*,grub_emu-commands_help.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+
+-include grub_emu-commands_help.d
+
 grub_emu-commands_terminal.o: commands/terminal.c
        $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
@@ -633,7 +641,7 @@ genmoddep-util_genmoddep.d: util/genmoddep.c
 pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
        hfs.mod jfs.mod normal.mod hello.mod font.mod \
        boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
-       pc.mod suspend.mod loopback.mod
+       pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod
 
 # For fshelp.mod.
 fshelp_mod_SOURCES = fs/fshelp.c
@@ -1503,6 +1511,123 @@ suspend_mod-commands_ieee1275_suspend.d: commands/ieee1275/suspend.c
 -include suspend_mod-commands_ieee1275_suspend.d
 
 suspend_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For reboot.mod
+reboot_mod_SOURCES = commands/ieee1275/reboot.c
+CLEANFILES += reboot.mod mod-reboot.o mod-reboot.c pre-reboot.o reboot_mod-commands_ieee1275_reboot.o def-reboot.lst und-reboot.lst
+MOSTLYCLEANFILES += reboot_mod-commands_ieee1275_reboot.d
+DEFSYMFILES += def-reboot.lst
+UNDSYMFILES += und-reboot.lst
+
+reboot.mod: pre-reboot.o mod-reboot.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-reboot.o: reboot_mod-commands_ieee1275_reboot.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-reboot.o: mod-reboot.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(reboot_mod_CFLAGS) -c -o $@ $<
+
+mod-reboot.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'reboot' $< > $@ || (rm -f $@; exit 1)
+
+def-reboot.lst: pre-reboot.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 reboot/' > $@
+
+und-reboot.lst: pre-reboot.o
+       echo 'reboot' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+reboot_mod-commands_ieee1275_reboot.o: commands/ieee1275/reboot.c
+       $(CC) -Icommands/ieee1275 -I$(srcdir)/commands/ieee1275 $(CPPFLAGS) $(CFLAGS) $(reboot_mod_CFLAGS) -c -o $@ $<
+
+reboot_mod-commands_ieee1275_reboot.d: commands/ieee1275/reboot.c
+       set -e;           $(CC) -Icommands/ieee1275 -I$(srcdir)/commands/ieee1275 $(CPPFLAGS) $(CFLAGS) $(reboot_mod_CFLAGS) -M $<        | sed 's,reboot\.o[ :]*,reboot_mod-commands_ieee1275_reboot.o $@ : ,g' > $@;    [ -s $@ ] || rm -f $@
+
+-include reboot_mod-commands_ieee1275_reboot.d
+
+reboot_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For halt.mod
+halt_mod_SOURCES = commands/ieee1275/halt.c
+CLEANFILES += halt.mod mod-halt.o mod-halt.c pre-halt.o halt_mod-commands_ieee1275_halt.o def-halt.lst und-halt.lst
+MOSTLYCLEANFILES += halt_mod-commands_ieee1275_halt.d
+DEFSYMFILES += def-halt.lst
+UNDSYMFILES += und-halt.lst
+
+halt.mod: pre-halt.o mod-halt.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-halt.o: halt_mod-commands_ieee1275_halt.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-halt.o: mod-halt.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(halt_mod_CFLAGS) -c -o $@ $<
+
+mod-halt.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'halt' $< > $@ || (rm -f $@; exit 1)
+
+def-halt.lst: pre-halt.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 halt/' > $@
+
+und-halt.lst: pre-halt.o
+       echo 'halt' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+halt_mod-commands_ieee1275_halt.o: commands/ieee1275/halt.c
+       $(CC) -Icommands/ieee1275 -I$(srcdir)/commands/ieee1275 $(CPPFLAGS) $(CFLAGS) $(halt_mod_CFLAGS) -c -o $@ $<
+
+halt_mod-commands_ieee1275_halt.d: commands/ieee1275/halt.c
+       set -e;           $(CC) -Icommands/ieee1275 -I$(srcdir)/commands/ieee1275 $(CPPFLAGS) $(CFLAGS) $(halt_mod_CFLAGS) -M $<          | sed 's,halt\.o[ :]*,halt_mod-commands_ieee1275_halt.o $@ : ,g' > $@;          [ -s $@ ] || rm -f $@
+
+-include halt_mod-commands_ieee1275_halt.d
+
+halt_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For help.mod.
+help_mod_SOURCES = commands/help.c
+CLEANFILES += help.mod mod-help.o mod-help.c pre-help.o help_mod-commands_help.o def-help.lst und-help.lst
+MOSTLYCLEANFILES += help_mod-commands_help.d
+DEFSYMFILES += def-help.lst
+UNDSYMFILES += und-help.lst
+
+help.mod: pre-help.o mod-help.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-help.o: help_mod-commands_help.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-help.o: mod-help.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(help_mod_CFLAGS) -c -o $@ $<
+
+mod-help.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'help' $< > $@ || (rm -f $@; exit 1)
+
+def-help.lst: pre-help.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 help/' > $@
+
+und-help.lst: pre-help.o
+       echo 'help' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+help_mod-commands_help.o: commands/help.c
+       $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(help_mod_CFLAGS) -c -o $@ $<
+
+help_mod-commands_help.d: commands/help.c
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(help_mod_CFLAGS) -M $<    | sed 's,help\.o[ :]*,help_mod-commands_help.o $@ : ,g' > $@;           [ -s $@ ] || rm -f $@
+
+-include help_mod-commands_help.d
+
+help_mod_CFLAGS = $(COMMON_CFLAGS)
 CLEANFILES += moddep.lst
 pkgdata_DATA += moddep.lst
 moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
index ddc0f406f32ce8a6486e8e00ae765a738317b7ac..71e59c650e0f843701ce34083be48b65e34217f9 100644 (file)
@@ -22,7 +22,8 @@
 
 /* The symbol shared between the normal mode and rescue mode
    loader.  */
-void grub_load_linux (int argc, char *argv[]);
+void grub_rescue_cmd_linux (int argc, char *argv[]);
+void grub_rescue_cmd_initrd (int argc, char *argv[]);
 
 void grub_linux_init (void);
 void grub_linux_fini (void);
index 076da409bbc4e1b553fdcea1523f393488e15587..d5d65e61312df79baca3edff6d06bdafc6fdb043 100644 (file)
@@ -50,13 +50,6 @@ grub_linux_boot (void)
   grub_ieee1275_phandle_t chosen;
   grub_size_t actual;
   
-  struct bi_rec
-  {
-    unsigned long tag;
-    unsigned long size;
-    unsigned long data[0];
-  };
-  
   grub_ieee1275_finddevice ("/chosen", &chosen);
   
   /* Set the command line arguments.  */
@@ -79,7 +72,12 @@ grub_linux_release_mem (void)
   if (linux_addr && grub_ieee1275_release (linux_addr, linux_size))
     return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not release memory");
   
+  if (initrd_addr && grub_ieee1275_release (initrd_addr, initrd_size))
+    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not release memory");
+  
   linux_addr = 0;
+  initrd_addr = 0;
+  
   return GRUB_ERR_NONE;
 }
 
@@ -97,14 +95,15 @@ grub_linux_unload (void)
 }
 
 void
-grub_load_linux (int argc, char *argv[])
+grub_rescue_cmd_linux (int argc, char *argv[])
 {
   grub_file_t file = 0;
   Elf32_Ehdr ehdr;
   Elf32_Phdr *phdrs = 0;
   int i;  
   int offset = 0;
-  static grub_addr_t entry;
+  grub_addr_t entry;
+  int found_addr = 0;
   int size;
   
   grub_dl_ref (my_mod);
@@ -188,13 +187,22 @@ grub_load_linux (int argc, char *argv[])
   /* Reserve memory for the kernel.  */
   linux_size += 0x100000;
   
-  if (grub_claimmap (entry, linux_size) == -1)
+  /* For some vmlinux kernels the address set above won't work.  Just
+     try some other addresses just like yaboot does.  */
+  for (linux_addr = entry; linux_addr < entry + 200 * 0x100000; linux_addr += 0x100000)
+    {
+      found_addr = grub_claimmap (linux_addr, linux_size);
+      if (found_addr != -1)
+       break;
+    }
+
+  if (found_addr == -1)
     {
       grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not claim memory");
       goto fail;
     }
-  linux_addr = entry;
-
+  entry = linux_addr;
+  
   /* Load every loadable segment in memory.  */
   for (i = 0; i < ehdr.e_phnum; i++)
     {
@@ -257,28 +265,66 @@ grub_load_linux (int argc, char *argv[])
   return;
 }
 
-\f
-GRUB_MOD_INIT
+void
+grub_rescue_cmd_initrd (int argc, char *argv[])
 {
-  grub_rescue_register_command ("linux", grub_load_linux,
-                               "load a linux kernel");
-  my_mod = mod;
-}
+  grub_file_t file = 0;
+  grub_ssize_t size;
+  grub_addr_t addr;
+  
+  if (argc == 0)
+    {
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no initrd specified");
+      goto fail;
+    }
+  
+  if (!loaded)
+    {
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first.");
+      goto fail;
+    }
 
-GRUB_MOD_FINI
-{
-  grub_rescue_unregister_command ("linux");
+  file = grub_file_open (argv[0]);
+  if (! file)
+    goto fail;
+  
+  addr = linux_addr + linux_size;
+  size = grub_file_size (file);
+  
+  if (grub_claimmap (addr, size) == -1)
+    {
+      grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not claim memory");
+      goto fail;
+    }
+  
+  if (grub_file_read (file, (void *) addr, size) != size)
+    {
+      grub_ieee1275_release (addr, size);
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      goto fail;
+    }
+  
+  initrd_addr = addr;
+  initrd_size = size;
+  
+ fail:
+  if (file)
+    grub_file_close (file);
 }
 
-void
-grub_linux_init (void)
+
+\f
+GRUB_MOD_INIT
 {
-  grub_rescue_register_command ("linux", grub_load_linux,
+  grub_rescue_register_command ("linux", grub_rescue_cmd_linux,
                                "load a linux kernel");
+  grub_rescue_register_command ("initrd", grub_rescue_cmd_initrd,
+                               "load an initrd");
+  my_mod = mod;
 }
 
-void
-grub_linux_fini (void)
+GRUB_MOD_FINI
 {
   grub_rescue_unregister_command ("linux");
+  grub_rescue_unregister_command ("initrd");
 }
index b18177861a465da93e3486c629643e5f35f875c6..2f3623fe34f306d0d8e1b04b8d96cc8c91153f8f 100644 (file)
@@ -31,33 +31,31 @@ static grub_err_t
 grub_cmd_linux (struct grub_arg_list *state  __attribute__ ((unused)),
                int argc, char **args)
 {
-  grub_load_linux (argc, args);
+  grub_rescue_cmd_linux (argc, args);
   return GRUB_ERR_NONE;
 }
 
-GRUB_MOD_INIT
-{
-  (void) mod;
-  grub_register_command ("linux", grub_cmd_linux, GRUB_COMMAND_FLAG_BOTH,
-                        "linux [KERNELARGS...]",
-                        "Loads linux", options);
-}
-
-GRUB_MOD_FINI
+static grub_err_t
+grub_cmd_initrd (struct grub_arg_list *state  __attribute__ ((unused)),
+                int argc, char **args)
 {
-  grub_unregister_command ("linux");
+  grub_rescue_cmd_initrd (argc, args);
+  return GRUB_ERR_NONE;
 }
 
-void
-grub_linux_normal_init (void)
+GRUB_MOD_INIT
 {
+  (void) mod;
   grub_register_command ("linux", grub_cmd_linux, GRUB_COMMAND_FLAG_BOTH,
                         "linux [KERNELARGS...]",
                         "Loads linux", options);
+  grub_register_command ("initrd", grub_cmd_initrd, GRUB_COMMAND_FLAG_BOTH,
+                        "initrd FILE",
+                        "Loads initrd", options);
 }
 
-void
-grub_linux_normal_fini (void)
+GRUB_MOD_FINI
 {
   grub_unregister_command ("linux");
+  grub_unregister_command ("initrd");
 }