diff --git a/ChangeLog b/ChangeLog index 05fdd9ed8..2f6140cf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2005-11-13 Timothy Baldwin + + Add support for Linux/ADFS partition tables. + + * partmap/acorn.c: New file. + + * include/grub/acorn_filecore.h: Likewise. + + * DISTLIST: Added `partmap/acorn.c' and + `include/grub/acorn_filecore.h'. + + * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add + `partmap/acorn.c'. + (pkgdata_MODULES): Add `acorn.mod'. + (acorn_mod_SOURCES): New variable. + (acorn_mod_CFLAGS): Likewise. + + * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Add + `partmap/acorn.c'. + (pkgdata_MODULES): Add `acorn.mod'. + (acorn_mod_SOURCES): New variable. + (acorn_mod_CFLAGS): Likewise. + + * conf/i386-pc.rmk (grub_emu_SOURCES): Add `partmap/acorn.c'. + (pkgdata_MODULES): Add `acorn.mod'. + (acorn_mod_SOURCES): New variable. + (acorn_mod_CFLAGS): Likewise. + (acorn_mod_LDFLAGS): Likewise. + + * include/types.h (grub_disk_addr_t): New typedef. + 2005-11-13 Marco Gerards * geninit.sh: New file. diff --git a/DISTLIST b/DISTLIST index 2f21ab1a3..dc74dec7a 100644 --- a/DISTLIST +++ b/DISTLIST @@ -67,6 +67,7 @@ fs/ufs.c fs/sfs.c fs/xfs.c hello/hello.c +include/grub/acorn_filecore.h include/grub/arg.h include/grub/boot.h include/grub/cache.h @@ -184,6 +185,7 @@ normal/menu_entry.c normal/misc.c normal/i386/setjmp.S normal/powerpc/setjmp.S +partmap/acorn.c partmap/amiga.c partmap/apple.c partmap/pc.c diff --git a/conf/i386-pc.mk b/conf/i386-pc.mk index 2502019fc..29a757948 100644 --- a/conf/i386-pc.mk +++ b/conf/i386-pc.mk @@ -770,13 +770,14 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ normal/completion.c normal/context.c normal/main.c \ normal/menu.c normal/menu_entry.c normal/misc.c normal/script.c \ partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ + partmap/acorn.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 grub_emu_init.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_test.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_sfs.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-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.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_function.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-normal_script.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_init.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_test.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_sfs.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-normal_execute.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-normal_lexer.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-grub_script_tab.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_function.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-normal_script.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_init.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_test.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_sfs.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-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.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_function.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-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.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_init.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_test.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_sfs.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-normal_execute.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-normal_lexer.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-grub_script_tab.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_function.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-normal_script.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-partmap_acorn.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_init.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_test.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_sfs.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-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.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_function.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-normal_script.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_init.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_test.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_sfs.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-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.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_function.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-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.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_init.o $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS) grub_emu-commands_boot.o: commands/boot.c @@ -1243,6 +1244,14 @@ grub_emu-partmap_sun.d: partmap/sun.c -include grub_emu-partmap_sun.d +grub_emu-partmap_acorn.o: partmap/acorn.c + $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< + +grub_emu-partmap_acorn.d: partmap/acorn.c + set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,acorn\.o[ :]*,grub_emu-partmap_acorn.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include grub_emu-partmap_acorn.d + grub_emu-util_console.o: util/console.c $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< @@ -1348,7 +1357,8 @@ 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 affs.mod sfs.mod test.mod + terminfo.mod serial.mod xfs.mod affs.mod sfs.mod test.mod \ + acorn.mod # For _chain.mod. _chain_mod_SOURCES = loader/i386/pc/chainloader.c @@ -3379,6 +3389,57 @@ fs-sun.lst: partmap/sun.c genfslist.sh sun_mod_CFLAGS = $(COMMON_CFLAGS) sun_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For acorn.mod +acorn_mod_SOURCES = partmap/acorn.c +CLEANFILES += acorn.mod mod-acorn.o mod-acorn.c pre-acorn.o acorn_mod-partmap_acorn.o def-acorn.lst und-acorn.lst +MOSTLYCLEANFILES += acorn_mod-partmap_acorn.d +DEFSYMFILES += def-acorn.lst +UNDSYMFILES += und-acorn.lst + +acorn.mod: pre-acorn.o mod-acorn.o + -rm -f $@ + $(LD) $(acorn_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + +pre-acorn.o: acorn_mod-partmap_acorn.o + -rm -f $@ + $(LD) $(acorn_mod_LDFLAGS) -r -d -o $@ $^ + +mod-acorn.o: mod-acorn.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -c -o $@ $< + +mod-acorn.c: moddep.lst genmodsrc.sh + sh $(srcdir)/genmodsrc.sh 'acorn' $< > $@ || (rm -f $@; exit 1) + +def-acorn.lst: pre-acorn.o + $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 acorn/' > $@ + +und-acorn.lst: pre-acorn.o + echo 'acorn' > $@ + $(NM) -u -P -p $< | cut -f1 -d' ' >> $@ + +acorn_mod-partmap_acorn.o: partmap/acorn.c + $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -c -o $@ $< + +acorn_mod-partmap_acorn.d: partmap/acorn.c + set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -M $< | sed 's,acorn\.o[ :]*,acorn_mod-partmap_acorn.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include acorn_mod-partmap_acorn.d + +CLEANFILES += cmd-acorn.lst fs-acorn.lst +COMMANDFILES += cmd-acorn.lst +FSFILES += fs-acorn.lst + +cmd-acorn.lst: partmap/acorn.c gencmdlist.sh + set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh acorn > $@ || (rm -f $@; exit 1) + +fs-acorn.lst: partmap/acorn.c genfslist.sh + set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh acorn > $@ || (rm -f $@; exit 1) + + +acorn_mod_CFLAGS = $(COMMON_CFLAGS) +acorn_mod_LDFLAGS = $(COMMON_LDFLAGS) + # 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 diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index 7578ea437..90ce49529 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -102,6 +102,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ normal/completion.c normal/context.c normal/main.c \ normal/menu.c normal/menu_entry.c normal/misc.c normal/script.c \ partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ + partmap/acorn.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 grub_emu_init.c @@ -134,7 +135,8 @@ 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 affs.mod sfs.mod test.mod + terminfo.mod serial.mod xfs.mod affs.mod sfs.mod test.mod \ + acorn.mod # For _chain.mod. _chain_mod_SOURCES = loader/i386/pc/chainloader.c @@ -316,6 +318,11 @@ sun_mod_SOURCES = partmap/sun.c sun_mod_CFLAGS = $(COMMON_CFLAGS) sun_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For acorn.mod +acorn_mod_SOURCES = partmap/acorn.c +acorn_mod_CFLAGS = $(COMMON_CFLAGS) +acorn_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For loopback.mod loopback_mod_SOURCES = disk/loopback.c loopback_mod_CFLAGS = $(COMMON_CFLAGS) diff --git a/conf/powerpc-ieee1275.mk b/conf/powerpc-ieee1275.mk index 22161dd64..b322f987a 100644 --- a/conf/powerpc-ieee1275.mk +++ b/conf/powerpc-ieee1275.mk @@ -87,13 +87,14 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_entry.c normal/misc.c normal/script.c \ partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ + partmap/acorn.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 grub_script.tab.c grub_emu_init.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_test.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_sfs.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_parser.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_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.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_script_tab.o grub_emu-grub_emu_init.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_test.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_sfs.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_parser.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_execute.d grub_emu-normal_function.d grub_emu-normal_lexer.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.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_script_tab.d grub_emu-grub_emu_init.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_test.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_sfs.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_parser.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_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.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_script_tab.o grub_emu-grub_emu_init.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_test.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_sfs.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_parser.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_execute.d grub_emu-normal_function.d grub_emu-normal_lexer.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-partmap_acorn.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_script_tab.d grub_emu-grub_emu_init.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_test.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_sfs.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_parser.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_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.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_script_tab.o grub_emu-grub_emu_init.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_test.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_sfs.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_parser.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_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.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_script_tab.o grub_emu-grub_emu_init.o $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS) grub_emu-commands_boot.o: commands/boot.c @@ -552,6 +553,14 @@ grub_emu-partmap_sun.d: partmap/sun.c -include grub_emu-partmap_sun.d +grub_emu-partmap_acorn.o: partmap/acorn.c + $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< + +grub_emu-partmap_acorn.d: partmap/acorn.c + set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,acorn\.o[ :]*,grub_emu-partmap_acorn.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include grub_emu-partmap_acorn.d + grub_emu-util_console.o: util/console.c $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< @@ -625,7 +634,7 @@ grub_modules_init.lst: geninit.sh grub_modules_init.h: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh grub_modules_init.lst sh $(srcdir)/geninitheader.sh > $@ -grub_emu_init.c: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_modules_init.lst +grub_emu_init.c: $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_modules_init.lst grub_modules_init.h sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@ grubof_SOURCES = kern/powerpc/ieee1275/crt0.S kern/powerpc/ieee1275/cmain.c \ @@ -882,7 +891,7 @@ pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.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 \ - affs.mod sfs.mod test.mod + affs.mod sfs.mod test.mod acorn.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c @@ -2359,6 +2368,56 @@ fs-sun.lst: partmap/sun.c genfslist.sh sun_mod_CFLAGS = $(COMMON_CFLAGS) +# For acorn.mod +acorn_mod_SOURCES = partmap/acorn.c +CLEANFILES += acorn.mod mod-acorn.o mod-acorn.c pre-acorn.o acorn_mod-partmap_acorn.o def-acorn.lst und-acorn.lst +MOSTLYCLEANFILES += acorn_mod-partmap_acorn.d +DEFSYMFILES += def-acorn.lst +UNDSYMFILES += und-acorn.lst + +acorn.mod: pre-acorn.o mod-acorn.o + -rm -f $@ + $(LD) $(acorn_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + +pre-acorn.o: acorn_mod-partmap_acorn.o + -rm -f $@ + $(LD) $(acorn_mod_LDFLAGS) -r -d -o $@ $^ + +mod-acorn.o: mod-acorn.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -c -o $@ $< + +mod-acorn.c: moddep.lst genmodsrc.sh + sh $(srcdir)/genmodsrc.sh 'acorn' $< > $@ || (rm -f $@; exit 1) + +def-acorn.lst: pre-acorn.o + $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 acorn/' > $@ + +und-acorn.lst: pre-acorn.o + echo 'acorn' > $@ + $(NM) -u -P -p $< | cut -f1 -d' ' >> $@ + +acorn_mod-partmap_acorn.o: partmap/acorn.c + $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -c -o $@ $< + +acorn_mod-partmap_acorn.d: partmap/acorn.c + set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -M $< | sed 's,acorn\.o[ :]*,acorn_mod-partmap_acorn.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include acorn_mod-partmap_acorn.d + +CLEANFILES += cmd-acorn.lst fs-acorn.lst +COMMANDFILES += cmd-acorn.lst +FSFILES += fs-acorn.lst + +cmd-acorn.lst: partmap/acorn.c gencmdlist.sh + set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh acorn > $@ || (rm -f $@; exit 1) + +fs-acorn.lst: partmap/acorn.c genfslist.sh + set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh acorn > $@ || (rm -f $@; exit 1) + + +acorn_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 diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index a121c921f..56f7678eb 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -57,6 +57,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ normal/function.c normal/lexer.c normal/main.c normal/menu.c \ normal/menu_entry.c normal/misc.c normal/script.c \ partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ + partmap/acorn.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 grub_script.tab.c grub_emu_init.c @@ -100,7 +101,7 @@ pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.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 \ - affs.mod sfs.mod test.mod + affs.mod sfs.mod test.mod acorn.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c @@ -207,6 +208,10 @@ pc_mod_CFLAGS = $(COMMON_CFLAGS) sun_mod_SOURCES = partmap/sun.c sun_mod_CFLAGS = $(COMMON_CFLAGS) +# For acorn.mod +acorn_mod_SOURCES = partmap/acorn.c +acorn_mod_CFLAGS = $(COMMON_CFLAGS) + # For loopback.mod loopback_mod_SOURCES = disk/loopback.c loopback_mod_CFLAGS = $(COMMON_CFLAGS) diff --git a/conf/sparc64-ieee1275.mk b/conf/sparc64-ieee1275.mk index fa6ad3320..2f3732c60 100644 --- a/conf/sparc64-ieee1275.mk +++ b/conf/sparc64-ieee1275.mk @@ -58,6 +58,7 @@ grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \ # normal/function.c normal/lexer.c \ # normal/main.c normal/menu.c normal/menu_entry.c normal/misc.c \ # partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ +# partmap/acorn.c \ # util/console.c util/grub-emu.c util/misc.c \ # util/i386/pc/biosdisk.c util/i386/pc/getroot.c \ # util/sparc64/ieee1275/misc.c @@ -290,7 +291,7 @@ pkgdata_MODULES = fat.mod ufs.mod ext2.mod minix.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 \ - affs.mod sfs.mod + affs.mod sfs.mod acorn.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c @@ -1701,6 +1702,56 @@ fs-sun.lst: partmap/sun.c genfslist.sh sun_mod_CFLAGS = $(COMMON_CFLAGS) sun_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For acorn.mod +acorn_mod_SOURCES = partmap/acorn.c +CLEANFILES += acorn.mod mod-acorn.o mod-acorn.c pre-acorn.o acorn_mod-partmap_acorn.o def-acorn.lst und-acorn.lst +MOSTLYCLEANFILES += acorn_mod-partmap_acorn.d +DEFSYMFILES += def-acorn.lst +UNDSYMFILES += und-acorn.lst + +acorn.mod: pre-acorn.o mod-acorn.o + -rm -f $@ + $(LD) $(acorn_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + +pre-acorn.o: acorn_mod-partmap_acorn.o + -rm -f $@ + $(LD) $(acorn_mod_LDFLAGS) -r -d -o $@ $^ + +mod-acorn.o: mod-acorn.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -c -o $@ $< + +mod-acorn.c: moddep.lst genmodsrc.sh + sh $(srcdir)/genmodsrc.sh 'acorn' $< > $@ || (rm -f $@; exit 1) + +def-acorn.lst: pre-acorn.o + $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 acorn/' > $@ + +und-acorn.lst: pre-acorn.o + echo 'acorn' > $@ + $(NM) -u -P -p $< | cut -f1 -d' ' >> $@ + +acorn_mod-partmap_acorn.o: partmap/acorn.c + $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -c -o $@ $< + +acorn_mod-partmap_acorn.d: partmap/acorn.c + set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -M $< | sed 's,acorn\.o[ :]*,acorn_mod-partmap_acorn.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include acorn_mod-partmap_acorn.d + +CLEANFILES += cmd-acorn.lst fs-acorn.lst +COMMANDFILES += cmd-acorn.lst +FSFILES += fs-acorn.lst + +cmd-acorn.lst: partmap/acorn.c gencmdlist.sh + set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh acorn > $@ || (rm -f $@; exit 1) + +fs-acorn.lst: partmap/acorn.c genfslist.sh + set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(acorn_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh acorn > $@ || (rm -f $@; exit 1) + + +acorn_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 diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk index 0066a96af..a93641a1d 100644 --- a/conf/sparc64-ieee1275.rmk +++ b/conf/sparc64-ieee1275.rmk @@ -58,6 +58,7 @@ grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \ # normal/function.c normal/lexer.c \ # normal/main.c normal/menu.c normal/menu_entry.c normal/misc.c \ # partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ +# partmap/acorn.c \ # util/console.c util/grub-emu.c util/misc.c \ # util/i386/pc/biosdisk.c util/i386/pc/getroot.c \ # util/sparc64/ieee1275/misc.c @@ -86,7 +87,7 @@ pkgdata_MODULES = fat.mod ufs.mod ext2.mod minix.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 \ - affs.mod sfs.mod + affs.mod sfs.mod acorn.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c @@ -219,6 +220,10 @@ sun_mod_SOURCES = partmap/sun.c sun_mod_CFLAGS = $(COMMON_CFLAGS) sun_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For acorn.mod +acorn_mod_SOURCES = partmap/acorn.c +acorn_mod_CFLAGS = $(COMMON_CFLAGS) + # For loopback.mod loopback_mod_SOURCES = disk/loopback.c loopback_mod_CFLAGS = $(COMMON_CFLAGS) diff --git a/include/grub/acorn_filecore.h b/include/grub/acorn_filecore.h new file mode 100644 index 000000000..b03a1b78d --- /dev/null +++ b/include/grub/acorn_filecore.h @@ -0,0 +1,55 @@ + +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 + * 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. + */ + +#ifndef GRUB_ACORN_FILECORE_HEADER +#define GRUB_ACORN_FILECORE_HEADER 1 + +#include + +struct grub_filecore_disc_record +{ + grub_uint8_t log2secsize; + grub_uint8_t secspertrack; + grub_uint8_t heads; + grub_uint8_t density; + grub_uint8_t idlen; + grub_uint8_t log2bpmb; + grub_uint8_t skew; + grub_uint8_t bootoption; + /* In bits 0-5, flags in bits 6 and 7. */ + grub_uint8_t lowsector; + grub_uint8_t nzones; + grub_uint16_t zone_spare; + grub_uint32_t root_address; + /* Disc size in bytes. */ + grub_uint32_t disc_size; + grub_uint16_t cycle_id; + char disc_name[10]; + /* Yes, it is 32 bits! */ + grub_uint32_t disctype; + /* Most significant part of the disc size. */ + grub_uint32_t disc_size2; + grub_uint8_t share_size; + grub_uint8_t big_flag; + grub_uint8_t reserved[18]; +}; + + +#endif /* ! GRUB_ACORN_FILECORE_HEADER */ diff --git a/include/grub/types.h b/include/grub/types.h index d33b78b82..08d58d6f6 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002 Free Software Foundation, Inc. + * Copyright (C) 2002, 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 @@ -93,6 +93,9 @@ typedef grub_uint32_t grub_size_t; typedef grub_int32_t grub_ssize_t; #endif +/* FIXME: Will be grub_uint64_t */ +typedef unsigned long grub_disk_addr_t; + /* Byte-orders. */ #define grub_swap_bytes16(x) \ ({ \ diff --git a/partmap/acorn.c b/partmap/acorn.c new file mode 100644 index 000000000..c223b5202 --- /dev/null +++ b/partmap/acorn.c @@ -0,0 +1,198 @@ +/* acorn.c - Read Linux/ADFS partition tables. */ +/* + * 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 + +#define LINUX_NATIVE_MAGIC grub_cpu_to_le32 (0xdeafa1de) +#define LINUX_SWAP_MAGIC grub_cpu_to_le32 (0xdeafab1e) +#define LINUX_MAP_ENTRIES (512 / 12) + +#define NONADFS_PARTITON_TYPE_LINUX 9 +#define NONADFS_PARTITON_TYPE_MASK 15 + +struct grub_acorn_boot_block +{ + grub_uint8_t misc[0x1C0]; + struct grub_filecore_disc_record disc_record; + grub_uint8_t flags; + grub_uint16_t start_cylinder; + grub_uint8_t checksum; +} __attribute__ ((packed, aligned)); + +struct linux_part +{ + grub_uint32_t magic; + grub_uint32_t start; + grub_uint32_t size; +}; + +static struct grub_partition_map grub_acorn_partition_map; + +static grub_err_t +find (grub_disk_t disk, struct linux_part *m, unsigned *sector) +{ + int i; + struct grub_acorn_boot_block boot; + grub_err_t err = grub_disk_read (disk, 0xC00 / GRUB_DISK_SECTOR_SIZE, 0, + sizeof (struct grub_acorn_boot_block), + &boot); + if (err) + return err; + + if ((boot.flags & NONADFS_PARTITON_TYPE_MASK) != NONADFS_PARTITON_TYPE_LINUX) + goto fail; + + unsigned checksum = 0; + for (i = 0; i != 0x1ff; ++i) + checksum = (checksum & 0xff) + (checksum >> 8) + boot.misc[i]; + + if ((grub_uint8_t) checksum != boot.checksum) + goto fail; + + unsigned heads = (boot.disc_record.heads + + ((boot.disc_record.lowsector >> 6) & 1)); + unsigned sectors_per_cylinder = boot.disc_record.secspertrack * heads; + *sector = grub_le_to_cpu16 (boot.start_cylinder) * sectors_per_cylinder; + + return grub_disk_read (disk, *sector, 0, + sizeof (struct linux_part) * LINUX_MAP_ENTRIES, m); + +fail: + return grub_error (GRUB_ERR_BAD_PART_TABLE, + "Linux/ADFS partition map not found."); + +} + + +static grub_err_t +acorn_partition_map_iterate (grub_disk_t disk, + int (*hook) (grub_disk_t disk, + const grub_partition_t partition)) +{ + int i; + unsigned sector; + struct grub_partition part; + struct grub_disk raw; + struct linux_part map[LINUX_MAP_ENTRIES]; + + /* Enforce raw disk access. */ + raw = *disk; + raw.partition = 0; + + grub_err_t err = find (&raw, map, §or); + if (err) + return err; + + part.partmap = &grub_acorn_partition_map; + + for (i = 0; i != LINUX_MAP_ENTRIES; ++i) + { + if (map[i].magic != LINUX_NATIVE_MAGIC + && map[i].magic != LINUX_SWAP_MAGIC) + return GRUB_ERR_NONE; + + part.start = (grub_disk_addr_t)sector + map[i].start; + part.len = map[i].size; + part.offset = 6; + part.index = i; + + if (hook (disk, &part)) + return grub_errno; + } + + return GRUB_ERR_NONE; +} + + +static grub_partition_t +acorn_partition_map_probe (grub_disk_t disk, const char *str) +{ + unsigned sector; + struct linux_part map[LINUX_MAP_ENTRIES]; + + /* Enforce raw disk access. */ + struct grub_disk raw = *disk; + raw.partition = 0; + + /* Get the partition number. */ + unsigned long partnum = grub_strtoul (str, 0, 10); + if (partnum > LINUX_MAP_ENTRIES) + goto fail; + + grub_err_t err = find (&raw, map, §or); + if (err) + return 0; + + if (map[partnum].magic != LINUX_NATIVE_MAGIC + && map[partnum].magic != LINUX_SWAP_MAGIC) + goto fail; + + grub_partition_t p = grub_malloc (sizeof (struct grub_partition)); + if (!p) + return 0; + + p->start = (grub_disk_addr_t)sector + map[partnum].start; + p->len = map[partnum].size; + p->offset = 6; + p->index = partnum; + return p; + +fail: + grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition"); + return 0; +} + + +static char * +acorn_partition_map_get_name (const grub_partition_t p) +{ + char *name; + + name = grub_malloc (13); + if (!name) + return 0; + + grub_sprintf (name, "%d", p->index); + return name; +} + + +/* Partition map type. */ +static struct grub_partition_map grub_acorn_partition_map = +{ + .name = "Linux/ADFS partition map", + .iterate = acorn_partition_map_iterate, + .probe = acorn_partition_map_probe, + .get_name = acorn_partition_map_get_name +}; + +GRUB_MOD_INIT(acorn_partition_map) +{ + grub_partition_map_register (&grub_acorn_partition_map); +} + +GRUB_MOD_FINI(acorn_partition_map) +{ + grub_partition_map_unregister (&grub_acorn_partition_map); +}