From 57bdbde34ec0b31bf777226259d68dfaaf36e3b0 Mon Sep 17 00:00:00 2001 From: marco_g Date: Fri, 7 Oct 2005 19:25:46 +0000 Subject: [PATCH] 2005-10-07 Marco Gerards Add support for the AFFS filesystem. * fs/affs.c: New file. * DISTLIST: Added `fs/affs.c'. * conf/i386-pc.rmk (grub_setup_SOURCES): Add `fs/affs.c'. (grub_probefs_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. (pkgdata_MODULES): Add `affs.mod'. (affs_mod_SOURCES): New variable. (affs_mod_CFLAGS): Likewise. (affs_mod_LDFLAGS): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `fs/affs.c'. (pkgdata_MODULES): Add `affs.mod'. (affs_mod_SOURCES): New variable. (affs_mod_CFLAGS): Likewise. * util/grub-emu.c (main): Call `grub_affs_init' and `grub_affs_fini'. * include/grub/fs.h (grub_affs_init): New prototype. (grub_affs_fini): Likewise. --- ChangeLog | 27 ++ DISTLIST | 1 + conf/i386-pc.mk | 104 ++++++- conf/i386-pc.rmk | 16 +- conf/powerpc-ieee1275.mk | 201 ++++++++----- conf/powerpc-ieee1275.rmk | 13 +- fs/affs.c | 579 ++++++++++++++++++++++++++++++++++++++ include/grub/fs.h | 2 + util/grub-emu.c | 2 + 9 files changed, 851 insertions(+), 94 deletions(-) create mode 100644 fs/affs.c diff --git a/ChangeLog b/ChangeLog index 8891ced75..faa4ab345 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2005-10-07 Marco Gerards + + Add support for the AFFS filesystem. + + * fs/affs.c: New file. + + * DISTLIST: Added `fs/affs.c'. + + * conf/i386-pc.rmk (grub_setup_SOURCES): Add `fs/affs.c'. + (grub_probefs_SOURCES): Likewise. + (grub_emu_SOURCES): Likewise. + (pkgdata_MODULES): Add `affs.mod'. + (affs_mod_SOURCES): New variable. + (affs_mod_CFLAGS): Likewise. + (affs_mod_LDFLAGS): Likewise. + + * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `fs/affs.c'. + (pkgdata_MODULES): Add `affs.mod'. + (affs_mod_SOURCES): New variable. + (affs_mod_CFLAGS): Likewise. + + * util/grub-emu.c (main): Call `grub_affs_init' and + `grub_affs_fini'. + + * include/grub/fs.h (grub_affs_init): New prototype. + (grub_affs_fini): Likewise. + 2005-10-01 Marco Gerards * fs/xfs.c (grub_xfs_iterate_dir): Add parentheses. diff --git a/DISTLIST b/DISTLIST index 7b317f432..c40807c77 100644 --- a/DISTLIST +++ b/DISTLIST @@ -55,6 +55,7 @@ disk/loopback.c disk/i386/pc/biosdisk.c disk/ieee1275/ofdisk.c font/manager.c +fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c diff --git a/conf/i386-pc.mk b/conf/i386-pc.mk index 390b0e4e5..434162fed 100644 --- a/conf/i386-pc.mk +++ b/conf/i386-pc.mk @@ -312,13 +312,13 @@ grub_mkimage_LDFLAGS = $(LIBLZO) # For grub-setup. grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \ util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \ - kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c \ + kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \ kern/partition.c partmap/pc.c \ fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c -CLEANFILES += grub-setup grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-fs_xfs.o grub_setup-kern_partition.o grub_setup-partmap_pc.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o -MOSTLYCLEANFILES += grub_setup-util_i386_pc_grub_setup.d grub_setup-util_i386_pc_biosdisk.d grub_setup-util_misc.d grub_setup-util_i386_pc_getroot.d grub_setup-kern_device.d grub_setup-kern_disk.d grub_setup-kern_err.d grub_setup-kern_misc.d grub_setup-fs_fat.d grub_setup-fs_ext2.d grub_setup-fs_xfs.d grub_setup-kern_partition.d grub_setup-partmap_pc.d grub_setup-fs_ufs.d grub_setup-fs_minix.d grub_setup-fs_hfs.d grub_setup-fs_jfs.d grub_setup-kern_file.d grub_setup-kern_fs.d grub_setup-kern_env.d grub_setup-fs_fshelp.d +CLEANFILES += grub-setup grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-fs_xfs.o grub_setup-fs_affs.o grub_setup-kern_partition.o grub_setup-partmap_pc.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o +MOSTLYCLEANFILES += grub_setup-util_i386_pc_grub_setup.d grub_setup-util_i386_pc_biosdisk.d grub_setup-util_misc.d grub_setup-util_i386_pc_getroot.d grub_setup-kern_device.d grub_setup-kern_disk.d grub_setup-kern_err.d grub_setup-kern_misc.d grub_setup-fs_fat.d grub_setup-fs_ext2.d grub_setup-fs_xfs.d grub_setup-fs_affs.d grub_setup-kern_partition.d grub_setup-partmap_pc.d grub_setup-fs_ufs.d grub_setup-fs_minix.d grub_setup-fs_hfs.d grub_setup-fs_jfs.d grub_setup-kern_file.d grub_setup-kern_fs.d grub_setup-kern_env.d grub_setup-fs_fshelp.d -grub-setup: grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-fs_xfs.o grub_setup-kern_partition.o grub_setup-partmap_pc.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o +grub-setup: grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-fs_xfs.o grub_setup-fs_affs.o grub_setup-kern_partition.o grub_setup-partmap_pc.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_setup_LDFLAGS) grub_setup-util_i386_pc_grub_setup.o: util/i386/pc/grub-setup.c @@ -409,6 +409,14 @@ grub_setup-fs_xfs.d: fs/xfs.c -include grub_setup-fs_xfs.d +grub_setup-fs_affs.o: fs/affs.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< + +grub_setup-fs_affs.d: fs/affs.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,affs\.o[ :]*,grub_setup-fs_affs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include grub_setup-fs_affs.d + grub_setup-kern_partition.o: kern/partition.c $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< @@ -520,11 +528,12 @@ grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \ util/i386/pc/biosdisk.c util/misc.c util/i386/pc/getroot.c \ kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c \ fs/ext2.c kern/partition.c partmap/pc.c fs/ufs.c fs/minix.c \ - fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c fs/xfs.c -CLEANFILES += grub-probefs grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o -MOSTLYCLEANFILES += grub_probefs-util_i386_pc_grub_probefs.d grub_probefs-util_i386_pc_biosdisk.d grub_probefs-util_misc.d grub_probefs-util_i386_pc_getroot.d grub_probefs-kern_device.d grub_probefs-kern_disk.d grub_probefs-kern_err.d grub_probefs-kern_misc.d grub_probefs-fs_fat.d grub_probefs-fs_ext2.d grub_probefs-kern_partition.d grub_probefs-partmap_pc.d grub_probefs-fs_ufs.d grub_probefs-fs_minix.d grub_probefs-fs_hfs.d grub_probefs-fs_jfs.d grub_probefs-kern_fs.d grub_probefs-kern_env.d grub_probefs-fs_fshelp.d grub_probefs-fs_xfs.d + fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c fs/xfs.c \ + fs/affs.c +CLEANFILES += grub-probefs grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o +MOSTLYCLEANFILES += grub_probefs-util_i386_pc_grub_probefs.d grub_probefs-util_i386_pc_biosdisk.d grub_probefs-util_misc.d grub_probefs-util_i386_pc_getroot.d grub_probefs-kern_device.d grub_probefs-kern_disk.d grub_probefs-kern_err.d grub_probefs-kern_misc.d grub_probefs-fs_fat.d grub_probefs-fs_ext2.d grub_probefs-kern_partition.d grub_probefs-partmap_pc.d grub_probefs-fs_ufs.d grub_probefs-fs_minix.d grub_probefs-fs_hfs.d grub_probefs-fs_jfs.d grub_probefs-kern_fs.d grub_probefs-kern_env.d grub_probefs-fs_fshelp.d grub_probefs-fs_xfs.d grub_probefs-fs_affs.d -grub-probefs: grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o +grub-probefs: grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_probefs_LDFLAGS) grub_probefs-util_i386_pc_grub_probefs.o: util/i386/pc/grub-probefs.c @@ -687,6 +696,14 @@ grub_probefs-fs_xfs.d: fs/xfs.c -include grub_probefs-fs_xfs.d +grub_probefs-fs_affs.o: fs/affs.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_probefs_CFLAGS) -c -o $@ $< + +grub_probefs-fs_affs.d: fs/affs.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_probefs_CFLAGS) -M $< | sed 's,affs\.o[ :]*,grub_probefs-fs_affs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include grub_probefs-fs_affs.d + # For grub-emu. grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ @@ -695,8 +712,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ commands/timeout.c \ commands/i386/pc/halt.c commands/i386/pc/reboot.c \ disk/loopback.c \ - fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c \ - fs/minix.c fs/ufs.c fs/xfs.c \ + fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \ + fs/jfs.c fs/minix.c fs/ufs.c fs/xfs.c \ io/gzio.c \ kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \ kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c \ @@ -708,10 +725,10 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ util/console.c util/grub-emu.c util/misc.c \ util/i386/pc/biosdisk.c util/i386/pc/getroot.c \ util/i386/pc/misc.c -CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o -MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_search.d grub_emu-commands_timeout.d grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d +CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o +MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_search.d grub_emu-commands_timeout.d grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d -grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o +grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS) grub_emu-commands_boot.o: commands/boot.c @@ -818,6 +835,14 @@ grub_emu-disk_loopback.d: disk/loopback.c -include grub_emu-disk_loopback.d +grub_emu-fs_affs.o: fs/affs.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< + +grub_emu-fs_affs.d: fs/affs.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,affs\.o[ :]*,grub_emu-fs_affs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include grub_emu-fs_affs.d + grub_emu-fs_ext2.o: fs/ext2.c $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< @@ -1194,7 +1219,7 @@ pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod \ apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod \ help.mod default.mod timeout.mod configfile.mod vbe.mod \ vesafb.mod vbetest.mod vbeinfo.mod search.mod gzio.mod \ - terminfo.mod serial.mod xfs.mod + terminfo.mod serial.mod xfs.mod affs.mod # For _chain.mod. _chain_mod_SOURCES = loader/i386/pc/chainloader.c @@ -1711,6 +1736,57 @@ fs-xfs.lst: fs/xfs.c genfslist.sh xfs_mod_CFLAGS = $(COMMON_CFLAGS) xfs_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For affs.mod. +affs_mod_SOURCES = fs/affs.c +CLEANFILES += affs.mod mod-affs.o mod-affs.c pre-affs.o affs_mod-fs_affs.o def-affs.lst und-affs.lst +MOSTLYCLEANFILES += affs_mod-fs_affs.d +DEFSYMFILES += def-affs.lst +UNDSYMFILES += und-affs.lst + +affs.mod: pre-affs.o mod-affs.o + -rm -f $@ + $(LD) $(affs_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + +pre-affs.o: affs_mod-fs_affs.o + -rm -f $@ + $(LD) $(affs_mod_LDFLAGS) -r -d -o $@ $^ + +mod-affs.o: mod-affs.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(affs_mod_CFLAGS) -c -o $@ $< + +mod-affs.c: moddep.lst genmodsrc.sh + sh $(srcdir)/genmodsrc.sh 'affs' $< > $@ || (rm -f $@; exit 1) + +def-affs.lst: pre-affs.o + $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 affs/' > $@ + +und-affs.lst: pre-affs.o + echo 'affs' > $@ + $(NM) -u -P -p $< | cut -f1 -d' ' >> $@ + +affs_mod-fs_affs.o: fs/affs.c + $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(affs_mod_CFLAGS) -c -o $@ $< + +affs_mod-fs_affs.d: fs/affs.c + set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(affs_mod_CFLAGS) -M $< | sed 's,affs\.o[ :]*,affs_mod-fs_affs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include affs_mod-fs_affs.d + +CLEANFILES += cmd-affs.lst fs-affs.lst +COMMANDFILES += cmd-affs.lst +FSFILES += fs-affs.lst + +cmd-affs.lst: fs/affs.c gencmdlist.sh + set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(affs_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh affs > $@ || (rm -f $@; exit 1) + +fs-affs.lst: fs/affs.c genfslist.sh + set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(affs_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh affs > $@ || (rm -f $@; exit 1) + + +affs_mod_CFLAGS = $(COMMON_CFLAGS) +affs_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For _linux.mod. _linux_mod_SOURCES = loader/i386/pc/linux.c CLEANFILES += _linux.mod mod-_linux.o mod-_linux.c pre-_linux.o _linux_mod-loader_i386_pc_linux.o def-_linux.lst und-_linux.lst diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index fd3ddffba..7a8828317 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -62,7 +62,7 @@ grub_mkimage_LDFLAGS = $(LIBLZO) # For grub-setup. grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \ util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \ - kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c \ + kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \ kern/partition.c partmap/pc.c \ fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c @@ -74,7 +74,8 @@ grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \ util/i386/pc/biosdisk.c util/misc.c util/i386/pc/getroot.c \ kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c \ fs/ext2.c kern/partition.c partmap/pc.c fs/ufs.c fs/minix.c \ - fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c fs/xfs.c + fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c fs/xfs.c \ + fs/affs.c # For grub-emu. grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ @@ -83,8 +84,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ commands/timeout.c \ commands/i386/pc/halt.c commands/i386/pc/reboot.c \ disk/loopback.c \ - fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c \ - fs/minix.c fs/ufs.c fs/xfs.c \ + fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \ + fs/jfs.c fs/minix.c fs/ufs.c fs/xfs.c \ io/gzio.c \ kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \ kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c \ @@ -116,7 +117,7 @@ pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod \ apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod \ help.mod default.mod timeout.mod configfile.mod vbe.mod \ vesafb.mod vbetest.mod vbeinfo.mod search.mod gzio.mod \ - terminfo.mod serial.mod xfs.mod + terminfo.mod serial.mod xfs.mod affs.mod # For _chain.mod. _chain_mod_SOURCES = loader/i386/pc/chainloader.c @@ -173,6 +174,11 @@ xfs_mod_SOURCES = fs/xfs.c xfs_mod_CFLAGS = $(COMMON_CFLAGS) xfs_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For affs.mod. +affs_mod_SOURCES = fs/affs.c +affs_mod_CFLAGS = $(COMMON_CFLAGS) +affs_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For _linux.mod. _linux_mod_SOURCES = loader/i386/pc/linux.c _linux_mod_CFLAGS = $(COMMON_CFLAGS) diff --git a/conf/powerpc-ieee1275.mk b/conf/powerpc-ieee1275.mk index 7a9df218b..02e93a1f6 100644 --- a/conf/powerpc-ieee1275.mk +++ b/conf/powerpc-ieee1275.mk @@ -69,8 +69,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ commands/timeout.c \ commands/ieee1275/halt.c commands/ieee1275/reboot.c \ disk/loopback.c \ - fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c \ - fs/minix.c fs/ufs.c fs/xfs.c \ + fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \ + fs/jfs.c fs/minix.c fs/ufs.c fs/xfs.c \ io/gzio.c \ kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \ kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c \ @@ -82,10 +82,10 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ util/console.c util/grub-emu.c util/misc.c \ util/i386/pc/biosdisk.c util/i386/pc/getroot.c \ util/powerpc/ieee1275/misc.c -CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o -MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_search.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d grub_emu-disk_loopback.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_powerpc_ieee1275_misc.d +CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o +MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_search.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_powerpc_ieee1275_misc.d -grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o +grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS) grub_emu-commands_boot.o: commands/boot.c @@ -192,6 +192,14 @@ grub_emu-disk_loopback.d: disk/loopback.c -include grub_emu-disk_loopback.d +grub_emu-fs_affs.o: fs/affs.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< + +grub_emu-fs_affs.d: fs/affs.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,affs\.o[ :]*,grub_emu-fs_affs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include grub_emu-fs_affs.d + grub_emu-fs_ext2.o: fs/ext2.c $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< @@ -764,7 +772,8 @@ pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \ hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \ boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \ pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \ - default.mod timeout.mod configfile.mod search.mod gzio.mod xfs.mod + default.mod timeout.mod configfile.mod search.mod gzio.mod xfs.mod \ + affs.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c @@ -775,12 +784,12 @@ UNDSYMFILES += und-fshelp.lst fshelp.mod: pre-fshelp.o mod-fshelp.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(fshelp_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(fshelp_mod_LDFLAGS) -r -d -o $@ $^ mod-fshelp.o: mod-fshelp.c $(CC) $(CPPFLAGS) $(CFLAGS) $(fshelp_mod_CFLAGS) -c -o $@ $< @@ -825,12 +834,12 @@ UNDSYMFILES += und-fat.lst fat.mod: pre-fat.o mod-fat.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(fat_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(fat_mod_LDFLAGS) -r -d -o $@ $^ mod-fat.o: mod-fat.c $(CC) $(CPPFLAGS) $(CFLAGS) $(fat_mod_CFLAGS) -c -o $@ $< @@ -875,12 +884,12 @@ UNDSYMFILES += und-ext2.lst ext2.mod: pre-ext2.o mod-ext2.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(ext2_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(ext2_mod_LDFLAGS) -r -d -o $@ $^ mod-ext2.o: mod-ext2.c $(CC) $(CPPFLAGS) $(CFLAGS) $(ext2_mod_CFLAGS) -c -o $@ $< @@ -925,12 +934,12 @@ UNDSYMFILES += und-ufs.lst ufs.mod: pre-ufs.o mod-ufs.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(ufs_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(ufs_mod_LDFLAGS) -r -d -o $@ $^ mod-ufs.o: mod-ufs.c $(CC) $(CPPFLAGS) $(CFLAGS) $(ufs_mod_CFLAGS) -c -o $@ $< @@ -975,12 +984,12 @@ UNDSYMFILES += und-minix.lst minix.mod: pre-minix.o mod-minix.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(minix_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(minix_mod_LDFLAGS) -r -d -o $@ $^ mod-minix.o: mod-minix.c $(CC) $(CPPFLAGS) $(CFLAGS) $(minix_mod_CFLAGS) -c -o $@ $< @@ -1025,12 +1034,12 @@ UNDSYMFILES += und-hfs.lst hfs.mod: pre-hfs.o mod-hfs.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(hfs_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(hfs_mod_LDFLAGS) -r -d -o $@ $^ mod-hfs.o: mod-hfs.c $(CC) $(CPPFLAGS) $(CFLAGS) $(hfs_mod_CFLAGS) -c -o $@ $< @@ -1075,12 +1084,12 @@ UNDSYMFILES += und-jfs.lst jfs.mod: pre-jfs.o mod-jfs.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(jfs_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(jfs_mod_LDFLAGS) -r -d -o $@ $^ mod-jfs.o: mod-jfs.c $(CC) $(CPPFLAGS) $(CFLAGS) $(jfs_mod_CFLAGS) -c -o $@ $< @@ -1129,12 +1138,12 @@ UNDSYMFILES += und-xfs.lst xfs.mod: pre-xfs.o mod-xfs.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(xfs_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-xfs.o: xfs_mod-fs_xfs.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(xfs_mod_LDFLAGS) -r -d -o $@ $^ mod-xfs.o: mod-xfs.c $(CC) $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -c -o $@ $< @@ -1168,6 +1177,56 @@ fs-xfs.lst: fs/xfs.c genfslist.sh set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh xfs > $@ || (rm -f $@; exit 1) +xfs_mod_CFLAGS = $(COMMON_CFLAGS) + +# For affs.mod. +xfs_mod_SOURCES = fs/affs.c +CLEANFILES += xfs.mod mod-xfs.o mod-xfs.c pre-xfs.o xfs_mod-fs_affs.o def-xfs.lst und-xfs.lst +MOSTLYCLEANFILES += xfs_mod-fs_affs.d +DEFSYMFILES += def-xfs.lst +UNDSYMFILES += und-xfs.lst + +xfs.mod: pre-xfs.o mod-xfs.o + -rm -f $@ + $(LD) $(xfs_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + +pre-xfs.o: xfs_mod-fs_affs.o + -rm -f $@ + $(LD) $(xfs_mod_LDFLAGS) -r -d -o $@ $^ + +mod-xfs.o: mod-xfs.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -c -o $@ $< + +mod-xfs.c: moddep.lst genmodsrc.sh + sh $(srcdir)/genmodsrc.sh 'xfs' $< > $@ || (rm -f $@; exit 1) + +def-xfs.lst: pre-xfs.o + $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 xfs/' > $@ + +und-xfs.lst: pre-xfs.o + echo 'xfs' > $@ + $(NM) -u -P -p $< | cut -f1 -d' ' >> $@ + +xfs_mod-fs_affs.o: fs/affs.c + $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -c -o $@ $< + +xfs_mod-fs_affs.d: fs/affs.c + set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -M $< | sed 's,affs\.o[ :]*,xfs_mod-fs_affs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include xfs_mod-fs_affs.d + +CLEANFILES += cmd-affs.lst fs-affs.lst +COMMANDFILES += cmd-affs.lst +FSFILES += fs-affs.lst + +cmd-affs.lst: fs/affs.c gencmdlist.sh + set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh xfs > $@ || (rm -f $@; exit 1) + +fs-affs.lst: fs/affs.c genfslist.sh + set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh xfs > $@ || (rm -f $@; exit 1) + + xfs_mod_CFLAGS = $(COMMON_CFLAGS) # For _linux.mod. @@ -1179,12 +1238,12 @@ UNDSYMFILES += und-_linux.lst _linux.mod: pre-_linux.o mod-_linux.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(_linux_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(_linux_mod_LDFLAGS) -r -d -o $@ $^ mod-_linux.o: mod-_linux.c $(CC) $(CPPFLAGS) $(CFLAGS) $(_linux_mod_CFLAGS) -c -o $@ $< @@ -1219,7 +1278,7 @@ fs-linux.lst: loader/powerpc/ieee1275/linux.c genfslist.sh _linux_mod_CFLAGS = $(COMMON_CFLAGS) - + # For linux.mod. linux_mod_SOURCES = loader/powerpc/ieee1275/linux_normal.c CLEANFILES += linux.mod mod-linux.o mod-linux.c pre-linux.o linux_mod-loader_powerpc_ieee1275_linux_normal.o def-linux.lst und-linux.lst @@ -1229,12 +1288,12 @@ UNDSYMFILES += und-linux.lst linux.mod: pre-linux.o mod-linux.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(linux_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(linux_mod_LDFLAGS) -r -d -o $@ $^ mod-linux.o: mod-linux.c $(CC) $(CPPFLAGS) $(CFLAGS) $(linux_mod_CFLAGS) -c -o $@ $< @@ -1282,12 +1341,12 @@ UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(normal_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-normal.o: normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_context.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-normal_powerpc_setjmp.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(normal_mod_LDFLAGS) -r -d -o $@ $^ mod-normal.o: mod-normal.c $(CC) $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $< @@ -1504,12 +1563,12 @@ UNDSYMFILES += und-hello.lst hello.mod: pre-hello.o mod-hello.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(hello_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(hello_mod_LDFLAGS) -r -d -o $@ $^ mod-hello.o: mod-hello.c $(CC) $(CPPFLAGS) $(CFLAGS) $(hello_mod_CFLAGS) -c -o $@ $< @@ -1554,12 +1613,12 @@ UNDSYMFILES += und-boot.lst boot.mod: pre-boot.o mod-boot.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(boot_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(boot_mod_LDFLAGS) -r -d -o $@ $^ mod-boot.o: mod-boot.c $(CC) $(CPPFLAGS) $(CFLAGS) $(boot_mod_CFLAGS) -c -o $@ $< @@ -1604,12 +1663,12 @@ UNDSYMFILES += und-terminal.lst terminal.mod: pre-terminal.o mod-terminal.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(terminal_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(terminal_mod_LDFLAGS) -r -d -o $@ $^ mod-terminal.o: mod-terminal.c $(CC) $(CPPFLAGS) $(CFLAGS) $(terminal_mod_CFLAGS) -c -o $@ $< @@ -1654,12 +1713,12 @@ UNDSYMFILES += und-ls.lst ls.mod: pre-ls.o mod-ls.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(ls_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(ls_mod_LDFLAGS) -r -d -o $@ $^ mod-ls.o: mod-ls.c $(CC) $(CPPFLAGS) $(CFLAGS) $(ls_mod_CFLAGS) -c -o $@ $< @@ -1704,12 +1763,12 @@ UNDSYMFILES += und-cmp.lst cmp.mod: pre-cmp.o mod-cmp.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(cmp_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(cmp_mod_LDFLAGS) -r -d -o $@ $^ mod-cmp.o: mod-cmp.c $(CC) $(CPPFLAGS) $(CFLAGS) $(cmp_mod_CFLAGS) -c -o $@ $< @@ -1754,12 +1813,12 @@ UNDSYMFILES += und-cat.lst cat.mod: pre-cat.o mod-cat.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(cat_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(cat_mod_LDFLAGS) -r -d -o $@ $^ mod-cat.o: mod-cat.c $(CC) $(CPPFLAGS) $(CFLAGS) $(cat_mod_CFLAGS) -c -o $@ $< @@ -1804,12 +1863,12 @@ UNDSYMFILES += und-font.lst font.mod: pre-font.o mod-font.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(font_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(font_mod_LDFLAGS) -r -d -o $@ $^ mod-font.o: mod-font.c $(CC) $(CPPFLAGS) $(CFLAGS) $(font_mod_CFLAGS) -c -o $@ $< @@ -1854,12 +1913,12 @@ UNDSYMFILES += und-amiga.lst amiga.mod: pre-amiga.o mod-amiga.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(amiga_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(amiga_mod_LDFLAGS) -r -d -o $@ $^ mod-amiga.o: mod-amiga.c $(CC) $(CPPFLAGS) $(CFLAGS) $(amiga_mod_CFLAGS) -c -o $@ $< @@ -1904,12 +1963,12 @@ UNDSYMFILES += und-apple.lst apple.mod: pre-apple.o mod-apple.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(apple_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(apple_mod_LDFLAGS) -r -d -o $@ $^ mod-apple.o: mod-apple.c $(CC) $(CPPFLAGS) $(CFLAGS) $(apple_mod_CFLAGS) -c -o $@ $< @@ -1954,12 +2013,12 @@ UNDSYMFILES += und-pc.lst pc.mod: pre-pc.o mod-pc.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(pc_mod_LDFLAGS) $(LDFLAGS) -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 -d -o $@ $^ + $(LD) $(pc_mod_LDFLAGS) -r -d -o $@ $^ mod-pc.o: mod-pc.c $(CC) $(CPPFLAGS) $(CFLAGS) $(pc_mod_CFLAGS) -c -o $@ $< @@ -2004,12 +2063,12 @@ UNDSYMFILES += und-sun.lst sun.mod: pre-sun.o mod-sun.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(sun_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-sun.o: sun_mod-partmap_sun.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(sun_mod_LDFLAGS) -r -d -o $@ $^ mod-sun.o: mod-sun.c $(CC) $(CPPFLAGS) $(CFLAGS) $(sun_mod_CFLAGS) -c -o $@ $< @@ -2054,12 +2113,12 @@ UNDSYMFILES += und-loopback.lst loopback.mod: pre-loopback.o mod-loopback.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(loopback_mod_LDFLAGS) $(LDFLAGS) -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 $@ $^ + $(LD) $(loopback_mod_LDFLAGS) -r -d -o $@ $^ mod-loopback.o: mod-loopback.c $(CC) $(CPPFLAGS) $(CFLAGS) $(loopback_mod_CFLAGS) -c -o $@ $< @@ -2104,12 +2163,12 @@ UNDSYMFILES += und-suspend.lst suspend.mod: pre-suspend.o mod-suspend.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(suspend_mod_LDFLAGS) $(LDFLAGS) -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 $@ $^ + $(LD) $(suspend_mod_LDFLAGS) -r -d -o $@ $^ mod-suspend.o: mod-suspend.c $(CC) $(CPPFLAGS) $(CFLAGS) $(suspend_mod_CFLAGS) -c -o $@ $< @@ -2154,12 +2213,12 @@ UNDSYMFILES += und-reboot.lst reboot.mod: pre-reboot.o mod-reboot.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(reboot_mod_LDFLAGS) $(LDFLAGS) -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 $@ $^ + $(LD) $(reboot_mod_LDFLAGS) -r -d -o $@ $^ mod-reboot.o: mod-reboot.c $(CC) $(CPPFLAGS) $(CFLAGS) $(reboot_mod_CFLAGS) -c -o $@ $< @@ -2204,12 +2263,12 @@ UNDSYMFILES += und-halt.lst halt.mod: pre-halt.o mod-halt.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(halt_mod_LDFLAGS) $(LDFLAGS) -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 $@ $^ + $(LD) $(halt_mod_LDFLAGS) -r -d -o $@ $^ mod-halt.o: mod-halt.c $(CC) $(CPPFLAGS) $(CFLAGS) $(halt_mod_CFLAGS) -c -o $@ $< @@ -2254,12 +2313,12 @@ UNDSYMFILES += und-help.lst help.mod: pre-help.o mod-help.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(help_mod_LDFLAGS) $(LDFLAGS) -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 $@ $^ + $(LD) $(help_mod_LDFLAGS) -r -d -o $@ $^ mod-help.o: mod-help.c $(CC) $(CPPFLAGS) $(CFLAGS) $(help_mod_CFLAGS) -c -o $@ $< @@ -2304,12 +2363,12 @@ UNDSYMFILES += und-default.lst default.mod: pre-default.o mod-default.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(default_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-default.o: default_mod-commands_default.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(default_mod_LDFLAGS) -r -d -o $@ $^ mod-default.o: mod-default.c $(CC) $(CPPFLAGS) $(CFLAGS) $(default_mod_CFLAGS) -c -o $@ $< @@ -2354,12 +2413,12 @@ UNDSYMFILES += und-timeout.lst timeout.mod: pre-timeout.o mod-timeout.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(timeout_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-timeout.o: timeout_mod-commands_timeout.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(timeout_mod_LDFLAGS) -r -d -o $@ $^ mod-timeout.o: mod-timeout.c $(CC) $(CPPFLAGS) $(CFLAGS) $(timeout_mod_CFLAGS) -c -o $@ $< @@ -2404,12 +2463,12 @@ UNDSYMFILES += und-configfile.lst configfile.mod: pre-configfile.o mod-configfile.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(configfile_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-configfile.o: configfile_mod-commands_configfile.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(configfile_mod_LDFLAGS) -r -d -o $@ $^ mod-configfile.o: mod-configfile.c $(CC) $(CPPFLAGS) $(CFLAGS) $(configfile_mod_CFLAGS) -c -o $@ $< @@ -2454,12 +2513,12 @@ UNDSYMFILES += und-search.lst search.mod: pre-search.o mod-search.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(search_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-search.o: search_mod-commands_search.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(search_mod_LDFLAGS) -r -d -o $@ $^ mod-search.o: mod-search.c $(CC) $(CPPFLAGS) $(CFLAGS) $(search_mod_CFLAGS) -c -o $@ $< @@ -2504,12 +2563,12 @@ UNDSYMFILES += und-gzio.lst gzio.mod: pre-gzio.o mod-gzio.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(gzio_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-gzio.o: gzio_mod-io_gzio.o -rm -f $@ - $(LD) -r -d -o $@ $^ + $(LD) $(gzio_mod_LDFLAGS) -r -d -o $@ $^ mod-gzio.o: mod-gzio.c $(CC) $(CPPFLAGS) $(CFLAGS) $(gzio_mod_CFLAGS) -c -o $@ $< diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index 6568e9d54..feeaea625 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -39,8 +39,8 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ commands/timeout.c \ commands/ieee1275/halt.c commands/ieee1275/reboot.c \ disk/loopback.c \ - fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c \ - fs/minix.c fs/ufs.c fs/xfs.c \ + fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \ + fs/jfs.c fs/minix.c fs/ufs.c fs/xfs.c \ io/gzio.c \ kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \ kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c \ @@ -76,7 +76,8 @@ pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \ hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \ boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \ pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \ - default.mod timeout.mod configfile.mod search.mod gzio.mod xfs.mod + default.mod timeout.mod configfile.mod search.mod gzio.mod xfs.mod \ + affs.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c @@ -114,10 +115,14 @@ iso9660_mod_CFLAGS = $(COMMON_CFLAGS) xfs_mod_SOURCES = fs/xfs.c xfs_mod_CFLAGS = $(COMMON_CFLAGS) +# For affs.mod. +xfs_mod_SOURCES = fs/affs.c +xfs_mod_CFLAGS = $(COMMON_CFLAGS) + # For _linux.mod. _linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c _linux_mod_CFLAGS = $(COMMON_CFLAGS) - + # For linux.mod. linux_mod_SOURCES = loader/powerpc/ieee1275/linux_normal.c linux_mod_CFLAGS = $(COMMON_CFLAGS) diff --git a/fs/affs.c b/fs/affs.c new file mode 100644 index 000000000..e0adb2e54 --- /dev/null +++ b/fs/affs.c @@ -0,0 +1,579 @@ +/* affs.c - Amiga Fast FileSystem. */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 + * 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 this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* The affs bootblock. */ +struct grub_affs_bblock +{ + grub_uint8_t type[3]; + grub_uint8_t flags; + grub_uint32_t checksum; + grub_uint32_t rootblock; +} __attribute__ ((packed)); + +/* Set if the filesystem is a AFFS filesystem. Otherwise this is an + OFS filesystem. */ +#define GRUB_AFFS_FLAG_FFS 1 + +/* The affs rootblock. */ +struct grub_affs_rblock +{ + grub_uint8_t type[4]; + grub_uint8_t unused1[8]; + grub_uint32_t htsize; + grub_uint32_t unused2; + grub_uint32_t checksum; + grub_uint32_t hashtable[1]; +} __attribute__ ((packed)); + +/* The second part of a file header block. */ +struct grub_affs_file +{ + grub_uint8_t unused1[12]; + grub_uint32_t size; + grub_uint8_t unused2[104]; + grub_uint8_t namelen; + grub_uint8_t name[30]; + grub_uint8_t unused3[33]; + grub_uint32_t next; + grub_uint32_t parent; + grub_uint32_t extension; + grub_int32_t type; +} __attribute__ ((packed)); + +/* The location of `struct grub_affs_file' relative to the end of a + file header block. */ +#define GRUB_AFFS_FILE_LOCATION 200 + +/* The offset in both the rootblock and the file header block for the + hashtable, symlink and block pointers (all synonyms). */ +#define GRUB_AFFS_HASHTABLE_OFFSET 24 +#define GRUB_AFFS_BLOCKPTR_OFFSET 24 +#define GRUB_AFFS_SYMLINK_OFFSET 24 + +#define GRUB_AFFS_SYMLINK_SIZE(blocksize) ((blocksize) - 225) + +#define GRUB_AFFS_FILETYPE_DIR -3 +#define GRUB_AFFS_FILETYPE_REG 2 +#define GRUB_AFFS_FILETYPE_SYMLINK 3 + + +struct grub_fshelp_node +{ + struct grub_affs_data *data; + int block; + int size; + int parent; +}; + +/* Information about a "mounted" affs filesystem. */ +struct grub_affs_data +{ + struct grub_affs_bblock bblock; + struct grub_fshelp_node diropen; + grub_disk_t disk; + + /* Blocksize in sectors. */ + int blocksize; + + /* The number of entries in the hashtable. */ + int htsize; +}; + +#ifndef GRUB_UTIL +static grub_dl_t my_mod; +#endif + + +static int +grub_affs_read_block (grub_fshelp_node_t node, int fileblock) +{ + int links; + grub_uint32_t pos; + int block = node->block; + struct grub_affs_file file; + struct grub_affs_data *data = node->data; + + /* Find the block that points to the fileblock we are looking up by + following the chain until the right table is reached. */ + for (links = fileblock / (data->htsize); links; links--) + { + grub_disk_read (data->disk, block + data->blocksize - 1, + data->blocksize * (GRUB_DISK_SECTOR_SIZE + - GRUB_AFFS_FILE_LOCATION), + sizeof (file), (char *) &file); + if (grub_errno) + return 0; + + block = grub_be_to_cpu32 (file.extension); + } + + /* Translate the fileblock to the block within the right table. */ + fileblock = fileblock % (data->htsize); + grub_disk_read (data->disk, block, + GRUB_AFFS_BLOCKPTR_OFFSET + + (data->htsize - fileblock - 1) * sizeof (pos), + sizeof (pos), (char *) &pos); + if (grub_errno) + return 0; + + return grub_be_to_cpu32 (pos); +} + + +/* Read LEN bytes from the file described by DATA starting with byte + POS. Return the amount of read bytes in READ. */ +static grub_ssize_t +grub_affs_read_file (grub_fshelp_node_t node, + void (*read_hook) (unsigned long sector, + unsigned offset, unsigned length), + int pos, unsigned int len, char *buf) +{ + return grub_fshelp_read_file (node->data->disk, node, read_hook, + pos, len, buf, grub_affs_read_block, + node->size, 0); +} + + +static struct grub_affs_data * +grub_affs_mount (grub_disk_t disk) +{ + struct grub_affs_data *data; + grub_uint32_t *rootblock = 0; + struct grub_affs_rblock *rblock; + + int checksum = 0; + int checksumr = 0; + int blocksize = 0; + + data = grub_malloc (sizeof (struct grub_affs_data)); + if (!data) + return 0; + + /* Read the bootblock. */ + grub_disk_read (disk, 0, 0, sizeof (struct grub_affs_bblock), + (char *) &data->bblock); + if (grub_errno) + goto fail; + + /* Make sure this is an affs filesystem. */ + if (grub_strncmp (data->bblock.type, "DOS", 3)) + { + grub_error (GRUB_ERR_BAD_FS, "not an affs filesystem"); + goto fail; + } + + /* Test if the filesystem is a OFS filesystem. */ + if (! (data->bblock.flags & GRUB_AFFS_FLAG_FFS)) + { + grub_error (GRUB_ERR_BAD_FS, "ofs not yet supported"); + goto fail; + } + + /* Read the bootblock. */ + grub_disk_read (disk, 0, 0, sizeof (struct grub_affs_bblock), + (char *) &data->bblock); + if (grub_errno) + goto fail; + + /* No sane person uses more than 8KB for a block. At least I hope + for that person because in that case this won't work. */ + rootblock = grub_malloc (GRUB_DISK_SECTOR_SIZE * 16); + if (!rootblock) + goto fail; + + rblock = (struct grub_affs_rblock *) rootblock; + + /* Read the rootblock. */ + grub_disk_read (disk, (disk->total_sectors >> 1) + blocksize, 0, + GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock); + if (grub_errno) + goto fail; + + /* The filesystem blocksize is not stored anywhere in the filesystem + itself. One way to determine it is reading blocks for the + rootblock until the checksum is correct. */ + checksumr = grub_be_to_cpu32 (rblock->checksum); + rblock->checksum = 0; + for (blocksize = 0; blocksize < 8; blocksize++) + { + grub_uint32_t *currblock = rootblock + GRUB_DISK_SECTOR_SIZE * blocksize; + unsigned int i; + + for (i = 0; i < GRUB_DISK_SECTOR_SIZE / sizeof (*currblock); i++) + checksum += grub_be_to_cpu32 (currblock[i]); + + if (checksumr == -checksum) + break; + } + if (-checksum != checksumr) + { + grub_error (GRUB_ERR_BAD_FS, "affs blocksize could not be determined"); + goto fail; + } + blocksize++; + + data->blocksize = blocksize; + data->disk = disk; + data->htsize = grub_be_to_cpu32 (rblock->htsize); + data->diropen.data = data; + data->diropen.block = (disk->total_sectors >> 1); + + grub_free (rootblock); + + return data; + + fail: + grub_free (data); + grub_free (rootblock); + return 0; +} + + +static char * +grub_affs_read_symlink (grub_fshelp_node_t node) +{ + struct grub_affs_data *data = node->data; + char *symlink; + + symlink = grub_malloc (GRUB_AFFS_SYMLINK_SIZE (data->blocksize)); + if (!symlink) + return 0; + + grub_disk_read (data->disk, node->block, GRUB_AFFS_SYMLINK_OFFSET, + GRUB_AFFS_SYMLINK_SIZE (data->blocksize), symlink); + if (grub_errno) + { + grub_free (symlink); + return 0; + } + grub_printf ("Symlink: `%s'\n", symlink); + return symlink; +} + + +static int +grub_affs_iterate_dir (grub_fshelp_node_t dir, + int NESTED_FUNC_ATTR + (*hook) (const char *filename, + enum grub_fshelp_filetype filetype, + grub_fshelp_node_t node)) +{ + int i; + struct grub_affs_file file; + struct grub_fshelp_node *node = 0; + struct grub_affs_data *data = dir->data; + grub_uint32_t *hashtable; + + auto int NESTED_FUNC_ATTR grub_affs_create_node (const char *name, int block, + int size, int type); + + int NESTED_FUNC_ATTR grub_affs_create_node (const char *name, int block, + int size, int type) + { + node = grub_malloc (sizeof (*node)); + if (!node) + { + grub_free (hashtable); + return 1; + } + + node->data = data; + node->size = size; + node->block = block; + node->parent = grub_be_to_cpu32 (file.parent); + + if (hook (name, type, node)) + { + grub_free (hashtable); + return 1; + } + return 0; + } + + hashtable = grub_malloc (data->htsize * sizeof (*hashtable)); + if (!hashtable) + return 1; + + grub_disk_read (data->disk, dir->block, GRUB_AFFS_HASHTABLE_OFFSET, + data->htsize * sizeof (*hashtable), (char *) hashtable); + if (grub_errno) + goto fail; + + /* Create the directory entries for `.' and `..'. */ + if (grub_affs_create_node (".", dir->block, dir->size, GRUB_FSHELP_DIR)) + return 1; + if (grub_affs_create_node ("..", dir->parent ? dir->parent : dir->block, + dir->size, GRUB_FSHELP_DIR)) + return 1; + + for (i = 0; i < data->htsize; i++) + { + enum grub_fshelp_filetype type; + grub_uint64_t next; + + if (!hashtable[i]) + continue; + + /* Every entry in the hashtable can be chained. Read the entire + chain. */ + next = grub_be_to_cpu32 (hashtable[i]); + + while (next) + { + grub_disk_read (data->disk, next + data->blocksize - 1, + data->blocksize * GRUB_DISK_SECTOR_SIZE + - GRUB_AFFS_FILE_LOCATION, + sizeof (file), (char *) &file); + if (grub_errno) + goto fail; + + file.name[file.namelen] = '\0'; + + if ((int) grub_be_to_cpu32 (file.type) == GRUB_AFFS_FILETYPE_DIR) + type = GRUB_FSHELP_REG; + else if (grub_be_to_cpu32 (file.type) == GRUB_AFFS_FILETYPE_REG) + type = GRUB_FSHELP_DIR; + else if (grub_be_to_cpu32 (file.type) == GRUB_AFFS_FILETYPE_SYMLINK) + type = GRUB_FSHELP_SYMLINK; + else + type = GRUB_FSHELP_UNKNOWN; + + if (grub_affs_create_node (file.name, next, + grub_be_to_cpu32 (file.size), type)) + return 1; + + next = grub_be_to_cpu32 (file.next); + } + } + + grub_free (hashtable); + return 0; + + fail: + grub_free (node); + grub_free (hashtable); + return 1; +} + + +/* Open a file named NAME and initialize FILE. */ +static grub_err_t +grub_affs_open (struct grub_file *file, const char *name) +{ + struct grub_affs_data *data; + struct grub_fshelp_node *fdiro = 0; + +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); +#endif + + data = grub_affs_mount (file->device->disk); + if (!data) + goto fail; + + grub_fshelp_find_file (name, &data->diropen, &fdiro, grub_affs_iterate_dir, + grub_affs_read_symlink, GRUB_FSHELP_REG); + if (grub_errno) + goto fail; + + file->size = fdiro->size; + data->diropen = *fdiro; + grub_free (fdiro); + + file->data = data; + file->offset = 0; + + return 0; + + fail: + if (data && fdiro != &data->diropen) + grub_free (fdiro); + grub_free (data); + +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); +#endif + + return grub_errno; +} + + +static grub_err_t +grub_affs_close (grub_file_t file) +{ + grub_free (file->data); + +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); +#endif + + return GRUB_ERR_NONE; +} + + +/* Read LEN bytes data from FILE into BUF. */ +static grub_ssize_t +grub_affs_read (grub_file_t file, char *buf, grub_ssize_t len) +{ + struct grub_affs_data *data = + (struct grub_affs_data *) file->data; + + int size = grub_affs_read_file (&data->diropen, file->read_hook, + file->offset, len, buf); + + return size; +} + + +static grub_err_t +grub_affs_dir (grub_device_t device, const char *path, + int (*hook) (const char *filename, int dir)) +{ + struct grub_affs_data *data = 0; + struct grub_fshelp_node *fdiro = 0; + + auto int NESTED_FUNC_ATTR iterate (const char *filename, + enum grub_fshelp_filetype filetype, + grub_fshelp_node_t node); + + int NESTED_FUNC_ATTR iterate (const char *filename, + enum grub_fshelp_filetype filetype, + grub_fshelp_node_t node) + { + grub_free (node); + + if (filetype == GRUB_FSHELP_DIR) + return hook (filename, 1); + else + return hook (filename, 0); + + return 0; + } + +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); +#endif + + data = grub_affs_mount (device->disk); + if (!data) + goto fail; + + grub_fshelp_find_file (path, &data->diropen, &fdiro, grub_affs_iterate_dir, + grub_affs_read_symlink, GRUB_FSHELP_DIR); + if (grub_errno) + goto fail; + + grub_affs_iterate_dir (fdiro, iterate); + + fail: + if (data && fdiro != &data->diropen) + grub_free (fdiro); + grub_free (data); + +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); +#endif + + return grub_errno; +} + + +static grub_err_t +grub_affs_label (grub_device_t device, char **label) +{ + struct grub_affs_data *data; + struct grub_affs_file file; + grub_disk_t disk = device->disk; + +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); +#endif + + data = grub_affs_mount (disk); + if (data) + { + /* The rootblock maps quite well on a file header block, it's + something we can use here. */ + grub_disk_read (data->disk, disk->total_sectors >> 1, + data->blocksize * (GRUB_DISK_SECTOR_SIZE + - GRUB_AFFS_FILE_LOCATION), + sizeof (file), (char *) &file); + if (grub_errno) + return 0; + + *label = grub_strndup (file.name, file.namelen); + } + else + *label = 0; + +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); +#endif + + grub_free (data); + + return grub_errno; +} + + +static struct grub_fs grub_affs_fs = + { + .name = "affs", + .dir = grub_affs_dir, + .open = grub_affs_open, + .read = grub_affs_read, + .close = grub_affs_close, + .label = grub_affs_label, + .next = 0 + }; + +#ifdef GRUB_UTIL +void +grub_affs_init (void) +{ + grub_fs_register (&grub_affs_fs); +} + +void +grub_affs_fini (void) +{ + grub_fs_unregister (&grub_affs_fs); +} +#else /* ! GRUB_UTIL */ +GRUB_MOD_INIT +{ + grub_fs_register (&grub_affs_fs); + my_mod = mod; +} + +GRUB_MOD_FINI +{ + grub_fs_unregister (&grub_affs_fs); +} +#endif /* ! GRUB_UTIL */ diff --git a/include/grub/fs.h b/include/grub/fs.h index c62c92656..552bb15f1 100644 --- a/include/grub/fs.h +++ b/include/grub/fs.h @@ -87,6 +87,8 @@ void grub_jfs_init (void); void grub_jfs_fini (void); void grub_xfs_init (void); void grub_xfs_fini (void); +void grub_affs_init (void); +void grub_affs_fini (void); void grub_iso9660_init (void); #endif /* GRUB_UTIL */ diff --git a/util/grub-emu.c b/util/grub-emu.c index b8f97acf3..6c437ce99 100644 --- a/util/grub-emu.c +++ b/util/grub-emu.c @@ -204,6 +204,7 @@ main (int argc, char *argv[]) grub_hfs_init (); grub_jfs_init (); grub_xfs_init (); + grub_affs_init (); grub_ls_init (); grub_boot_init (); grub_cmp_init (); @@ -235,6 +236,7 @@ main (int argc, char *argv[]) grub_loop_fini (); grub_util_biosdisk_fini (); grub_normal_fini (); + grub_affs_fini (); grub_xfs_fini (); grub_ufs_fini (); grub_ext2_fini ();