2005-01-21 Marco Gerards <metgerards@student.han.nl>
Add the loopback device, a device via which files can be accessed as devices. * conf/i386-pc.rmk (grub_emu_SOURCES): Add `disk/loopback.c'. (pkgdata_MODULES): Add loopback.mod. (loopback_mod_SOURCES): New variable. (loopback_mod_CFLAGS): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `disk/loopback.c'. (pkgdata_MODULES): Add loopback.mod. (loopback_mod_SOURCES): New variable. (loopback_mod_CFLAGS): Likewise. * disk/loopback.c: new file. * include/grub/normal.h (grub_loop_init): New prototype. (grub_loop_fini): New prototype. * util/grub-emu.c (main): Initialize and de-initialize loopback support. * include/grub/disk.h (grub_disk_dev_id): Add `GRUB_DISK_DEVICE_LOOPBACK_ID'.
This commit is contained in:
parent
6f1c18bd82
commit
67bbaf0f38
9 changed files with 546 additions and 105 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2005-01-21 Marco Gerards <metgerards@student.han.nl>
|
||||
|
||||
Add the loopback device, a device via which files can be accessed
|
||||
as devices.
|
||||
|
||||
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `disk/loopback.c'.
|
||||
(pkgdata_MODULES): Add loopback.mod.
|
||||
(loopback_mod_SOURCES): New variable.
|
||||
(loopback_mod_CFLAGS): Likewise.
|
||||
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add
|
||||
`disk/loopback.c'.
|
||||
(pkgdata_MODULES): Add loopback.mod.
|
||||
(loopback_mod_SOURCES): New variable.
|
||||
(loopback_mod_CFLAGS): Likewise.
|
||||
* disk/loopback.c: new file.
|
||||
* include/grub/normal.h (grub_loop_init): New prototype.
|
||||
(grub_loop_fini): New prototype.
|
||||
* util/grub-emu.c (main): Initialize and de-initialize loopback
|
||||
support.
|
||||
* include/grub/disk.h (grub_disk_dev_id): Add
|
||||
`GRUB_DISK_DEVICE_LOOPBACK_ID'.
|
||||
|
||||
2005-01-20 Hollis Blanchard <hollis@penguinppc.org>
|
||||
|
||||
* boot/powerpc/ieee1275/ieee1275.c (grub_ieee1275_enter): New
|
||||
|
|
157
conf/i386-pc.mk
157
conf/i386-pc.mk
|
@ -505,11 +505,11 @@ 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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
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: 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
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
|
||||
|
||||
grub_emu-kern_main.o: kern/main.c
|
||||
|
@ -824,6 +824,14 @@ grub_emu-util_i386_pc_getroot.d: util/i386/pc/getroot.c
|
|||
|
||||
-include grub_emu-util_i386_pc_getroot.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 $@ $<
|
||||
|
||||
grub_emu-disk_loopback.d: disk/loopback.c
|
||||
set -e; $(BUILD_CC) -Idisk -I$(srcdir)/disk $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,loopback\.o[ :]*,grub_emu-disk_loopback.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-disk_loopback.d
|
||||
|
||||
grub_emu_LDFLAGS = -lncurses
|
||||
|
||||
# For genmoddep.
|
||||
|
@ -847,7 +855,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
|
||||
amiga.mod apple.mod pc.mod loopback.mod
|
||||
|
||||
# For _chain.mod.
|
||||
_chain_mod_SOURCES = loader/i386/pc/chainloader.c
|
||||
|
@ -858,12 +866,12 @@ UNDSYMFILES += und-_chain.lst
|
|||
|
||||
_chain.mod: pre-_chain.o mod-_chain.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-_chain.o: _chain_mod-loader_i386_pc_chainloader.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-_chain.o: mod-_chain.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(_chain_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -897,12 +905,12 @@ UNDSYMFILES += und-chain.lst
|
|||
|
||||
chain.mod: pre-chain.o mod-chain.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-chain.o: chain_mod-loader_i386_pc_chainloader_normal.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-chain.o: mod-chain.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(chain_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -936,12 +944,12 @@ UNDSYMFILES += und-fshelp.lst
|
|||
|
||||
fshelp.mod: pre-fshelp.o mod-fshelp.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-fshelp.o: fshelp_mod-fs_fshelp.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-fshelp.o: mod-fshelp.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(fshelp_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -975,12 +983,12 @@ UNDSYMFILES += und-fat.lst
|
|||
|
||||
fat.mod: pre-fat.o mod-fat.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-fat.o: fat_mod-fs_fat.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-fat.o: mod-fat.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(fat_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1014,12 +1022,12 @@ UNDSYMFILES += und-ext2.lst
|
|||
|
||||
ext2.mod: pre-ext2.o mod-ext2.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-ext2.o: ext2_mod-fs_ext2.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-ext2.o: mod-ext2.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(ext2_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1053,12 +1061,12 @@ UNDSYMFILES += und-ufs.lst
|
|||
|
||||
ufs.mod: pre-ufs.o mod-ufs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-ufs.o: ufs_mod-fs_ufs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-ufs.o: mod-ufs.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(ufs_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1092,12 +1100,12 @@ UNDSYMFILES += und-minix.lst
|
|||
|
||||
minix.mod: pre-minix.o mod-minix.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-minix.o: minix_mod-fs_minix.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-minix.o: mod-minix.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(minix_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1131,12 +1139,12 @@ UNDSYMFILES += und-hfs.lst
|
|||
|
||||
hfs.mod: pre-hfs.o mod-hfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-hfs.o: hfs_mod-fs_hfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-hfs.o: mod-hfs.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(hfs_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1170,12 +1178,12 @@ UNDSYMFILES += und-jfs.lst
|
|||
|
||||
jfs.mod: pre-jfs.o mod-jfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-jfs.o: jfs_mod-fs_jfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-jfs.o: mod-jfs.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(jfs_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1213,12 +1221,12 @@ UNDSYMFILES += und-_linux.lst
|
|||
|
||||
_linux.mod: pre-_linux.o mod-_linux.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-_linux.o: _linux_mod-loader_i386_pc_linux.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-_linux.o: mod-_linux.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(_linux_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1252,12 +1260,12 @@ UNDSYMFILES += und-linux.lst
|
|||
|
||||
linux.mod: pre-linux.o mod-linux.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-linux.o: linux_mod-loader_i386_pc_linux_normal.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-linux.o: mod-linux.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(linux_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1292,12 +1300,12 @@ UNDSYMFILES += und-normal.lst
|
|||
|
||||
normal.mod: pre-normal.o mod-normal.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-normal.o: normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_arg.o normal_mod-normal_i386_setjmp.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-normal.o: mod-normal.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1372,12 +1380,12 @@ UNDSYMFILES += und-hello.lst
|
|||
|
||||
hello.mod: pre-hello.o mod-hello.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-hello.o: hello_mod-hello_hello.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-hello.o: mod-hello.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(hello_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1411,12 +1419,12 @@ UNDSYMFILES += und-boot.lst
|
|||
|
||||
boot.mod: pre-boot.o mod-boot.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-boot.o: boot_mod-commands_boot.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-boot.o: mod-boot.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(boot_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1450,12 +1458,12 @@ UNDSYMFILES += und-terminal.lst
|
|||
|
||||
terminal.mod: pre-terminal.o mod-terminal.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-terminal.o: terminal_mod-commands_terminal.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-terminal.o: mod-terminal.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(terminal_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1489,12 +1497,12 @@ UNDSYMFILES += und-ls.lst
|
|||
|
||||
ls.mod: pre-ls.o mod-ls.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-ls.o: ls_mod-commands_ls.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-ls.o: mod-ls.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(ls_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1528,12 +1536,12 @@ UNDSYMFILES += und-cmp.lst
|
|||
|
||||
cmp.mod: pre-cmp.o mod-cmp.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-cmp.o: cmp_mod-commands_cmp.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-cmp.o: mod-cmp.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(cmp_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1567,12 +1575,12 @@ UNDSYMFILES += und-cat.lst
|
|||
|
||||
cat.mod: pre-cat.o mod-cat.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-cat.o: cat_mod-commands_cat.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-cat.o: mod-cat.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(cat_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1606,12 +1614,12 @@ UNDSYMFILES += und-vga.lst
|
|||
|
||||
vga.mod: pre-vga.o mod-vga.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-vga.o: vga_mod-term_i386_pc_vga.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-vga.o: mod-vga.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(vga_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1645,12 +1653,12 @@ UNDSYMFILES += und-font.lst
|
|||
|
||||
font.mod: pre-font.o mod-font.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-font.o: font_mod-font_manager.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-font.o: mod-font.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(font_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1684,12 +1692,12 @@ UNDSYMFILES += und-_multiboot.lst
|
|||
|
||||
_multiboot.mod: pre-_multiboot.o mod-_multiboot.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-_multiboot.o: _multiboot_mod-loader_i386_pc_multiboot.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-_multiboot.o: mod-_multiboot.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(_multiboot_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1723,12 +1731,12 @@ UNDSYMFILES += und-multiboot.lst
|
|||
|
||||
multiboot.mod: pre-multiboot.o mod-multiboot.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-multiboot.o: multiboot_mod-loader_i386_pc_multiboot_normal.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-multiboot.o: mod-multiboot.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(multiboot_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1762,12 +1770,12 @@ UNDSYMFILES += und-amiga.lst
|
|||
|
||||
amiga.mod: pre-amiga.o mod-amiga.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-amiga.o: amiga_mod-partmap_amiga.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-amiga.o: mod-amiga.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(amiga_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1801,12 +1809,12 @@ UNDSYMFILES += und-apple.lst
|
|||
|
||||
apple.mod: pre-apple.o mod-apple.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-apple.o: apple_mod-partmap_apple.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-apple.o: mod-apple.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(apple_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1840,12 +1848,12 @@ UNDSYMFILES += und-pc.lst
|
|||
|
||||
pc.mod: pre-pc.o mod-pc.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-pc.o: pc_mod-partmap_pc.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-pc.o: mod-pc.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(pc_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1869,6 +1877,45 @@ pc_mod-partmap_pc.d: partmap/pc.c
|
|||
-include pc_mod-partmap_pc.d
|
||||
|
||||
pc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For loopback.mod
|
||||
loopback_mod_SOURCES = disk/loopback.c
|
||||
CLEANFILES += loopback.mod mod-loopback.o mod-loopback.c pre-loopback.o loopback_mod-disk_loopback.o def-loopback.lst und-loopback.lst
|
||||
MOSTLYCLEANFILES += loopback_mod-disk_loopback.d
|
||||
DEFSYMFILES += def-loopback.lst
|
||||
UNDSYMFILES += und-loopback.lst
|
||||
|
||||
loopback.mod: pre-loopback.o mod-loopback.o
|
||||
-rm -f $@
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-loopback.o: loopback_mod-disk_loopback.o
|
||||
-rm -f $@
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-loopback.o: mod-loopback.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(loopback_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-loopback.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'loopback' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
def-loopback.lst: pre-loopback.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 loopback/' > $@
|
||||
|
||||
und-loopback.lst: pre-loopback.o
|
||||
echo 'loopback' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
loopback_mod-disk_loopback.o: disk/loopback.c
|
||||
$(CC) -Idisk -I$(srcdir)/disk $(CPPFLAGS) $(CFLAGS) $(loopback_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
loopback_mod-disk_loopback.d: disk/loopback.c
|
||||
set -e; $(CC) -Idisk -I$(srcdir)/disk $(CPPFLAGS) $(CFLAGS) $(loopback_mod_CFLAGS) -M $< | sed 's,loopback\.o[ :]*,loopback_mod-disk_loopback.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include loopback_mod-disk_loopback.d
|
||||
|
||||
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
CLEANFILES += moddep.lst
|
||||
pkgdata_DATA += moddep.lst
|
||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
|
||||
|
|
|
@ -73,7 +73,7 @@ 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
|
||||
util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c disk/loopback.c
|
||||
grub_emu_LDFLAGS = -lncurses
|
||||
|
||||
# For genmoddep.
|
||||
|
@ -83,7 +83,7 @@ genmoddep_SOURCES = 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
|
||||
amiga.mod apple.mod pc.mod loopback.mod
|
||||
|
||||
# For _chain.mod.
|
||||
_chain_mod_SOURCES = loader/i386/pc/chainloader.c
|
||||
|
@ -190,3 +190,7 @@ apple_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
# For pc.mod
|
||||
pc_mod_SOURCES = partmap/pc.c
|
||||
pc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For loopback.mod
|
||||
loopback_mod_SOURCES = disk/loopback.c
|
||||
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
|
|
@ -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 commands/ls.c \
|
||||
kern/env.c disk/loopback.c commands/ls.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-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-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_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
|
||||
|
||||
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-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_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
|
||||
|
@ -351,6 +351,14 @@ grub_emu-kern_env.d: kern/env.c
|
|||
|
||||
-include grub_emu-kern_env.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 $@ $<
|
||||
|
||||
grub_emu-disk_loopback.d: disk/loopback.c
|
||||
set -e; $(BUILD_CC) -Idisk -I$(srcdir)/disk $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,loopback\.o[ :]*,grub_emu-disk_loopback.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-disk_loopback.d
|
||||
|
||||
grub_emu-commands_ls.o: commands/ls.c
|
||||
$(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
|
@ -624,7 +632,8 @@ genmoddep-util_genmoddep.d: util/genmoddep.c
|
|||
# Modules.
|
||||
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
|
||||
boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
|
||||
pc.mod suspend.mod loopback.mod
|
||||
|
||||
# For fshelp.mod.
|
||||
fshelp_mod_SOURCES = fs/fshelp.c
|
||||
|
@ -635,12 +644,12 @@ UNDSYMFILES += und-fshelp.lst
|
|||
|
||||
fshelp.mod: pre-fshelp.o mod-fshelp.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-fshelp.o: fshelp_mod-fs_fshelp.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-fshelp.o: mod-fshelp.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(fshelp_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -674,12 +683,12 @@ UNDSYMFILES += und-fat.lst
|
|||
|
||||
fat.mod: pre-fat.o mod-fat.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-fat.o: fat_mod-fs_fat.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-fat.o: mod-fat.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(fat_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -713,12 +722,12 @@ UNDSYMFILES += und-ext2.lst
|
|||
|
||||
ext2.mod: pre-ext2.o mod-ext2.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-ext2.o: ext2_mod-fs_ext2.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-ext2.o: mod-ext2.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(ext2_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -752,12 +761,12 @@ UNDSYMFILES += und-ufs.lst
|
|||
|
||||
ufs.mod: pre-ufs.o mod-ufs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-ufs.o: ufs_mod-fs_ufs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-ufs.o: mod-ufs.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(ufs_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -791,12 +800,12 @@ UNDSYMFILES += und-minix.lst
|
|||
|
||||
minix.mod: pre-minix.o mod-minix.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-minix.o: minix_mod-fs_minix.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-minix.o: mod-minix.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(minix_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -830,12 +839,12 @@ UNDSYMFILES += und-hfs.lst
|
|||
|
||||
hfs.mod: pre-hfs.o mod-hfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-hfs.o: hfs_mod-fs_hfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-hfs.o: mod-hfs.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(hfs_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -869,12 +878,12 @@ UNDSYMFILES += und-jfs.lst
|
|||
|
||||
jfs.mod: pre-jfs.o mod-jfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-jfs.o: jfs_mod-fs_jfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-jfs.o: mod-jfs.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(jfs_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -912,12 +921,12 @@ UNDSYMFILES += und-_linux.lst
|
|||
|
||||
_linux.mod: pre-_linux.o mod-_linux.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-_linux.o: _linux_mod-loader_powerpc_ieee1275_linux.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-_linux.o: mod-_linux.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(_linux_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -951,12 +960,12 @@ UNDSYMFILES += und-linux.lst
|
|||
|
||||
linux.mod: pre-linux.o mod-linux.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-linux.o: linux_mod-loader_powerpc_ieee1275_linux_normal.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-linux.o: mod-linux.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(linux_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -991,12 +1000,12 @@ UNDSYMFILES += und-normal.lst
|
|||
|
||||
normal.mod: pre-normal.o mod-normal.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-normal.o: normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_arg.o normal_mod-normal_powerpc_setjmp.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-normal.o: mod-normal.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1071,12 +1080,12 @@ UNDSYMFILES += und-hello.lst
|
|||
|
||||
hello.mod: pre-hello.o mod-hello.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-hello.o: hello_mod-hello_hello.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-hello.o: mod-hello.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(hello_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1110,12 +1119,12 @@ UNDSYMFILES += und-boot.lst
|
|||
|
||||
boot.mod: pre-boot.o mod-boot.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-boot.o: boot_mod-commands_boot.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-boot.o: mod-boot.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(boot_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1149,12 +1158,12 @@ UNDSYMFILES += und-terminal.lst
|
|||
|
||||
terminal.mod: pre-terminal.o mod-terminal.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-terminal.o: terminal_mod-commands_terminal.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-terminal.o: mod-terminal.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(terminal_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1192,12 +1201,12 @@ UNDSYMFILES += und-cmp.lst
|
|||
|
||||
cmp.mod: pre-cmp.o mod-cmp.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-cmp.o: cmp_mod-commands_cmp.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-cmp.o: mod-cmp.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(cmp_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1231,12 +1240,12 @@ UNDSYMFILES += und-cat.lst
|
|||
|
||||
cat.mod: pre-cat.o mod-cat.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-cat.o: cat_mod-commands_cat.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-cat.o: mod-cat.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(cat_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1270,12 +1279,12 @@ UNDSYMFILES += und-font.lst
|
|||
|
||||
font.mod: pre-font.o mod-font.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-font.o: font_mod-font_manager.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-font.o: mod-font.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(font_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1309,12 +1318,12 @@ UNDSYMFILES += und-amiga.lst
|
|||
|
||||
amiga.mod: pre-amiga.o mod-amiga.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-amiga.o: amiga_mod-partmap_amiga.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-amiga.o: mod-amiga.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(amiga_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1348,12 +1357,12 @@ UNDSYMFILES += und-apple.lst
|
|||
|
||||
apple.mod: pre-apple.o mod-apple.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-apple.o: apple_mod-partmap_apple.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-apple.o: mod-apple.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(apple_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1387,12 +1396,12 @@ UNDSYMFILES += und-pc.lst
|
|||
|
||||
pc.mod: pre-pc.o mod-pc.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-pc.o: pc_mod-partmap_pc.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-pc.o: mod-pc.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(pc_mod_CFLAGS) -c -o $@ $<
|
||||
|
@ -1416,6 +1425,84 @@ pc_mod-partmap_pc.d: partmap/pc.c
|
|||
-include pc_mod-partmap_pc.d
|
||||
|
||||
pc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For loopback.mod
|
||||
loopback_mod_SOURCES = disk/loopback.c
|
||||
CLEANFILES += loopback.mod mod-loopback.o mod-loopback.c pre-loopback.o loopback_mod-disk_loopback.o def-loopback.lst und-loopback.lst
|
||||
MOSTLYCLEANFILES += loopback_mod-disk_loopback.d
|
||||
DEFSYMFILES += def-loopback.lst
|
||||
UNDSYMFILES += und-loopback.lst
|
||||
|
||||
loopback.mod: pre-loopback.o mod-loopback.o
|
||||
-rm -f $@
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-loopback.o: loopback_mod-disk_loopback.o
|
||||
-rm -f $@
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-loopback.o: mod-loopback.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(loopback_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-loopback.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'loopback' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
def-loopback.lst: pre-loopback.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 loopback/' > $@
|
||||
|
||||
und-loopback.lst: pre-loopback.o
|
||||
echo 'loopback' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
loopback_mod-disk_loopback.o: disk/loopback.c
|
||||
$(CC) -Idisk -I$(srcdir)/disk $(CPPFLAGS) $(CFLAGS) $(loopback_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
loopback_mod-disk_loopback.d: disk/loopback.c
|
||||
set -e; $(CC) -Idisk -I$(srcdir)/disk $(CPPFLAGS) $(CFLAGS) $(loopback_mod_CFLAGS) -M $< | sed 's,loopback\.o[ :]*,loopback_mod-disk_loopback.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include loopback_mod-disk_loopback.d
|
||||
|
||||
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For suspend.mod
|
||||
suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
||||
CLEANFILES += suspend.mod mod-suspend.o mod-suspend.c pre-suspend.o suspend_mod-commands_ieee1275_suspend.o def-suspend.lst und-suspend.lst
|
||||
MOSTLYCLEANFILES += suspend_mod-commands_ieee1275_suspend.d
|
||||
DEFSYMFILES += def-suspend.lst
|
||||
UNDSYMFILES += und-suspend.lst
|
||||
|
||||
suspend.mod: pre-suspend.o mod-suspend.o
|
||||
-rm -f $@
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-suspend.o: suspend_mod-commands_ieee1275_suspend.o
|
||||
-rm -f $@
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-suspend.o: mod-suspend.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(suspend_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-suspend.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'suspend' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
def-suspend.lst: pre-suspend.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 suspend/' > $@
|
||||
|
||||
und-suspend.lst: pre-suspend.o
|
||||
echo 'suspend' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
suspend_mod-commands_ieee1275_suspend.o: commands/ieee1275/suspend.c
|
||||
$(CC) -Icommands/ieee1275 -I$(srcdir)/commands/ieee1275 $(CPPFLAGS) $(CFLAGS) $(suspend_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
suspend_mod-commands_ieee1275_suspend.d: commands/ieee1275/suspend.c
|
||||
set -e; $(CC) -Icommands/ieee1275 -I$(srcdir)/commands/ieee1275 $(CPPFLAGS) $(CFLAGS) $(suspend_mod_CFLAGS) -M $< | sed 's,suspend\.o[ :]*,suspend_mod-commands_ieee1275_suspend.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include suspend_mod-commands_ieee1275_suspend.d
|
||||
|
||||
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
CLEANFILES += moddep.lst
|
||||
pkgdata_DATA += moddep.lst
|
||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
|
||||
|
|
|
@ -41,7 +41,7 @@ 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 commands/ls.c \
|
||||
kern/env.c disk/loopback.c commands/ls.c \
|
||||
commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c
|
||||
grub_emu_LDFLAGS = -lncurses
|
||||
|
||||
|
@ -65,7 +65,7 @@ genmoddep_SOURCES = 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
|
||||
pc.mod suspend.mod loopback.mod
|
||||
|
||||
# For fshelp.mod.
|
||||
fshelp_mod_SOURCES = fs/fshelp.c
|
||||
|
@ -153,6 +153,10 @@ apple_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
pc_mod_SOURCES = partmap/pc.c
|
||||
pc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For loopback.mod
|
||||
loopback_mod_SOURCES = disk/loopback.c
|
||||
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For suspend.mod
|
||||
suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
||||
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
|
272
disk/loopback.c
Normal file
272
disk/loopback.c
Normal file
|
@ -0,0 +1,272 @@
|
|||
/* loopback.c - command to add loopback devices. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/normal.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/arg.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
struct grub_loopback
|
||||
{
|
||||
char *devname;
|
||||
char *filename;
|
||||
int has_partitions;
|
||||
struct grub_loopback *next;
|
||||
};
|
||||
|
||||
static struct grub_loopback *loopback_list;
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"delete", 'd', 0, "Delete the loopback device entry", 0, 0},
|
||||
{"partitions", 'p', 0, "Set that the drive has partitions to"
|
||||
" simulate a harddrive", 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* Delete the loopback device NAME. */
|
||||
static grub_err_t
|
||||
delete_loopback (const char *name)
|
||||
{
|
||||
struct grub_loopback *dev;
|
||||
struct grub_loopback **prev;
|
||||
|
||||
/* Search for the device. */
|
||||
for (dev = loopback_list, prev = &loopback_list;
|
||||
dev; prev = &dev->next, dev = dev->next)
|
||||
if (!grub_strcmp (dev->devname, name))
|
||||
break;
|
||||
if (!dev)
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "Device not found");
|
||||
|
||||
/* Remove the device from the list. */
|
||||
*prev = dev->next;
|
||||
|
||||
grub_free (dev->devname);
|
||||
grub_free (dev->filename);
|
||||
grub_free (dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The command to add and remove loopback devices. */
|
||||
static grub_err_t
|
||||
grub_cmd_loopback (struct grub_arg_list *state,
|
||||
int argc, char **args)
|
||||
{
|
||||
grub_file_t file;
|
||||
struct grub_loopback *newdev;
|
||||
|
||||
if (argc < 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required");
|
||||
|
||||
/* Check if `-d' was used. */
|
||||
if (state[0].set)
|
||||
return delete_loopback (args[0]);
|
||||
|
||||
if (argc < 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||
|
||||
file = grub_file_open (args[1]);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
|
||||
/* Close the file, the only reason for opening it is validation. */
|
||||
grub_file_close (file);
|
||||
|
||||
/* First try to replace the old device. */
|
||||
for (newdev = loopback_list; newdev; newdev = newdev->next)
|
||||
if (!grub_strcmp (newdev->devname, args[0]))
|
||||
break;
|
||||
if (newdev)
|
||||
{
|
||||
char *newname = grub_strdup (args[1]);
|
||||
if (!newname)
|
||||
return grub_errno;
|
||||
|
||||
grub_free (newdev->filename);
|
||||
newdev->filename = newname;
|
||||
|
||||
/* Set has_partitions when `--partitions' was used. */
|
||||
newdev->has_partitions = state[1].set;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Unable to replace it, make a new entry. */
|
||||
newdev = grub_malloc (sizeof (struct grub_loopback));
|
||||
if (!newdev)
|
||||
return grub_errno;
|
||||
|
||||
newdev->devname = grub_strdup (args[0]);
|
||||
if (!newdev->devname)
|
||||
{
|
||||
grub_free (newdev);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
newdev->filename = grub_strdup (args[1]);
|
||||
if (!newdev->devname)
|
||||
{
|
||||
grub_free (newdev->devname);
|
||||
grub_free (newdev);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
/* Set has_partitions when `--partitions' was used. */
|
||||
newdev->has_partitions = state[1].set;
|
||||
|
||||
/* Add the new entry to the list. */
|
||||
newdev->next = loopback_list;
|
||||
loopback_list = newdev;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
grub_loopback_iterate (int (*hook) (const char *name))
|
||||
{
|
||||
struct grub_loopback *d;
|
||||
for (d = loopback_list; d; d = d->next)
|
||||
{
|
||||
if (hook (d->devname))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_loopback_open (const char *name, grub_disk_t disk)
|
||||
{
|
||||
grub_file_t file;
|
||||
struct grub_loopback *dev;
|
||||
|
||||
for (dev = loopback_list; dev; dev = dev->next)
|
||||
if (!grub_strcmp (dev->devname, name))
|
||||
break;
|
||||
|
||||
if (! dev)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
|
||||
|
||||
file = grub_file_open (dev->filename);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
|
||||
/* Use the filesize for the disk size, round up to a complete sector. */
|
||||
disk->total_sectors = ((file->size + GRUB_DISK_SECTOR_SIZE - 1)
|
||||
/ GRUB_DISK_SECTOR_SIZE);
|
||||
disk->id = (int) dev;
|
||||
|
||||
disk->has_partitions = dev->has_partitions;
|
||||
disk->data = file;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_loopback_close (grub_disk_t disk)
|
||||
{
|
||||
grub_file_t file = (grub_file_t) disk->data;
|
||||
|
||||
grub_file_close (file);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_loopback_read (grub_disk_t disk, unsigned long sector,
|
||||
unsigned long size, char *buf)
|
||||
{
|
||||
grub_file_t file = (grub_file_t) disk->data;
|
||||
long pos;
|
||||
|
||||
grub_file_seek (file, sector * GRUB_DISK_SECTOR_SIZE);
|
||||
|
||||
grub_file_read (file, buf, size * GRUB_DISK_SECTOR_SIZE);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
|
||||
/* In case there is more data read than there is available, in case
|
||||
of files that are not a multiple of GRUB_DISK_SECTOR_SIZE, fill
|
||||
the rest with zeros. */
|
||||
pos = sector * GRUB_DISK_SECTOR_SIZE + size * GRUB_DISK_SECTOR_SIZE;
|
||||
if (pos > file->size)
|
||||
{
|
||||
unsigned long amount = pos - file->size;
|
||||
grub_memset (buf + pos - amount, amount, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_loopback_write (grub_disk_t disk __attribute ((unused)),
|
||||
unsigned long sector __attribute ((unused)),
|
||||
unsigned long size __attribute ((unused)),
|
||||
const char *buf __attribute ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NOT_IMPLEMENTED_YET;
|
||||
}
|
||||
|
||||
static struct grub_disk_dev grub_loopback_dev =
|
||||
{
|
||||
.name = "loopback",
|
||||
.id = GRUB_DISK_DEVICE_LOOPBACK_ID,
|
||||
.iterate = grub_loopback_iterate,
|
||||
.open = grub_loopback_open,
|
||||
.close = grub_loopback_close,
|
||||
.read = grub_loopback_read,
|
||||
.write = grub_loopback_write,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void
|
||||
grub_loop_init (void)
|
||||
{
|
||||
grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH,
|
||||
"loopback [OPTIONS] DEVICENAME FILE", "Makes a device of a file", options);
|
||||
grub_disk_dev_register (&grub_loopback_dev);
|
||||
}
|
||||
|
||||
void
|
||||
grub_loop_fini (void)
|
||||
{
|
||||
grub_unregister_command ("loopback");
|
||||
grub_disk_dev_unregister (&grub_loopback_dev);
|
||||
}
|
||||
#else /* ! GRUB_UTIL */
|
||||
GRUB_MOD_INIT
|
||||
{
|
||||
(void)mod; /* To stop warning. */
|
||||
grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH,
|
||||
"loopback [OPTIONS] DEVICENAME FILE", "Makes a device of a file", options);
|
||||
grub_disk_dev_register (&grub_loopback_dev);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI
|
||||
{
|
||||
grub_unregister_command ("loopback");
|
||||
grub_disk_dev_unregister (&grub_loopback_dev);
|
||||
}
|
||||
#endif /* ! GRUB_UTIL */
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002, 2003, 2004, 2005 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
|
||||
|
@ -31,6 +31,7 @@ enum grub_disk_dev_id
|
|||
{
|
||||
GRUB_DISK_DEVICE_BIOSDISK_ID,
|
||||
GRUB_DISK_DEVICE_OFDISK_ID,
|
||||
GRUB_DISK_DEVICE_LOOPBACK_ID
|
||||
};
|
||||
|
||||
struct grub_disk;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* normal.h - prototypes for the normal mode */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -158,6 +158,8 @@ void grub_cmp_init (void);
|
|||
void grub_cmp_fini (void);
|
||||
void grub_terminal_init (void);
|
||||
void grub_terminal_fini (void);
|
||||
void grub_loop_init (void);
|
||||
void grub_loop_fini (void);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_NORMAL_HEADER */
|
||||
|
|
|
@ -176,6 +176,7 @@ main (int argc, char *argv[])
|
|||
grub_cmp_init ();
|
||||
grub_cat_init ();
|
||||
grub_terminal_init ();
|
||||
grub_loop_init ();
|
||||
|
||||
/* XXX: Should normal mode be started by default? */
|
||||
grub_normal_init ();
|
||||
|
@ -183,6 +184,7 @@ main (int argc, char *argv[])
|
|||
/* Start GRUB! */
|
||||
grub_main ();
|
||||
|
||||
grub_loop_fini ();
|
||||
grub_util_biosdisk_fini ();
|
||||
grub_normal_fini ();
|
||||
grub_ufs_fini ();
|
||||
|
|
Loading…
Reference in a new issue