From 575b44b648a5007217689a857f82129a56cabc7c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 11 Apr 2013 23:15:26 +0200 Subject: [PATCH 282/482] Merge powerpc grub-mkrescue flavour with common. Use xorriso HFS+ feature for it. --- ChangeLog | 5 + Makefile.util.def | 38 +++- configure.ac | 1 + docs/man/grub-render-label.h2m | 3 + grub-core/Makefile.core.def | 6 + grub-core/boot/powerpc/grub.chrp.in | 172 +++++++++++++++ grub-core/font/font.c | 6 +- grub-core/font/font_cmd.c | 2 +- grub-core/video/video.c | 8 + include/grub/font.h | 2 +- include/grub/video.h | 5 + util/grub-mkrescue.in | 80 +++++++ util/grub-render-label.c | 393 +++++++++++++++++++++++++++++++++ util/powerpc/ieee1275/grub-mkrescue.in | 146 ------------ 14 files changed, 707 insertions(+), 160 deletions(-) create mode 100644 docs/man/grub-render-label.h2m create mode 100644 grub-core/boot/powerpc/grub.chrp.in create mode 100644 util/grub-render-label.c delete mode 100644 util/powerpc/ieee1275/grub-mkrescue.in diff --git a/ChangeLog b/ChangeLog index 70f0074..0d62509 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2013-04-11 Vladimir Serbinenko + Merge powerpc grub-mkrescue flavour with common. Use xorriso HFS+ + feature for it. + +2013-04-11 Vladimir Serbinenko + * docs/grub.texi: Fix description of GRUB_CMDLINE_XEN and GRUB_CMDLINE_XEN_DEFAULT. Reported by: Marc Warne (GigaTux) diff --git a/Makefile.util.def b/Makefile.util.def index 513dc38..bd286fc 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -59,6 +59,17 @@ library = { common = grub-core/disk/mdraid1x_linux.c; common = grub-core/disk/raid5_recover.c; common = grub-core/disk/raid6_recover.c; + common = grub-core/font/font.c; + common = grub-core/gfxmenu/font.c; + common = grub-core/normal/charset.c; + common = grub-core/video/fb/fbblit.c; + common = grub-core/video/fb/fbutil.c; + common = grub-core/video/fb/fbfill.c; + common = grub-core/video/fb/video_fb.c; + common = grub-core/video/video.c; + common = grub-core/video/colors.c; + common = grub-core/unidata.c; + common = grub-core/io/bufio.c; common = grub-core/fs/affs.c; common = grub-core/fs/afs.c; common = grub-core/fs/bfs.c; @@ -451,15 +462,8 @@ script = { script = { mansection = 1; name = grub-mkrescue; - x86 = util/grub-install_header; - x86 = util/grub-mkrescue.in; - mips_qemu_mips = util/grub-install_header; - mips_qemu_mips = util/grub-mkrescue.in; - mips_loongson = util/grub-install_header; - mips_loongson = util/grub-mkrescue.in; - ia64_efi = util/grub-install_header; - ia64_efi = util/grub-mkrescue.in; - powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in; + common = util/grub-install_header; + common = util/grub-mkrescue.in; enable = i386_pc; enable = i386_efi; enable = x86_64_efi; @@ -763,3 +767,19 @@ program = { ldadd = grub-core/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; + +program = { + name = grub-render-label; + mansection = 1; + + common = util/grub-render-label.c; + common = grub-core/kern/emu/argp_common.c; + common = grub-core/kern/emu/hostfs.c; + common = grub-core/disk/host.c; + + ldadd = libgrubmods.a; + ldadd = libgrubgcry.a; + ldadd = libgrubkern.a; + ldadd = grub-core/gnulib/libgnu.a; + ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; +}; diff --git a/configure.ac b/configure.ac index a39a025..19febfd 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-reboot]) grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) grub_TRANSFORM([grub-sparc64-setup]) +grub_TRANSFORM([grub-render-label]) # Optimization flag. Allow user to override. if test "x$TARGET_CFLAGS" = x; then diff --git a/docs/man/grub-render-label.h2m b/docs/man/grub-render-label.h2m new file mode 100644 index 0000000..50ae524 --- /dev/null +++ b/docs/man/grub-render-label.h2m @@ -0,0 +1,3 @@ +[NAME] +grub-render-label \- generate a .disk_label for Apple Macs. + diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 4c8e947..6aead4c 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -30,6 +30,12 @@ script = { common = gdb_grub.in; }; +script = { + installdir = platform; + name = grub.chrp; + common = boot/powerpc/grub.chrp.in; +}; + kernel = { name = kernel; diff --git a/grub-core/boot/powerpc/grub.chrp.in b/grub-core/boot/powerpc/grub.chrp.in new file mode 100644 index 0000000..9b22183 --- /dev/null +++ b/grub-core/boot/powerpc/grub.chrp.in @@ -0,0 +1,172 @@ + + +MacRISC MacRISC3 MacRISC4 + + +@PACKAGE@ @VERSION@ + + +3434 +00000000000000F781FB8181818181FBFAF500000000000000000000000000000000000000F6FAFAFAFA81F9F600000000000000 +0000000000F8FBF9F500F95656FCFB5656FBF800000000000000000000000000000000F5FAF9F5F7F600F6F6F9FAF70000000000 +000000F5FBFA0056FDFEFEFDFDFAAC81FB56568181560000000000000000000000F9F9F9F7FCFDFEFEFEFFFC81F656FA00000000 +0000F5AC2BF7FBFEFEFD2BF6568181F9F7F6F6F8FBF50000000000000000000000FAF700F600F5F7F7F6F7FEFFACF82BFB000000 +0000FC2BF5FEFFFFF5F7FC81F70000F7F9FAFAF8000000000000000000000000000056F9F9FAF9F7F7FA812BF7FFFF56F7FA0000 +005656F5FEFFAC2BF9FA000000000000000000000000000000000000000000000000000000000000000000FA56FAFEFEF8F9F700 +00FB00F7FFFF56F9F800000000000000000000F656FAFA56F50000000000F5F8F9F8F5000000000000000000F9F7FCFFFB00FB00 +F8F800ACFFACF6FA000000000000000000F6FA562BF5F5F781FA000000F9FA2B00F556F9F5000000000000000081F8FFFEF6562B +810000FFFFF9FAF500000000000000002B8100F5F9FCACFBF82BFBF6FCFAF6FAFC81F600FA2B000000000000002BF8FEFFF8F5FA +FA00F5FEFFFA8100000000000000002B8100F9FEFFFFFFFFFFFBF6FDFEACFDFEFFFFFFFBF581F600000000000000F9FEFFF700FA +FA00FBFFFEF6F900000000000000F6FB00FCFFFFFFFFFFFFFFFFFCF600FCF7ACFEFFFFFFFDF6810000000000000056F9FFAC00FA +FA00F6FFFFF856000000000000F5FBF5ACFFFFFFFFFFFFFFFFFFFF2B002BF8F5ACFFFFFFFFFDF6FA000000000000F9FCFF560081 +FA0081FFFFF8F9000000000000FBF6FBFFFFFFFFFFFFFFFFFFFFFFF800F55600FCFFFFFFFFFF81F8F80000000000F981FFAC0081 +FA0000FEFEF8FB0000000000812BFAFFFFFFFFFFFFFEFFFFFDF92BFA0000F6F981ACFEFFFFFFFF56F9F600000000F9FDFF2B0081 +FA00FAFFFF81812B000000FAF8F9FFFFFEACFBF80000F500000000F9F900562B0000FCF7F9ACFFFF2BF9F50000F9F6FEFFFB0081 +810000FCFFFBF6FB56F7FBF8F9FFFE5600000000F5FAAC000000F82BF6FAFBF800F556F80000F9FFFE2BFAFAFAF8FAFFFEF60081 +FAF6F5ACFFFFAC00F856F7ACFFFCF500000000FAFCFFFC00000056AC00F581F92BFEF9FAF6000081FFFFFBF6F62BFFFFACF6F6FA +F6FA00FAFFFFFFACFA56FFFFAC0000000000F6FD2BFEF6F5565600F5F800F60081FEF7F656000000FDFFFFFDFDFFFFFFAC0081F5 +0081F52BFDFFFFFFFFFFFFFFF60000000000FBF6F6F5F656F52BF900FA000000FCFAF5F656000000F7FFFFFFFFFFFFFDF7F68100 +00F6FB00F8FDFFFFFFFFFF810000000000F6F5000000F52B56F9FC00F7F70000FCF881FCF500000000FEFFFFFFFFAC5600FBF500 +000056F900F8ACFDFFFFFFF5000000000000002B0000FDFEFFFE560000F60000F9ACFFFE810000000081FFFEFDFAF800FAF70000 +000000FAF9002B56FAFDFC0000000000000000F80000FBF5FEFEF5000000000000ACFFFA2B0000000000FEFB2BF5008156000000 +00000000F9FBF600F6FBF800000000000000F7F8000000F9F9F9F82B0000000000F6ACACF70000000000F7FD2BFA812B00000000 +0000000000F681FCFBFD0000000000000000FBF6000000000000F52B000000000000F92B810000000000008181F6000000000000 +0000000000000000F6FC00000000000000F6FF0000000000000000000000000000000081FBFB2B00000000F7F900000000000000 +000000000000000000FC00000000000000FCFAF600000000000000000000000000000056ACF581FBF700000081FB000000000000 +0000000000000000FAF90000000000008156F5F8000000000000002BFBFCFBF800000000FD2B000056FB8181FBF8000000000000 +0000000000000000AC0000000000F5FBF90000F6000000000000F5AC56F6005681F50000F6ACFCFBF70000000000000000000000 +00000000000000F881000000F5FAFDFD00000000000000000000F7FEFA2B0000F581F70000000000810000000000000000000000 +000000000000F9FCF500FAFDACFAF5FD00000000000000000000F5ACF5FDFEFA0000F82B00000000810000000000000000000000 +000000000000FCF8F9AC81FD000000FD000000000000FAF7000000F50081F9FAF800000000000000FB0000000000000000000000 +000000000000FC81F956F5FD000000FD0000000000000000F800F5000000000056000000000000F7FB0000000000000000000000 +00000000000000000000F5AC000000ACF800000000000000F5FAF80000000000F50000000000F8ACF50000000000000000000000 +00000000000000000000F5AC000000F5AC000000000000000056F9000000000000000000F7ACFCF5000000000000000000000000 +00000000000000000000F5FD00000000AC000000000000000000FB0000000000000000F5F6F5FCF6000000000000000000000000 +0000000000000000000000FD00000000FBFDF600000000000000F8F900000000000000000000F5FB000000000000000000000000 +0000000000000000000000FDF500000000F9ACF800000000000000815600000000F656818181AC56000000000000000000000000 +000000000000000000000081F80000000000F9FC0000000000000000F9ACACACFCFBFAFA81FD2B00000000000000000000000000 +0000000000000000000000F7FB0000000000FBF70000000000000000000000000000000000FB0000000000000000000000000000 +000000000000000000000000ACF500000000F9FD56F5000000000000000000000000000000FB0000000000000000000000000000 +000000000000000000000000F8FA0000000000F6FEFEF5000000000000F55681FCACFDACFC560000000000000000000000000000 +00000000000000000000000000FBF600000000002BFCFA00F700000000F9FDFDFAFEF90000000000000000000000000000000000 +00000000000000000000000000F5FB0000000000F5FEF7ACAC0000000000000000FCF50000000000000000000000000000000000 +0000000000000000000000000000F6FA000000002BFF2BFFFFAC00000000000000F7FA0000000000000000000000000000000000 +000000000000000000000000000000F65600000000FAFEFFFFAC0000000000F800F6810000000000000000000000000000000000 +00000000000000000000000000000000F52B00000000F8FEFBFF5600000000FCFAACF60000000000000000000000000000000000 +0000000000000000000000000000000000000000000000F9FCFCFFFB00F8FEFFFDF5000000000000000000000000000000000000 +00000000000000000000000000000000000000000000F9FDF7F5FFFD56FFFFFFFD00000000000000000000000000000000000000 +00000000000000000000000000000000000000000000810000FBFFFFFBFFFFFFFFACF9F5F5000000000000000000000000000000 +0000000000000000000000000000000000000000000000F600FC81FFFEFFFFFFFFFFFE8100000000000000000000000000000000 +00000000000000000000000000000000000000000000000000F7F6FDFFFFFFFEFFFFACF500000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000F5FC81FC81FAFBF9F500000000000000000000000000000000 + +00000000000000F781FB8181818181FBFAF500000000000000000000000000000000000000F6FAFAFAFA81F9F600000000000000 +0000000000F8FBF9F500F95656FCFB5656FBF800000000000000000000000000000000F5FAF9F5F7F600F6F6F9FAF70000000000 +000000F5FBFA0056FDFEFEFDFDFAAC81FB56568181560000000000000000000000F9F9F9F7FCFDFEFEFEFFFC81F656FA00000000 +0000F5AC2BF7FBFEFEFD2BF6568181F9F7F6F6F8FBF50000000000000000000000FAF700F600F5F7F7F6F7FEFFACF82BFB000000 +0000FC2BF5FEFFFFF5F7FC81F70000F7F9FAFAF8000000000000000000000000000056F9F9FAF9F7F7FA812BF7FFFF56F7FA0000 +005656F5FEFFAC2BF9FA000000000000000000000000000000000000000000000000000000000000000000FA56FAFEFEF8F9F700 +00FB00F7FFFF56F9F800000000000000000000F656FAFA56F50000000000F5F8F9F8F5000000000000000000F9F7FCFFFB00FB00 +F8F800ACFFACF6FA000000000000000000F6FA562BF5F5F781FA000000F9FA2B00F556F9F5000000000000000081F8FFFEF6562B +810000FFFFF9FAF500000000000000002B8100F5F9FCACFBF82BFBF6FCFAF6FAFC81F600FA2B000000000000002BF8FEFFF8F5FA +FA00F5FEFFFA8100000000000000002B8100F9FEFFFFFFFFFFFBF6FDFEACFDFEFFFFFFFBF581F600000000000000F9FEFFF700FA +FA00FBFFFEF6F900000000000000F6FB00FCFFFFFFFFFFFFFFFFFCF600FCF7ACFEFFFFFFFDF6810000000000000056F9FFAC00FA +FA00F6FFFFF856000000000000F5FBF5ACFFFFFFFFFFFFFFFFFFFF2B002BF8F5ACFFFFFFFFFDF6FA000000000000F9FCFF560081 +FA0081FFFFF8F9000000000000FBF6FBFFFFFFFFFFFFFFFFFFFFFFF800F55600FCFFFFFFFFFF81F8F80000000000F981FFAC0081 +FA0000FEFEF8FB0000000000812BFAFFFFFFFFFFFFFEFFFFFDF92BFA0000F6F981ACFEFFFFFFFF56F9F600000000F9FDFF2B0081 +FA00FAFFFF81812B000000FAF8F9FFFFFEACFBF80000F500000000F9F900562B0000FCF7F9ACFFFF2BF9F50000F9F6FEFFFB0081 +810000FCFFFBF6FB56F7FBF8F9FFFE5600000000F5FAAC000000F82BF6FAFBF800F556F80000F9FFFE2BFAFAFAF8FAFFFEF60081 +FAF6F5ACFFFFAC00F856F7ACFFFCF500000000FAFCFFFC00000056AC00F581F92BFEF9FAF6000081FFFFFBF6F62BFFFFACF6F6FA +F6FA00FAFFFFFFACFA56FFFFAC0000000000F6FD2BFEF6F5565600F5F800F60081FEF7F656000000FDFFFFFDFDFFFFFFAC0081F5 +0081F52BFDFFFFFFFFFFFFFFF60000000000FBF6F6F5F656F52BF900FA000000FCFAF5F656000000F7FFFFFFFFFFFFFDF7F68100 +00F6FB00F8FDFFFFFFFFFF810000000000F6F5000000F52B56F9FC00F7F70000FCF881FCF500000000FEFFFFFFFFAC5600FBF500 +000056F900F8ACFDFFFFFFF5000000000000002B0000FDFEFFFE560000F60000F9ACFFFE810000000081FFFEFDFAF800FAF70000 +000000FAF9002B56FAFDFC0000000000000000F80000FBF5FEFEF5000000000000ACFFFA2B0000000000FEFB2BF5008156000000 +00000000F9FBF600F6FBF800000000000000F7F8000000F9F9F9F82B0000000000F6ACACF70000000000F7FD2BFA812B00000000 +0000000000F681FCFBFD0000000000000000FBF6000000000000F52B000000000000F92B810000000000008181F6000000000000 +0000000000000000F6FC00000000000000F6FF0000000000000000000000000000000081FBFB2B00000000F7F900000000000000 +000000000000000000FC00000000000000FCFAF600000000000000000000000000000056ACF581FBF700000081FB000000000000 +0000000000000000FAF90000000000008156F5F8000000000000002BFBFCFBF800000000FD2B000056FB8181FBF8000000000000 +0000000000000000AC0000000000F5FBF90000F6000000000000F5AC56F6005681F50000F6ACFCFBF70000000000000000000000 +00000000000000F881000000F5FAFDFD00000000000000000000F7FEFA2B0000F581F70000000000810000000000000000000000 +000000000000F9FCF500FAFDACFAF5FD00000000000000000000F5ACF5FDFEFA0000F82B00000000810000000000000000000000 +000000000000FCF8F9AC81FD000000FD000000000000FAF7000000F50081F9FAF800000000000000FB0000000000000000000000 +000000000000FC81F956F5FD000000FD0000000000000000F800F5000000000056000000000000F7FB0000000000000000000000 +00000000000000000000F5AC000000ACF800000000000000F5FAF80000000000F50000000000F8ACF50000000000000000000000 +00000000000000000000F5AC000000F5AC000000000000000056F9000000000000000000F7ACFCF5000000000000000000000000 +00000000000000000000F5FD00000000AC000000000000000000FB0000000000000000F5F6F5FCF6000000000000000000000000 +0000000000000000000000FD00000000FBFDF600000000000000F8F900000000000000000000F5FB000000000000000000000000 +0000000000000000000000FDF500000000F9ACF800000000000000815600000000F656818181AC56000000000000000000000000 +000000000000000000000081F80000000000F9FC0000000000000000F9ACACACFCFBFAFA81FD2B00000000000000000000000000 +0000000000000000000000F7FB0000000000FBF70000000000000000000000000000000000FB0000000000000000000000000000 +000000000000000000000000ACF500000000F9FD56F5000000000000000000000000000000FB0000000000000000000000000000 +000000000000000000000000F8FA0000000000F6FEFEF5000000000000F55681FCACFDACFC560000000000000000000000000000 +00000000000000000000000000FBF600000000002BFCFA00F700000000F9FDFDFAFEF90000000000000000000000000000000000 +00000000000000000000000000F5FB0000000000F5FEF7ACAC0000000000000000FCF50000000000000000000000000000000000 +0000000000000000000000000000F6FA000000002BFF2BFFFFAC00000000000000F7FA0000000000000000000000000000000000 +000000000000000000000000000000F65600000000FAFEFFFFAC0000000000F800F6810000000000000000000000000000000000 +00000000000000000000000000000000F52B00000000F8FEFBFF5600000000FCFAACF60000000000000000000000000000000000 +0000000000000000000000000000000000000000000000F9FCFCFFFB00F8FEFFFDF5000000000000000000000000000000000000 +00000000000000000000000000000000000000000000F9FDF7F5FFFD56FFFFFFFD00000000000000000000000000000000000000 +00000000000000000000000000000000000000000000810000FBFFFFFBFFFFFFFFACF9F5F5000000000000000000000000000000 +0000000000000000000000000000000000000000000000F600FC81FFFEFFFFFFFFFFFE8100000000000000000000000000000000 +00000000000000000000000000000000000000000000000000F7F6FDFFFFFFFEFFFFACF500000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000F5FC81FC81FAFBF9F500000000000000000000000000000000 + +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF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FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + + +boot &device;:&partition;,\System\Library\CoreServices\grub.elf + + diff --git a/grub-core/font/font.c b/grub-core/font/font.c index 6b54a84..fbbb988 100644 --- a/grub-core/font/font.c +++ b/grub-core/font/font.c @@ -422,7 +422,7 @@ read_section_as_short (struct font_file_section *section, /* Load a font and add it to the beginning of the global font list. Returns 0 upon success, nonzero upon failure. */ -int +grub_font_t grub_font_load (const char *filename) { grub_file_t file = 0; @@ -657,7 +657,7 @@ grub_font_load (const char *filename) if (register_font (font) != 0) goto fail; - return 0; + return font; fail: if (file) @@ -666,7 +666,7 @@ fail: font->file = 0; free_font (font); - return 1; + return 0; } /* Read a 16-bit big-endian integer from FILE, convert it to native byte diff --git a/grub-core/font/font_cmd.c b/grub-core/font/font_cmd.c index 90f605d..1d9ddea 100644 --- a/grub-core/font/font_cmd.c +++ b/grub-core/font/font_cmd.c @@ -32,7 +32,7 @@ loadfont_command (grub_command_t cmd __attribute__ ((unused)), return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); while (argc--) - if (grub_font_load (*args++) != 0) + if (grub_font_load (*args++) == 0) { if (!grub_errno) return grub_error (GRUB_ERR_BAD_FONT, "invalid font"); diff --git a/grub-core/video/video.c b/grub-core/video/video.c index c36994f..aab9b18 100644 --- a/grub-core/video/video.c +++ b/grub-core/video/video.c @@ -711,3 +711,11 @@ grub_video_set_mode (const char *modestring, return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("no suitable video mode found")); } + +#ifdef GRUB_UTIL +void +grub_video_set_adapter (grub_video_adapter_t adapter) +{ + grub_video_adapter_active = adapter; +} +#endif diff --git a/include/grub/font.h b/include/grub/font.h index 690363f..975432e 100644 --- a/include/grub/font.h +++ b/include/grub/font.h @@ -81,7 +81,7 @@ void grub_font_loader_init (void); /* Load a font and add it to the beginning of the global font list. Returns: 0 upon success; nonzero upon failure. */ -int grub_font_load (const char *filename); +grub_font_t grub_font_load (const char *filename); /* Get the font that has the specified name. Font names are in the form "Family Name Bold Italic 14", where Bold and Italic are optional. diff --git a/include/grub/video.h b/include/grub/video.h index 9fe4783..40a7711 100644 --- a/include/grub/video.h +++ b/include/grub/video.h @@ -542,4 +542,9 @@ extern void grub_video_sis315pro_fini (void); extern void grub_video_radeon_fuloong2e_fini (void); #endif +#ifdef GRUB_UTIL +void +grub_video_set_adapter (grub_video_adapter_t adapter); +#endif + #endif /* ! GRUB_VIDEO_HEADER */ diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index c57a0d9..a6e4de6 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -43,9 +43,16 @@ pc_dir="${libdir}/@PACKAGE@/i386-pc" efi32_dir="${libdir}/@PACKAGE@/i386-efi" efi64_dir="${libdir}/@PACKAGE@/x86_64-efi" ia64_dir="${libdir}/@PACKAGE@/ia64-efi" +ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275" rom_directory= override_dir= grub_mkimage="${bindir}/@grub_mkimage@" +grub_render_label="${bindir}/@grub_render_label@" +label_font="${pkgdatadir}/unicode.pf2" +label_color="black" +label_bgcolor="white" +product_name="${PACKAGE_NAME}" +product_version="${PACKAGE_VERSION}" xorriso=xorriso @@ -74,6 +81,12 @@ usage () { # TRANSLATORS: xorriso is a program for creating ISOs and burning CDs print_option_help "--xorriso=$filetrans" "$(gettext "use FILE as xorriso [optional]")" print_option_help "--grub-mkimage=$filetrans" "$(gettext "use FILE as grub-mkimage")" + print_option_help "--grub-render-label=$filetrans" "$(gettext "use FILE as grub-render-label")" + print_option_help "--label-font=$filetrans" "$(gettext "use FILE as font for label")" + print_option_help "--label-color=$(gettext "COLOR")" "$(gettext "use COLOR for label")" + print_option_help "--label-bgcolor=$(gettext "COLOR")" "$(gettext "use COLOR for label background")" + print_option_help "--product-name=$(gettext "STR")" "$(gettext "use STR as product")" + print_option_help "--product-version=$(gettext "STR")" "$(gettext "use STR as product version")" echo gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self" | grub_fmt echo @@ -131,11 +144,41 @@ do export PATH ;; + --product-name) + product_name=`argument $option "$@"`; shift ;; + --product-name=*) + product_name=`echo "$option" | sed 's/--product-name=//'` ;; + + --product-version) + product_version=`argument $option "$@"`; shift ;; + --product-version=*) + product_version=`echo "$option" | sed 's/--product-version=//'` ;; + --grub-mkimage) grub_mkimage=`argument $option "$@"`; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + --grub-render-label) + grub_render_label=`argument $option "$@"`; shift ;; + --grub-render-label=*) + grub_render_label=`echo "$option" | sed 's/--grub-render-label=//'` ;; + + --label-font) + label_font=`argument $option "$@"`; shift ;; + --label-font=*) + label_font=`echo "$option" | sed 's/--label-font=//'` ;; + + --label-color) + label_color=`argument $option "$@"`; shift ;; + --label-color=*) + label_color=`echo "$option" | sed 's/--label-color=//'` ;; + + --label-bgcolor) + label_bgcolor=`argument $option "$@"`; shift ;; + --label-bgcolor=*) + label_bgcolor=`echo "$option" | sed 's/--label-bgcolor=//'` ;; + --xorriso) xorriso=`argument $option "$@"`; shift ;; --xorriso=*) @@ -231,6 +274,9 @@ if [ "${override_dir}" = "" ] ; then if test -e "${loongson_dir}" ; then process_input_dir "${loongson_dir}" mipsel-loongson fi + if test -e "${ppc_dir}" ; then + process_input_dir "${ppc_dir}" mipsel-loongson + fi else . "${override_dir}"/modinfo.sh process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform} @@ -244,6 +290,7 @@ else mipsel_qemu_dir= mips_qemu_dir= loongson_dir= + ppc_dir= case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in i386-multiboot) multiboot_dir="${override_dir}" ;; i386-coreboot) coreboot_dir="${override_dir}" ;; @@ -255,6 +302,7 @@ else mipsel-qemu_mips) mipsel_qemu_dir="${override_dir}" ;; mipsel-loongson) loongson_dir="${override_dir}" ;; mips-qemu_mips) mips_qemu_dir="${override_dir}" ;; + powerpc-ieee1275) ppc_dir="${override_dir}" ;; esac fi @@ -309,6 +357,38 @@ if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; th grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img" fi +make_image "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/powerpc.elf" "" +if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso9660_dir}/boot/powerpc.elf" ]; then + mkdir -p "${iso9660_dir}"/System/Library/CoreServices + touch "${iso9660_dir}/mach_kernel" + cat > "${iso9660_dir}/System/Library/CoreServices/SystemVersion.plist" < + + ProductBuildVersion + + ProductName + ${product_name} + ProductVersion + ${product_version} + + +EOF + "$grub_render_label" -f "$label_font" -b "$label_bgcolor" -c "$label_color" -t "${product_name} ${product_version}" -o "${iso9660_dir}/System/Library/CoreServices/.disk_label" + echo "${product_name} ${product_version}" > "${iso9660_dir}/System/Library/CoreServices/.disk_label.contentDetails" + grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label" +fi + +if [ -e "${iso9660_dir}/boot/powerpc.elf" ] ; then + cp "${ppc_dir}/grub.chrp" "${iso9660_dir}"/System/Library/CoreServices/BootX + cp "${iso9660_dir}/boot/powerpc.elf" "${iso9660_dir}"/System/Library/CoreServices/grub.elf + # FIXME: add PreP + grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus-file-creator-type chrp tbxi /System/Library/CoreServices/BootX -hfs-bless-by p /System/Library/CoreServices -sysid PPC" +fi + +if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ]; then + grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfs-bless-by i /System/Library/CoreServices/boot.efi" +fi + make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "pata" if [ -e "${iso9660_dir}/boot/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then cp "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf" diff --git a/util/grub-render-label.c b/util/grub-render-label.c new file mode 100644 index 0000000..7237759 --- /dev/null +++ b/util/grub-render-label.c @@ -0,0 +1,393 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2010,2012 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + + +#define grub_video_render_target grub_video_fbrender_target + +#include + +#include +#include +#include +#include +#include + +#define _GNU_SOURCE 1 + +#include +#include +#include +#include +#include +#include + +#include "progname.h" + +struct arguments +{ + char *input; + char *text; + char *output; + char *font; + grub_video_rgba_color_t fgcolor; + grub_video_rgba_color_t bgcolor; + int verbosity; +}; + +static struct argp_option options[] = { + {"input", 'i', N_("FILE"), 0, + N_("read text from FILE."), 0}, + {"color", 'c', N_("COLOR"), 0, + N_("use COLOR for text"), 0}, + {"bgcolor", 'b', N_("COLOR"), 0, + N_("use COLOR for background"), 0}, + {"text", 't', N_("STR"), 0, + N_("supply the string."), 0}, + {"output", 'o', N_("FILE"), 0, + N_("set output filename. Default is STDOUT"), 0}, + {"font", 'f', N_("FILE"), 0, + N_("use FILE as font (PF2)."), 0}, + {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, + { 0, 0, 0, 0, 0, 0 } +}; + +#include +#include +#include +#include +#include +#include +#include + +static struct +{ + struct grub_video_mode_info mode_info; + struct grub_video_render_target *render_target; + grub_uint8_t *ptr; +} framebuffer; + +static grub_err_t +grub_video_text_render_swap_buffers (void) +{ + return GRUB_ERR_NONE; +} + +static grub_err_t +grub_video_text_render_set_active_render_target (struct grub_video_render_target *target) +{ + if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY) + target = framebuffer.render_target; + + return grub_video_fb_set_active_render_target (target); +} + +static struct grub_video_adapter grub_video_text_render_adapter = + { + .name = "Text rendering", + + .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE, + + .fini = grub_video_fb_fini, + .get_info = grub_video_fb_get_info, + .get_info_and_fini = 0, + .set_palette = grub_video_fb_set_palette, + .get_palette = grub_video_fb_get_palette, + .set_viewport = grub_video_fb_set_viewport, + .get_viewport = grub_video_fb_get_viewport, + .map_color = grub_video_fb_map_color, + .map_rgb = grub_video_fb_map_rgb, + .map_rgba = grub_video_fb_map_rgba, + .unmap_color = grub_video_fb_unmap_color, + .fill_rect = grub_video_fb_fill_rect, + .blit_bitmap = grub_video_fb_blit_bitmap, + .blit_render_target = grub_video_fb_blit_render_target, + .scroll = grub_video_fb_scroll, + .swap_buffers = grub_video_text_render_swap_buffers, + .create_render_target = grub_video_fb_create_render_target, + .delete_render_target = grub_video_fb_delete_render_target, + .set_active_render_target = grub_video_text_render_set_active_render_target, + .get_active_render_target = grub_video_fb_get_active_render_target, + + .next = 0 + }; + +static error_t +argp_parser (int key, char *arg, struct argp_state *state) +{ + /* Get the input argument from argp_parse, which we + know is a pointer to our arguments structure. */ + struct arguments *arguments = state->input; + grub_err_t err; + + switch (key) + { + case 'i': + arguments->input = xstrdup (arg); + break; + + case 'b': + err = grub_video_parse_color (arg, &arguments->bgcolor); + if (err) + grub_util_error (_("Invalud color `%s'"), arg); + break; + + case 'c': + err = grub_video_parse_color (arg, &arguments->fgcolor); + if (err) + grub_util_error (_("Invalud color `%s'"), arg); + break; + + case 'f': + arguments->font = xstrdup (arg); + break; + + case 't': + arguments->text = xstrdup (arg); + break; + + case 'o': + arguments->output = xstrdup (arg); + break; + + case 'v': + arguments->verbosity++; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + + return 0; +} + +void grub_hostfs_init (void); +void grub_host_init (void); + +struct header +{ + grub_uint8_t magic; + grub_uint16_t width; + grub_uint16_t height; +} __attribute__ ((packed)); + +static struct argp argp = { + options, argp_parser, N_("[OPTIONS]"), + N_("Render Apple .disk_label."), + NULL, NULL, NULL +}; + +static struct grub_video_palette_data ieee1275_palette[256]; + +int +main (int argc, char *argv[]) +{ + FILE *out; + char *text; + char *fontfull; + struct arguments arguments; + grub_font_t font; + int width, height; + struct header head; + const grub_uint8_t vals[] = { 0xff, 0xda, 0xb3, 0x87, 0x54, 0x00 }; + const grub_uint8_t vals2[] = { 0xf3, 0xe7, 0xcd, 0xc0, 0xa5, 0x96, + 0x77, 0x66, 0x3f, 0x27 }; + int i, j, k, cptr = 0; + grub_uint8_t bg, fg; + + for (i = 0; i < 256; i++) + ieee1275_palette[i].a = 0xff; + + for (i = 0; i < 6; i++) + for (j = 0; j < 6; j++) + for (k = 0; k < 6; k++) + { + ieee1275_palette[cptr].r = vals[i]; + ieee1275_palette[cptr].g = vals[j]; + ieee1275_palette[cptr].b = vals[k]; + ieee1275_palette[cptr].a = 0xff; + cptr++; + } + cptr--; + for (i = 0; i < 10; i++) + { + ieee1275_palette[cptr].r = vals2[i]; + ieee1275_palette[cptr].g = 0; + ieee1275_palette[cptr].b = 0; + ieee1275_palette[cptr].a = 0xff; + cptr++; + } + for (i = 0; i < 10; i++) + { + ieee1275_palette[cptr].r = 0; + ieee1275_palette[cptr].g = vals2[i]; + ieee1275_palette[cptr].b = 0; + ieee1275_palette[cptr].a = 0xff; + cptr++; + } + for (i = 0; i < 10; i++) + { + ieee1275_palette[cptr].r = 0; + ieee1275_palette[cptr].g = 0; + ieee1275_palette[cptr].b = vals2[i]; + ieee1275_palette[cptr].a = 0xff; + cptr++; + } + for (i = 0; i < 10; i++) + { + ieee1275_palette[cptr].r = vals2[i]; + ieee1275_palette[cptr].g = vals2[i]; + ieee1275_palette[cptr].b = vals2[i]; + ieee1275_palette[cptr].a = 0xff; + cptr++; + } + ieee1275_palette[cptr].r = 0; + ieee1275_palette[cptr].g = 0; + ieee1275_palette[cptr].b = 0; + ieee1275_palette[cptr].a = 0xff; + + set_program_name (argv[0]); + + grub_util_init_nls (); + + /* Check for options. */ + memset (&arguments, 0, sizeof (struct arguments)); + arguments.bgcolor.red = 0xff; + arguments.bgcolor.green = 0xff; + arguments.bgcolor.blue = 0xff; + arguments.bgcolor.alpha = 0xff; + arguments.fgcolor.red = 0x00; + arguments.fgcolor.green = 0x00; + arguments.fgcolor.blue = 0x00; + arguments.fgcolor.alpha = 0xff; + if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0) + { + fprintf (stderr, "%s", _("Error in parsing command line arguments\n")); + exit(1); + } + + if ((!arguments.input && !arguments.text) || !arguments.font) + { + fprintf (stderr, "%s", _("Missing arguments\n")); + exit(1); + } + + if (arguments.text) + text = arguments.text; + else + { + FILE *in = fopen (arguments.input, "r"); + size_t s; + if (!in) + grub_util_error (_("cannot open `%s': %s"), arguments.input, + strerror (errno)); + fseek (in, 0, SEEK_END); + s = ftell (in); + fseek (in, 0, SEEK_SET); + text = xmalloc (s + 1); + if (fread (text, 1, s, in) != s) + grub_util_error (_("cannot read `%s': %s"), arguments.input, + strerror (errno)); + text[s] = 0; + fclose (in); + } + + if (arguments.output) + out = fopen (arguments.output, "wb"); + else + out = stdout; + if (!out) + { + grub_util_error (_("cannot open `%s': %s"), arguments.output ? : "stdout", + strerror (errno)); + } + + fontfull = canonicalize_file_name (arguments.font); + if (!fontfull) + { + grub_util_error (_("cannot open `%s': %s"), arguments.font, + strerror (errno)); + } + + fontfull = xasprintf ("(host)/%s", fontfull); + + grub_init_all (); + grub_hostfs_init (); + grub_host_init (); + + grub_font_loader_init (); + font = grub_font_load (fontfull); + if (!font) + { + grub_util_error (_("cannot open `%s': %s"), arguments.font, + grub_errmsg); + } + + width = grub_font_get_string_width (font, text) + 10; + height = grub_font_get_height (font); + + grub_memset (&framebuffer, 0, sizeof (framebuffer)); + + grub_video_fb_init (); + + framebuffer.mode_info.width = width; + framebuffer.mode_info.height = height; + framebuffer.mode_info.pitch = width; + + framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; + framebuffer.mode_info.bpp = 8; + framebuffer.mode_info.bytes_per_pixel = 1; + framebuffer.mode_info.number_of_colors = 256; + + framebuffer.mode_info.blit_format = grub_video_get_blit_format (&framebuffer.mode_info); + + /* For some reason sparc64 uses 32-bit pointer too. */ + framebuffer.ptr = xmalloc (height * width); + + grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target, + &framebuffer.mode_info, + framebuffer.ptr); + grub_video_fb_set_active_render_target (framebuffer.render_target); + grub_video_fb_set_palette (0, ARRAY_SIZE (ieee1275_palette), + ieee1275_palette); + + grub_video_set_adapter (&grub_video_text_render_adapter); + + fg = grub_video_map_rgb (arguments.fgcolor.red, + arguments.fgcolor.green, + arguments.fgcolor.blue); + bg = grub_video_map_rgb (arguments.bgcolor.red, + arguments.bgcolor.green, + arguments.bgcolor.blue); + + grub_memset (framebuffer.ptr, bg, height * width); + grub_font_draw_string (text, font, fg, + 5, grub_font_get_ascent (font)); + + grub_video_set_adapter (0); + + head.magic = 1; + head.width = grub_cpu_to_be16 (width); + head.height = grub_cpu_to_be16 (height); + fwrite (&head, 1, sizeof (head), out); + fwrite (framebuffer.ptr, 1, width * height, out); + + if (out != stdout) + fclose (out); + + return 0; +} diff --git a/util/powerpc/ieee1275/grub-mkrescue.in b/util/powerpc/ieee1275/grub-mkrescue.in deleted file mode 100644 index 2615cab..0000000 --- a/util/powerpc/ieee1275/grub-mkrescue.in +++ /dev/null @@ -1,146 +0,0 @@ -#! /bin/sh -set -e - -# Make GRUB rescue image -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. -# -# GRUB is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# GRUB is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GRUB. If not, see . - -# Initialize some variables. -prefix="@prefix@" -exec_prefix="@exec_prefix@" -bindir="@bindir@" -libdir="@libdir@" -PACKAGE_NAME=@PACKAGE_NAME@ -PACKAGE_TARNAME=@PACKAGE_TARNAME@ -PACKAGE_VERSION=@PACKAGE_VERSION@ -input_dir="${libdir}/@PACKAGE@/powerpc-ieee1275" -datarootdir="@datarootdir@" -datadir="@datadir@" -if [ "x$pkgdatadir" = x ]; then - pkgdatadir="${datadir}/@PACKAGE@" -fi - -self=`basename $0` - -grub_mkimage="${bindir}/@grub_mkimage@" - -export TEXTDOMAIN=@PACKAGE@ -export TEXTDOMAINDIR="@localedir@" - -. "${pkgdatadir}/grub-mkconfig_lib" - -# Usage: usage -# Print the usage. -usage () { - gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self" - gettext "Make GRUB CD-ROM, disk, pendrive and floppy bootable image."; echo - echo - print_option_help "-h, --help" "$(gettext "print this message and exit")" - print_option_help "-v, --version" "$(gettext "print the version information and exit")" - print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" - print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" - echo - gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "genisoimage -help" "$self" | grub_fmt - echo - gettext "Report bugs to ."; echo -} - -argument () { - opt=$1 - shift - - if test $# -eq 0; then - gettext_printf "%s: option requires an argument -- \`%s'\n" "$0" "$opt" 1>&2 - exit 1 - fi - echo $1 -} - -source= -output_image= - -# Check the arguments. -while test $# -gt 0 -do - option=$1 - shift - - case "$option" in - -h | --help) - usage - exit 0 ;; - -v | --version) - echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" - exit 0 ;; - - --modules) - modules=`argument $option "$@"`; shift ;; - --modules=*) - modules=`echo "$option" | sed 's/--modules=//'` ;; - - --override-directory) - input_dir=`argument $option "$@"`; shift ;; - --override-directory=*) - input_dir=`echo "$option" | sed 's/--override-directory=//'` ;; - - --grub-mkimage) - grub_mkimage=`argument $option "$@"`; shift ;; - --grub-mkimage=*) - grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; - - -o | --output) - output_image=`argument $option "$@"`; shift ;; - --output=*) - output_image=`echo "$option" | sed 's/--output=//'` ;; - - --rom-directory=*) - ;; - --rom-directory) - shift ;; - - *) - source="${source} ${option} $@"; break ;; - esac -done - -if test "x$output_image" = x; then - usage - exit 1 -fi - -if [ "x${modules}" = "x" ] ; then - modules=`cd ${input_dir}/ && ls *.mod` -fi - -map_file=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 -cat >${map_file} <