Merge mainline into mbtag
This commit is contained in:
commit
df32be8cc1
141 changed files with 5978 additions and 5414 deletions
|
@ -25,6 +25,8 @@ docs/version.texi
|
||||||
*.exec
|
*.exec
|
||||||
genkernsyms.sh
|
genkernsyms.sh
|
||||||
gensymlist.sh
|
gensymlist.sh
|
||||||
|
gentrigtables
|
||||||
|
grub-bin2h
|
||||||
grub-dumpbios
|
grub-dumpbios
|
||||||
grub-editenv
|
grub-editenv
|
||||||
grub-emu
|
grub-emu
|
||||||
|
@ -40,8 +42,13 @@ grub-pe2elf
|
||||||
grub-probe
|
grub-probe
|
||||||
grub_probe_init.c
|
grub_probe_init.c
|
||||||
grub_probe_init.h
|
grub_probe_init.h
|
||||||
|
grub-reboot
|
||||||
|
grub-script-check
|
||||||
|
grub_script_check_init.c
|
||||||
|
grub_script_check_init.h
|
||||||
grub_script.tab.c
|
grub_script.tab.c
|
||||||
grub_script.tab.h
|
grub_script.tab.h
|
||||||
|
grub-set-default
|
||||||
grub-setup
|
grub-setup
|
||||||
grub_setup_init.c
|
grub_setup_init.c
|
||||||
grub_setup_init.h
|
grub_setup_init.h
|
||||||
|
@ -62,4 +69,5 @@ stamp-h
|
||||||
stamp-h1
|
stamp-h1
|
||||||
stamp-h.in
|
stamp-h.in
|
||||||
symlist.c
|
symlist.c
|
||||||
|
trigtables.c
|
||||||
update-grub_lib
|
update-grub_lib
|
||||||
|
|
539
ChangeLog
539
ChangeLog
|
@ -1,3 +1,542 @@
|
||||||
|
2010-03-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Resync with gnulib.
|
||||||
|
|
||||||
|
* Makefile.in (GNULIB_CFLAGS): New variable.
|
||||||
|
* conf/common.rmk (grub_mkisofs_CFLAGS): Add GNULIB_CFLAGS.
|
||||||
|
(grub_script_check_CFLAGS): New variable.
|
||||||
|
* gnulib/alloca.h: Resync with gnulib.
|
||||||
|
* gnulib/error.c: Likewise.
|
||||||
|
* gnulib/error.h: Likewise.
|
||||||
|
* gnulib/fnmatch.c: Likewise.
|
||||||
|
* gnulib/fnmatch_loop.c: Likewise.
|
||||||
|
* gnulib/getdelim.c: Likewise.
|
||||||
|
* gnulib/getline.c: Likewise.
|
||||||
|
* gnulib/getopt.c: Likewise.
|
||||||
|
* gnulib/getopt1.c: Likewise.
|
||||||
|
* gnulib/getopt_int.h: Likewise.
|
||||||
|
* gnulib/gettext.h: Likewise.
|
||||||
|
* gnulib/progname.c: Likewise.
|
||||||
|
* gnulib/progname.h: Likewise.
|
||||||
|
|
||||||
|
2010-03-27 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||||
|
|
||||||
|
Fix a build failure (-Wundef -Werror) when ENABLE_NLS is not defined,
|
||||||
|
which is the case with --disabled-nls.
|
||||||
|
|
||||||
|
* include/grub/i18n.h: Use (defined(ENABLE_NLS)
|
||||||
|
&& ENABLE_NLS) instead of ENABLE_NLS in all #if preprocessor macros.
|
||||||
|
* util/misc.c: Likewise.
|
||||||
|
* util/mkisofs/mkisofs.c: Likewise.
|
||||||
|
* util/mkisofs/mkisofs.h: Likewise.
|
||||||
|
|
||||||
|
2010-03-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Simplify Apple CC support.
|
||||||
|
|
||||||
|
* commands/i386/pc/drivemap_int13h.S: Use LOCAL when possible.
|
||||||
|
Add 0 byte at the end not to have a symbol with empty target.
|
||||||
|
* mmap/i386/pc/mmap_helper.S: Likewise.
|
||||||
|
* genmk.rb: Ignore errors 2030 and 2050.
|
||||||
|
* kern/i386/pc/startup.S: Use LOCAL when possible.
|
||||||
|
|
||||||
|
2010-03-26 BVK Chaitanya <bvk.groups@gmail.com>
|
||||||
|
|
||||||
|
Testcase and the fix for final semicolon on cmdline.
|
||||||
|
|
||||||
|
* tests/grub_script_final_semicolon.in: New testcase.
|
||||||
|
* conf/tests.rmk: Rules for the new testcase.
|
||||||
|
* script/parser.y: Grammar fix.
|
||||||
|
|
||||||
|
2010-03-26 BVK Chaitanya <bvk@localhost>
|
||||||
|
|
||||||
|
Blank lines testcase for GRUB script.
|
||||||
|
|
||||||
|
* tests/grub_script_blanklines.in: New testcase.
|
||||||
|
* conf/tests.rmk: Rules for the new testcase.
|
||||||
|
|
||||||
|
2010-03-26 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Don't use __FILE__.
|
||||||
|
|
||||||
|
* genmk.rb: Add -DGRUB_FILE to all C targets.
|
||||||
|
* fs/reiserfs.c: Replace __FILE__ with GRUB_FILE.
|
||||||
|
* include/grub/list.h: Likewise.
|
||||||
|
* include/grub/misc.h: Likewise.
|
||||||
|
* include/grub/mm.h: Likewise.
|
||||||
|
* include/grub/test.h: Likewise.
|
||||||
|
* kern/mm.c: Likewise.
|
||||||
|
* lib/libgcrypt_wrap/cipher_wrap.h: Likewise.
|
||||||
|
|
||||||
|
2010-03-26 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Sunpc partitions support.
|
||||||
|
|
||||||
|
* conf/common.rmk (grub_probe_SOURCES): Add partmap/sunpc.c.
|
||||||
|
(grub_fstest_SOURCES): Likewise.
|
||||||
|
(pkglib_MODULES): Add part_sunpc.mod.
|
||||||
|
(part_sunpc_mod_SOURCES): New variable.
|
||||||
|
(part_sunpc_mod_CFLAGS): Likewise.
|
||||||
|
(part_sunpc_mod_LDFLAGS): Likewise.
|
||||||
|
* conf/i386-pc.rmk (grub_setup_SOURCES): Add partmap/sunpc.c.
|
||||||
|
* partmap/sunpc.c: New file.
|
||||||
|
|
||||||
|
2010-03-26 BVK Chaitanya <bvk@localhost>
|
||||||
|
|
||||||
|
For loop support to GRUB script.
|
||||||
|
|
||||||
|
* include/grub/script_sh.h (grub_script_cmdfor): New struct.
|
||||||
|
(grub_script_create_cmdfor): New function prototype.
|
||||||
|
(grub_script_execute_cmdfor): New function prototype.
|
||||||
|
* script/execute.c (grub_script_execute_cmdfor): New function.
|
||||||
|
* script/parser.y (command): New for command.
|
||||||
|
(forcmd): New grammar rule.
|
||||||
|
* script/script.c (grub_script_create_cmdfor): New function.
|
||||||
|
* util/grub-script-check.c (grub_script_execute_cmdfor): New
|
||||||
|
function.
|
||||||
|
* tests/grub_script_for1.in: New testcase.
|
||||||
|
* conf/tests.rmk: Rules for new testcase.
|
||||||
|
|
||||||
|
2010-03-26 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Nested partitions
|
||||||
|
|
||||||
|
* commands/blocklist.c (grub_cmd_blocklist): Don't check whether
|
||||||
|
'partition' is NULL, grub_partition_get_start already does that.
|
||||||
|
* commands/loadenv.c (check_blocklists): Likewise.
|
||||||
|
(write_blocklists): Likewise.
|
||||||
|
* conf/common.rmk (grub_probe_SOURCES): Add partmap/bsdlabel.c.
|
||||||
|
(grub_fstest_SOURCES): Likewise.
|
||||||
|
(pkglib_MODULES): Add part_bsd.mod.
|
||||||
|
(part_bsd_mod_SOURCES): New variable.
|
||||||
|
(part_bsd_mod_CFLAGS): Likewise.
|
||||||
|
(part_bsd_mod_LDFLAGS): Likewise.
|
||||||
|
* conf/i386-pc.rmk (grub_setup_SOURCES): Add partmap/bsdlabel.c.
|
||||||
|
(grub_emu_SOURCES): Likewise.
|
||||||
|
* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||||
|
* include/grub/bsdlabel.h: New file.
|
||||||
|
* include/grub/partition.h (grub_partition_map): Remove 'probe' and
|
||||||
|
'get_name'.
|
||||||
|
(grub_partition): Add 'parent' and 'number'. Remove 'data'.
|
||||||
|
(grub_partition_map_list): New variable.
|
||||||
|
(grub_partition_map_register): Inline.
|
||||||
|
(grub_partition_map_unregister): Likewise.
|
||||||
|
(FOR_PARTITION_MAPS): New macro.
|
||||||
|
(grub_partition_map_iterate): Removed.
|
||||||
|
(grub_partition_get_start): Handle nested partitions.
|
||||||
|
* include/grub/msdos_partition.h: Remove bsd-related entries.
|
||||||
|
(grub_pc_partition): Remove.
|
||||||
|
* kern/disk.c (grub_disk_close): Free partition data.
|
||||||
|
(grub_disk_adjust_range): Handle nested partitions.
|
||||||
|
* kern/partition.c (grub_partition_map_probe): New function.
|
||||||
|
(grub_partition_probe): Parse name to number, handle subpartitions.
|
||||||
|
(get_partmap): New function.
|
||||||
|
(grub_partition_iterate): Handle subpartitions.
|
||||||
|
(grub_partition_get_name): Likewise.
|
||||||
|
* loader/i386/pc/bsd.c (grub_bsd_get_device): Likewise.
|
||||||
|
* loader/i386/multiboot.c (grub_multiboot_get_bootdev): Likewise.
|
||||||
|
* loader/i386/pc/chainloader.c (grub_chainloader_cmd): Likewise.
|
||||||
|
* partmap/acorn.c (acorn_partition_map_iterate): Don't force raw access.
|
||||||
|
Set 'number'.
|
||||||
|
(acorn_partition_map_probe): Remove.
|
||||||
|
(acorn_partition_map_get_name): Likewise.
|
||||||
|
* partmap/amiga.c (amiga_partition_map_iterate): Don't force raw access.
|
||||||
|
Set 'number'.
|
||||||
|
Set 'index' to 0 since there can be only one partition entry per sector.
|
||||||
|
(amiga_partition_map_probe): Remove.
|
||||||
|
(amiga_partition_map_get_name): Likewise.
|
||||||
|
* partmap/apple.c (apple_partition_map_iterate): Don't force raw access.
|
||||||
|
Set 'number'.
|
||||||
|
Set 'offset' and 'index' to real positions of partitions.
|
||||||
|
(apple_partition_map_probe): Remove.
|
||||||
|
(apple_partition_map_get_name): Likewise.
|
||||||
|
* partmap/bsdlabel.c: New file.
|
||||||
|
* partmap/gpt.c (gpt_partition_map_iterate): Don't force raw access.
|
||||||
|
Set 'number'.
|
||||||
|
Allocate 'data' so it can be correctly freed.
|
||||||
|
Set 'index' to offset inside sector.
|
||||||
|
(gpt_partition_map_probe): Remove.
|
||||||
|
(gpt_partition_map_get_name): Likewise.
|
||||||
|
* partmap/msdos.c (grub_partition_parse): Remove.
|
||||||
|
(pc_partition_map_iterate): Don't force raw access.
|
||||||
|
Set 'number'.
|
||||||
|
Make 'ext_offset' a local variable.
|
||||||
|
(pc_partition_map_probe): Remove.
|
||||||
|
(pc_partition_map_get_name): Remove.
|
||||||
|
* partmap/sun.c (sun_partition_map_iterate): Don't force raw access.
|
||||||
|
Set 'number'.
|
||||||
|
(sun_partition_map_probe): Remove.
|
||||||
|
(sun_partition_map_get_name): Likewise.
|
||||||
|
* parttool/msdospart.c (grub_pcpart_boot): Handle nested partitions.
|
||||||
|
(grub_pcpart_type): Likewise.
|
||||||
|
* util/hostdisk.c (open_device): Handle new numbering scheme.
|
||||||
|
(grub_util_biosdisk_get_grub_dev): Handle nested partitions.
|
||||||
|
* util/i386/pc/grub-setup.c (setup): Handle new numbering scheme.
|
||||||
|
* util/grub-probe.c (probe_partmap): Handle nested paritions.
|
||||||
|
* util/grub-install.in: Insert all subpartition modules.
|
||||||
|
* util/ieee1275/grub-install.in: Likewise.
|
||||||
|
|
||||||
|
2010-03-24 Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
|
||||||
|
|
||||||
|
* kern/dl.c (grub_dl_resolve_symbols): Improve error message
|
||||||
|
grammar.
|
||||||
|
|
||||||
|
2010-03-24 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* .bzrignore: Add grub-bin2h, grub-reboot, and grub-set-default.
|
||||||
|
|
||||||
|
2010-03-21 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* util/grub-install.in: Copy .mo files from @datadir@/locale, to
|
||||||
|
match where 'make install' puts them.
|
||||||
|
* util/i386/efi/grub-install.in: Likewise.
|
||||||
|
|
||||||
|
2010-03-19 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* .bzrignore: Add gentrigtables, grub-script-check,
|
||||||
|
grub_script_check_init.c, grub_script_check_init.h, and
|
||||||
|
trigtables.c.
|
||||||
|
|
||||||
|
2010-03-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/parser.c: Indented.
|
||||||
|
|
||||||
|
2010-03-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* term/i386/pc/vesafb.c: Removed (orphaned, deprecated and broken).
|
||||||
|
|
||||||
|
2010-03-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* video/fb/fbblit.c (grub_video_fbblit_blend_XXXA8888_1bit): Handle
|
||||||
|
alpha_mask_size == 0 case.
|
||||||
|
|
||||||
|
2010-03-14 BVK Chaitanya <bvk.groups@gmail.com>
|
||||||
|
|
||||||
|
GRUB shell lexer and parser improvements.
|
||||||
|
|
||||||
|
* conf/any-emu.rmk: Build rule updates.
|
||||||
|
* conf/common.rmk: Likewise.
|
||||||
|
* conf/i386-coreboot.rmk: Likewise.
|
||||||
|
* conf/i386-efi.rmk: Likewise.
|
||||||
|
* conf/i386-ieee1275.rmk: Likewise.
|
||||||
|
* conf/i386-pc.rmk: Likewise.
|
||||||
|
* conf/powerpc-ieee1275.rmk: Likewise.
|
||||||
|
* conf/x86_64-efi.rmk: Likewise.
|
||||||
|
|
||||||
|
* configure.ac: Configure check for flex.
|
||||||
|
|
||||||
|
* include/grub/script_sh.h (grub_script_arg_type_t): More argument
|
||||||
|
types.
|
||||||
|
(grub_lexer_param): Struct member updates.
|
||||||
|
(grub_parser_param): Likewise.
|
||||||
|
(GRUB_LEXER_TOKEN_MAX): Maximum token size.
|
||||||
|
(GRUB_LEXER_RECORD_INCREMENT): Memory increments' size.
|
||||||
|
(grub_script_lexer_init): Prototype update.
|
||||||
|
(grub_script_lexer_record_start): Likewise.
|
||||||
|
(grub_script_lexer_record_stop): Likewise.
|
||||||
|
(grub_script_lexer_yywrap): New function prototype.
|
||||||
|
(grub_script_lexer_fini): Likewise.
|
||||||
|
(grub_script_execute_argument_to_string): Removed by...
|
||||||
|
(grub_script_execute_argument_to_argv): ...better version.
|
||||||
|
|
||||||
|
* script/execute.c (ROUND_UPTO): New macro.
|
||||||
|
(grub_script_execute_cmdline): Out of memory fixes.
|
||||||
|
(grub_script_execute_menuentry): Likewise.
|
||||||
|
(grub_script_execute_argument_to_string): Removed. Update all
|
||||||
|
users by...
|
||||||
|
(grub_script_execute_argument_to_argv): ...better version.
|
||||||
|
* script/function.c (grub_script_function_create): Use
|
||||||
|
grub_script_execute_argument_to_argv instead of
|
||||||
|
grub_script_execute_argument_to_string.
|
||||||
|
|
||||||
|
* script/lexer.c (check_varstate): Removed.
|
||||||
|
(check_textstate): Removed.
|
||||||
|
(grub_script_lexer_record_start): Likewise.
|
||||||
|
(grub_script_lexer_record_stop): Likewise.
|
||||||
|
(recordchar): Replaced with...
|
||||||
|
(grub_script_lexer_record): ...new function.
|
||||||
|
(nextchar): Removed.
|
||||||
|
(grub_script_lexer_init): Rewritten.
|
||||||
|
(grub_script_yylex): Rewritten.
|
||||||
|
(append_newline): New function.
|
||||||
|
(grub_script_lexer_yywrap): New function.
|
||||||
|
(grub_script_lexer_fini): New function.
|
||||||
|
(grub_script_yyerror): Sets error flag.
|
||||||
|
|
||||||
|
* script/yylex.l: New file.
|
||||||
|
(grub_lexer_yyfree): Wrapper for flex yyffre.
|
||||||
|
(grub_lexer_yyalloc): Likewise.
|
||||||
|
(grub_lexer_yyrealloc): Likewise.
|
||||||
|
* script/parser.y: Refactored.
|
||||||
|
|
||||||
|
* script/script.c (grub_script_arg_add): Out of memory fixes.
|
||||||
|
(grub_script_add_arglist): Likewise.
|
||||||
|
(grub_script_create_cmdline): Likewise.
|
||||||
|
(grub_script_create_cmdmenu): Likewise.
|
||||||
|
(grub_script_add_cmd): Likewise.
|
||||||
|
(grub_script_parse): Use grub_script_lexer_fini to deallocated.
|
||||||
|
* util/grub-script-check.c (grub_script_execute_menuentry): Remove
|
||||||
|
unnecessary code.
|
||||||
|
|
||||||
|
* tests/grub_script_echo1.in: New testcase.
|
||||||
|
* tests/grub_script_vars1.in: New testcase.
|
||||||
|
* tests/grub_script_echo_keywords.in: New testcase.
|
||||||
|
|
||||||
|
2010-03-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Remove some redundancy in build system.
|
||||||
|
|
||||||
|
* Makefile.in (TARGET_CFLAGS): Add -ffreestanding.
|
||||||
|
(TARGET_ASFLAGS): Add -nostdinc -fno-builtin.
|
||||||
|
(TARGET_LDFLAGS): Add -nostdlib.
|
||||||
|
(TARGET_IMG_LDFLAGS): Likewise.
|
||||||
|
* commands/lsmmap.c (grub_cmd_lsmmap) [GRUB_MACHINE_EMU]: Don't do
|
||||||
|
anything since mmap isn't available.
|
||||||
|
* conf/any-emu.rmk (kernel_img_SOURCES): Remove commands/boot.c.
|
||||||
|
Add util/time.c.
|
||||||
|
(pkglib_MODULES): Remove reboot.mod.
|
||||||
|
(reboot_mod_SOURCES): Removed.
|
||||||
|
(reboot_mod_CFLAGS): Likewise.
|
||||||
|
(reboot_mod_LDFLAGS): Likewise.
|
||||||
|
* conf/common.rmk (script/lexer.c_DEPENDENCIES): New variable.
|
||||||
|
(MOSTLYCLEANFILES): Add symlist.c kernel_syms.lst.
|
||||||
|
(DEFSYMFILES): Add kernel_syms.lst.
|
||||||
|
(kernel_img_HEADERS): Add common headers.
|
||||||
|
(symlist.c): New target.
|
||||||
|
(kernel_syms.lst): Likewise.
|
||||||
|
(pkglib_MODULES): Add memdisk.mod.
|
||||||
|
(memdisk_mod_SOURCES): New variable.
|
||||||
|
(memdisk_mod_CFLAGS): Likewise.
|
||||||
|
(memdisk_mod_LDFLAGS): Likewise.
|
||||||
|
(pkglib_MODULES): Add reboot.mod.
|
||||||
|
(reboot_mod_SOURCES): New variable.
|
||||||
|
(reboot_mod_CFLAGS): Likewise.
|
||||||
|
(reboot_mod_LDFLAGS): Likewise.
|
||||||
|
(pkglib_MODULES): Add date.mod.
|
||||||
|
(date_mod_SOURCES): New variable.
|
||||||
|
(date_mod_CFLAGS): Likewise.
|
||||||
|
(date_mod_LDFLAGS): Likewise.
|
||||||
|
(pkglib_MODULES): Add datehook.mod.
|
||||||
|
(datehook_mod_SOURCES): New variable.
|
||||||
|
(datehook_mod_CFLAGS): Likewise.
|
||||||
|
(datehook_mod_LDFLAGS): Likewise.
|
||||||
|
(pkglib_MODULES): Add lsmmap.mod.
|
||||||
|
(lsmmap_mod_SOURCES): New variable.
|
||||||
|
(lsmmap_mod_CFLAGS): Likewise.
|
||||||
|
(lsmmap_mod_LDFLAGS): Likewise.
|
||||||
|
(pkglib_MODULES): Add boot.mod.
|
||||||
|
(boot_mod_SOURCES): New variable.
|
||||||
|
(boot_mod_CFLAGS): Likewise.
|
||||||
|
(boot_mod_LDFLAGS): Likewise.
|
||||||
|
* conf/i386-coreboot.rmk: Removed redundant parts.
|
||||||
|
* conf/i386-ieee1275.rmk: Likewise.
|
||||||
|
* conf/i386-pc.rmk: Likewise.
|
||||||
|
* conf/mips-yeeloong.rmk: Likewise.
|
||||||
|
* conf/mips.rmk: Likewise.
|
||||||
|
* conf/powerpc-ieee1275.rmk: Likewise.
|
||||||
|
* conf/sparc64-ieee1275.rmk: Likewise.
|
||||||
|
* conf/x86_64-efi.rmk: Likewise.
|
||||||
|
* conf/i386-coreboot.rmk: Moved qemu parts ..
|
||||||
|
* conf/i386-qemu.rmk: ... here
|
||||||
|
* conf/i386-efi.rmk: Moved common parts to...
|
||||||
|
* conf/x86-efi.rmk: ... here.
|
||||||
|
* conf/i386.rmk: Added modules common to all x86 variants.
|
||||||
|
* configure.ac: Add -m32/-m64 to TARGET_ASFLAGS.
|
||||||
|
* disk/memdisk.c: Remove grub/machine/kernel.h.
|
||||||
|
* gensymlist.sh.in: Include symbol.h.
|
||||||
|
* hook/datehook.c: Correct module name.
|
||||||
|
* include/grub/datetime.h (grub_get_datetime) [GRUB_MACHINE_EMU]: Export.
|
||||||
|
(grub_set_datetime) [GRUB_MACHINE_EMU]: Likewise.
|
||||||
|
* include/grub/i386/efi/serial.h: New file.
|
||||||
|
* include/grub/x86_64/efi/serial.h: Likewise.
|
||||||
|
* util/time.c: Likewise.
|
||||||
|
* video/ieee1275.c (grub_video_ieee1275_setup): Handle 64-bit void *.
|
||||||
|
|
||||||
|
2010-03-14 Colin King <colin.king@ubuntu.com>
|
||||||
|
2010-03-14 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
Shrink the pre-partition-table part of boot.img by eight bytes.
|
||||||
|
|
||||||
|
* boot/i386/pc/boot.S (ERR): New macro.
|
||||||
|
(chs_mode): Use ERR.
|
||||||
|
(geometry_error): Likewise.
|
||||||
|
(hd_probe_error): Remove. This is only used once, so we wrwite
|
||||||
|
it inline instead.
|
||||||
|
(read_error): Instead of printing read_error_string, just set up
|
||||||
|
%si and fall through to ...
|
||||||
|
(error_message): ... this new function, also used by ERR.
|
||||||
|
|
||||||
|
2010-03-14 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
Speed up consecutive hostdisk operations on the same device.
|
||||||
|
|
||||||
|
* util/hostdisk.c (struct grub_util_biosdisk_data): New structure.
|
||||||
|
(grub_util_biosdisk_open): Initialise disk->data.
|
||||||
|
(struct linux_partition_cache): New structure.
|
||||||
|
(linux_find_partition): Cache partition start positions; these are
|
||||||
|
expensive to compute on every read and write.
|
||||||
|
(open_device): Cache open file descriptor in disk->data, so that we
|
||||||
|
don't have to reopen it and flush the buffer cache for consecutive
|
||||||
|
operations on the same device.
|
||||||
|
(grub_util_biosdisk_close): New function.
|
||||||
|
(grub_util_biosdisk_dev): Set `close' member.
|
||||||
|
|
||||||
|
* conf/common.rmk (grub_probe_SOURCES): Add kern/list.c.
|
||||||
|
* conf/i386-efi.rmk (grub_setup_SOURCES): Likewise.
|
||||||
|
* conf/i386-pc.rmk (grub_setup_SOURCES): Likewise.
|
||||||
|
* conf/sparc64-ieee1275.rmk (grub_setup_SOURCES): Likewise.
|
||||||
|
* conf/x86_64-efi.rmk (grub_setup_SOURCES): Likewise.
|
||||||
|
|
||||||
|
2010-03-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Compile parts of grub-emu as modules.
|
||||||
|
|
||||||
|
* Makefile.in (TARGET_CPPFLAGS) [emu]: Remove -nostdinc -isystem.
|
||||||
|
(pkglib_DATA) [emu]: Remove moddep.lst command.lst fs.lst
|
||||||
|
partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst.
|
||||||
|
(all-local): Add $(GRUB_EMU).
|
||||||
|
(install-local): Install $(GRUB_EMU).
|
||||||
|
(uninstall): Uninstall $(GRUB_EMU).
|
||||||
|
* commands/parttool.c: Replace GRUB_UTIL with GRUB_NO_MODULES.
|
||||||
|
* kern/dl.c: Likewise.
|
||||||
|
* commands/sleep.c: Not include machine/time.h.
|
||||||
|
* conf/any-emu.rmk (COMMON_LDFLAGS): New variable.
|
||||||
|
(COMMON_CFLAGS): Likewise.
|
||||||
|
(sbin_UTILITIES): Remove grub-emu.
|
||||||
|
(grub_emu_SOURCES): Removed.
|
||||||
|
(kernel_img_RELOCATABLE): New variable.
|
||||||
|
(pkglib_PROGRAMS): Add kernel.img.
|
||||||
|
(kernel_img_SOURCES): New variable
|
||||||
|
(kernel_img_CFLAGS): Likewise.
|
||||||
|
(kernel_img_LDFLAGS): Likewise.
|
||||||
|
(TARGET_NO_STRIP): Likewise.
|
||||||
|
(TARGET_NO_DYNAMIC_MODULES): Likewise.
|
||||||
|
(pkglib_MODULES): Add progname.mod, hostfs.mod, host.mod, reboot.mod,
|
||||||
|
halt.mod, cpuid.mod, usb.mod, sdl.mod and pci.mod.
|
||||||
|
(grub-emu): New target.
|
||||||
|
(GRUB_EMU): New variable.
|
||||||
|
* configure.ac: Whitelist -emu as possible x86_64 architecture.
|
||||||
|
* efiemu/main.c: Replace GRUB_UTIL with GRUB_MACHINE_EMU.
|
||||||
|
* loader/xnu.c: Likewise.
|
||||||
|
* include/grub/pci.h: Likewise.
|
||||||
|
* genemuinit.sh: New file.
|
||||||
|
* genemuinitheader.sh: Likewise.
|
||||||
|
* genmk.rb: Don't strip if TARGET_NO_STRIP is yes.
|
||||||
|
Support TARGET_NO_DYNAMIC_MODULES.
|
||||||
|
* include/grub/dl.h (GRUB_NO_MODULES): New variable.
|
||||||
|
* commands/search.c: Fix GRUB_MOD_INIT and GRUB_MOD_FINI arguments.
|
||||||
|
* disk/loopback.c: Likewise.
|
||||||
|
* font/font_cmd.c: Likewise.
|
||||||
|
* partmap/acorn.c: Likewise.
|
||||||
|
* partmap/amiga.c: Likewise.
|
||||||
|
* partmap/apple.c: Likewise.
|
||||||
|
* partmap/gpt.c: Likewise.
|
||||||
|
* partmap/msdos.c: Likewise.
|
||||||
|
* partmap/sun.c: Likewise.
|
||||||
|
* parttool/msdospart.c: Likewise.
|
||||||
|
* term/gfxterm.c: Likewise.
|
||||||
|
* video/bitmap.c: Likewise.
|
||||||
|
* video/readers/jpeg.c: Likewise.
|
||||||
|
* video/readers/png.c: Likewise.
|
||||||
|
* video/readers/tga.c: Likewise.
|
||||||
|
* video/video.c: Likewise.
|
||||||
|
* util/grub-emu.c (read_command_list): Removed.
|
||||||
|
(main): Don't call util_init_nls.
|
||||||
|
* util/misc.c (grub_err_printf) [!GRUB_UTIL]: Removed.
|
||||||
|
(grub_util_init_nls) [!GRUB_UTIL]: Likewise.
|
||||||
|
|
||||||
|
2010-03-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* conf/powerpc-ieee1275.rmk (pkglib_MODULES): Add datetime.mod,
|
||||||
|
date.mod, datehook.mod.
|
||||||
|
(datetime_mod_SOURCES): New variable.
|
||||||
|
(datetime_mod_CFLAGS): Likewise.
|
||||||
|
(datetime_mod_LDFLAGS): Likewise.
|
||||||
|
(date_mod_SOURCES): Likewise.
|
||||||
|
(date_mod_CFLAGS): Likewise.
|
||||||
|
(date_mod_LDFLAGS): Likewise.
|
||||||
|
(datehook_mod_SOURCES): Likewise.
|
||||||
|
(datehook_mod_CFLAGS): Likewise.
|
||||||
|
(datehook_mod_LDFLAGS): Likewise.
|
||||||
|
* conf/sparc64-ieee1275.rmk: Likewise.
|
||||||
|
* lib/ieee1275/datetime.c: New file.
|
||||||
|
|
||||||
|
2010-03-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* conf/powerpc-ieee1275.rmk (pkglib_MODULES): Add ieee1275_fb.mod.
|
||||||
|
(ieee1275_fb_mod_SOURCES): New variable.
|
||||||
|
(ieee1275_fb_mod_CFLAGS): Likewise.
|
||||||
|
(ieee1275_fb_mod_LDFLAGS): Likewise.
|
||||||
|
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_devices_iterate):
|
||||||
|
New proto.
|
||||||
|
* kern/ieee1275/init.c (HEAP_MAX_SIZE): Increased.
|
||||||
|
(HEAP_MAX_ADDR): Likewise.
|
||||||
|
* kern/ieee1275/openfw.c (grub_children_iterate): Don't skip empty
|
||||||
|
type.
|
||||||
|
Correct stop condition.
|
||||||
|
(grub_ieee1275_devices_iterate): New function.
|
||||||
|
* video/ieee1275.c: New file.
|
||||||
|
|
||||||
|
2010-03-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Merge sparc grub-mkimage into generic grub-mkimage and a.out support.
|
||||||
|
|
||||||
|
* boot/sparc64/ieee1275/boot.S (boot_continue): Use SCRATCH_PAD_BOOT
|
||||||
|
as scratch.
|
||||||
|
* boot/sparc64/ieee1275/diskboot.S (after_info_block): Use
|
||||||
|
SCRATCH_PAD_DISKBOOT as scratch.
|
||||||
|
(bootit): Pass Openfirmware pointer in %o4.
|
||||||
|
* conf/sparc64-ieee1275.rmk (kernel_img_LDFLAGS): Link at 0x4400 instead
|
||||||
|
of 0x200000.
|
||||||
|
(grub_mkimage_SOURCES): Replace util/sparc64/ieee1275/grub-mkimage.c
|
||||||
|
with util/grub-mkrawimage.c.
|
||||||
|
* configure.ac: Handle GRUB_MACHINE_SPARC64 and GRUB_MACHINE_MIPS.
|
||||||
|
* include/grub/aout.h (AOUT_MID_SUN): New definition.
|
||||||
|
(grub_aout_get_type) [GRUB_UTIL]: Removed.
|
||||||
|
(grub_aout_load) [GRUB_UTIL]: Likewise.
|
||||||
|
* include/grub/kernel.h (grub_modules_get_end): New proto.
|
||||||
|
* include/grub/sparc64/ieee1275/boot.h (SCRATCH_PAD): Removed.
|
||||||
|
(SCRATCH_PAD_BOOT): New definition.
|
||||||
|
(SCRATCH_PAD_DISKBOOT): Likewise.
|
||||||
|
(GRUB_BOOT_MACHINE_IMAGE_ADDRESS): Set to 0x4400.
|
||||||
|
* include/grub/sparc64/ieee1275/ieee1275.h
|
||||||
|
(grub_ieee1275_original_stack): New variable
|
||||||
|
* include/grub/sparc64/ieee1275/kernel.h (GRUB_KERNEL_MACHINE_RAW_SIZE):
|
||||||
|
New definition
|
||||||
|
(GRUB_KERNEL_MACHINE_STACK_SIZE): Likewise.
|
||||||
|
(GRUB_PLATFORM_IMAGE_FORMATS): Likewise.
|
||||||
|
(GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT): Likewise.
|
||||||
|
(GRUB_PLATFORM_IMAGE_DEFAULT): Likewise.
|
||||||
|
(GRUB_PLATFORM_IMAGE_RAW): Likewise.
|
||||||
|
(GRUB_PLATFORM_IMAGE_AOUT): Likewise.
|
||||||
|
(grub_platform_image_format_t): New type.
|
||||||
|
* kern/mips/yeeloong/init.c (grub_modules_get_end): Move from here ...
|
||||||
|
* kern/main.c (grub_modules_get_end)
|
||||||
|
[GRUB_MACHINE_MIPS_YEELOONG || GRUB_MACHINE_SPARC64]: ... here.
|
||||||
|
* kern/sparc64/ieee1275/crt0.S: Store firmware entry point in %o0.
|
||||||
|
(codestart): Switch stacks.
|
||||||
|
* kern/sparc64/ieee1275/init.c (grub_ieee1275_original_stack): New
|
||||||
|
variable.
|
||||||
|
(grub_heap_init): Use grub_modules_get_end.
|
||||||
|
* loader/sparc64/ieee1275/linux.c (grub_linux_boot): Restore original
|
||||||
|
stack.
|
||||||
|
* util/grub-mkrawimage.c (generate_image): Support sparc64.
|
||||||
|
(main): Likewise.
|
||||||
|
* util/sparc64/ieee1275/grub-mkimage.c: Removed.
|
||||||
|
|
||||||
|
2010-03-14 Thorsten Glaser <tg@mirbsd.org>
|
||||||
|
|
||||||
|
* util/grub-mkrescue.in: Base ISO UUID on UTC.
|
||||||
|
|
||||||
|
2010-03-08 Matt Kraai <kraai@ftbfs.org>
|
||||||
|
|
||||||
|
* util/i386/pc/grub-setup.c (setup): Fix a grammatical error (Debian
|
||||||
|
bug #559005).
|
||||||
|
|
||||||
|
2010-03-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* genmoddep.awk: Output all missing symbols and not only first.
|
||||||
|
|
||||||
2010-03-06 Vladimir Serbinenko <phcoder@gmail.com>
|
2010-03-06 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* NEWS: Put the date of 1.98 release.
|
* NEWS: Put the date of 1.98 release.
|
||||||
|
|
17
Makefile.in
17
Makefile.in
|
@ -79,21 +79,22 @@ LIBS = @LIBS@ $(LIBINTL)
|
||||||
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
|
GNULIB_CFLAGS = -Wno-undef -D_GL_UNUSED="__attribute__ ((unused))"
|
||||||
ASFLAGS = @ASFLAGS@
|
ASFLAGS = @ASFLAGS@
|
||||||
LDFLAGS = @LDFLAGS@ $(LIBS)
|
LDFLAGS = @LDFLAGS@ $(LIBS)
|
||||||
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
|
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
|
||||||
-DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
|
-DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
|
||||||
TARGET_CC = @TARGET_CC@
|
TARGET_CC = @TARGET_CC@
|
||||||
TARGET_CFLAGS = @TARGET_CFLAGS@
|
TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@
|
||||||
TARGET_ASFLAGS = @TARGET_ASFLAGS@
|
TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@
|
||||||
TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
|
TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
|
||||||
TARGET_APPLE_CC = @TARGET_APPLE_CC@
|
TARGET_APPLE_CC = @TARGET_APPLE_CC@
|
||||||
OBJCONV = @OBJCONV@
|
OBJCONV = @OBJCONV@
|
||||||
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
|
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
|
||||||
-Wall -W
|
-Wall -W
|
||||||
TARGET_LDFLAGS = @TARGET_LDFLAGS@
|
TARGET_LDFLAGS = -nostdlib @TARGET_LDFLAGS@
|
||||||
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
|
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
|
||||||
TARGET_IMG_LDFLAGS = @TARGET_IMG_LDFLAGS@
|
TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@
|
||||||
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
|
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
|
||||||
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
|
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
|
||||||
EXEEXT = @EXEEXT@
|
EXEEXT = @EXEEXT@
|
||||||
|
@ -178,7 +179,9 @@ endif
|
||||||
### General targets.
|
### General targets.
|
||||||
|
|
||||||
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
|
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
|
||||||
|
ifneq ($(platform), emu)
|
||||||
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst
|
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst
|
||||||
|
endif
|
||||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
|
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
|
||||||
cat $(DEFSYMFILES) /dev/null \
|
cat $(DEFSYMFILES) /dev/null \
|
||||||
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
|
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
|
||||||
|
@ -279,7 +282,7 @@ build_env.mk: Makefile
|
||||||
) > $@
|
) > $@
|
||||||
pkglib_BUILDDIR += config.h grub_script.tab.h
|
pkglib_BUILDDIR += config.h grub_script.tab.h
|
||||||
|
|
||||||
all-local: $(PROGRAMS) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo)
|
all-local: $(PROGRAMS) $(GRUB_EMU) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo)
|
||||||
|
|
||||||
install: install-local
|
install: install-local
|
||||||
|
|
||||||
|
@ -300,7 +303,7 @@ install-local: all
|
||||||
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkgdatadir)/$$dest; \
|
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkgdatadir)/$$dest; \
|
||||||
done
|
done
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
|
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
|
||||||
@list='$(bin_UTILITIES)'; for file in $$list; do \
|
@list='$(bin_UTILITIES) $(GRUB_EMU)'; for file in $$list; do \
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
||||||
|
@ -376,7 +379,7 @@ uninstall:
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
dest="`echo $$file | sed 's,.*/,,'`"; \
|
||||||
rm -f $(DESTDIR)$(pkgdatadir)/$$dest; \
|
rm -f $(DESTDIR)$(pkgdatadir)/$$dest; \
|
||||||
done
|
done
|
||||||
@list='$(bin_UTILITIES) $(bin_SCRIPTS)'; for file in $$list; do \
|
@list='$(bin_UTILITIES) $(bin_SCRIPTS) $(GRUB_EMU)'; for file in $$list; do \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
rm -f $(DESTDIR)$(bindir)/$$dest; \
|
rm -f $(DESTDIR)$(bindir)/$$dest; \
|
||||||
rm -f $(DESTDIR)$(mandir)/man1/$$dest.1; \
|
rm -f $(DESTDIR)$(mandir)/man1/$$dest.1; \
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
/* Print message string */
|
/* Print message string */
|
||||||
#define MSG(x) movw $x, %si; call LOCAL(message)
|
#define MSG(x) movw $x, %si; call LOCAL(message)
|
||||||
|
#define ERR(x) movw $x, %si; jmp LOCAL(error_message)
|
||||||
|
|
||||||
.file "boot.S"
|
.file "boot.S"
|
||||||
|
|
||||||
|
@ -233,7 +234,7 @@ LOCAL(chs_mode):
|
||||||
jz LOCAL(floppy_probe)
|
jz LOCAL(floppy_probe)
|
||||||
|
|
||||||
/* Nope, we definitely have a hard disk, and we're screwed. */
|
/* Nope, we definitely have a hard disk, and we're screwed. */
|
||||||
jmp LOCAL(hd_probe_error)
|
ERR(hd_probe_error_string)
|
||||||
|
|
||||||
LOCAL(final_init):
|
LOCAL(final_init):
|
||||||
/* set the mode to zero */
|
/* set the mode to zero */
|
||||||
|
@ -360,22 +361,15 @@ LOCAL(copy_buffer):
|
||||||
* BIOS Geometry translation error (past the end of the disk geometry!).
|
* BIOS Geometry translation error (past the end of the disk geometry!).
|
||||||
*/
|
*/
|
||||||
LOCAL(geometry_error):
|
LOCAL(geometry_error):
|
||||||
MSG(geometry_error_string)
|
ERR(geometry_error_string)
|
||||||
jmp LOCAL(general_error)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disk probe failure.
|
|
||||||
*/
|
|
||||||
LOCAL(hd_probe_error):
|
|
||||||
MSG(hd_probe_error_string)
|
|
||||||
jmp LOCAL(general_error)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read error on the disk.
|
* Read error on the disk.
|
||||||
*/
|
*/
|
||||||
LOCAL(read_error):
|
LOCAL(read_error):
|
||||||
MSG(read_error_string)
|
movw $read_error_string, %si
|
||||||
|
LOCAL(error_message):
|
||||||
|
call LOCAL(message)
|
||||||
LOCAL(general_error):
|
LOCAL(general_error):
|
||||||
MSG(general_error_string)
|
MSG(general_error_string)
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ prom_call:
|
||||||
|
|
||||||
boot_continue:
|
boot_continue:
|
||||||
mov %o7, PIC_REG /* PIC base */
|
mov %o7, PIC_REG /* PIC base */
|
||||||
sethi %hi(SCRATCH_PAD), %l1 /* OF argument slots */
|
sethi %hi(SCRATCH_PAD_BOOT), %l1 /* OF argument slots */
|
||||||
|
|
||||||
/* Find the /chosen node so we can fetch the stdout handle,
|
/* Find the /chosen node so we can fetch the stdout handle,
|
||||||
* and thus perform console output.
|
* and thus perform console output.
|
||||||
|
|
|
@ -81,7 +81,7 @@ prom_call:
|
||||||
|
|
||||||
|
|
||||||
after_info_block:
|
after_info_block:
|
||||||
sethi %hi(SCRATCH_PAD), %l1 /* OF argument slots */
|
sethi %hi(SCRATCH_PAD_DISKBOOT), %l1 /* OF argument slots */
|
||||||
|
|
||||||
GET_ABS(notification_string, %o2)
|
GET_ABS(notification_string, %o2)
|
||||||
call console_write
|
call console_write
|
||||||
|
@ -129,7 +129,7 @@ bootit:
|
||||||
mov NOTIFICATION_DONE_LEN, %o3
|
mov NOTIFICATION_DONE_LEN, %o3
|
||||||
sethi %hi(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o2
|
sethi %hi(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o2
|
||||||
jmpl %o2 + %lo(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o7
|
jmpl %o2 + %lo(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o7
|
||||||
mov CIF_REG, %o0
|
mov CIF_REG, %o4
|
||||||
1: ba,a 1b
|
1: ba,a 1b
|
||||||
|
|
||||||
lastlist:
|
lastlist:
|
||||||
|
|
|
@ -90,7 +90,6 @@ grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE,
|
return grub_error (GRUB_ERR_BAD_DEVICE,
|
||||||
"this command is available only for disk devices");
|
"this command is available only for disk devices");
|
||||||
|
|
||||||
if (file->device->disk->partition)
|
|
||||||
part_start = grub_partition_get_start (file->device->disk->partition);
|
part_start = grub_partition_get_start (file->device->disk->partition);
|
||||||
|
|
||||||
file->read_hook = read_blocklist;
|
file->read_hook = read_blocklist;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
|
|
||||||
#define INT13H_OFFSET(x) ((x) - EXT_C(grub_drivemap_handler))
|
#define INT13H_OFFSET(x) ((x) - LOCAL (base))
|
||||||
|
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
/* The replacement int13 handler. Preserve all registers. */
|
/* The replacement int13 handler. Preserve all registers. */
|
||||||
FUNCTION(grub_drivemap_handler)
|
FUNCTION(grub_drivemap_handler)
|
||||||
|
LOCAL (base):
|
||||||
/* Save %dx for future restore. */
|
/* Save %dx for future restore. */
|
||||||
push %dx
|
push %dx
|
||||||
/* Push flags. Used to simulate interrupt with original flags. */
|
/* Push flags. Used to simulate interrupt with original flags. */
|
||||||
|
@ -35,12 +36,7 @@ FUNCTION(grub_drivemap_handler)
|
||||||
/* Map the drive number (always in DL). */
|
/* Map the drive number (always in DL). */
|
||||||
push %ax
|
push %ax
|
||||||
push %bx
|
push %bx
|
||||||
#ifdef APPLE_CC
|
movw $INT13H_OFFSET(LOCAL (mapstart)), %bx
|
||||||
grub_drivemap_mapstart_ofs = INT13H_OFFSET(EXT_C(grub_drivemap_mapstart))
|
|
||||||
movw $grub_drivemap_mapstart_ofs, %bx
|
|
||||||
#else
|
|
||||||
movw $INT13H_OFFSET(EXT_C(grub_drivemap_mapstart)), %bx
|
|
||||||
#endif
|
|
||||||
|
|
||||||
more_remaining:
|
more_remaining:
|
||||||
movw %cs:(%bx), %ax
|
movw %cs:(%bx), %ax
|
||||||
|
@ -66,12 +62,7 @@ not_found:
|
||||||
popf
|
popf
|
||||||
pushf
|
pushf
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
lcall *%cs:INT13H_OFFSET (LOCAL (oldhandler))
|
||||||
grub_drivemap_oldhandler_ofs = INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
|
||||||
lcall *%cs:grub_drivemap_oldhandler_ofs
|
|
||||||
#else
|
|
||||||
lcall *%cs:INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
push %bp
|
push %bp
|
||||||
mov %sp, %bp
|
mov %sp, %bp
|
||||||
|
@ -94,11 +85,7 @@ norestore:
|
||||||
popf
|
popf
|
||||||
pushf
|
pushf
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
lcall *%cs:INT13H_OFFSET (LOCAL (oldhandler))
|
||||||
lcall *%cs:grub_drivemap_oldhandler_ofs
|
|
||||||
#else
|
|
||||||
lcall *%cs:INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
push %bp
|
push %bp
|
||||||
mov %sp, %bp
|
mov %sp, %bp
|
||||||
|
@ -111,9 +98,13 @@ norestore:
|
||||||
/* Far pointer to the old handler. Stored as a CS:IP in the style of real-mode
|
/* Far pointer to the old handler. Stored as a CS:IP in the style of real-mode
|
||||||
IVT entries (thus PI:SC in mem). */
|
IVT entries (thus PI:SC in mem). */
|
||||||
VARIABLE(grub_drivemap_oldhandler)
|
VARIABLE(grub_drivemap_oldhandler)
|
||||||
|
LOCAL (oldhandler):
|
||||||
.word 0x0, 0x0
|
.word 0x0, 0x0
|
||||||
|
|
||||||
/* This label MUST be at the end of the copied block, since the installer code
|
/* This label MUST be at the end of the copied block, since the installer code
|
||||||
reserves additional space for mappings at runtime and copies them over it. */
|
reserves additional space for mappings at runtime and copies them over it. */
|
||||||
.align 2
|
.align 2
|
||||||
|
|
||||||
VARIABLE(grub_drivemap_mapstart)
|
VARIABLE(grub_drivemap_mapstart)
|
||||||
|
LOCAL (mapstart):
|
||||||
|
.byte 0
|
||||||
|
|
|
@ -235,10 +235,8 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||||
/* One more sanity check. Re-read all sectors by blocklists, and compare
|
/* One more sanity check. Re-read all sectors by blocklists, and compare
|
||||||
those with the data read via a file. */
|
those with the data read via a file. */
|
||||||
disk = file->device->disk;
|
disk = file->device->disk;
|
||||||
if (disk->partition)
|
|
||||||
part_start = grub_partition_get_start (disk->partition);
|
part_start = grub_partition_get_start (disk->partition);
|
||||||
else
|
|
||||||
part_start = 0;
|
|
||||||
|
|
||||||
buf = grub_envblk_buffer (envblk);
|
buf = grub_envblk_buffer (envblk);
|
||||||
for (p = blocklists, index = 0; p; index += p->length, p = p->next)
|
for (p = blocklists, index = 0; p; index += p->length, p = p->next)
|
||||||
|
@ -268,10 +266,7 @@ write_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||||
|
|
||||||
buf = grub_envblk_buffer (envblk);
|
buf = grub_envblk_buffer (envblk);
|
||||||
disk = file->device->disk;
|
disk = file->device->disk;
|
||||||
if (disk->partition)
|
|
||||||
part_start = grub_partition_get_start (disk->partition);
|
part_start = grub_partition_get_start (disk->partition);
|
||||||
else
|
|
||||||
part_start = 0;
|
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
for (p = blocklists; p; index += p->length, p = p->next)
|
for (p = blocklists; p; index += p->length, p = p->next)
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef GRUB_MACHINE_EMU
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
|
#endif
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
@ -34,7 +36,9 @@ grub_cmd_lsmmap (grub_command_t cmd __attribute__ ((unused)),
|
||||||
(long long) addr, (long long) size, type);
|
(long long) addr, (long long) size, type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifndef GRUB_MACHINE_EMU
|
||||||
grub_machine_mmap_iterate (hook);
|
grub_machine_mmap_iterate (hook);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load modules. */
|
/* Load modules. */
|
||||||
#ifndef GRUB_UTIL
|
#if GRUB_NO_MODULES
|
||||||
{
|
{
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
prefix = grub_env_get ("prefix");
|
prefix = grub_env_get ("prefix");
|
||||||
|
|
|
@ -149,11 +149,11 @@ grub_cmd_do_search (grub_command_t cmd __attribute__ ((unused)), int argc,
|
||||||
static grub_command_t cmd;
|
static grub_command_t cmd;
|
||||||
|
|
||||||
#ifdef DO_SEARCH_FILE
|
#ifdef DO_SEARCH_FILE
|
||||||
GRUB_MOD_INIT(search_file)
|
GRUB_MOD_INIT(search_fs_file)
|
||||||
#elif defined (DO_SEARCH_FS_UUID)
|
#elif defined (DO_SEARCH_FS_UUID)
|
||||||
GRUB_MOD_INIT(search_fs_uuid)
|
GRUB_MOD_INIT(search_fs_uuid)
|
||||||
#else
|
#else
|
||||||
GRUB_MOD_INIT(search_fs_label)
|
GRUB_MOD_INIT(search_label)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
cmd =
|
cmd =
|
||||||
|
@ -163,11 +163,11 @@ GRUB_MOD_INIT(search_fs_label)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DO_SEARCH_FILE
|
#ifdef DO_SEARCH_FILE
|
||||||
GRUB_MOD_FINI(search_file)
|
GRUB_MOD_FINI(search_fs_file)
|
||||||
#elif defined (DO_SEARCH_FS_UUID)
|
#elif defined (DO_SEARCH_FS_UUID)
|
||||||
GRUB_MOD_FINI(search_fs_uuid)
|
GRUB_MOD_FINI(search_fs_uuid)
|
||||||
#else
|
#else
|
||||||
GRUB_MOD_FINI(search_fs_label)
|
GRUB_MOD_FINI(search_label)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
grub_unregister_command (cmd);
|
grub_unregister_command (cmd);
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/machine/time.h>
|
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
|
162
conf/any-emu.rmk
162
conf/any-emu.rmk
|
@ -1,129 +1,95 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
COMMON_LDFLAGS += -nostdlib
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) -fno-builtin
|
||||||
|
|
||||||
sbin_UTILITIES += grub-emu
|
|
||||||
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
|
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
|
||||||
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
kernel_img_RELOCATABLE = yes
|
||||||
commands/configfile.c commands/echo.c commands/help.c \
|
pkglib_PROGRAMS = kernel.img
|
||||||
commands/handler.c commands/ls.c commands/test.c \
|
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
||||||
commands/search_wrap.c commands/search_file.c \
|
kern/err.c kern/list.c kern/handler.c kern/command.c \
|
||||||
commands/search_label.c commands/search_uuid.c \
|
kern/corecmd.c kern/file.c kern/fs.c kern/main.c kern/misc.c \
|
||||||
commands/blocklist.c commands/hexdump.c \
|
kern/parser.c kern/partition.c kern/term.c \
|
||||||
lib/hexdump.c commands/halt.c commands/reboot.c \
|
|
||||||
lib/envblk.c commands/loadenv.c \
|
|
||||||
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
|
|
||||||
commands/password.c commands/keystatus.c \
|
|
||||||
disk/host.c disk/loopback.c disk/scsi.c \
|
|
||||||
fs/fshelp.c \
|
|
||||||
\
|
|
||||||
io/gzio.c \
|
|
||||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
|
||||||
kern/err.c kern/list.c kern/handler.c \
|
|
||||||
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
|
|
||||||
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
|
|
||||||
kern/partition.c kern/term.c \
|
|
||||||
kern/rescue_reader.c kern/rescue_parser.c \
|
kern/rescue_reader.c kern/rescue_parser.c \
|
||||||
lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
|
|
||||||
normal/handler.c normal/auth.c lib/crypto.c normal/autofs.c \
|
|
||||||
normal/completion.c normal/main.c normal/color.c \
|
|
||||||
normal/menu.c normal/menu_entry.c \
|
|
||||||
normal/menu_text.c normal/crypto.c normal/term.c \
|
|
||||||
commands/terminal.c normal/context.c lib/charset.c \
|
|
||||||
script/main.c script/execute.c script/function.c \
|
|
||||||
script/lexer.c script/script.c grub_script.tab.c \
|
|
||||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
|
||||||
partmap/acorn.c partmap/gpt.c \
|
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
util/console.c util/grub-emu.c util/misc.c util/hostdisk.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
util/getroot.c util/time.c \
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
|
||||||
\
|
\
|
||||||
video/video.c video/fb/video_fb.c video/fb/fbblit.c \
|
grub_emu_init.c gnulib/progname.c util/hostfs.c disk/host.c
|
||||||
video/fb/fbfill.c video/fb/fbutil.c commands/videotest.c \
|
kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-undef -I$(srcdir)/gnulib
|
||||||
video/bitmap.c video/bitmap_scale.c video/readers/tga.c \
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
video/readers/jpeg.c video/readers/png.c font/font_cmd.c \
|
TARGET_NO_STRIP = yes
|
||||||
font/font.c term/gfxterm.c io/bufio.c \
|
TARGET_NO_DYNAMIC_MODULES = yes
|
||||||
\
|
|
||||||
gfxmenu/gfxmenu.c gfxmenu/model.c gfxmenu/view.c \
|
|
||||||
gfxmenu/icon_manager.c gfxmenu/theme_loader.c \
|
|
||||||
gfxmenu/widget-box.c gfxmenu/gui_canvas.c \
|
|
||||||
gfxmenu/gui_circular_progress.c gfxmenu/gui_box.c \
|
|
||||||
gfxmenu/gui_label.c gfxmenu/gui_list.c gfxmenu/gui_image.c \
|
|
||||||
gfxmenu/gui_progress_bar.c gfxmenu/gui_util.c \
|
|
||||||
gfxmenu/gui_string_util.c gfxmenu/named_colors.c trigtables.c \
|
|
||||||
\
|
|
||||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
|
||||||
util/hostdisk.c util/getroot.c \
|
|
||||||
\
|
|
||||||
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
|
||||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
|
||||||
commands/parttool.c parttool/msdospart.c \
|
|
||||||
lib/libgcrypt-grub/cipher/md5.c \
|
|
||||||
grub_emu_init.c gnulib/progname.c
|
|
||||||
grub_emu_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap
|
|
||||||
|
|
||||||
|
# For halt.mod.
|
||||||
|
pkglib_MODULES += halt.mod
|
||||||
|
halt_mod_SOURCES = commands/halt.c
|
||||||
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
ifeq ($(target_cpu), i386)
|
ifeq ($(target_cpu), i386)
|
||||||
grub_emu_SOURCES += commands/i386/cpuid.c
|
pkglib_MODULES += cpuid.mod
|
||||||
|
cpuid_mod_SOURCES = commands/i386/cpuid.c
|
||||||
|
cpuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
grub_emu_LDFLAGS = $(LIBCURSES)
|
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||||
|
|
||||||
ifeq ($(enable_grub_emu_usb), yes)
|
ifeq ($(enable_grub_emu_usb), yes)
|
||||||
grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \
|
pkglib_MODULES += libusb.mod
|
||||||
commands/usbtest.c
|
libusb_mod_SOURCES = util/usb.c
|
||||||
grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
|
libusb_mod_CFLAGS =
|
||||||
|
libusb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For usb.mod
|
||||||
|
pkglib_MODULES += usb.mod
|
||||||
|
usb_mod_SOURCES = bus/usb/usb.c
|
||||||
|
usb_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For usbtest.mod
|
||||||
|
pkglib_MODULES += usbtest.mod
|
||||||
|
usbtest_mod_SOURCES = commands/usbtest.c
|
||||||
|
usbtest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
usbtest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For usbms.mod
|
||||||
|
pkglib_MODULES += usbms.mod
|
||||||
|
usbms_mod_SOURCES = disk/usbms.c
|
||||||
|
usbms_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
usbms_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
grub_emu_LDFLAGS += $(LIBUSB)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(enable_grub_emu_sdl), yes)
|
ifeq ($(enable_grub_emu_sdl), yes)
|
||||||
grub_emu_SOURCES += util/sdl.c
|
pkglib_MODULES += sdl.mod
|
||||||
|
sdl_mod_SOURCES = util/sdl.c
|
||||||
|
sdl_mod_CFLAGS =
|
||||||
|
sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
grub_emu_LDFLAGS += $(LIBSDL)
|
grub_emu_LDFLAGS += $(LIBSDL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(enable_grub_emu_pci), yes)
|
ifeq ($(enable_grub_emu_pci), yes)
|
||||||
grub_emu_SOURCES += util/pci.c commands/lspci.c
|
pkglib_MODULES += pci.mod
|
||||||
|
pci_mod_SOURCES = util/pci.c commands/lspci.c
|
||||||
|
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
grub_emu_LDFLAGS += $(LIBPCIACCESS)
|
grub_emu_LDFLAGS += $(LIBPCIACCESS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES))
|
include $(srcdir)/conf/common.mk
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
|
||||||
DISTCLEANFILES += grub_emu_init.lst
|
|
||||||
|
|
||||||
grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh
|
grub_emu_init.h: genemuinitheader.sh $(pkglib_MODULES)
|
||||||
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
|
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@
|
||||||
DISTCLEANFILES += grub_emu_init.h
|
DISTCLEANFILES += grub_emu_init.h
|
||||||
|
|
||||||
grub_emu_init.c: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_emu_init.h
|
grub_emu_init.c: genemuinit.sh $(pkglib_MODULES)
|
||||||
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
|
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
|
||||||
DISTCLEANFILES += grub_emu_init.c
|
DISTCLEANFILES += grub_emu_init.c
|
||||||
|
|
||||||
|
CLEANFILES += grub-emu
|
||||||
|
grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS)
|
||||||
|
$(CC) -o $@ $(pkglib_MODULES) $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
|
||||||
|
GRUB_EMU=grub-emu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# FIXME: this could be shared with common.rmk
|
|
||||||
|
|
||||||
trigtables.c: gentrigtables
|
|
||||||
./gentrigtables > $@
|
|
||||||
DISTCLEANFILES += trigtables.c
|
|
||||||
gentrigtables: gentrigtables.c
|
|
||||||
$(CC) -o $@ $^ $(CPPFLAGS) -lm
|
|
||||||
DISTCLEANFILES += gentrigtables
|
|
||||||
|
|
||||||
# For grub-mkfont.
|
|
||||||
ifeq ($(enable_grub_mkfont), yes)
|
|
||||||
bin_UTILITIES += grub-mkfont
|
|
||||||
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
|
|
||||||
grub_mkfont_CFLAGS = $(freetype_cflags)
|
|
||||||
grub_mkfont_LDFLAGS = $(freetype_libs)
|
|
||||||
endif
|
|
||||||
|
|
||||||
grub_script.tab.c grub_script.tab.h: script/parser.y
|
|
||||||
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
|
|
||||||
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
|
|
||||||
|
|
||||||
bin_UTILITIES += grub-bin2h
|
|
||||||
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
# Used by various components. These rules need to precede them.
|
||||||
|
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
||||||
|
|
||||||
sbin_UTILITIES += grub-mkdevicemap
|
sbin_UTILITIES += grub-mkdevicemap
|
||||||
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
||||||
util/deviceiter.c \
|
util/deviceiter.c \
|
||||||
|
@ -24,7 +27,7 @@ util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
||||||
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
||||||
util/hostdisk.c util/misc.c util/getroot.c \
|
util/hostdisk.c util/misc.c util/getroot.c \
|
||||||
kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
||||||
kern/parser.c kern/partition.c kern/file.c \
|
kern/parser.c kern/partition.c kern/file.c kern/list.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
|
@ -32,7 +35,8 @@ grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
partmap/msdos.c partmap/apple.c partmap/sun.c partmap/gpt.c\
|
partmap/msdos.c partmap/bsdlabel.c partmap/apple.c \
|
||||||
|
partmap/sun.c partmap/sunpc.c partmap/gpt.c \
|
||||||
kern/fs.c kern/env.c fs/fshelp.c \
|
kern/fs.c kern/env.c fs/fshelp.c \
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c grub_probe_init.c
|
disk/raid.c disk/mdraid_linux.c disk/lvm.c grub_probe_init.c
|
||||||
|
|
||||||
|
@ -52,7 +56,7 @@ grub_mkisofs_SOURCES = util/mkisofs/eltorito.c \
|
||||||
gnulib/error.c gnulib/progname.c
|
gnulib/error.c gnulib/progname.c
|
||||||
grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
|
grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
|
||||||
-I$(srcdir)/util/mkisofs/include \
|
-I$(srcdir)/util/mkisofs/include \
|
||||||
-Wno-all -Werror
|
-Wno-all -Werror $(GNULIB_CFLAGS)
|
||||||
|
|
||||||
# For grub-fstest.
|
# For grub-fstest.
|
||||||
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
|
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
|
||||||
|
@ -69,8 +73,8 @@ grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
|
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
|
||||||
fs/befs_be.c fs/tar.c \
|
fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
kern/partition.c partmap/msdos.c partmap/apple.c partmap/sun.c \
|
kern/partition.c partmap/msdos.c partmap/bsdlabel.c \
|
||||||
partmap/gpt.c \
|
partmap/apple.c partmap/sun.c partmap/sunpc.c partmap/gpt.c \
|
||||||
kern/fs.c kern/env.c fs/fshelp.c disk/raid.c \
|
kern/fs.c kern/env.c fs/fshelp.c disk/raid.c \
|
||||||
disk/raid5_recover.c disk/raid6_recover.c \
|
disk/raid5_recover.c disk/raid6_recover.c \
|
||||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
||||||
|
@ -91,6 +95,13 @@ grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
|
||||||
bin_UTILITIES += grub-bin2h
|
bin_UTILITIES += grub-bin2h
|
||||||
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
||||||
|
|
||||||
|
# For the lexer.
|
||||||
|
grub_script.yy.c grub_script.yy.h: script/yylex.l
|
||||||
|
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(srcdir)/script/yylex.l
|
||||||
|
sed -i 's/^#include.*\(<stdio\.h>\|<string\.h>\|<errno\.h>\|<stdlib\.h>\|<unistd\.h>\)//g' grub_script.yy.h
|
||||||
|
sed -i 's/^#include.*\(<stdio\.h>\|<string\.h>\|<errno\.h>\|<stdlib\.h>\|<unistd\.h>\)//g' grub_script.yy.c
|
||||||
|
DISTCLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||||
|
|
||||||
# For grub-script-check.
|
# For grub-script-check.
|
||||||
bin_UTILITIES += grub-script-check
|
bin_UTILITIES += grub-script-check
|
||||||
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
|
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
|
||||||
|
@ -98,7 +109,23 @@ grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c
|
||||||
util/grub-script-check.c util/misc.c \
|
util/grub-script-check.c util/misc.c \
|
||||||
script/main.c script/script.c script/function.c script/lexer.c \
|
script/main.c script/script.c script/function.c script/lexer.c \
|
||||||
kern/handler.c kern/err.c kern/parser.c kern/list.c \
|
kern/handler.c kern/err.c kern/parser.c kern/list.c \
|
||||||
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c
|
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c \
|
||||||
|
grub_script.yy.c
|
||||||
|
grub_script_check_CFLAGS = $(GNULIB_CFLAGS)
|
||||||
|
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||||
|
DEFSYMFILES += kernel_syms.lst
|
||||||
|
|
||||||
|
kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||||
|
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||||
|
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||||
|
machine/memory.h machine/loader.h machine/kernel.h \
|
||||||
|
list.h handler.h command.h i18n.h env_private.h
|
||||||
|
|
||||||
|
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
||||||
|
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
|
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
||||||
|
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
# For the parser.
|
# For the parser.
|
||||||
grub_script.tab.c grub_script.tab.h: script/parser.y
|
grub_script.tab.c grub_script.tab.h: script/parser.y
|
||||||
|
@ -377,6 +404,16 @@ part_gpt_mod_SOURCES = partmap/gpt.c
|
||||||
part_gpt_mod_CFLAGS = $(COMMON_CFLAGS)
|
part_gpt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
part_gpt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
part_gpt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += part_bsd.mod
|
||||||
|
part_bsd_mod_SOURCES = partmap/bsdlabel.c
|
||||||
|
part_bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
part_bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += part_sunpc.mod
|
||||||
|
part_sunpc_mod_SOURCES = partmap/sunpc.c
|
||||||
|
part_sunpc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
part_sunpc_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# Special disk structures and generic drivers
|
# Special disk structures and generic drivers
|
||||||
|
|
||||||
pkglib_MODULES += raid.mod raid5rec.mod raid6rec.mod mdraid.mod dm_nv.mod \
|
pkglib_MODULES += raid.mod raid5rec.mod raid6rec.mod mdraid.mod dm_nv.mod \
|
||||||
|
@ -617,7 +654,7 @@ normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For sh.mod.
|
# For sh.mod.
|
||||||
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
||||||
script/function.c script/lexer.c grub_script.tab.c
|
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
|
||||||
sh_mod_CFLAGS = $(COMMON_CFLAGS)
|
sh_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
@ -775,6 +812,42 @@ password_pbkdf2_mod_SOURCES = commands/password_pbkdf2.c
|
||||||
password_pbkdf2_mod_CFLAGS = $(COMMON_CFLAGS)
|
password_pbkdf2_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
password_pbkdf2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
password_pbkdf2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For memdisk.mod.
|
||||||
|
pkglib_MODULES += memdisk.mod
|
||||||
|
memdisk_mod_SOURCES = disk/memdisk.c
|
||||||
|
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For reboot.mod.
|
||||||
|
pkglib_MODULES += reboot.mod
|
||||||
|
reboot_mod_SOURCES = commands/reboot.c
|
||||||
|
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For date.mod
|
||||||
|
pkglib_MODULES += date.mod
|
||||||
|
date_mod_SOURCES = commands/date.c
|
||||||
|
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For datehook.mod
|
||||||
|
pkglib_MODULES += datehook.mod
|
||||||
|
datehook_mod_SOURCES = hook/datehook.c
|
||||||
|
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For lsmmap.mod
|
||||||
|
pkglib_MODULES += lsmmap.mod
|
||||||
|
lsmmap_mod_SOURCES = commands/lsmmap.c
|
||||||
|
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For boot.mod.
|
||||||
|
pkglib_MODULES += boot.mod
|
||||||
|
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
||||||
|
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
bin_UTILITIES += grub-mkpasswd-pbkdf2
|
bin_UTILITIES += grub-mkpasswd-pbkdf2
|
||||||
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c kern/err.c
|
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c kern/err.c
|
||||||
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1
|
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
|
|
||||||
COMMON_LDFLAGS = -m32 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
|
|
||||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||||
|
|
||||||
ifeq ($(platform), coreboot)
|
|
||||||
|
|
||||||
pkglib_PROGRAMS += kernel.img
|
pkglib_PROGRAMS += kernel.img
|
||||||
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
kern/i386/misc.S \
|
kern/i386/misc.S \
|
||||||
|
@ -31,74 +24,10 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
kern/env.c \
|
kern/env.c \
|
||||||
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
||||||
symlist.c
|
symlist.c
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
machine/boot.h machine/console.h machine/init.h \
|
|
||||||
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h \
|
|
||||||
env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(platform), qemu)
|
|
||||||
|
|
||||||
GRUB_BOOT_MACHINE_LINK_ADDR = 0xffe00
|
|
||||||
|
|
||||||
pkglib_IMAGES += boot.img
|
|
||||||
boot_img_SOURCES = boot/i386/qemu/boot.S
|
|
||||||
boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
||||||
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
||||||
boot_img_FORMAT = binary
|
|
||||||
|
|
||||||
bin_UTILITIES += grub-mkimage
|
|
||||||
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
|
||||||
util/resolve.c gnulib/progname.c
|
|
||||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
||||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
|
|
||||||
pkglib_IMAGES += kernel.img
|
|
||||||
kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
|
||||||
kern/i386/misc.S \
|
|
||||||
kern/i386/coreboot/init.c \
|
|
||||||
kern/i386/qemu/mmap.c \
|
|
||||||
kern/i386/halt.c \
|
|
||||||
kern/main.c kern/device.c \
|
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
|
||||||
kern/generic/rtc_get_time_ms.c \
|
|
||||||
kern/generic/millisleep.c \
|
|
||||||
kern/env.c \
|
|
||||||
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
|
||||||
symlist.c
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
machine/boot.h machine/console.h machine/init.h \
|
|
||||||
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h \
|
|
||||||
env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
||||||
kernel_img_FORMAT = binary
|
|
||||||
endif
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
sbin_SCRIPTS += grub-install
|
sbin_SCRIPTS += grub-install
|
||||||
grub_install_SOURCES = util/grub-install.in
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
|
||||||
|
@ -106,17 +35,7 @@ bin_SCRIPTS += grub-mkrescue
|
||||||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_MODULES = linux.mod \
|
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
|
||||||
aout.mod play.mod serial.mod \
|
|
||||||
memdisk.mod pci.mod lspci.mod reboot.mod \
|
|
||||||
halt.mod datetime.mod date.mod datehook.mod \
|
|
||||||
lsmmap.mod mmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
# For mmap.mod.
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
||||||
|
@ -129,21 +48,11 @@ linux_mod_SOURCES = loader/i386/linux.c
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
# For halt.mod.
|
||||||
halt_mod_SOURCES = commands/halt.c
|
halt_mod_SOURCES = commands/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
serial_mod_SOURCES = term/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For aout.mod.
|
# For aout.mod.
|
||||||
aout_mod_SOURCES = loader/aout.c
|
aout_mod_SOURCES = loader/aout.c
|
||||||
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -156,45 +65,10 @@ bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
# For play.mod.
|
|
||||||
play_mod_SOURCES = commands/i386/pc/play.c
|
|
||||||
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For memdisk.mod.
|
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
# For datetime.mod
|
||||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
include $(srcdir)/conf/i386.mk
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
|
@ -1,166 +1,5 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
|
COMMON_LDFLAGS = -melf_i386
|
||||||
COMMON_CFLAGS = -fno-builtin -m32
|
|
||||||
COMMON_LDFLAGS = -melf_i386 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
include $(srcdir)/conf/x86-efi.mk
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Utilities.
|
|
||||||
bin_UTILITIES = grub-mkimage
|
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
|
|
||||||
util/misc.c util/resolve.c
|
|
||||||
util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
# For grub-setup.
|
|
||||||
#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
|
|
||||||
# util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
|
||||||
# kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
|
||||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/msdos.c \
|
|
||||||
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
|
||||||
# kern/fs.c kern/env.c fs/fshelp.c
|
|
||||||
|
|
||||||
# Scripts.
|
|
||||||
sbin_SCRIPTS = grub-install
|
|
||||||
|
|
||||||
# For grub-install.
|
|
||||||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_PROGRAMS = kernel.img
|
|
||||||
pkglib_MODULES = chain.mod appleldr.mod \
|
|
||||||
linux.mod halt.mod reboot.mod pci.mod lspci.mod \
|
|
||||||
datetime.mod date.mod datehook.mod loadbios.mod \
|
|
||||||
fixvideo.mod mmap.mod acpi.mod
|
|
||||||
|
|
||||||
# For kernel.img.
|
|
||||||
kernel_img_RELOCATABLE = yes
|
|
||||||
kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
|
||||||
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
|
||||||
term/efi/console.c disk/efi/efidisk.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
|
||||||
kern/generic/rtc_get_time_ms.c \
|
|
||||||
kern/generic/millisleep.c
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h \
|
|
||||||
i18n.h env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For acpi.mod.
|
|
||||||
acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
|
|
||||||
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
acpi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c \
|
|
||||||
mmap/efi/mmap.c
|
|
||||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For chain.mod.
|
|
||||||
chain_mod_SOURCES = loader/efi/chainloader.c
|
|
||||||
chain_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For appleldr.mod.
|
|
||||||
appleldr_mod_SOURCES = loader/efi/appleloader.c
|
|
||||||
appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
|
||||||
linux_mod_SOURCES = loader/i386/efi/linux.c
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
|
||||||
halt_mod_SOURCES = commands/halt.c
|
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
|
||||||
datetime_mod_SOURCES = lib/efi/datetime.c
|
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For loadbios.mod
|
|
||||||
loadbios_mod_SOURCES = commands/efi/loadbios.c
|
|
||||||
loadbios_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For fixvideo.mod
|
|
||||||
fixvideo_mod_SOURCES = commands/efi/fixvideo.c
|
|
||||||
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += efi_uga.mod
|
|
||||||
efi_uga_mod_SOURCES = video/efi_uga.c
|
|
||||||
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += efi_gop.mod
|
|
||||||
efi_gop_mod_SOURCES = video/efi_gop.c
|
|
||||||
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += xnu.mod
|
|
||||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
|
|
||||||
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
|
||||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -m32 -nostdinc -fno-builtin
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
COMMON_CFLAGS = -ffreestanding -mrtd -mregparm=3
|
|
||||||
COMMON_LDFLAGS = -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
pkglib_PROGRAMS = kernel.img
|
pkglib_PROGRAMS = kernel.img
|
||||||
|
@ -29,24 +24,11 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
|
||||||
term/ieee1275/ofconsole.c \
|
term/ieee1275/ofconsole.c \
|
||||||
disk/ieee1275/ofdisk.c \
|
disk/ieee1275/ofdisk.c \
|
||||||
symlist.c
|
symlist.c
|
||||||
kernel_img_HEADERS = cache.h device.h disk.h dl.h elf.h elfload.h \
|
kernel_img_HEADERS += ieee1275/ieee1275.h
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
ieee1275/ieee1275.h machine/kernel.h machine/loader.h machine/memory.h \
|
|
||||||
list.h handler.h command.h i18n.h env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Scripts.
|
# Scripts.
|
||||||
sbin_SCRIPTS = grub-install
|
sbin_SCRIPTS = grub-install
|
||||||
|
|
||||||
|
@ -54,16 +36,10 @@ sbin_SCRIPTS = grub-install
|
||||||
grub_install_SOURCES = util/ieee1275/grub-install.in
|
grub_install_SOURCES = util/ieee1275/grub-install.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_MODULES = halt.mod reboot.mod suspend.mod \
|
pkglib_MODULES = halt.mod suspend.mod \
|
||||||
aout.mod serial.mod linux.mod \
|
aout.mod linux.mod \
|
||||||
nand.mod memdisk.mod pci.mod lspci.mod datetime.mod \
|
nand.mod datetime.mod \
|
||||||
date.mod datehook.mod lsmmap.mod mmap.mod
|
mmap.mod
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
# For mmap.mod.
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
||||||
|
@ -81,21 +57,11 @@ suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
||||||
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For reboot.mod
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod
|
# For halt.mod
|
||||||
halt_mod_SOURCES = commands/halt.c
|
halt_mod_SOURCES = commands/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
serial_mod_SOURCES = term/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
# For linux.mod.
|
||||||
linux_mod_SOURCES = loader/i386/ieee1275/linux.c
|
linux_mod_SOURCES = loader/i386/ieee1275/linux.c
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -106,40 +72,10 @@ nand_mod_SOURCES = disk/ieee1275/nand.c
|
||||||
nand_mod_CFLAGS = $(COMMON_CFLAGS)
|
nand_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
nand_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
nand_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For memdisk.mod.
|
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
# For datetime.mod
|
||||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
include $(srcdir)/conf/i386.mk
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
|
@ -2,12 +2,7 @@
|
||||||
|
|
||||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
|
|
||||||
COMMON_LDFLAGS = -m32 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
|
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
|
||||||
|
@ -59,27 +54,13 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
|
||||||
kern/env.c \
|
kern/env.c \
|
||||||
term/i386/pc/console.c term/i386/vga_common.c \
|
term/i386/pc/console.c term/i386/vga_common.c \
|
||||||
symlist.c
|
symlist.c
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
kernel_img_HEADERS += machine/biosdisk.h machine/vga.h machine/vbe.h \
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
machine/pxe.h i386/pit.h machine/init.h
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
|
|
||||||
machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
|
|
||||||
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h \
|
|
||||||
i18n.h env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
|
||||||
kernel_img_FORMAT = binary
|
kernel_img_FORMAT = binary
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Utilities.
|
# Utilities.
|
||||||
bin_UTILITIES = grub-mkimage
|
bin_UTILITIES = grub-mkimage
|
||||||
sbin_UTILITIES = grub-setup
|
sbin_UTILITIES = grub-setup
|
||||||
|
@ -96,7 +77,8 @@ grub_setup_SOURCES = gnulib/progname.c \
|
||||||
util/i386/pc/grub-setup.c util/hostdisk.c \
|
util/i386/pc/grub-setup.c util/hostdisk.c \
|
||||||
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
||||||
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
||||||
kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
|
kern/file.c kern/fs.c kern/env.c kern/list.c \
|
||||||
|
fs/fshelp.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
|
@ -104,7 +86,8 @@ grub_setup_SOURCES = gnulib/progname.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
partmap/msdos.c partmap/gpt.c \
|
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \
|
||||||
|
partmap/gpt.c \
|
||||||
\
|
\
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||||
util/raid.c util/lvm.c \
|
util/raid.c util/lvm.c \
|
||||||
|
@ -117,20 +100,14 @@ bin_SCRIPTS += grub-mkrescue
|
||||||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||||
|
|
||||||
pkglib_MODULES = biosdisk.mod chain.mod \
|
pkglib_MODULES = biosdisk.mod chain.mod \
|
||||||
reboot.mod halt.mod \
|
halt.mod \
|
||||||
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
|
vbe.mod vbetest.mod vbeinfo.mod \
|
||||||
vga.mod memdisk.mod pci.mod lspci.mod \
|
vga.mod \
|
||||||
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
|
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod \
|
||||||
datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
|
ata_pthru.mod hdparm.mod \
|
||||||
usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
|
usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
|
||||||
efiemu.mod mmap.mod acpi.mod drivemap.mod
|
efiemu.mod mmap.mod acpi.mod drivemap.mod
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For drivemap.mod.
|
# For drivemap.mod.
|
||||||
drivemap_mod_SOURCES = commands/i386/pc/drivemap.c \
|
drivemap_mod_SOURCES = commands/i386/pc/drivemap.c \
|
||||||
commands/i386/pc/drivemap_int13h.S
|
commands/i386/pc/drivemap_int13h.S
|
||||||
|
@ -187,21 +164,11 @@ xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
# For halt.mod.
|
||||||
halt_mod_SOURCES = commands/i386/pc/halt.c
|
halt_mod_SOURCES = commands/i386/pc/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
serial_mod_SOURCES = term/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For vbe.mod.
|
# For vbe.mod.
|
||||||
vbe_mod_SOURCES = video/i386/pc/vbe.c
|
vbe_mod_SOURCES = video/i386/pc/vbe.c
|
||||||
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
|
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -217,31 +184,11 @@ vbetest_mod_SOURCES = commands/i386/pc/vbetest.c
|
||||||
vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
|
vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For play.mod.
|
|
||||||
play_mod_SOURCES = commands/i386/pc/play.c
|
|
||||||
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For vga.mod.
|
# For vga.mod.
|
||||||
vga_mod_SOURCES = term/i386/pc/vga.c
|
vga_mod_SOURCES = term/i386/pc/vga.c
|
||||||
vga_mod_CFLAGS = $(COMMON_CFLAGS)
|
vga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
vga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
vga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For memdisk.mod.
|
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For aout.mod
|
# For aout.mod
|
||||||
aout_mod_SOURCES = loader/aout.c
|
aout_mod_SOURCES = loader/aout.c
|
||||||
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -298,21 +245,6 @@ datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ata_pthru.mod.
|
# For ata_pthru.mod.
|
||||||
ata_pthru_mod_SOURCES = disk/ata_pthru.c
|
ata_pthru_mod_SOURCES = disk/ata_pthru.c
|
||||||
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
|
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
|
|
@ -1,2 +1,88 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
include $(srcdir)/conf/i386-coreboot.mk
|
|
||||||
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
|
|
||||||
|
# Images.
|
||||||
|
|
||||||
|
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||||
|
GRUB_BOOT_MACHINE_LINK_ADDR = 0xffe00
|
||||||
|
|
||||||
|
pkglib_IMAGES += boot.img
|
||||||
|
boot_img_SOURCES = boot/i386/qemu/boot.S
|
||||||
|
boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||||
|
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||||
|
boot_img_FORMAT = binary
|
||||||
|
|
||||||
|
bin_UTILITIES += grub-mkimage
|
||||||
|
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
||||||
|
util/resolve.c gnulib/progname.c
|
||||||
|
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||||
|
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||||
|
|
||||||
|
pkglib_IMAGES += kernel.img
|
||||||
|
kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
||||||
|
kern/i386/misc.S \
|
||||||
|
kern/i386/coreboot/init.c \
|
||||||
|
kern/i386/qemu/mmap.c \
|
||||||
|
kern/i386/halt.c \
|
||||||
|
kern/main.c kern/device.c \
|
||||||
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
|
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
|
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
|
kern/generic/rtc_get_time_ms.c \
|
||||||
|
kern/generic/millisleep.c \
|
||||||
|
kern/env.c \
|
||||||
|
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
||||||
|
symlist.c
|
||||||
|
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||||
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||||
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||||
|
kernel_img_FORMAT = binary
|
||||||
|
|
||||||
|
sbin_SCRIPTS += grub-install
|
||||||
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
|
||||||
|
bin_SCRIPTS += grub-mkrescue
|
||||||
|
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||||
|
|
||||||
|
# Modules.
|
||||||
|
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
|
||||||
|
|
||||||
|
# For mmap.mod.
|
||||||
|
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
||||||
|
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For linux.mod.
|
||||||
|
linux_mod_SOURCES = loader/i386/linux.c
|
||||||
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For halt.mod.
|
||||||
|
halt_mod_SOURCES = commands/halt.c
|
||||||
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For aout.mod.
|
||||||
|
aout_mod_SOURCES = loader/aout.c
|
||||||
|
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For bsd.mod
|
||||||
|
pkglib_MODULES += bsd.mod
|
||||||
|
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
|
||||||
|
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For datetime.mod
|
||||||
|
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
include $(srcdir)/conf/i386.mk
|
||||||
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
|
@ -45,3 +45,28 @@ multiboot2_mod_SOURCES = loader/i386/multiboot.c \
|
||||||
multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
|
multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
|
||||||
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For serial.mod.
|
||||||
|
pkglib_MODULES += serial.mod
|
||||||
|
serial_mod_SOURCES = term/serial.c
|
||||||
|
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For pci.mod
|
||||||
|
pkglib_MODULES += pci.mod
|
||||||
|
pci_mod_SOURCES = bus/pci.c
|
||||||
|
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For lspci.mod
|
||||||
|
pkglib_MODULES += lspci.mod
|
||||||
|
lspci_mod_SOURCES = commands/lspci.c
|
||||||
|
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For play.mod.
|
||||||
|
pkglib_MODULES += play.mod
|
||||||
|
play_mod_SOURCES = commands/i386/pc/play.c
|
||||||
|
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ target_machine=yeeloong
|
||||||
COMMON_CFLAGS += -march=mips3
|
COMMON_CFLAGS += -march=mips3
|
||||||
COMMON_ASFLAGS += -march=mips3
|
COMMON_ASFLAGS += -march=mips3
|
||||||
|
|
||||||
kernel_img_HEADERS += bitmap.h video.h gfxterm.h font.h bitmap_scale.h bufio.h
|
kernel_img_HEADERS += pci.h bitmap.h video.h gfxterm.h font.h bitmap_scale.h bufio.h
|
||||||
|
|
||||||
include $(srcdir)/conf/mips.mk
|
include $(srcdir)/conf/mips.mk
|
||||||
|
|
||||||
|
@ -64,18 +64,6 @@ datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
pkglib_MODULES += date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
pkglib_MODULES += datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += linux.mod
|
pkglib_MODULES += linux.mod
|
||||||
linux_mod_SOURCES = loader/$(target_cpu)/linux.c
|
linux_mod_SOURCES = loader/$(target_cpu)/linux.c
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -84,4 +72,3 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
sbin_SCRIPTS += grub-install
|
sbin_SCRIPTS += grub-install
|
||||||
grub_install_SOURCES = util/grub-install.in
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,10 @@
|
||||||
|
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS += -nostdinc
|
COMMON_CFLAGS += -mexplicit-relocs -mflush-func=grub_cpu_flush_cache
|
||||||
COMMON_CFLAGS += -ffreestanding -mexplicit-relocs -mflush-func=grub_cpu_flush_cache
|
|
||||||
COMMON_LDFLAGS += -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
|
kernel_img_HEADERS += cpu/libgcc.h cpu/cache.h
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \
|
|
||||||
symbol.h term.h time.h types.h loader.h partition.h \
|
|
||||||
msdos_partition.h machine/kernel.h handler.h list.h \
|
|
||||||
command.h machine/memory.h cpu/libgcc.h cpu/cache.h i18n.h env_private.h
|
|
||||||
|
|
||||||
ifeq ($(platform), yeeloong)
|
|
||||||
kernel_img_HEADERS += pci.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Scripts.
|
# Scripts.
|
||||||
sbin_SCRIPTS =
|
sbin_SCRIPTS =
|
||||||
|
@ -40,26 +17,6 @@ grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
||||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(LINK_BASE)
|
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(LINK_BASE)
|
||||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_MODULES = memdisk.mod \
|
|
||||||
lsmmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For memdisk.mod.
|
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For serial.mod.
|
# For serial.mod.
|
||||||
pkglib_MODULES += serial.mod
|
pkglib_MODULES += serial.mod
|
||||||
serial_mod_SOURCES = term/serial.c
|
serial_mod_SOURCES = term/serial.c
|
||||||
|
|
|
@ -1,29 +1,9 @@
|
||||||
|
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -D__ASSEMBLY__
|
|
||||||
COMMON_CFLAGS = -ffreestanding
|
|
||||||
COMMON_LDFLAGS += -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
kernel_img_HEADERS += cpu/libgcc.h ieee1275/ieee1275.h
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \
|
|
||||||
symbol.h term.h time.h types.h powerpc/libgcc.h loader.h partition.h \
|
|
||||||
msdos_partition.h ieee1275/ieee1275.h machine/kernel.h handler.h list.h \
|
|
||||||
command.h i18n.h env_private.h
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Programs
|
# Programs
|
||||||
pkglib_PROGRAMS = kernel.img
|
pkglib_PROGRAMS = kernel.img
|
||||||
|
@ -57,47 +37,33 @@ grub_install_SOURCES = util/ieee1275/grub-install.in
|
||||||
grub_mkrescue_SOURCES = util/powerpc/ieee1275/grub-mkrescue.in
|
grub_mkrescue_SOURCES = util/powerpc/ieee1275/grub-mkrescue.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_MODULES = halt.mod \
|
pkglib_MODULES += ieee1275_fb.mod
|
||||||
linux.mod \
|
ieee1275_fb_mod_SOURCES = video/ieee1275.c
|
||||||
reboot.mod \
|
ieee1275_fb_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
suspend.mod \
|
ieee1275_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
memdisk.mod \
|
|
||||||
lsmmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
# For linux.mod.
|
||||||
|
pkglib_MODULES += linux.mod
|
||||||
linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c
|
linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For suspend.mod
|
# For suspend.mod
|
||||||
|
pkglib_MODULES += suspend.mod
|
||||||
suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
||||||
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For reboot.mod
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod
|
# For halt.mod
|
||||||
|
pkglib_MODULES += halt.mod
|
||||||
halt_mod_SOURCES = commands/halt.c
|
halt_mod_SOURCES = commands/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For memdisk.mod.
|
# For datetime.mod
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
pkglib_MODULES += datetime.mod
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_SOURCES = lib/ieee1275/datetime.c
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
|
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -m64
|
COMMON_CFLAGS = -mno-app-regs
|
||||||
COMMON_CFLAGS = -ffreestanding -m64 -mno-app-regs
|
COMMON_LDFLAGS = -melf64_sparc -mno-relax
|
||||||
COMMON_LDFLAGS = -melf64_sparc -nostdlib -mno-relax
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
pkglib_IMAGES = boot.img diskboot.img kernel.img
|
pkglib_IMAGES = boot.img diskboot.img kernel.img
|
||||||
|
@ -23,15 +19,7 @@ diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4200
|
diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4200
|
||||||
diskboot_img_FORMAT = binary
|
diskboot_img_FORMAT = binary
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
kernel_img_HEADERS += cpu/libgcc.h ieee1275/ieee1275.h cpu/ieee1275/ieee1275.h
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
list.h handler.h command.h i18n.h \
|
|
||||||
sparc64/libgcc.h ieee1275/ieee1275.h machine/kernel.h \
|
|
||||||
sparc64/ieee1275/ieee1275.h env_private.h
|
|
||||||
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
||||||
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
|
@ -48,21 +36,15 @@ kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
||||||
symlist.c kern/$(target_cpu)/cache.S
|
symlist.c kern/$(target_cpu)/cache.S
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,0x200000,-Bstatic,-melf64_sparc -static-libgcc -lgcc
|
kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc -static-libgcc -lgcc
|
||||||
kernel_img_FORMAT = binary
|
kernel_img_FORMAT = binary
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Utilities.
|
# Utilities.
|
||||||
bin_UTILITIES = grub-mkimage
|
bin_UTILITIES = grub-mkimage
|
||||||
sbin_UTILITIES = grub-setup grub-ofpathname
|
sbin_UTILITIES = grub-setup grub-ofpathname
|
||||||
|
|
||||||
# For grub-mkimage.
|
# For grub-mkimage.
|
||||||
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
|
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
||||||
util/resolve.c gnulib/progname.c
|
util/resolve.c gnulib/progname.c
|
||||||
|
|
||||||
# For grub-setup.
|
# For grub-setup.
|
||||||
|
@ -70,7 +52,8 @@ util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||||
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
||||||
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
||||||
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
||||||
kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
|
kern/file.c kern/fs.c kern/env.c kern/list.c \
|
||||||
|
fs/fshelp.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
|
@ -79,7 +62,7 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
||||||
partmap/sun.c partmap/acorn.c \
|
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
|
||||||
\
|
\
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||||
util/raid.c util/lvm.c gnulib/progname.c \
|
util/raid.c util/lvm.c gnulib/progname.c \
|
||||||
|
@ -96,41 +79,27 @@ sbin_SCRIPTS = grub-install
|
||||||
grub_install_SOURCES = util/grub-install.in
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_MODULES = halt.mod \
|
pkglib_MODULES += ieee1275_fb.mod
|
||||||
linux.mod \
|
ieee1275_fb_mod_SOURCES = video/ieee1275.c
|
||||||
reboot.mod \
|
ieee1275_fb_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
memdisk.mod \
|
ieee1275_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
lsmmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
# For linux.mod.
|
||||||
|
pkglib_MODULES += linux.mod
|
||||||
linux_mod_SOURCES = loader/sparc64/ieee1275/linux.c
|
linux_mod_SOURCES = loader/sparc64/ieee1275/linux.c
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
# For halt.mod.
|
||||||
|
pkglib_MODULES += halt.mod
|
||||||
halt_mod_SOURCES = commands/halt.c
|
halt_mod_SOURCES = commands/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For memdisk.mod.
|
# For datetime.mod
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
pkglib_MODULES += datetime.mod
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_SOURCES = lib/ieee1275/datetime.c
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
|
@ -37,12 +37,40 @@ example_scripted_test_SOURCES = tests/example_scripted_test.in
|
||||||
check_SCRIPTS += example_grub_script_test
|
check_SCRIPTS += example_grub_script_test
|
||||||
example_grub_script_test_SOURCES = tests/example_grub_script_test.in
|
example_grub_script_test_SOURCES = tests/example_grub_script_test.in
|
||||||
|
|
||||||
|
#
|
||||||
|
# Rules for real tests
|
||||||
|
#
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_echo1
|
||||||
|
grub_script_echo1_SOURCES = tests/grub_script_echo1.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_echo_keywords
|
||||||
|
grub_script_echo_keywords_SOURCES = tests/grub_script_echo_keywords.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_vars1
|
||||||
|
grub_script_vars1_SOURCES = tests/grub_script_vars1.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_for1
|
||||||
|
grub_script_for1_SOURCES = tests/grub_script_for1.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_blanklines
|
||||||
|
grub_script_blanklines_SOURCES = tests/grub_script_blanklines.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_final_semicolon
|
||||||
|
grub_script_final_semicolon_SOURCES = tests/grub_script_final_semicolon.in
|
||||||
|
|
||||||
# List of tests to execute on "make check"
|
# List of tests to execute on "make check"
|
||||||
SCRIPTED_TESTS = example_scripted_test
|
# SCRIPTED_TESTS = example_scripted_test
|
||||||
SCRIPTED_TESTS += example_grub_script_test
|
# SCRIPTED_TESTS += example_grub_script_test
|
||||||
UNIT_TESTS = example_unit_test
|
# UNIT_TESTS = example_unit_test
|
||||||
FUNCTIONAL_TESTS = example_functional_test.mod
|
# FUNCTIONAL_TESTS = example_functional_test.mod
|
||||||
|
|
||||||
|
SCRIPTED_TESTS = grub_script_echo1
|
||||||
|
SCRIPTED_TESTS += grub_script_echo_keywords
|
||||||
|
SCRIPTED_TESTS += grub_script_vars1
|
||||||
|
SCRIPTED_TESTS += grub_script_for1
|
||||||
|
SCRIPTED_TESTS += grub_script_blanklines
|
||||||
|
SCRIPTED_TESTS += grub_script_final_semicolon
|
||||||
|
|
||||||
# dependencies between tests and testing-tools
|
# dependencies between tests and testing-tools
|
||||||
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
||||||
|
|
113
conf/x86-efi.rmk
Normal file
113
conf/x86-efi.rmk
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
# Utilities.
|
||||||
|
bin_UTILITIES = grub-mkimage
|
||||||
|
|
||||||
|
# For grub-mkimage.
|
||||||
|
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
|
||||||
|
util/misc.c util/resolve.c
|
||||||
|
util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||||
|
|
||||||
|
# Scripts.
|
||||||
|
sbin_SCRIPTS = grub-install
|
||||||
|
|
||||||
|
# For grub-install.
|
||||||
|
grub_install_SOURCES = util/i386/efi/grub-install.in
|
||||||
|
|
||||||
|
# Modules.
|
||||||
|
pkglib_PROGRAMS = kernel.img
|
||||||
|
pkglib_MODULES = chain.mod appleldr.mod \
|
||||||
|
linux.mod halt.mod \
|
||||||
|
datetime.mod loadbios.mod \
|
||||||
|
fixvideo.mod mmap.mod acpi.mod
|
||||||
|
|
||||||
|
# For kernel.img.
|
||||||
|
kernel_img_RELOCATABLE = yes
|
||||||
|
kernel_img_SOURCES = kern/$(target_cpu)/efi/startup.S kern/main.c kern/device.c \
|
||||||
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
|
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
||||||
|
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
||||||
|
term/efi/console.c disk/efi/efidisk.c \
|
||||||
|
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
|
kern/generic/rtc_get_time_ms.c \
|
||||||
|
kern/generic/millisleep.c
|
||||||
|
ifeq ($(target_cpu),x86_64)
|
||||||
|
kernel_img_SOURCES += kern/x86_64/efi/callwrap.S
|
||||||
|
endif
|
||||||
|
kernel_img_HEADERS += efi/efi.h efi/time.h efi/disk.h i386/pit.h
|
||||||
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For acpi.mod.
|
||||||
|
acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
|
||||||
|
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
acpi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For mmap.mod.
|
||||||
|
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c \
|
||||||
|
mmap/efi/mmap.c
|
||||||
|
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For chain.mod.
|
||||||
|
chain_mod_SOURCES = loader/efi/chainloader.c
|
||||||
|
chain_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For appleldr.mod.
|
||||||
|
appleldr_mod_SOURCES = loader/efi/appleloader.c
|
||||||
|
appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For linux.mod.
|
||||||
|
linux_mod_SOURCES = loader/i386/efi/linux.c
|
||||||
|
ifeq ($(target_cpu), x86_64)
|
||||||
|
linux_mod_SOURCES += loader/i386/linux_trampoline.S
|
||||||
|
endif
|
||||||
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For halt.mod.
|
||||||
|
halt_mod_SOURCES = commands/halt.c
|
||||||
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For datetime.mod
|
||||||
|
datetime_mod_SOURCES = lib/efi/datetime.c
|
||||||
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For loadbios.mod
|
||||||
|
loadbios_mod_SOURCES = commands/efi/loadbios.c
|
||||||
|
loadbios_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For fixvideo.mod
|
||||||
|
fixvideo_mod_SOURCES = commands/efi/fixvideo.c
|
||||||
|
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += efi_uga.mod
|
||||||
|
efi_uga_mod_SOURCES = video/efi_uga.c
|
||||||
|
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += efi_gop.mod
|
||||||
|
efi_gop_mod_SOURCES = video/efi_gop.c
|
||||||
|
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += xnu.mod
|
||||||
|
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
|
||||||
|
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
||||||
|
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
include $(srcdir)/conf/i386.mk
|
||||||
|
include $(srcdir)/conf/common.mk
|
|
@ -1,166 +1,5 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m64
|
COMMON_LDFLAGS = -melf_x86_64
|
||||||
COMMON_CFLAGS = -fno-builtin -m64
|
|
||||||
COMMON_LDFLAGS = -melf_x86_64 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
include $(srcdir)/conf/x86-efi.mk
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Utilities.
|
|
||||||
bin_UTILITIES = grub-mkimage
|
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
|
|
||||||
util/misc.c util/resolve.c
|
|
||||||
|
|
||||||
# For grub-setup.
|
|
||||||
#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
|
|
||||||
# util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
|
||||||
# kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
|
||||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/msdos.c \
|
|
||||||
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
|
||||||
# kern/fs.c kern/env.c fs/fshelp.c
|
|
||||||
|
|
||||||
# Scripts.
|
|
||||||
sbin_SCRIPTS = grub-install
|
|
||||||
|
|
||||||
# For grub-install.
|
|
||||||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_PROGRAMS = kernel.img
|
|
||||||
pkglib_MODULES = chain.mod appleldr.mod \
|
|
||||||
halt.mod reboot.mod linux.mod pci.mod lspci.mod \
|
|
||||||
datetime.mod date.mod datehook.mod loadbios.mod \
|
|
||||||
fixvideo.mod mmap.mod acpi.mod
|
|
||||||
|
|
||||||
# For kernel.img.
|
|
||||||
kernel_img_RELOCATABLE = yes
|
|
||||||
kernel_img_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
|
|
||||||
kern/main.c kern/device.c \
|
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
|
||||||
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
|
||||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c \
|
|
||||||
term/efi/console.c disk/efi/efidisk.c
|
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
|
||||||
efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \
|
|
||||||
handler.h command.h i18n.h env_private.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For acpi.mod.
|
|
||||||
acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
|
|
||||||
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
acpi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c \
|
|
||||||
mmap/efi/mmap.c
|
|
||||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For chain.mod.
|
|
||||||
chain_mod_SOURCES = loader/efi/chainloader.c
|
|
||||||
chain_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For appleldr.mod.
|
|
||||||
appleldr_mod_SOURCES = loader/efi/appleloader.c
|
|
||||||
appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
|
||||||
linux_mod_SOURCES = loader/i386/efi/linux.c loader/i386/linux_trampoline.S
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
|
||||||
halt_mod_SOURCES = commands/halt.c
|
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
|
||||||
datetime_mod_SOURCES = lib/efi/datetime.c
|
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For loadbios.mod
|
|
||||||
loadbios_mod_SOURCES = commands/efi/loadbios.c
|
|
||||||
loadbios_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For fixvideo.mod
|
|
||||||
fixvideo_mod_SOURCES = commands/efi/fixvideo.c
|
|
||||||
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += efi_uga.mod
|
|
||||||
efi_uga_mod_SOURCES = video/efi_uga.c
|
|
||||||
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += efi_gop.mod
|
|
||||||
efi_gop_mod_SOURCES = video/efi_gop.c
|
|
||||||
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
pkglib_MODULES += xnu.mod
|
|
||||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
|
|
||||||
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
|
||||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
|
|
19
configure.ac
19
configure.ac
|
@ -91,6 +91,7 @@ fi
|
||||||
if test -z "$target_alias"; then
|
if test -z "$target_alias"; then
|
||||||
case "$target_cpu"-"$platform" in
|
case "$target_cpu"-"$platform" in
|
||||||
x86_64-efi) ;;
|
x86_64-efi) ;;
|
||||||
|
x86_64-emu) ;;
|
||||||
x86_64-*) target_cpu=i386 ;;
|
x86_64-*) target_cpu=i386 ;;
|
||||||
powerpc64-ieee1275) target_cpu=powerpc ;;
|
powerpc64-ieee1275) target_cpu=powerpc ;;
|
||||||
esac
|
esac
|
||||||
|
@ -139,9 +140,14 @@ case "$platform" in
|
||||||
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
||||||
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
|
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
|
||||||
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
|
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
|
||||||
yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||||
qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||||
esac
|
esac
|
||||||
|
case "$target_cpu" in
|
||||||
|
mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
||||||
|
sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
CFLAGS="$CFLAGS $machine_CFLAGS"
|
CFLAGS="$CFLAGS $machine_CFLAGS"
|
||||||
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
|
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
|
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
|
||||||
|
@ -164,6 +170,11 @@ if test "x$CMP" = x; then
|
||||||
AC_MSG_ERROR([cmp is not found])
|
AC_MSG_ERROR([cmp is not found])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_PROGS([LEX], [flex])
|
||||||
|
if test "x$LEX" = x; then
|
||||||
|
AC_MSG_ERROR([flex is not found])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_CHECK_PROGS([YACC], [bison])
|
AC_CHECK_PROGS([YACC], [bison])
|
||||||
if test "x$YACC" = x; then
|
if test "x$YACC" = x; then
|
||||||
AC_MSG_ERROR([bison is not found])
|
AC_MSG_ERROR([bison is not found])
|
||||||
|
@ -353,6 +364,7 @@ AC_MSG_RESULT([$TARGET_OBJ2ELF])
|
||||||
if test "x$target_m32" = x1; then
|
if test "x$target_m32" = x1; then
|
||||||
# Force 32-bit mode.
|
# Force 32-bit mode.
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||||
|
TARGET_ASFLAGS="$TARGET_CFLAGS -m32"
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||||
TARGET_MODULE_FORMAT="elf32"
|
TARGET_MODULE_FORMAT="elf32"
|
||||||
fi
|
fi
|
||||||
|
@ -360,6 +372,7 @@ fi
|
||||||
if test "x$target_m64" = x1; then
|
if test "x$target_m64" = x1; then
|
||||||
# Force 64-bit mode.
|
# Force 64-bit mode.
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||||
|
TARGET_ASFLAGS="$TARGET_ASFLAGS -m64"
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||||
TARGET_MODULE_FORMAT="elf64"
|
TARGET_MODULE_FORMAT="elf64"
|
||||||
fi
|
fi
|
||||||
|
@ -517,6 +530,7 @@ enable_efiemu=no
|
||||||
fi
|
fi
|
||||||
AC_SUBST([enable_efiemu])
|
AC_SUBST([enable_efiemu])
|
||||||
|
|
||||||
|
if test "$platform" != emu; then
|
||||||
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
|
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
|
||||||
SAVED_CPPFLAGS="$CPPFLAGS"
|
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||||
CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
|
CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
|
||||||
|
@ -530,6 +544,7 @@ int va_arg_func (int fixed, va_list args);]], [[]])],
|
||||||
if test x"$grub_cv_cc_isystem" = xyes ; then
|
if test x"$grub_cv_cc_isystem" = xyes ; then
|
||||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
|
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Restore the flags.
|
# Restore the flags.
|
||||||
CC="$tmp_CC"
|
CC="$tmp_CC"
|
||||||
|
|
|
@ -242,7 +242,7 @@ static struct grub_disk_dev grub_loopback_dev =
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
static grub_extcmd_t cmd;
|
||||||
|
|
||||||
GRUB_MOD_INIT(loop)
|
GRUB_MOD_INIT(loopback)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("loopback", grub_cmd_loopback,
|
cmd = grub_register_extcmd ("loopback", grub_cmd_loopback,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
|
@ -251,7 +251,7 @@ GRUB_MOD_INIT(loop)
|
||||||
grub_disk_dev_register (&grub_loopback_dev);
|
grub_disk_dev_register (&grub_loopback_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(loop)
|
GRUB_MOD_FINI(loopback)
|
||||||
{
|
{
|
||||||
grub_unregister_extcmd (cmd);
|
grub_unregister_extcmd (cmd);
|
||||||
grub_disk_dev_unregister (&grub_loopback_dev);
|
grub_disk_dev_unregister (&grub_loopback_dev);
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/machine/kernel.h>
|
|
||||||
|
|
||||||
static char *memdisk_addr;
|
static char *memdisk_addr;
|
||||||
static grub_off_t memdisk_size = 0;
|
static grub_off_t memdisk_size = 0;
|
||||||
|
|
|
@ -265,7 +265,7 @@ grub_efiemu_autocore (void)
|
||||||
grub_free (filename);
|
grub_free (filename);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
#ifndef GRUB_UTIL
|
#ifndef GRUB_MACHINE_EMU
|
||||||
err = grub_machine_efiemu_init_tables ();
|
err = grub_machine_efiemu_init_tables ();
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
@ -313,7 +313,7 @@ grub_cmd_efiemu_load (grub_command_t cmd __attribute__ ((unused)),
|
||||||
err = grub_efiemu_load_file (args[0]);
|
err = grub_efiemu_load_file (args[0]);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
#ifndef GRUB_UTIL
|
#ifndef GRUB_MACHINE_EMU
|
||||||
err = grub_machine_efiemu_init_tables ();
|
err = grub_machine_efiemu_init_tables ();
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -281,7 +281,7 @@ grub_efiemu_mmap_init (void)
|
||||||
// the place for memory used by efiemu itself
|
// the place for memory used by efiemu itself
|
||||||
mmap_reserved_size = GRUB_EFI_MAX_MEMORY_TYPE + 1;
|
mmap_reserved_size = GRUB_EFI_MAX_MEMORY_TYPE + 1;
|
||||||
|
|
||||||
#ifndef GRUB_UTIL
|
#ifndef GRUB_MACHINE_EMU
|
||||||
grub_machine_mmap_iterate (bounds_hook);
|
grub_machine_mmap_iterate (bounds_hook);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ grub_efiemu_mmap_fill (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GRUB_UTIL
|
#ifndef GRUB_MACHINE_EMU
|
||||||
grub_machine_mmap_iterate (fill_hook);
|
grub_machine_mmap_iterate (fill_hook);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ lsfonts_command (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
|
||||||
static grub_command_t cmd_loadfont, cmd_lsfonts;
|
static grub_command_t cmd_loadfont, cmd_lsfonts;
|
||||||
|
|
||||||
GRUB_MOD_INIT(font_manager)
|
GRUB_MOD_INIT(font)
|
||||||
{
|
{
|
||||||
grub_font_loader_init ();
|
grub_font_loader_init ();
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ GRUB_MOD_INIT(font_manager)
|
||||||
0, "List the loaded fonts.");
|
0, "List the loaded fonts.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(font_manager)
|
GRUB_MOD_FINI(font)
|
||||||
{
|
{
|
||||||
/* TODO: Determine way to free allocated resources.
|
/* TODO: Determine way to free allocated resources.
|
||||||
Warning: possible pointer references could be in use. */
|
Warning: possible pointer references could be in use. */
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
|
|
||||||
static grub_dl_t my_mod;
|
static grub_dl_t my_mod;
|
||||||
|
|
||||||
#define assert(boolean) real_assert (boolean, __FILE__, __LINE__)
|
#define assert(boolean) real_assert (boolean, GRUB_FILE, __LINE__)
|
||||||
static inline void
|
static inline void
|
||||||
real_assert (int boolean, const char *file, const int line)
|
real_assert (int boolean, const char *file, const int line)
|
||||||
{
|
{
|
||||||
|
|
72
genemuinit.sh
Normal file
72
genemuinit.sh
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002,2005,2007 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This gensymlist.sh is free software; the author
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
nm="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
/* This file is automatically generated by geninit.sh. DO NOT EDIT! */
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2002,2005,2007 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "grub_emu_init.h"
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
void
|
||||||
|
grub_init_all (void)
|
||||||
|
{
|
||||||
|
EOF
|
||||||
|
|
||||||
|
read mods
|
||||||
|
for line in $mods; do
|
||||||
|
if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
|
||||||
|
echo "grub_${line}_init ();" | sed 's,\.mod,,g;'
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
void
|
||||||
|
grub_fini_all (void)
|
||||||
|
{
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for line in $mods; do
|
||||||
|
if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
|
||||||
|
echo "grub_${line}_fini ();" | sed 's,\.mod,,g;'
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
}
|
||||||
|
EOF
|
52
genemuinitheader.sh
Normal file
52
genemuinitheader.sh
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2005,2007 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This gensymlist.sh is free software; the author
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
nm="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
/* This file is automatically generated by gensymlist.sh. DO NOT EDIT! */
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2005,2007 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
void grub_init_all (void);
|
||||||
|
void grub_fini_all (void);
|
||||||
|
EOF
|
||||||
|
|
||||||
|
read mods
|
||||||
|
for line in $mods; do
|
||||||
|
if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
|
||||||
|
echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;'
|
||||||
|
fi
|
||||||
|
if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
|
||||||
|
echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;'
|
||||||
|
fi
|
||||||
|
done
|
26
genmk.rb
26
genmk.rb
|
@ -91,7 +91,7 @@ endif
|
||||||
dir = File.dirname(src)
|
dir = File.dirname(src)
|
||||||
|
|
||||||
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
||||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
|
||||||
-include #{dep}
|
-include #{dep}
|
||||||
|
|
||||||
"
|
"
|
||||||
|
@ -143,27 +143,35 @@ mostlyclean-module-#{@name}.#{@rule_count}:
|
||||||
MOSTLYCLEAN_MODULE_TARGETS += mostlyclean-module-#{@name}.#{@rule_count}
|
MOSTLYCLEAN_MODULE_TARGETS += mostlyclean-module-#{@name}.#{@rule_count}
|
||||||
UNDSYMFILES += #{undsym}
|
UNDSYMFILES += #{undsym}
|
||||||
|
|
||||||
|
ifeq ($(TARGET_NO_DYNAMIC_MODULES), yes)
|
||||||
|
#{@name}: #{pre_obj} $(TARGET_OBJ2ELF)
|
||||||
|
-rm -f $@
|
||||||
|
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj}
|
||||||
|
if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||||
|
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; fi
|
||||||
|
else
|
||||||
ifneq ($(TARGET_APPLE_CC),1)
|
ifneq ($(TARGET_APPLE_CC),1)
|
||||||
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
|
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
|
||||||
-rm -f $@
|
-rm -f $@
|
||||||
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
|
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
|
||||||
if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; fi
|
||||||
else
|
else
|
||||||
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
|
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
|
||||||
-rm -f $@
|
-rm -f $@
|
||||||
-rm -f $@.bin
|
-rm -f $@.bin
|
||||||
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@.bin #{pre_obj} #{mod_obj}
|
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@.bin #{pre_obj} #{mod_obj}
|
||||||
$(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -nu -nd $@.bin $@
|
$(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -ew2030 -ew2050 -nu -nd $@.bin $@
|
||||||
-rm -f $@.bin
|
-rm -f $@.bin
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
||||||
-rm -f $@
|
-rm -f $@
|
||||||
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str}
|
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str}
|
||||||
|
|
||||||
#{mod_obj}: #{mod_src}
|
#{mod_obj}: #{mod_src}
|
||||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -c -o $@ $<
|
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -DGRUB_FILE=\\\"#{mod_src}\\\" -c -o $@ $<
|
||||||
|
|
||||||
#{mod_src}: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
|
#{mod_src}: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
|
||||||
sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
|
sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
|
||||||
|
@ -197,7 +205,7 @@ endif
|
||||||
dir = File.dirname(src)
|
dir = File.dirname(src)
|
||||||
|
|
||||||
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
||||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
|
||||||
-include #{dep}
|
-include #{dep}
|
||||||
|
|
||||||
clean-module-#{extra_target}.#{@rule_count}:
|
clean-module-#{extra_target}.#{@rule_count}:
|
||||||
|
@ -299,7 +307,7 @@ MOSTLYCLEAN_UTILITY_TARGETS += mostlyclean-utility-#{@name}.#{@rule_count}
|
||||||
dir = File.dirname(src)
|
dir = File.dirname(src)
|
||||||
|
|
||||||
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
||||||
$(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -MD -c -o $@ $<
|
$(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
|
||||||
-include #{dep}
|
-include #{dep}
|
||||||
|
|
||||||
"
|
"
|
||||||
|
@ -330,11 +338,11 @@ MOSTLYCLEANFILES += #{deps_str}
|
||||||
ifeq ($(#{prefix}_RELOCATABLE),yes)
|
ifeq ($(#{prefix}_RELOCATABLE),yes)
|
||||||
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
||||||
$(TARGET_CC) -Wl,-r,-d -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
$(TARGET_CC) -Wl,-r,-d -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||||
$(STRIP) --strip-unneeded -K start -R .note -R .comment $@
|
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K start -R .note -R .comment $@; fi
|
||||||
else
|
else
|
||||||
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
||||||
$(TARGET_CC) -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
$(TARGET_CC) -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||||
$(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@
|
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@; fi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" + objs.collect_with_index do |obj, i|
|
" + objs.collect_with_index do |obj, i|
|
||||||
|
@ -346,7 +354,7 @@ endif
|
||||||
dir = File.dirname(src)
|
dir = File.dirname(src)
|
||||||
|
|
||||||
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
||||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
|
||||||
|
|
||||||
-include #{dep}
|
-include #{dep}
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,12 @@ FNR == 1 {
|
||||||
else if ($1 != "__gnu_local_gp") {
|
else if ($1 != "__gnu_local_gp") {
|
||||||
printf "%s in %s is not defined\n", $1, module >"/dev/stderr";
|
printf "%s in %s is not defined\n", $1, module >"/dev/stderr";
|
||||||
error++;
|
error++;
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Output the result.
|
# Output the result.
|
||||||
END {
|
END {
|
||||||
if (error == 1)
|
if (error >= 1)
|
||||||
exit 1;
|
exit 1;
|
||||||
|
|
||||||
for (mod in modtab) {
|
for (mod in modtab) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ cat <<EOF
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <grub/symbol.h>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
for i in $*; do
|
for i in $*; do
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* Memory allocation on the stack.
|
/* Memory allocation on the stack.
|
||||||
|
|
||||||
Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software
|
Copyright (C) 1995, 1999, 2001-2004, 2006-2010 Free Software Foundation,
|
||||||
Foundation, Inc.
|
Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
This program is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published
|
under the terms of the GNU General Public License as published
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Error handler for noninteractive utilities
|
/* Error handler for noninteractive utilities
|
||||||
Copyright (C) 1990-1998, 2000-2007, 2009 Free Software Foundation, Inc.
|
Copyright (C) 1990-1998, 2000-2007, 2009-2010 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -86,6 +86,7 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
|
||||||
#else /* not _LIBC */
|
#else /* not _LIBC */
|
||||||
|
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
|
||||||
# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
|
# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
|
||||||
# ifndef HAVE_DECL_STRERROR_R
|
# ifndef HAVE_DECL_STRERROR_R
|
||||||
|
@ -103,6 +104,31 @@ extern char *program_name;
|
||||||
# endif /* HAVE_STRERROR_R || defined strerror_r */
|
# endif /* HAVE_STRERROR_R || defined strerror_r */
|
||||||
#endif /* not _LIBC */
|
#endif /* not _LIBC */
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
flush_stdout (void)
|
||||||
|
{
|
||||||
|
#if !_LIBC && defined F_GETFL
|
||||||
|
int stdout_fd;
|
||||||
|
|
||||||
|
# if GNULIB_FREOPEN_SAFER
|
||||||
|
/* Use of gnulib's freopen-safer module normally ensures that
|
||||||
|
fileno (stdout) == 1
|
||||||
|
whenever stdout is open. */
|
||||||
|
stdout_fd = STDOUT_FILENO;
|
||||||
|
# else
|
||||||
|
/* POSIX states that fileno (stdout) after fclose is unspecified. But in
|
||||||
|
practice it is not a problem, because stdout is statically allocated and
|
||||||
|
the fd of a FILE stream is stored as a field in its allocated memory. */
|
||||||
|
stdout_fd = fileno (stdout);
|
||||||
|
# endif
|
||||||
|
/* POSIX states that fflush (stdout) after fclose is unspecified; it
|
||||||
|
is safe in glibc, but not on all other platforms. fflush (NULL)
|
||||||
|
is always defined, but too draconian. */
|
||||||
|
if (0 <= stdout_fd && 0 <= fcntl (stdout_fd, F_GETFL))
|
||||||
|
#endif
|
||||||
|
fflush (stdout);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_errno_message (int errnum)
|
print_errno_message (int errnum)
|
||||||
{
|
{
|
||||||
|
@ -238,13 +264,7 @@ error (int status, int errnum, const char *message, ...)
|
||||||
0);
|
0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !_LIBC && defined F_GETFL
|
flush_stdout ();
|
||||||
/* POSIX states that fflush (stdout) after fclose is unspecified; it
|
|
||||||
is safe in glibc, but not on all other platforms. fflush (NULL)
|
|
||||||
is always defined, but too draconian. */
|
|
||||||
if (0 <= fcntl (1, F_GETFL))
|
|
||||||
#endif
|
|
||||||
fflush (stdout);
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
_IO_flockfile (stderr);
|
_IO_flockfile (stderr);
|
||||||
#endif
|
#endif
|
||||||
|
@ -303,13 +323,7 @@ error_at_line (int status, int errnum, const char *file_name,
|
||||||
0);
|
0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !_LIBC && defined F_GETFL
|
flush_stdout ();
|
||||||
/* POSIX states that fflush (stdout) after fclose is unspecified; it
|
|
||||||
is safe in glibc, but not on all other platforms. fflush (NULL)
|
|
||||||
is always defined, but too draconian. */
|
|
||||||
if (0 <= fcntl (1, F_GETFL))
|
|
||||||
#endif
|
|
||||||
fflush (stdout);
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
_IO_flockfile (stderr);
|
_IO_flockfile (stderr);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Declaration for error-reporting function
|
/* Declaration for error-reporting function
|
||||||
Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008, 2009, 2010 Free Software
|
||||||
|
Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -19,15 +20,14 @@
|
||||||
#define _ERROR_H 1
|
#define _ERROR_H 1
|
||||||
|
|
||||||
#ifndef __attribute__
|
#ifndef __attribute__
|
||||||
/* This feature is available in gcc versions 2.5 and later. */
|
/* The __attribute__ feature is available in gcc versions 2.5 and later.
|
||||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
The __-protected variants of the attributes 'format' and 'printf' are
|
||||||
# define __attribute__(Spec) /* empty */
|
accepted by gcc versions 2.6.4 (effectively 2.7) and later.
|
||||||
# endif
|
We enable __attribute__ only if these are supported too, because
|
||||||
/* The __-protected variants of `format' and `printf' attributes
|
gnulib and libintl do '#define printf __printf__' when they override
|
||||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
the 'printf' function. */
|
||||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||||
# define __format__ format
|
# define __attribute__(Spec) /* empty */
|
||||||
# define __printf__ printf
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
|
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
Free Software Foundation, Inc.
|
2003, 2004, 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -89,7 +89,7 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
|
||||||
# define isblank(c) ((c) == ' ' || (c) == '\t')
|
# define isblank(c) ((c) == ' ' || (c) == '\t')
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
|
# define STREQ(s1, s2) (strcmp (s1, s2) == 0)
|
||||||
|
|
||||||
# if defined _LIBC || WIDE_CHAR_SUPPORT
|
# if defined _LIBC || WIDE_CHAR_SUPPORT
|
||||||
/* The GNU C library provides support for user-defined character classes
|
/* The GNU C library provides support for user-defined character classes
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
|
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
Free Software Foundation, Inc.
|
2003, 2004, 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -382,15 +382,20 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
|
||||||
/* We found a table entry. Now see whether the
|
/* We found a table entry. Now see whether the
|
||||||
character we are currently at has the same
|
character we are currently at has the same
|
||||||
equivalance class value. */
|
equivalance class value. */
|
||||||
int len = weights[idx];
|
int len = weights[idx & 0xffffff];
|
||||||
int32_t idx2;
|
int32_t idx2;
|
||||||
const UCHAR *np = (const UCHAR *) n;
|
const UCHAR *np = (const UCHAR *) n;
|
||||||
|
|
||||||
idx2 = findidx (&np);
|
idx2 = findidx (&np);
|
||||||
if (idx2 != 0 && len == weights[idx2])
|
if (idx2 != 0
|
||||||
|
&& (idx >> 24) == (idx2 >> 24)
|
||||||
|
&& len == weights[idx2 & 0xffffff])
|
||||||
{
|
{
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
|
idx &= 0xffffff;
|
||||||
|
idx2 &= 0xffffff;
|
||||||
|
|
||||||
while (cnt < len
|
while (cnt < len
|
||||||
&& (weights[idx + 1 + cnt]
|
&& (weights[idx + 1 + cnt]
|
||||||
== weights[idx2 + 1 + cnt]))
|
== weights[idx2 + 1 + cnt]))
|
||||||
|
@ -1069,10 +1074,9 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
|
||||||
size_t plensize; \
|
size_t plensize; \
|
||||||
size_t newpsize; \
|
size_t newpsize; \
|
||||||
\
|
\
|
||||||
assert (p > startp); \
|
|
||||||
plen = (opt == L_('?') || opt == L_('@') \
|
plen = (opt == L_('?') || opt == L_('@') \
|
||||||
? pattern_len \
|
? pattern_len \
|
||||||
: (unsigned) (p - startp) + 1); \
|
: p - startp + 1UL); \
|
||||||
plensize = plen * sizeof (CHAR); \
|
plensize = plen * sizeof (CHAR); \
|
||||||
newpsize = offsetof (struct patternlist, str) + plensize; \
|
newpsize = offsetof (struct patternlist, str) + plensize; \
|
||||||
if ((size_t) -1 / sizeof (CHAR) < plen \
|
if ((size_t) -1 / sizeof (CHAR) < plen \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* getdelim.c --- Implementation of replacement getdelim function.
|
/* getdelim.c --- Implementation of replacement getdelim function.
|
||||||
Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007,
|
Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007, 2008,
|
||||||
2008, 2009 Free Software Foundation, Inc.
|
2009, 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License as
|
modify it under the terms of the GNU General Public License as
|
||||||
|
@ -21,13 +21,16 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
|
||||||
|
optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */
|
||||||
|
#define _GL_ARG_NONNULL(params)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#ifndef SSIZE_MAX
|
#ifndef SSIZE_MAX
|
||||||
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
|
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* getline.c --- Implementation of replacement getline function.
|
/* getline.c --- Implementation of replacement getline function.
|
||||||
Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License as
|
modify it under the terms of the GNU General Public License as
|
||||||
|
|
129
gnulib/getopt.c
129
gnulib/getopt.c
|
@ -1,9 +1,9 @@
|
||||||
/* Getopt for GNU.
|
/* Getopt for GNU.
|
||||||
NOTE: getopt is now part of the C library, so if you don't know what
|
NOTE: getopt is part of the C library, so if you don't know what
|
||||||
"Keep this file name-space clean" means, talk to drepper@gnu.org
|
"Keep this file name-space clean" means, talk to drepper@gnu.org
|
||||||
before changing it!
|
before changing it!
|
||||||
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006,2008
|
Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2010 Free Software
|
||||||
Free Software Foundation, Inc.
|
Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -41,12 +41,9 @@
|
||||||
# include <wchar.h>
|
# include <wchar.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef attribute_hidden
|
/* This version of `getopt' appears to the caller like standard Unix `getopt'
|
||||||
# define attribute_hidden
|
but it behaves differently for the user, since it allows the user
|
||||||
#endif
|
to intersperse the options with the other arguments.
|
||||||
|
|
||||||
/* Unlike standard Unix `getopt', functions like `getopt_long'
|
|
||||||
let the user intersperse the options with the other arguments.
|
|
||||||
|
|
||||||
As `getopt_long' works, it permutes the elements of ARGV so that,
|
As `getopt_long' works, it permutes the elements of ARGV so that,
|
||||||
when it is done, all the options precede everything else. Thus
|
when it is done, all the options precede everything else. Thus
|
||||||
|
@ -54,7 +51,7 @@
|
||||||
|
|
||||||
Using `getopt' or setting the environment variable POSIXLY_CORRECT
|
Using `getopt' or setting the environment variable POSIXLY_CORRECT
|
||||||
disables permutation.
|
disables permutation.
|
||||||
Then the application's behavior is completely standard.
|
Then the behavior is completely standard.
|
||||||
|
|
||||||
GNU application programs can use a third alternative mode in which
|
GNU application programs can use a third alternative mode in which
|
||||||
they can distinguish the relative order of options and other arguments. */
|
they can distinguish the relative order of options and other arguments. */
|
||||||
|
@ -225,8 +222,9 @@ exchange (char **argv, struct _getopt_data *d)
|
||||||
/* Initialize the internal data when the first call is made. */
|
/* Initialize the internal data when the first call is made. */
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
_getopt_initialize (int argc, char **argv, const char *optstring,
|
_getopt_initialize (int argc _GL_UNUSED,
|
||||||
int posixly_correct, struct _getopt_data *d)
|
char **argv _GL_UNUSED, const char *optstring,
|
||||||
|
struct _getopt_data *d, int posixly_correct)
|
||||||
{
|
{
|
||||||
/* Start processing options with ARGV-element 1 (since ARGV-element 0
|
/* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||||
is the program name); the sequence of previously skipped
|
is the program name); the sequence of previously skipped
|
||||||
|
@ -330,6 +328,10 @@ _getopt_initialize (int argc, char **argv, const char *optstring,
|
||||||
`flag' field is nonzero, the value of the option's `val' field
|
`flag' field is nonzero, the value of the option's `val' field
|
||||||
if the `flag' field is zero.
|
if the `flag' field is zero.
|
||||||
|
|
||||||
|
The elements of ARGV aren't really const, because we permute them.
|
||||||
|
But we pretend they're const in the prototype to be compatible
|
||||||
|
with other systems.
|
||||||
|
|
||||||
LONGOPTS is a vector of `struct option' terminated by an
|
LONGOPTS is a vector of `struct option' terminated by an
|
||||||
element containing a name which is zero.
|
element containing a name which is zero.
|
||||||
|
|
||||||
|
@ -338,15 +340,12 @@ _getopt_initialize (int argc, char **argv, const char *optstring,
|
||||||
recent call.
|
recent call.
|
||||||
|
|
||||||
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
|
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
|
||||||
long-named options.
|
long-named options. */
|
||||||
|
|
||||||
If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT
|
|
||||||
environment variable were set. */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_getopt_internal_r (int argc, char **argv, const char *optstring,
|
_getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
const struct option *longopts, int *longind,
|
const struct option *longopts, int *longind,
|
||||||
int long_only, int posixly_correct, struct _getopt_data *d)
|
int long_only, struct _getopt_data *d, int posixly_correct)
|
||||||
{
|
{
|
||||||
int print_errors = d->opterr;
|
int print_errors = d->opterr;
|
||||||
if (optstring[0] == ':')
|
if (optstring[0] == ':')
|
||||||
|
@ -361,8 +360,8 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
{
|
{
|
||||||
if (d->optind == 0)
|
if (d->optind == 0)
|
||||||
d->optind = 1; /* Don't scan ARGV[0], the program name. */
|
d->optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||||
optstring = _getopt_initialize (argc, argv, optstring,
|
optstring = _getopt_initialize (argc, argv, optstring, d,
|
||||||
posixly_correct, d);
|
posixly_correct);
|
||||||
d->__initialized = 1;
|
d->__initialized = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,7 +522,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
|
if (__asprintf (&buf, _("%s: option '%s' is ambiguous\n"),
|
||||||
argv[0], argv[d->optind]) >= 0)
|
argv[0], argv[d->optind]) >= 0)
|
||||||
{
|
{
|
||||||
_IO_flockfile (stderr);
|
_IO_flockfile (stderr);
|
||||||
|
@ -539,7 +538,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
free (buf);
|
free (buf);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
|
fprintf (stderr, _("%s: option '%s' is ambiguous\n"),
|
||||||
argv[0], argv[d->optind]);
|
argv[0], argv[d->optind]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -573,11 +572,11 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
/* --option */
|
/* --option */
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
n = __asprintf (&buf, _("\
|
n = __asprintf (&buf, _("\
|
||||||
%s: option `--%s' doesn't allow an argument\n"),
|
%s: option '--%s' doesn't allow an argument\n"),
|
||||||
argv[0], pfound->name);
|
argv[0], pfound->name);
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, _("\
|
fprintf (stderr, _("\
|
||||||
%s: option `--%s' doesn't allow an argument\n"),
|
%s: option '--%s' doesn't allow an argument\n"),
|
||||||
argv[0], pfound->name);
|
argv[0], pfound->name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -586,12 +585,12 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
/* +option or -option */
|
/* +option or -option */
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
n = __asprintf (&buf, _("\
|
n = __asprintf (&buf, _("\
|
||||||
%s: option `%c%s' doesn't allow an argument\n"),
|
%s: option '%c%s' doesn't allow an argument\n"),
|
||||||
argv[0], argv[d->optind - 1][0],
|
argv[0], argv[d->optind - 1][0],
|
||||||
pfound->name);
|
pfound->name);
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, _("\
|
fprintf (stderr, _("\
|
||||||
%s: option `%c%s' doesn't allow an argument\n"),
|
%s: option '%c%s' doesn't allow an argument\n"),
|
||||||
argv[0], argv[d->optind - 1][0],
|
argv[0], argv[d->optind - 1][0],
|
||||||
pfound->name);
|
pfound->name);
|
||||||
#endif
|
#endif
|
||||||
|
@ -634,7 +633,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (__asprintf (&buf, _("\
|
if (__asprintf (&buf, _("\
|
||||||
%s: option `%s' requires an argument\n"),
|
%s: option '%s' requires an argument\n"),
|
||||||
argv[0], argv[d->optind - 1]) >= 0)
|
argv[0], argv[d->optind - 1]) >= 0)
|
||||||
{
|
{
|
||||||
_IO_flockfile (stderr);
|
_IO_flockfile (stderr);
|
||||||
|
@ -652,7 +651,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: option `%s' requires an argument\n"),
|
_("%s: option '%s' requires an argument\n"),
|
||||||
argv[0], argv[d->optind - 1]);
|
argv[0], argv[d->optind - 1]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -690,10 +689,10 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
{
|
{
|
||||||
/* --option */
|
/* --option */
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
|
n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"),
|
||||||
argv[0], d->__nextchar);
|
argv[0], d->__nextchar);
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
|
fprintf (stderr, _("%s: unrecognized option '--%s'\n"),
|
||||||
argv[0], d->__nextchar);
|
argv[0], d->__nextchar);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -701,10 +700,10 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
{
|
{
|
||||||
/* +option or -option */
|
/* +option or -option */
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
|
n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"),
|
||||||
argv[0], argv[d->optind][0], d->__nextchar);
|
argv[0], argv[d->optind][0], d->__nextchar);
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
|
fprintf (stderr, _("%s: unrecognized option '%c%s'\n"),
|
||||||
argv[0], argv[d->optind][0], d->__nextchar);
|
argv[0], argv[d->optind][0], d->__nextchar);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -752,25 +751,12 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
int n;
|
int n;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (d->__posixly_correct)
|
|
||||||
{
|
|
||||||
/* 1003.2 specifies the format of this message. */
|
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
n = __asprintf (&buf, _("%s: illegal option -- %c\n"),
|
n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"),
|
||||||
argv[0], c);
|
argv[0], c);
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
|
fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
|
||||||
n = __asprintf (&buf, _("%s: invalid option -- %c\n"),
|
|
||||||
argv[0], c);
|
|
||||||
#else
|
|
||||||
fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
if (n >= 0)
|
if (n >= 0)
|
||||||
|
@ -815,12 +801,11 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
{
|
{
|
||||||
if (print_errors)
|
if (print_errors)
|
||||||
{
|
{
|
||||||
/* 1003.2 specifies the format of this message. */
|
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (__asprintf (&buf,
|
if (__asprintf (&buf,
|
||||||
_("%s: option requires an argument -- %c\n"),
|
_("%s: option requires an argument -- '%c'\n"),
|
||||||
argv[0], c) >= 0)
|
argv[0], c) >= 0)
|
||||||
{
|
{
|
||||||
_IO_flockfile (stderr);
|
_IO_flockfile (stderr);
|
||||||
|
@ -836,7 +821,8 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
free (buf);
|
free (buf);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, _("%s: option requires an argument -- %c\n"),
|
fprintf (stderr,
|
||||||
|
_("%s: option requires an argument -- '%c'\n"),
|
||||||
argv[0], c);
|
argv[0], c);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -889,7 +875,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
|
if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"),
|
||||||
argv[0], argv[d->optind]) >= 0)
|
argv[0], argv[d->optind]) >= 0)
|
||||||
{
|
{
|
||||||
_IO_flockfile (stderr);
|
_IO_flockfile (stderr);
|
||||||
|
@ -905,7 +891,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
free (buf);
|
free (buf);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
|
fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"),
|
||||||
argv[0], argv[d->optind]);
|
argv[0], argv[d->optind]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -930,7 +916,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (__asprintf (&buf, _("\
|
if (__asprintf (&buf, _("\
|
||||||
%s: option `-W %s' doesn't allow an argument\n"),
|
%s: option '-W %s' doesn't allow an argument\n"),
|
||||||
argv[0], pfound->name) >= 0)
|
argv[0], pfound->name) >= 0)
|
||||||
{
|
{
|
||||||
_IO_flockfile (stderr);
|
_IO_flockfile (stderr);
|
||||||
|
@ -948,7 +934,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, _("\
|
fprintf (stderr, _("\
|
||||||
%s: option `-W %s' doesn't allow an argument\n"),
|
%s: option '-W %s' doesn't allow an argument\n"),
|
||||||
argv[0], pfound->name);
|
argv[0], pfound->name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -969,7 +955,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (__asprintf (&buf, _("\
|
if (__asprintf (&buf, _("\
|
||||||
%s: option `%s' requires an argument\n"),
|
%s: option '%s' requires an argument\n"),
|
||||||
argv[0], argv[d->optind - 1]) >= 0)
|
argv[0], argv[d->optind - 1]) >= 0)
|
||||||
{
|
{
|
||||||
_IO_flockfile (stderr);
|
_IO_flockfile (stderr);
|
||||||
|
@ -987,7 +973,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: option `%s' requires an argument\n"),
|
_("%s: option '%s' requires an argument\n"),
|
||||||
argv[0], argv[d->optind - 1]);
|
argv[0], argv[d->optind - 1]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1036,12 +1022,11 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
{
|
{
|
||||||
if (print_errors)
|
if (print_errors)
|
||||||
{
|
{
|
||||||
/* 1003.2 specifies the format of this message. */
|
|
||||||
#if defined _LIBC && defined USE_IN_LIBIO
|
#if defined _LIBC && defined USE_IN_LIBIO
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (__asprintf (&buf, _("\
|
if (__asprintf (&buf, _("\
|
||||||
%s: option requires an argument -- %c\n"),
|
%s: option requires an argument -- '%c'\n"),
|
||||||
argv[0], c) >= 0)
|
argv[0], c) >= 0)
|
||||||
{
|
{
|
||||||
_IO_flockfile (stderr);
|
_IO_flockfile (stderr);
|
||||||
|
@ -1058,7 +1043,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: option requires an argument -- %c\n"),
|
_("%s: option requires an argument -- '%c'\n"),
|
||||||
argv[0], c);
|
argv[0], c);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1081,16 +1066,17 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||||
|
|
||||||
int
|
int
|
||||||
_getopt_internal (int argc, char **argv, const char *optstring,
|
_getopt_internal (int argc, char **argv, const char *optstring,
|
||||||
const struct option *longopts, int *longind,
|
const struct option *longopts, int *longind, int long_only,
|
||||||
int long_only, int posixly_correct)
|
int posixly_correct)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
getopt_data.optind = optind;
|
getopt_data.optind = optind;
|
||||||
getopt_data.opterr = opterr;
|
getopt_data.opterr = opterr;
|
||||||
|
|
||||||
result = _getopt_internal_r (argc, argv, optstring, longopts, longind,
|
result = _getopt_internal_r (argc, argv, optstring, longopts,
|
||||||
long_only, posixly_correct, &getopt_data);
|
longind, long_only, &getopt_data,
|
||||||
|
posixly_correct);
|
||||||
|
|
||||||
optind = getopt_data.optind;
|
optind = getopt_data.optind;
|
||||||
optarg = getopt_data.optarg;
|
optarg = getopt_data.optarg;
|
||||||
|
@ -1110,10 +1096,23 @@ enum { POSIXLY_CORRECT = 1 };
|
||||||
int
|
int
|
||||||
getopt (int argc, char *const *argv, const char *optstring)
|
getopt (int argc, char *const *argv, const char *optstring)
|
||||||
{
|
{
|
||||||
return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0,
|
return _getopt_internal (argc, (char **) argv, optstring,
|
||||||
POSIXLY_CORRECT);
|
(const struct option *) 0,
|
||||||
|
(int *) 0,
|
||||||
|
0, POSIXLY_CORRECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
int
|
||||||
|
__posix_getopt (int argc, char *const *argv, const char *optstring)
|
||||||
|
{
|
||||||
|
return _getopt_internal (argc, argv, optstring,
|
||||||
|
(const struct option *) 0,
|
||||||
|
(int *) 0,
|
||||||
|
0, 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
|
|
||||||
|
@ -1161,7 +1160,7 @@ main (int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
printf ("option c with value `%s'\n", optarg);
|
printf ("option c with value '%s'\n", optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006
|
Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997,
|
||||||
Free Software Foundation, Inc.
|
1998, 2004, 2006, 2009, 2010 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -50,7 +50,7 @@ _getopt_long_r (int argc, char **argv, const char *options,
|
||||||
struct _getopt_data *d)
|
struct _getopt_data *d)
|
||||||
{
|
{
|
||||||
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
||||||
0, 0, d);
|
0, d, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||||
|
@ -73,7 +73,7 @@ _getopt_long_only_r (int argc, char **argv, const char *options,
|
||||||
struct _getopt_data *d)
|
struct _getopt_data *d)
|
||||||
{
|
{
|
||||||
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
||||||
1, 0, d);
|
1, d, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int this_option_optind = optind ? optind : 1;
|
int this_option_optind = optind ? optind : 1;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
static struct option long_options[] =
|
static const struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"add", 1, 0, 0},
|
{"add", 1, 0, 0},
|
||||||
{"append", 0, 0, 0},
|
{"append", 0, 0, 0},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Internal declarations for getopt.
|
/* Internal declarations for getopt.
|
||||||
Copyright (C) 1989-1994,1996-1999,2001,2003,2004
|
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2010 Free Software
|
||||||
Free Software Foundation, Inc.
|
Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -19,6 +19,8 @@
|
||||||
#ifndef _GETOPT_INT_H
|
#ifndef _GETOPT_INT_H
|
||||||
#define _GETOPT_INT_H 1
|
#define _GETOPT_INT_H 1
|
||||||
|
|
||||||
|
#include <getopt.h>
|
||||||
|
|
||||||
extern int _getopt_internal (int ___argc, char **___argv,
|
extern int _getopt_internal (int ___argc, char **___argv,
|
||||||
const char *__shortopts,
|
const char *__shortopts,
|
||||||
const struct option *__longopts, int *__longind,
|
const struct option *__longopts, int *__longind,
|
||||||
|
@ -113,8 +115,8 @@ struct _getopt_data
|
||||||
extern int _getopt_internal_r (int ___argc, char **___argv,
|
extern int _getopt_internal_r (int ___argc, char **___argv,
|
||||||
const char *__shortopts,
|
const char *__shortopts,
|
||||||
const struct option *__longopts, int *__longind,
|
const struct option *__longopts, int *__longind,
|
||||||
int __long_only, int __posixly_correct,
|
int __long_only, struct _getopt_data *__data,
|
||||||
struct _getopt_data *__data);
|
int __posixly_correct);
|
||||||
|
|
||||||
extern int _getopt_long_r (int ___argc, char **___argv,
|
extern int _getopt_long_r (int ___argc, char **___argv,
|
||||||
const char *__shortopts,
|
const char *__shortopts,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Convenience header for conditional use of GNU <libintl.h>.
|
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||||
Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc.
|
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 Free Software
|
||||||
|
Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -63,21 +64,30 @@
|
||||||
for invalid uses of the value returned from these functions.
|
for invalid uses of the value returned from these functions.
|
||||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||||
contain "#define const". */
|
contain "#define const". */
|
||||||
|
# undef gettext
|
||||||
# define gettext(Msgid) ((const char *) (Msgid))
|
# define gettext(Msgid) ((const char *) (Msgid))
|
||||||
|
# undef dgettext
|
||||||
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
|
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
|
||||||
|
# undef dcgettext
|
||||||
# define dcgettext(Domainname, Msgid, Category) \
|
# define dcgettext(Domainname, Msgid, Category) \
|
||||||
((void) (Category), dgettext (Domainname, Msgid))
|
((void) (Category), dgettext (Domainname, Msgid))
|
||||||
|
# undef ngettext
|
||||||
# define ngettext(Msgid1, Msgid2, N) \
|
# define ngettext(Msgid1, Msgid2, N) \
|
||||||
((N) == 1 \
|
((N) == 1 \
|
||||||
? ((void) (Msgid2), (const char *) (Msgid1)) \
|
? ((void) (Msgid2), (const char *) (Msgid1)) \
|
||||||
: ((void) (Msgid1), (const char *) (Msgid2)))
|
: ((void) (Msgid1), (const char *) (Msgid2)))
|
||||||
|
# undef dngettext
|
||||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||||
((void) (Domainname), ngettext (Msgid1, Msgid2, N))
|
((void) (Domainname), ngettext (Msgid1, Msgid2, N))
|
||||||
|
# undef dcngettext
|
||||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||||
((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
|
((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
|
||||||
|
# undef textdomain
|
||||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
# define textdomain(Domainname) ((const char *) (Domainname))
|
||||||
|
# undef bindtextdomain
|
||||||
# define bindtextdomain(Domainname, Dirname) \
|
# define bindtextdomain(Domainname, Dirname) \
|
||||||
((void) (Domainname), (const char *) (Dirname))
|
((void) (Domainname), (const char *) (Dirname))
|
||||||
|
# undef bind_textdomain_codeset
|
||||||
# define bind_textdomain_codeset(Domainname, Codeset) \
|
# define bind_textdomain_codeset(Domainname, Codeset) \
|
||||||
((void) (Domainname), (const char *) (Codeset))
|
((void) (Domainname), (const char *) (Codeset))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Program name management.
|
/* Program name management.
|
||||||
Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc.
|
Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc.
|
||||||
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
Written by Bruno Haible <bruno@clisp.org>, 2001.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,6 +23,8 @@
|
||||||
#include "progname.h"
|
#include "progname.h"
|
||||||
|
|
||||||
#include <errno.h> /* get program_invocation_name declaration */
|
#include <errno.h> /* get program_invocation_name declaration */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +32,9 @@
|
||||||
To be initialized by main(). */
|
To be initialized by main(). */
|
||||||
const char *program_name = NULL;
|
const char *program_name = NULL;
|
||||||
|
|
||||||
/* Set program_name, based on argv[0]. */
|
/* Set program_name, based on argv[0].
|
||||||
|
argv0 must be a string allocated with indefinite extent, and must not be
|
||||||
|
modified after this call. */
|
||||||
void
|
void
|
||||||
set_program_name (const char *argv0)
|
set_program_name (const char *argv0)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +46,16 @@ set_program_name (const char *argv0)
|
||||||
const char *slash;
|
const char *slash;
|
||||||
const char *base;
|
const char *base;
|
||||||
|
|
||||||
|
/* Sanity check. POSIX requires the invoking process to pass a non-NULL
|
||||||
|
argv[0]. */
|
||||||
|
if (argv0 == NULL)
|
||||||
|
{
|
||||||
|
/* It's a bug in the invoking program. Help diagnosing it. */
|
||||||
|
fputs ("A NULL argv[0] was passed through an exec system call.\n",
|
||||||
|
stderr);
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
slash = strrchr (argv0, '/');
|
slash = strrchr (argv0, '/');
|
||||||
base = (slash != NULL ? slash + 1 : argv0);
|
base = (slash != NULL ? slash + 1 : argv0);
|
||||||
if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0)
|
if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Program name management.
|
/* Program name management.
|
||||||
Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
|
Copyright (C) 2001-2004, 2006, 2009-2010 Free Software Foundation, Inc.
|
||||||
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
Written by Bruno Haible <bruno@clisp.org>, 2001.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -31,7 +31,9 @@ extern "C" {
|
||||||
/* String containing name the program is called with. */
|
/* String containing name the program is called with. */
|
||||||
extern const char *program_name;
|
extern const char *program_name;
|
||||||
|
|
||||||
/* Set program_name, based on argv[0]. */
|
/* Set program_name, based on argv[0].
|
||||||
|
argv0 must be a string allocated with indefinite extent, and must not be
|
||||||
|
modified after this call. */
|
||||||
extern void set_program_name (const char *argv0);
|
extern void set_program_name (const char *argv0);
|
||||||
|
|
||||||
#if ENABLE_RELOCATABLE
|
#if ENABLE_RELOCATABLE
|
||||||
|
|
|
@ -84,7 +84,7 @@ grub_read_hook_datetime (struct grub_env_var *var,
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_INIT(datetime)
|
GRUB_MOD_INIT(datehook)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ GRUB_MOD_INIT(datetime)
|
||||||
grub_read_hook_datetime, 0);
|
grub_read_hook_datetime, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(datetime)
|
GRUB_MOD_FINI(datehook)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,7 @@ union grub_aout_header
|
||||||
#define AOUT_MID_I386 134 /* i386 BSD binary */
|
#define AOUT_MID_I386 134 /* i386 BSD binary */
|
||||||
#define AOUT_MID_SPARC 138 /* sparc */
|
#define AOUT_MID_SPARC 138 /* sparc */
|
||||||
#define AOUT_MID_HP200 200 /* hp200 (68010) BSD binary */
|
#define AOUT_MID_HP200 200 /* hp200 (68010) BSD binary */
|
||||||
|
#define AOUT_MID_SUN 0x103
|
||||||
#define AOUT_MID_HP300 300 /* hp300 (68020+68881) BSD binary */
|
#define AOUT_MID_HP300 300 /* hp300 (68020+68881) BSD binary */
|
||||||
#define AOUT_MID_HPUX 0x20C /* hp200/300 HP-UX binary */
|
#define AOUT_MID_HPUX 0x20C /* hp200/300 HP-UX binary */
|
||||||
#define AOUT_MID_HPUX800 0x20B /* hp800 HP-UX binary */
|
#define AOUT_MID_HPUX800 0x20B /* hp800 HP-UX binary */
|
||||||
|
@ -114,10 +115,14 @@ union grub_aout_header
|
||||||
#define AOUT_GETMID(header) ((header).a_midmag >> 16) & 0x03ff)
|
#define AOUT_GETMID(header) ((header).a_midmag >> 16) & 0x03ff)
|
||||||
#define AOUT_GETFLAG(header) ((header).a_midmag >> 26) & 0x3f)
|
#define AOUT_GETFLAG(header) ((header).a_midmag >> 26) & 0x3f)
|
||||||
|
|
||||||
|
#ifndef GRUB_UTIL
|
||||||
|
|
||||||
int EXPORT_FUNC(grub_aout_get_type) (union grub_aout_header *header);
|
int EXPORT_FUNC(grub_aout_get_type) (union grub_aout_header *header);
|
||||||
|
|
||||||
grub_err_t EXPORT_FUNC(grub_aout_load) (grub_file_t file, int offset,
|
grub_err_t EXPORT_FUNC(grub_aout_load) (grub_file_t file, int offset,
|
||||||
grub_addr_t load_addr, int load_size,
|
grub_addr_t load_addr, int load_size,
|
||||||
grub_addr_t bss_end_addr);
|
grub_addr_t bss_end_addr);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ! GRUB_AOUT_HEADER */
|
#endif /* ! GRUB_AOUT_HEADER */
|
||||||
|
|
89
include/grub/bsdlabel.h
Normal file
89
include/grub/bsdlabel.h
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 1999,2000,2001,2002,2004,2007 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GRUB_BSDLABEL_PARTITION_HEADER
|
||||||
|
#define GRUB_BSDLABEL_PARTITION_HEADER 1
|
||||||
|
|
||||||
|
/* Constants for BSD disk label. */
|
||||||
|
#define GRUB_PC_PARTITION_BSD_LABEL_SECTOR 1
|
||||||
|
#define GRUB_PC_PARTITION_BSD_LABEL_MAGIC 0x82564557
|
||||||
|
|
||||||
|
/* BSD partition types. */
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_UNUSED 0
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_SWAP 1
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_V6 2
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_V7 3
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_SYSV 4
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_V71K 5
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_V8 6
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_BSDFFS 7
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_MSDOS 8
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_BSDLFS 9
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_OTHER 10
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_HPFS 11
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_ISO9660 12
|
||||||
|
#define GRUB_PC_PARTITION_BSD_TYPE_BOOT 13
|
||||||
|
|
||||||
|
/* FreeBSD-specific types. */
|
||||||
|
#define GRUB_PC_PARTITION_FREEBSD_TYPE_VINUM 14
|
||||||
|
#define GRUB_PC_PARTITION_FREEBSD_TYPE_RAID 15
|
||||||
|
#define GRUB_PC_PARTITION_FREEBSD_TYPE_JFS2 21
|
||||||
|
|
||||||
|
/* NetBSD-specific types. */
|
||||||
|
#define GRUB_PC_PARTITION_NETBSD_TYPE_ADOS 14
|
||||||
|
#define GRUB_PC_PARTITION_NETBSD_TYPE_HFS 15
|
||||||
|
#define GRUB_PC_PARTITION_NETBSD_TYPE_FILECORE 16
|
||||||
|
#define GRUB_PC_PARTITION_NETBSD_TYPE_EXT2FS 17
|
||||||
|
#define GRUB_PC_PARTITION_NETBSD_TYPE_NTFS 18
|
||||||
|
#define GRUB_PC_PARTITION_NETBSD_TYPE_RAID 19
|
||||||
|
#define GRUB_PC_PARTITION_NETBSD_TYPE_CCD 20
|
||||||
|
#define GRUB_PC_PARTITION_NETBSD_TYPE_JFS2 21
|
||||||
|
#define GRUB_PC_PARTITION_NETBSD_TYPE_APPLEUFS 22
|
||||||
|
|
||||||
|
/* OpenBSD-specific types. */
|
||||||
|
#define GRUB_PC_PARTITION_OPENBSD_TYPE_ADOS 14
|
||||||
|
#define GRUB_PC_PARTITION_OPENBSD_TYPE_HFS 15
|
||||||
|
#define GRUB_PC_PARTITION_OPENBSD_TYPE_FILECORE 16
|
||||||
|
#define GRUB_PC_PARTITION_OPENBSD_TYPE_EXT2FS 17
|
||||||
|
#define GRUB_PC_PARTITION_OPENBSD_TYPE_NTFS 18
|
||||||
|
#define GRUB_PC_PARTITION_OPENBSD_TYPE_RAID 19
|
||||||
|
|
||||||
|
/* The BSD partition entry. */
|
||||||
|
struct grub_partition_bsd_entry
|
||||||
|
{
|
||||||
|
grub_uint32_t size;
|
||||||
|
grub_uint32_t offset;
|
||||||
|
grub_uint32_t fragment_size;
|
||||||
|
grub_uint8_t fs_type;
|
||||||
|
grub_uint8_t fs_fragments;
|
||||||
|
grub_uint16_t fs_cylinders;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* The BSD disk label. Only define members useful for GRUB. */
|
||||||
|
struct grub_partition_bsd_disk_label
|
||||||
|
{
|
||||||
|
grub_uint32_t magic;
|
||||||
|
grub_uint8_t padding[128];
|
||||||
|
grub_uint32_t magic2;
|
||||||
|
grub_uint16_t checksum;
|
||||||
|
grub_uint16_t num_partitions;
|
||||||
|
grub_uint32_t boot_size;
|
||||||
|
grub_uint32_t superblock_size;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
#endif /* ! GRUB_PC_PARTITION_HEADER */
|
|
@ -33,10 +33,17 @@ struct grub_datetime
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Return date and time. */
|
/* Return date and time. */
|
||||||
|
#ifdef GRUB_MACHINE_EMU
|
||||||
|
grub_err_t EXPORT_FUNC(grub_get_datetime) (struct grub_datetime *datetime);
|
||||||
|
|
||||||
|
/* Set date and time. */
|
||||||
|
grub_err_t EXPORT_FUNC(grub_set_datetime) (struct grub_datetime *datetime);
|
||||||
|
#else
|
||||||
grub_err_t grub_get_datetime (struct grub_datetime *datetime);
|
grub_err_t grub_get_datetime (struct grub_datetime *datetime);
|
||||||
|
|
||||||
/* Set date and time. */
|
/* Set date and time. */
|
||||||
grub_err_t grub_set_datetime (struct grub_datetime *datetime);
|
grub_err_t grub_set_datetime (struct grub_datetime *datetime);
|
||||||
|
#endif
|
||||||
|
|
||||||
int grub_get_weekday (struct grub_datetime *datetime);
|
int grub_get_weekday (struct grub_datetime *datetime);
|
||||||
char *grub_get_weekday_name (struct grub_datetime *datetime);
|
char *grub_get_weekday_name (struct grub_datetime *datetime);
|
||||||
|
|
|
@ -91,7 +91,12 @@ grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
|
||||||
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
|
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
|
||||||
void grub_dl_unload_unneeded (void);
|
void grub_dl_unload_unneeded (void);
|
||||||
void grub_dl_unload_all (void);
|
void grub_dl_unload_all (void);
|
||||||
#ifdef GRUB_UTIL
|
#if defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
|
||||||
|
#define GRUB_NO_MODULES 1
|
||||||
|
#else
|
||||||
|
#define GRUB_NO_MODULES 0
|
||||||
|
#endif
|
||||||
|
#if GRUB_NO_MODULES
|
||||||
static inline int
|
static inline int
|
||||||
grub_dl_ref (grub_dl_t mod)
|
grub_dl_ref (grub_dl_t mod)
|
||||||
{
|
{
|
||||||
|
@ -116,7 +121,7 @@ grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
||||||
grub_err_t grub_arch_dl_check_header (void *ehdr);
|
grub_err_t grub_arch_dl_check_header (void *ehdr);
|
||||||
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
|
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
|
||||||
|
|
||||||
#if defined (_mips) && ! defined (GRUB_UTIL)
|
#if defined (_mips) && ! defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
|
||||||
#define GRUB_LINKER_HAVE_INIT 1
|
#define GRUB_LINKER_HAVE_INIT 1
|
||||||
void grub_arch_dl_init_linker (void);
|
void grub_arch_dl_init_linker (void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||||
|
|
||||||
/* NLS can be disabled through the configure --disable-nls option. */
|
/* NLS can be disabled through the configure --disable-nls option. */
|
||||||
#if ENABLE_NLS
|
#if (defined(ENABLE_NLS) && ENABLE_NLS)
|
||||||
|
|
||||||
# ifdef GRUB_UTIL
|
# ifdef GRUB_UTIL
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||||
|
|
||||||
# endif /* GRUB_UTIL */
|
# endif /* GRUB_UTIL */
|
||||||
|
|
||||||
#else /* ! ENABLE_NLS */
|
#else /* ! (defined(ENABLE_NLS) && ENABLE_NLS) */
|
||||||
|
|
||||||
/* Disabled NLS.
|
/* Disabled NLS.
|
||||||
The casts to 'const char *' serve the purpose of producing warnings
|
The casts to 'const char *' serve the purpose of producing warnings
|
||||||
|
@ -47,7 +47,7 @@ extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||||
# define grub_gettext(str) ((const char *) (str))
|
# define grub_gettext(str) ((const char *) (str))
|
||||||
# endif /* GRUB_UTIL */
|
# endif /* GRUB_UTIL */
|
||||||
|
|
||||||
#endif /* ENABLE_NLS */
|
#endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
# define _(str) gettext(str)
|
# define _(str) gettext(str)
|
||||||
|
|
1
include/grub/i386/efi/serial.h
Normal file
1
include/grub/i386/efi/serial.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/serial.h>
|
|
@ -180,4 +180,8 @@ EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt,
|
||||||
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
|
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
|
||||||
char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
|
char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
|
||||||
|
|
||||||
|
int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook)
|
||||||
|
(struct grub_ieee1275_devalias *
|
||||||
|
alias));
|
||||||
|
|
||||||
#endif /* ! GRUB_IEEE1275_HEADER */
|
#endif /* ! GRUB_IEEE1275_HEADER */
|
||||||
|
|
|
@ -59,6 +59,8 @@ extern grub_addr_t grub_arch_modules_addr (void);
|
||||||
|
|
||||||
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
|
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
|
||||||
|
|
||||||
|
grub_addr_t grub_modules_get_end (void);
|
||||||
|
|
||||||
/* The start point of the C code. */
|
/* The start point of the C code. */
|
||||||
void grub_main (void);
|
void grub_main (void);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ grub_bad_type_cast_real (int line, const char *file)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define grub_bad_type_cast() grub_bad_type_cast_real(__LINE__, __FILE__)
|
#define grub_bad_type_cast() grub_bad_type_cast_real(__LINE__, GRUB_FILE)
|
||||||
|
|
||||||
#define GRUB_FIELD_MATCH(ptr, type, field) \
|
#define GRUB_FIELD_MATCH(ptr, type, field) \
|
||||||
((char *) &(ptr)->field == (char *) &((type) (ptr))->field)
|
((char *) &(ptr)->field == (char *) &((type) (ptr))->field)
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
|
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
|
||||||
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
|
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
|
||||||
|
|
||||||
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, __LINE__, condition, fmt, ## args)
|
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args)
|
||||||
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
|
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
|
||||||
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))
|
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
|
||||||
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
|
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
|
||||||
|
|
||||||
/* For debugging. */
|
/* For debugging. */
|
||||||
#if defined(MM_DEBUG) && !defined(GRUB_UTIL)
|
#if defined(MM_DEBUG) && !defined(GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
|
||||||
/* Set this variable to 1 when you want to trace all memory function calls. */
|
/* Set this variable to 1 when you want to trace all memory function calls. */
|
||||||
extern int EXPORT_VAR(grub_mm_debug);
|
extern int EXPORT_VAR(grub_mm_debug);
|
||||||
|
|
||||||
|
@ -44,19 +44,19 @@ void grub_mm_dump_free (void);
|
||||||
void grub_mm_dump (unsigned lineno);
|
void grub_mm_dump (unsigned lineno);
|
||||||
|
|
||||||
#define grub_malloc(size) \
|
#define grub_malloc(size) \
|
||||||
grub_debug_malloc (__FILE__, __LINE__, size)
|
grub_debug_malloc (GRUB_FILE, __LINE__, size)
|
||||||
|
|
||||||
#define grub_zalloc(size) \
|
#define grub_zalloc(size) \
|
||||||
grub_debug_zalloc (__FILE__, __LINE__, size)
|
grub_debug_zalloc (GRUB_FILE, __LINE__, size)
|
||||||
|
|
||||||
#define grub_realloc(ptr,size) \
|
#define grub_realloc(ptr,size) \
|
||||||
grub_debug_realloc (__FILE__, __LINE__, ptr, size)
|
grub_debug_realloc (GRUB_FILE, __LINE__, ptr, size)
|
||||||
|
|
||||||
#define grub_memalign(align,size) \
|
#define grub_memalign(align,size) \
|
||||||
grub_debug_memalign (__FILE__, __LINE__, align, size)
|
grub_debug_memalign (GRUB_FILE, __LINE__, align, size)
|
||||||
|
|
||||||
#define grub_free(ptr) \
|
#define grub_free(ptr) \
|
||||||
grub_debug_free (__FILE__, __LINE__, ptr)
|
grub_debug_free (GRUB_FILE, __LINE__, ptr)
|
||||||
|
|
||||||
void *EXPORT_FUNC(grub_debug_malloc) (const char *file, int line,
|
void *EXPORT_FUNC(grub_debug_malloc) (const char *file, int line,
|
||||||
grub_size_t size);
|
grub_size_t size);
|
||||||
|
|
|
@ -53,75 +53,6 @@
|
||||||
#define GRUB_PC_PARTITION_TYPE_GPT_DISK 0xee
|
#define GRUB_PC_PARTITION_TYPE_GPT_DISK 0xee
|
||||||
#define GRUB_PC_PARTITION_TYPE_LINUX_RAID 0xfd
|
#define GRUB_PC_PARTITION_TYPE_LINUX_RAID 0xfd
|
||||||
|
|
||||||
/* Constants for BSD disk label. */
|
|
||||||
#define GRUB_PC_PARTITION_BSD_LABEL_SECTOR 1
|
|
||||||
#define GRUB_PC_PARTITION_BSD_LABEL_MAGIC 0x82564557
|
|
||||||
#define GRUB_PC_PARTITION_BSD_MAX_ENTRIES 8
|
|
||||||
|
|
||||||
/* BSD partition types. */
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_UNUSED 0
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_SWAP 1
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_V6 2
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_V7 3
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_SYSV 4
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_V71K 5
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_V8 6
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_BSDFFS 7
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_MSDOS 8
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_BSDLFS 9
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_OTHER 10
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_HPFS 11
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_ISO9660 12
|
|
||||||
#define GRUB_PC_PARTITION_BSD_TYPE_BOOT 13
|
|
||||||
|
|
||||||
/* FreeBSD-specific types. */
|
|
||||||
#define GRUB_PC_PARTITION_FREEBSD_TYPE_VINUM 14
|
|
||||||
#define GRUB_PC_PARTITION_FREEBSD_TYPE_RAID 15
|
|
||||||
#define GRUB_PC_PARTITION_FREEBSD_TYPE_JFS2 21
|
|
||||||
|
|
||||||
/* NetBSD-specific types. */
|
|
||||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_ADOS 14
|
|
||||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_HFS 15
|
|
||||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_FILECORE 16
|
|
||||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_EXT2FS 17
|
|
||||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_NTFS 18
|
|
||||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_RAID 19
|
|
||||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_CCD 20
|
|
||||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_JFS2 21
|
|
||||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_APPLEUFS 22
|
|
||||||
|
|
||||||
/* OpenBSD-specific types. */
|
|
||||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_ADOS 14
|
|
||||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_HFS 15
|
|
||||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_FILECORE 16
|
|
||||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_EXT2FS 17
|
|
||||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_NTFS 18
|
|
||||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_RAID 19
|
|
||||||
|
|
||||||
/* The BSD partition entry. */
|
|
||||||
struct grub_msdos_partition_bsd_entry
|
|
||||||
{
|
|
||||||
grub_uint32_t size;
|
|
||||||
grub_uint32_t offset;
|
|
||||||
grub_uint32_t fragment_size;
|
|
||||||
grub_uint8_t fs_type;
|
|
||||||
grub_uint8_t fs_fragments;
|
|
||||||
grub_uint16_t fs_cylinders;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* The BSD disk label. Only define members useful for GRUB. */
|
|
||||||
struct grub_msdos_partition_disk_label
|
|
||||||
{
|
|
||||||
grub_uint32_t magic;
|
|
||||||
grub_uint8_t padding[128];
|
|
||||||
grub_uint32_t magic2;
|
|
||||||
grub_uint16_t checksum;
|
|
||||||
grub_uint16_t num_partitions;
|
|
||||||
grub_uint32_t boot_size;
|
|
||||||
grub_uint32_t superblock_size;
|
|
||||||
struct grub_msdos_partition_bsd_entry entries[GRUB_PC_PARTITION_BSD_MAX_ENTRIES];
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* The partition entry. */
|
/* The partition entry. */
|
||||||
struct grub_msdos_partition_entry
|
struct grub_msdos_partition_entry
|
||||||
{
|
{
|
||||||
|
@ -168,23 +99,6 @@ struct grub_msdos_partition_mbr
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
|
||||||
struct grub_msdos_partition
|
|
||||||
{
|
|
||||||
/* The DOS partition number. */
|
|
||||||
int dos_part;
|
|
||||||
|
|
||||||
/* The BSD partition number (a == 0). */
|
|
||||||
int bsd_part;
|
|
||||||
|
|
||||||
/* The DOS partition type. */
|
|
||||||
int dos_type;
|
|
||||||
|
|
||||||
/* The BSD partition type. */
|
|
||||||
int bsd_type;
|
|
||||||
|
|
||||||
/* The offset of the extended partition. */
|
|
||||||
unsigned long ext_offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
grub_msdos_partition_is_empty (int type)
|
grub_msdos_partition_is_empty (int type)
|
||||||
|
@ -200,12 +114,4 @@ grub_msdos_partition_is_extended (int type)
|
||||||
|| type == GRUB_PC_PARTITION_TYPE_LINUX_EXTENDED);
|
|| type == GRUB_PC_PARTITION_TYPE_LINUX_EXTENDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
|
||||||
grub_msdos_partition_is_bsd (int type)
|
|
||||||
{
|
|
||||||
return (type == GRUB_PC_PARTITION_TYPE_FREEBSD
|
|
||||||
|| type == GRUB_PC_PARTITION_TYPE_OPENBSD
|
|
||||||
|| type == GRUB_PC_PARTITION_TYPE_NETBSD);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ! GRUB_PC_PARTITION_HEADER */
|
#endif /* ! GRUB_PC_PARTITION_HEADER */
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#define GRUB_PART_HEADER 1
|
#define GRUB_PART_HEADER 1
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
|
#include <grub/list.h>
|
||||||
|
|
||||||
struct grub_disk;
|
struct grub_disk;
|
||||||
|
|
||||||
|
@ -28,6 +29,9 @@ typedef struct grub_partition *grub_partition_t;
|
||||||
/* Partition map type. */
|
/* Partition map type. */
|
||||||
struct grub_partition_map
|
struct grub_partition_map
|
||||||
{
|
{
|
||||||
|
/* The next partition map type. */
|
||||||
|
struct grub_partition_map *next;
|
||||||
|
|
||||||
/* The name of the partition map type. */
|
/* The name of the partition map type. */
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
|
@ -35,22 +39,15 @@ struct grub_partition_map
|
||||||
grub_err_t (*iterate) (struct grub_disk *disk,
|
grub_err_t (*iterate) (struct grub_disk *disk,
|
||||||
int (*hook) (struct grub_disk *disk,
|
int (*hook) (struct grub_disk *disk,
|
||||||
const grub_partition_t partition));
|
const grub_partition_t partition));
|
||||||
|
|
||||||
/* Return the partition named STR on the disk DISK. */
|
|
||||||
grub_partition_t (*probe) (struct grub_disk *disk,
|
|
||||||
const char *str);
|
|
||||||
|
|
||||||
/* Return the name of the partition PARTITION. */
|
|
||||||
char *(*get_name) (const grub_partition_t partition);
|
|
||||||
|
|
||||||
/* The next partition map type. */
|
|
||||||
struct grub_partition_map *next;
|
|
||||||
};
|
};
|
||||||
typedef struct grub_partition_map *grub_partition_map_t;
|
typedef struct grub_partition_map *grub_partition_map_t;
|
||||||
|
|
||||||
/* Partition description. */
|
/* Partition description. */
|
||||||
struct grub_partition
|
struct grub_partition
|
||||||
{
|
{
|
||||||
|
/* The partition number. */
|
||||||
|
int number;
|
||||||
|
|
||||||
/* The start sector. */
|
/* The start sector. */
|
||||||
grub_disk_addr_t start;
|
grub_disk_addr_t start;
|
||||||
|
|
||||||
|
@ -63,8 +60,8 @@ struct grub_partition
|
||||||
/* The index of this partition in the partition table. */
|
/* The index of this partition in the partition table. */
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
/* Partition map type specific data. */
|
/* Parent partition map. */
|
||||||
void *data;
|
struct grub_partition *parent;
|
||||||
|
|
||||||
/* The type partition map. */
|
/* The type partition map. */
|
||||||
grub_partition_map_t partmap;
|
grub_partition_map_t partmap;
|
||||||
|
@ -77,17 +74,36 @@ int EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
|
||||||
const grub_partition_t partition));
|
const grub_partition_t partition));
|
||||||
char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
|
char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
|
||||||
|
|
||||||
int EXPORT_FUNC(grub_partition_map_iterate) (int (*hook) (const grub_partition_map_t partmap));
|
|
||||||
|
|
||||||
void EXPORT_FUNC(grub_partition_map_register) (grub_partition_map_t partmap);
|
extern grub_partition_map_t EXPORT_VAR(grub_partition_map_list);
|
||||||
|
|
||||||
void EXPORT_FUNC(grub_partition_map_unregister) (grub_partition_map_t partmap);
|
static inline void
|
||||||
|
grub_partition_map_register (grub_partition_map_t partmap)
|
||||||
|
{
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list),
|
||||||
|
GRUB_AS_LIST (partmap));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_partition_map_unregister (grub_partition_map_t partmap)
|
||||||
|
{
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&grub_partition_map_list),
|
||||||
|
GRUB_AS_LIST (partmap));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define FOR_PARTITION_MAPS(var) for (var = grub_partition_map_list; var; var = var->next)
|
||||||
|
|
||||||
|
|
||||||
static inline grub_disk_addr_t
|
static inline grub_disk_addr_t
|
||||||
grub_partition_get_start (const grub_partition_t p)
|
grub_partition_get_start (const grub_partition_t p)
|
||||||
{
|
{
|
||||||
return p->start;
|
grub_partition_t part;
|
||||||
|
grub_uint64_t part_start = 0;
|
||||||
|
|
||||||
|
for (part = p; part; part = part->parent)
|
||||||
|
part_start += part->start;
|
||||||
|
|
||||||
|
return part_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline grub_uint64_t
|
static inline grub_uint64_t
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
|
|
||||||
typedef grub_uint32_t grub_pci_id_t;
|
typedef grub_uint32_t grub_pci_id_t;
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_MACHINE_EMU
|
||||||
#include <grub/pciutils.h>
|
#include <grub/pciutils.h>
|
||||||
#else
|
#else
|
||||||
typedef grub_uint32_t grub_pci_address_t;
|
typedef grub_uint32_t grub_pci_address_t;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* normal_parser.h */
|
/* normal_parser.h */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
|
* Copyright (C) 2005,2007,2009,2010 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -45,8 +45,11 @@ struct grub_script
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GRUB_SCRIPT_ARG_TYPE_STR,
|
GRUB_SCRIPT_ARG_TYPE_VAR,
|
||||||
GRUB_SCRIPT_ARG_TYPE_VAR
|
GRUB_SCRIPT_ARG_TYPE_TEXT,
|
||||||
|
GRUB_SCRIPT_ARG_TYPE_DQVAR,
|
||||||
|
GRUB_SCRIPT_ARG_TYPE_DQSTR,
|
||||||
|
GRUB_SCRIPT_ARG_TYPE_SQSTR
|
||||||
} grub_script_arg_type_t;
|
} grub_script_arg_type_t;
|
||||||
|
|
||||||
/* A part of an argument. */
|
/* A part of an argument. */
|
||||||
|
@ -103,6 +106,21 @@ struct grub_script_cmdif
|
||||||
struct grub_script_cmd *exec_on_false;
|
struct grub_script_cmd *exec_on_false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* A for statement. */
|
||||||
|
struct grub_script_cmdfor
|
||||||
|
{
|
||||||
|
struct grub_script_cmd cmd;
|
||||||
|
|
||||||
|
/* The name used as looping variable. */
|
||||||
|
struct grub_script_arg *name;
|
||||||
|
|
||||||
|
/* The words loop iterates over. */
|
||||||
|
struct grub_script_arglist *words;
|
||||||
|
|
||||||
|
/* The command list executed in each loop. */
|
||||||
|
struct grub_script_cmd *list;
|
||||||
|
};
|
||||||
|
|
||||||
/* A menu entry generate statement. */
|
/* A menu entry generate statement. */
|
||||||
struct grub_script_cmd_menuentry
|
struct grub_script_cmd_menuentry
|
||||||
{
|
{
|
||||||
|
@ -121,12 +139,6 @@ struct grub_script_cmd_menuentry
|
||||||
/* State of the lexer as passed to the lexer. */
|
/* State of the lexer as passed to the lexer. */
|
||||||
struct grub_lexer_param
|
struct grub_lexer_param
|
||||||
{
|
{
|
||||||
/* Set to 0 when the lexer is done. */
|
|
||||||
int done;
|
|
||||||
|
|
||||||
/* State of the state machine. */
|
|
||||||
grub_parser_state_t state;
|
|
||||||
|
|
||||||
/* Function used by the lexer to get a new line when more input is
|
/* Function used by the lexer to get a new line when more input is
|
||||||
expected, but not available. */
|
expected, but not available. */
|
||||||
grub_reader_getline_t getline;
|
grub_reader_getline_t getline;
|
||||||
|
@ -137,10 +149,6 @@ struct grub_lexer_param
|
||||||
depleted. */
|
depleted. */
|
||||||
int refs;
|
int refs;
|
||||||
|
|
||||||
/* The character stream that has to be parsed. */
|
|
||||||
char *script;
|
|
||||||
char *newscript; /* XXX */
|
|
||||||
|
|
||||||
/* While walking through the databuffer, `record' the characters to
|
/* While walking through the databuffer, `record' the characters to
|
||||||
this other buffer. It can be used to edit the menu entry at a
|
this other buffer. It can be used to edit the menu entry at a
|
||||||
later moment. */
|
later moment. */
|
||||||
|
@ -157,13 +165,31 @@ struct grub_lexer_param
|
||||||
/* Size of RECORDING. */
|
/* Size of RECORDING. */
|
||||||
int recordlen;
|
int recordlen;
|
||||||
|
|
||||||
/* The token that is already parsed but not yet returned. */
|
/* End of file reached. */
|
||||||
int tokenonhold;
|
int eof;
|
||||||
|
|
||||||
/* Was the last token a newline? */
|
/* Merge multiple word tokens. */
|
||||||
int was_newline;
|
int merge_start;
|
||||||
|
int merge_end;
|
||||||
|
|
||||||
|
/* Part of a multi-part token. */
|
||||||
|
char *text;
|
||||||
|
unsigned used;
|
||||||
|
unsigned size;
|
||||||
|
|
||||||
|
/* Type of text. */
|
||||||
|
grub_script_arg_type_t type;
|
||||||
|
|
||||||
|
/* Flex scanner. */
|
||||||
|
void *yyscanner;
|
||||||
|
|
||||||
|
/* Flex scanner buffer. */
|
||||||
|
void *buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define GRUB_LEXER_INITIAL_TEXT_SIZE 32
|
||||||
|
#define GRUB_LEXER_INITIAL_RECORD_SIZE 256
|
||||||
|
|
||||||
/* State of the parser as passes to the parser. */
|
/* State of the parser as passes to the parser. */
|
||||||
struct grub_parser_param
|
struct grub_parser_param
|
||||||
{
|
{
|
||||||
|
@ -202,6 +228,12 @@ grub_script_create_cmdif (struct grub_parser_param *state,
|
||||||
struct grub_script_cmd *exec_on_true,
|
struct grub_script_cmd *exec_on_true,
|
||||||
struct grub_script_cmd *exec_on_false);
|
struct grub_script_cmd *exec_on_false);
|
||||||
|
|
||||||
|
struct grub_script_cmd *
|
||||||
|
grub_script_create_cmdfor (struct grub_parser_param *state,
|
||||||
|
struct grub_script_arg *name,
|
||||||
|
struct grub_script_arglist *words,
|
||||||
|
struct grub_script_cmd *list);
|
||||||
|
|
||||||
struct grub_script_cmd *
|
struct grub_script_cmd *
|
||||||
grub_script_create_cmdmenu (struct grub_parser_param *state,
|
grub_script_create_cmdmenu (struct grub_parser_param *state,
|
||||||
struct grub_script_arglist *arglist,
|
struct grub_script_arglist *arglist,
|
||||||
|
@ -223,12 +255,16 @@ void grub_script_free (struct grub_script *script);
|
||||||
struct grub_script *grub_script_create (struct grub_script_cmd *cmd,
|
struct grub_script *grub_script_create (struct grub_script_cmd *cmd,
|
||||||
struct grub_script_mem *mem);
|
struct grub_script_mem *mem);
|
||||||
|
|
||||||
struct grub_lexer_param *grub_script_lexer_init (char *s,
|
struct grub_lexer_param *grub_script_lexer_init (struct grub_parser_param *parser,
|
||||||
|
char *script,
|
||||||
grub_reader_getline_t getline);
|
grub_reader_getline_t getline);
|
||||||
|
void grub_script_lexer_fini (struct grub_lexer_param *);
|
||||||
void grub_script_lexer_ref (struct grub_lexer_param *);
|
void grub_script_lexer_ref (struct grub_lexer_param *);
|
||||||
void grub_script_lexer_deref (struct grub_lexer_param *);
|
void grub_script_lexer_deref (struct grub_lexer_param *);
|
||||||
void grub_script_lexer_record_start (struct grub_lexer_param *);
|
void grub_script_lexer_record_start (struct grub_parser_param *);
|
||||||
char *grub_script_lexer_record_stop (struct grub_lexer_param *);
|
char *grub_script_lexer_record_stop (struct grub_parser_param *);
|
||||||
|
int grub_script_lexer_yywrap (struct grub_parser_param *);
|
||||||
|
void grub_script_lexer_record (struct grub_parser_param *, char *);
|
||||||
|
|
||||||
/* Functions to track allocated memory. */
|
/* Functions to track allocated memory. */
|
||||||
struct grub_script_mem *grub_script_mem_record (struct grub_parser_param *state);
|
struct grub_script_mem *grub_script_mem_record (struct grub_parser_param *state);
|
||||||
|
@ -246,6 +282,7 @@ void grub_script_yyerror (struct grub_parser_param *, char const *);
|
||||||
grub_err_t grub_script_execute_cmdline (struct grub_script_cmd *cmd);
|
grub_err_t grub_script_execute_cmdline (struct grub_script_cmd *cmd);
|
||||||
grub_err_t grub_script_execute_cmdblock (struct grub_script_cmd *cmd);
|
grub_err_t grub_script_execute_cmdblock (struct grub_script_cmd *cmd);
|
||||||
grub_err_t grub_script_execute_cmdif (struct grub_script_cmd *cmd);
|
grub_err_t grub_script_execute_cmdif (struct grub_script_cmd *cmd);
|
||||||
|
grub_err_t grub_script_execute_cmdfor (struct grub_script_cmd *cmd);
|
||||||
grub_err_t grub_script_execute_menuentry (struct grub_script_cmd *cmd);
|
grub_err_t grub_script_execute_menuentry (struct grub_script_cmd *cmd);
|
||||||
|
|
||||||
/* Execute any GRUB pre-parsed command or script. */
|
/* Execute any GRUB pre-parsed command or script. */
|
||||||
|
@ -284,7 +321,7 @@ int grub_script_function_iterate (int (*iterate) (grub_script_function_t));
|
||||||
int grub_script_function_call (grub_script_function_t func,
|
int grub_script_function_call (grub_script_function_t func,
|
||||||
int argc, char **args);
|
int argc, char **args);
|
||||||
|
|
||||||
char *
|
char **
|
||||||
grub_script_execute_argument_to_string (struct grub_script_arg *arg);
|
grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count);
|
||||||
|
|
||||||
#endif /* ! GRUB_NORMAL_PARSER_HEADER */
|
#endif /* ! GRUB_NORMAL_PARSER_HEADER */
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
#define BOOTDEV_REG %l6
|
#define BOOTDEV_REG %l6
|
||||||
#define PIC_REG %l7
|
#define PIC_REG %l7
|
||||||
|
|
||||||
#define SCRATCH_PAD 0x10000
|
#define SCRATCH_PAD_BOOT 0x5000
|
||||||
|
#define SCRATCH_PAD_DISKBOOT 0x4000
|
||||||
|
|
||||||
#define GET_ABS(symbol, reg) \
|
#define GET_ABS(symbol, reg) \
|
||||||
add PIC_REG, (symbol - pic_base), reg
|
add PIC_REG, (symbol - pic_base), reg
|
||||||
|
@ -51,7 +52,7 @@
|
||||||
|
|
||||||
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
|
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
|
||||||
|
|
||||||
#define GRUB_BOOT_MACHINE_IMAGE_ADDRESS 0x200000
|
#define GRUB_BOOT_MACHINE_IMAGE_ADDRESS 0x4400
|
||||||
|
|
||||||
#define GRUB_BOOT_MACHINE_KERNEL_ADDR 0x4200
|
#define GRUB_BOOT_MACHINE_KERNEL_ADDR 0x4200
|
||||||
|
|
||||||
|
|
|
@ -43,4 +43,6 @@ extern int EXPORT_FUNC(grub_ieee1275_alloc_physmem) (grub_addr_t *paddr,
|
||||||
grub_size_t size,
|
grub_size_t size,
|
||||||
grub_uint32_t align);
|
grub_uint32_t align);
|
||||||
|
|
||||||
|
extern grub_addr_t EXPORT_VAR (grub_ieee1275_original_stack);
|
||||||
|
|
||||||
#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */
|
#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */
|
||||||
|
|
|
@ -39,8 +39,24 @@
|
||||||
/* End of the data section. */
|
/* End of the data section. */
|
||||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x114
|
#define GRUB_KERNEL_MACHINE_DATA_END 0x114
|
||||||
|
|
||||||
|
#define GRUB_KERNEL_MACHINE_RAW_SIZE 0
|
||||||
|
#define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000
|
||||||
|
|
||||||
|
#define GRUB_PLATFORM_IMAGE_FORMATS "raw, aout"
|
||||||
|
#define GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "raw"
|
||||||
|
|
||||||
|
#define GRUB_PLATFORM_IMAGE_DEFAULT GRUB_PLATFORM_IMAGE_RAW
|
||||||
|
|
||||||
#ifndef ASM_FILE
|
#ifndef ASM_FILE
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GRUB_PLATFORM_IMAGE_RAW,
|
||||||
|
GRUB_PLATFORM_IMAGE_AOUT
|
||||||
|
}
|
||||||
|
grub_platform_image_format_t;
|
||||||
|
#define GRUB_PLATFORM_IMAGE_RAW GRUB_PLATFORM_IMAGE_RAW
|
||||||
|
#define GRUB_PLATFORM_IMAGE_AOUT GRUB_PLATFORM_IMAGE_AOUT
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ void grub_test_nonzero (int cond, const char *file,
|
||||||
|
|
||||||
/* Macro to fill in location details and an optional error message. */
|
/* Macro to fill in location details and an optional error message. */
|
||||||
#define grub_test_assert(cond, ...) \
|
#define grub_test_assert(cond, ...) \
|
||||||
grub_test_nonzero(cond, __FILE__, __FUNCTION__, __LINE__, \
|
grub_test_nonzero(cond, GRUB_FILE, __FUNCTION__, __LINE__, \
|
||||||
## __VA_ARGS__, \
|
## __VA_ARGS__, \
|
||||||
"assert failed: %s", #cond)
|
"assert failed: %s", #cond)
|
||||||
|
|
||||||
|
|
1
include/grub/x86_64/efi/serial.h
Normal file
1
include/grub/x86_64/efi/serial.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/serial.h>
|
13
kern/disk.c
13
kern/disk.c
|
@ -330,6 +330,7 @@ grub_disk_open (const char *name)
|
||||||
void
|
void
|
||||||
grub_disk_close (grub_disk_t disk)
|
grub_disk_close (grub_disk_t disk)
|
||||||
{
|
{
|
||||||
|
grub_partition_t part;
|
||||||
grub_dprintf ("disk", "Closing `%s'.\n", disk->name);
|
grub_dprintf ("disk", "Closing `%s'.\n", disk->name);
|
||||||
|
|
||||||
if (disk->dev && disk->dev->close)
|
if (disk->dev && disk->dev->close)
|
||||||
|
@ -338,7 +339,12 @@ grub_disk_close (grub_disk_t disk)
|
||||||
/* Reset the timer. */
|
/* Reset the timer. */
|
||||||
grub_last_time = grub_get_time_ms ();
|
grub_last_time = grub_get_time_ms ();
|
||||||
|
|
||||||
|
while (disk->partition)
|
||||||
|
{
|
||||||
|
part = disk->partition->parent;
|
||||||
grub_free (disk->partition);
|
grub_free (disk->partition);
|
||||||
|
disk->partition = part;
|
||||||
|
}
|
||||||
grub_free ((void *) disk->name);
|
grub_free ((void *) disk->name);
|
||||||
grub_free (disk);
|
grub_free (disk);
|
||||||
}
|
}
|
||||||
|
@ -351,16 +357,17 @@ static grub_err_t
|
||||||
grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
|
grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
|
||||||
grub_off_t *offset, grub_size_t size)
|
grub_off_t *offset, grub_size_t size)
|
||||||
{
|
{
|
||||||
|
grub_partition_t part;
|
||||||
*sector += *offset >> GRUB_DISK_SECTOR_BITS;
|
*sector += *offset >> GRUB_DISK_SECTOR_BITS;
|
||||||
*offset &= GRUB_DISK_SECTOR_SIZE - 1;
|
*offset &= GRUB_DISK_SECTOR_SIZE - 1;
|
||||||
|
|
||||||
if (disk->partition)
|
for (part = disk->partition; part; part = part->parent)
|
||||||
{
|
{
|
||||||
grub_disk_addr_t start;
|
grub_disk_addr_t start;
|
||||||
grub_uint64_t len;
|
grub_uint64_t len;
|
||||||
|
|
||||||
start = grub_partition_get_start (disk->partition);
|
start = part->start;
|
||||||
len = grub_partition_get_len (disk->partition);
|
len = part->len;
|
||||||
|
|
||||||
if (*sector >= len
|
if (*sector >= len
|
||||||
|| len - *sector < ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1)
|
|| len - *sector < ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1)
|
||||||
|
|
|
@ -348,7 +348,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
|
||||||
sym->st_value = (Elf_Addr) grub_dl_resolve_symbol (name);
|
sym->st_value = (Elf_Addr) grub_dl_resolve_symbol (name);
|
||||||
if (! sym->st_value)
|
if (! sym->st_value)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
"the symbol `%s' not found", name);
|
"symbol not found: `%s'", name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -469,7 +469,7 @@ grub_dl_resolve_dependencies (grub_dl_t mod, Elf_Ehdr *e)
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GRUB_UTIL
|
#if !GRUB_NO_MODULES
|
||||||
int
|
int
|
||||||
grub_dl_ref (grub_dl_t mod)
|
grub_dl_ref (grub_dl_t mod)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
#include <multiboot.h>
|
#include <multiboot.h>
|
||||||
#include <multiboot2.h>
|
#include <multiboot2.h>
|
||||||
|
|
||||||
#define ABS(x) ((x) - _start + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200)
|
#define ABS(x) ((x) - LOCAL (base) + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200)
|
||||||
|
|
||||||
.file "startup.S"
|
.file "startup.S"
|
||||||
|
|
||||||
|
@ -66,16 +66,15 @@
|
||||||
.globl start, _start
|
.globl start, _start
|
||||||
start:
|
start:
|
||||||
_start:
|
_start:
|
||||||
|
LOCAL (base):
|
||||||
/*
|
/*
|
||||||
* Guarantee that "main" is loaded at 0x0:0x8200.
|
* Guarantee that "main" is loaded at 0x0:0x8200.
|
||||||
*/
|
*/
|
||||||
#ifdef APPLE_CC
|
#ifdef __APPLE__
|
||||||
codestart_abs = ABS(codestart) - 0x10000
|
ljmp $0, $(ABS(LOCAL (codestart)) - 0x10000)
|
||||||
ljmp $0, $(codestart_abs)
|
|
||||||
#else
|
#else
|
||||||
ljmp $0, $ABS(codestart)
|
ljmp $0, $ABS(LOCAL (codestart))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compatibility version number
|
* Compatibility version number
|
||||||
*
|
*
|
||||||
|
@ -183,7 +182,7 @@ multiboot_trampoline:
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
/* the real mode code continues... */
|
/* the real mode code continues... */
|
||||||
codestart:
|
LOCAL (codestart):
|
||||||
cli /* we're not safe here! */
|
cli /* we're not safe here! */
|
||||||
|
|
||||||
/* set up %ds, %ss, and %es */
|
/* set up %ds, %ss, and %es */
|
||||||
|
@ -1156,7 +1155,7 @@ FUNCTION(grub_console_real_putchar)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* this table is used in translate_keycode below */
|
/* this table is used in translate_keycode below */
|
||||||
translation_table:
|
LOCAL (translation_table):
|
||||||
.word GRUB_CONSOLE_KEY_LEFT, GRUB_TERM_LEFT
|
.word GRUB_CONSOLE_KEY_LEFT, GRUB_TERM_LEFT
|
||||||
.word GRUB_CONSOLE_KEY_RIGHT, GRUB_TERM_RIGHT
|
.word GRUB_CONSOLE_KEY_RIGHT, GRUB_TERM_RIGHT
|
||||||
.word GRUB_CONSOLE_KEY_UP, GRUB_TERM_UP
|
.word GRUB_CONSOLE_KEY_UP, GRUB_TERM_UP
|
||||||
|
@ -1178,11 +1177,10 @@ translate_keycode:
|
||||||
pushw %bx
|
pushw %bx
|
||||||
pushw %si
|
pushw %si
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
#ifdef __APPLE__
|
||||||
translation_table_abs = ABS (translation_table) - 0x10000
|
movw $(ABS(LOCAL (translation_table)) - 0x10000), %si
|
||||||
movw $(translation_table_abs), %si
|
|
||||||
#else
|
#else
|
||||||
movw $ABS(translation_table), %si
|
movw $ABS(LOCAL (translation_table)), %si
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
1: lodsw
|
1: lodsw
|
||||||
|
|
|
@ -38,11 +38,11 @@
|
||||||
#define HEAP_MIN_SIZE (unsigned long) (2 * 1024 * 1024)
|
#define HEAP_MIN_SIZE (unsigned long) (2 * 1024 * 1024)
|
||||||
|
|
||||||
/* The maximum heap size we're going to claim */
|
/* The maximum heap size we're going to claim */
|
||||||
#define HEAP_MAX_SIZE (unsigned long) (4 * 1024 * 1024)
|
#define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024)
|
||||||
|
|
||||||
/* If possible, we will avoid claiming heap above this address, because it
|
/* If possible, we will avoid claiming heap above this address, because it
|
||||||
seems to cause relocation problems with OSes that link at 4 MiB */
|
seems to cause relocation problems with OSes that link at 4 MiB */
|
||||||
#define HEAP_MAX_ADDR (unsigned long) (4 * 1024 * 1024)
|
#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024)
|
||||||
|
|
||||||
extern char _start[];
|
extern char _start[];
|
||||||
extern char _end[];
|
extern char _end[];
|
||||||
|
|
|
@ -68,11 +68,10 @@ grub_children_iterate (char *devpath,
|
||||||
{
|
{
|
||||||
struct grub_ieee1275_devalias alias;
|
struct grub_ieee1275_devalias alias;
|
||||||
grub_ssize_t actual;
|
grub_ssize_t actual;
|
||||||
char *fullname;
|
|
||||||
|
|
||||||
if (grub_ieee1275_get_property (child, "device_type", childtype,
|
if (grub_ieee1275_get_property (child, "device_type", childtype,
|
||||||
IEEE1275_MAX_PROP_LEN, &actual))
|
IEEE1275_MAX_PROP_LEN, &actual))
|
||||||
continue;
|
childtype[0] = 0;
|
||||||
|
|
||||||
if (grub_ieee1275_package_to_path (child, childpath,
|
if (grub_ieee1275_package_to_path (child, childpath,
|
||||||
IEEE1275_MAX_PATH_LEN, &actual))
|
IEEE1275_MAX_PATH_LEN, &actual))
|
||||||
|
@ -82,24 +81,14 @@ grub_children_iterate (char *devpath,
|
||||||
IEEE1275_MAX_PROP_LEN, &actual))
|
IEEE1275_MAX_PROP_LEN, &actual))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fullname = grub_xasprintf ("%s/%s", devpath, childname);
|
|
||||||
if (!fullname)
|
|
||||||
{
|
|
||||||
grub_free (childname);
|
|
||||||
grub_free (childpath);
|
|
||||||
grub_free (childtype);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
alias.type = childtype;
|
alias.type = childtype;
|
||||||
alias.path = childpath;
|
alias.path = childpath;
|
||||||
alias.name = fullname;
|
alias.name = childname;
|
||||||
ret = hook (&alias);
|
ret = hook (&alias);
|
||||||
grub_free (fullname);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while (grub_ieee1275_peer (child, &child));
|
while (grub_ieee1275_peer (child, &child) != -1);
|
||||||
|
|
||||||
grub_free (childname);
|
grub_free (childname);
|
||||||
grub_free (childpath);
|
grub_free (childpath);
|
||||||
|
@ -108,6 +97,20 @@ grub_children_iterate (char *devpath,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
grub_ieee1275_devices_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
|
||||||
|
{
|
||||||
|
auto int it_through (struct grub_ieee1275_devalias *alias);
|
||||||
|
int it_through (struct grub_ieee1275_devalias *alias)
|
||||||
|
{
|
||||||
|
if (hook (alias))
|
||||||
|
return 1;
|
||||||
|
return grub_children_iterate (alias->path, it_through);
|
||||||
|
}
|
||||||
|
|
||||||
|
return grub_children_iterate ("/", it_through);
|
||||||
|
}
|
||||||
|
|
||||||
/* Iterate through all device aliases. This function can be used to
|
/* Iterate through all device aliases. This function can be used to
|
||||||
find a device of a specific type. */
|
find a device of a specific type. */
|
||||||
int
|
int
|
||||||
|
|
19
kern/main.c
19
kern/main.c
|
@ -53,6 +53,25 @@ grub_module_iterate (int (*hook) (struct grub_module_header *header))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is actualy platform-independant but used only on yeeloong and sparc. */
|
||||||
|
#if defined (GRUB_MACHINE_MIPS_YEELOONG) || defined (GRUB_MACHINE_SPARC64)
|
||||||
|
grub_addr_t
|
||||||
|
grub_modules_get_end (void)
|
||||||
|
{
|
||||||
|
struct grub_module_info *modinfo;
|
||||||
|
grub_addr_t modbase;
|
||||||
|
|
||||||
|
modbase = grub_arch_modules_addr ();
|
||||||
|
modinfo = (struct grub_module_info *) modbase;
|
||||||
|
|
||||||
|
/* Check if there are any modules. */
|
||||||
|
if ((modinfo == 0) || modinfo->magic != GRUB_MODULE_MAGIC)
|
||||||
|
return modbase;
|
||||||
|
|
||||||
|
return modbase + modinfo->size;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Load all modules in core. */
|
/* Load all modules in core. */
|
||||||
static void
|
static void
|
||||||
grub_load_modules (void)
|
grub_load_modules (void)
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
#include <grub/cpu/kernel.h>
|
#include <grub/cpu/kernel.h>
|
||||||
|
|
||||||
extern void grub_video_sm712_init (void);
|
extern void grub_video_sm712_init (void);
|
||||||
extern void grub_video_video_init (void);
|
extern void grub_video_init (void);
|
||||||
extern void grub_video_bitmap_init (void);
|
extern void grub_bitmap_init (void);
|
||||||
extern void grub_font_manager_init (void);
|
extern void grub_font_init (void);
|
||||||
extern void grub_term_gfxterm_init (void);
|
extern void grub_gfxterm_init (void);
|
||||||
extern void grub_at_keyboard_init (void);
|
extern void grub_at_keyboard_init (void);
|
||||||
|
|
||||||
/* FIXME: use interrupt to count high. */
|
/* FIXME: use interrupt to count high. */
|
||||||
|
@ -63,45 +63,23 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void *
|
|
||||||
get_modules_end (void)
|
|
||||||
{
|
|
||||||
struct grub_module_info *modinfo;
|
|
||||||
struct grub_module_header *header;
|
|
||||||
grub_addr_t modbase;
|
|
||||||
|
|
||||||
modbase = grub_arch_modules_addr ();
|
|
||||||
modinfo = (struct grub_module_info *) modbase;
|
|
||||||
|
|
||||||
/* Check if there are any modules. */
|
|
||||||
if ((modinfo == 0) || modinfo->magic != GRUB_MODULE_MAGIC)
|
|
||||||
return modinfo;
|
|
||||||
|
|
||||||
for (header = (struct grub_module_header *) (modbase + modinfo->offset);
|
|
||||||
header < (struct grub_module_header *) (modbase + modinfo->size);
|
|
||||||
header = (struct grub_module_header *) ((char *) header + header->size));
|
|
||||||
|
|
||||||
return header;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_machine_init (void)
|
grub_machine_init (void)
|
||||||
{
|
{
|
||||||
void *modend;
|
grub_addr_t modend;
|
||||||
modend = get_modules_end ();
|
modend = grub_modules_get_end ();
|
||||||
grub_mm_init_region (modend, (grub_arch_memsize << 20)
|
grub_mm_init_region ((void *) modend, (grub_arch_memsize << 20)
|
||||||
- (((grub_addr_t) modend) - GRUB_ARCH_LOWMEMVSTART));
|
- (modend - GRUB_ARCH_LOWMEMVSTART));
|
||||||
/* FIXME: use upper memory as well. */
|
/* FIXME: use upper memory as well. */
|
||||||
grub_install_get_time_ms (grub_rtc_get_time_ms);
|
grub_install_get_time_ms (grub_rtc_get_time_ms);
|
||||||
|
|
||||||
/* Initialize output terminal (can't be done earlier, as gfxterm
|
/* Initialize output terminal (can't be done earlier, as gfxterm
|
||||||
relies on a working heap. */
|
relies on a working heap. */
|
||||||
grub_video_sm712_init ();
|
grub_video_sm712_init ();
|
||||||
grub_video_video_init ();
|
grub_video_init ();
|
||||||
grub_video_bitmap_init ();
|
grub_bitmap_init ();
|
||||||
grub_font_manager_init ();
|
grub_font_init ();
|
||||||
grub_term_gfxterm_init ();
|
grub_gfxterm_init ();
|
||||||
|
|
||||||
grub_at_keyboard_init ();
|
grub_at_keyboard_init ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,7 +388,7 @@ grub_free (void *ptr)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
grub_printf ("%s:%d: q=%p, q->size=0x%x, q->magic=0x%x\n",
|
grub_printf ("%s:%d: q=%p, q->size=0x%x, q->magic=0x%x\n",
|
||||||
__FILE__, __LINE__, q, q->size, q->magic);
|
GRUB_FILE, __LINE__, q, q->size, q->magic);
|
||||||
q = q->next;
|
q = q->next;
|
||||||
}
|
}
|
||||||
while (q != r->first);
|
while (q != r->first);
|
||||||
|
|
|
@ -26,32 +26,31 @@
|
||||||
/* All the possible state transitions on the command line. If a
|
/* All the possible state transitions on the command line. If a
|
||||||
transition can not be found, it is assumed that there is no
|
transition can not be found, it is assumed that there is no
|
||||||
transition and keep_value is assumed to be 1. */
|
transition and keep_value is assumed to be 1. */
|
||||||
static struct grub_parser_state_transition state_transitions[] =
|
static struct grub_parser_state_transition state_transitions[] = {
|
||||||
{
|
{GRUB_PARSER_STATE_TEXT, GRUB_PARSER_STATE_QUOTE, '\'', 0},
|
||||||
{ GRUB_PARSER_STATE_TEXT, GRUB_PARSER_STATE_QUOTE, '\'', 0},
|
{GRUB_PARSER_STATE_TEXT, GRUB_PARSER_STATE_DQUOTE, '\"', 0},
|
||||||
{ GRUB_PARSER_STATE_TEXT, GRUB_PARSER_STATE_DQUOTE, '\"', 0},
|
{GRUB_PARSER_STATE_TEXT, GRUB_PARSER_STATE_VAR, '$', 0},
|
||||||
{ GRUB_PARSER_STATE_TEXT, GRUB_PARSER_STATE_VAR, '$', 0},
|
{GRUB_PARSER_STATE_TEXT, GRUB_PARSER_STATE_ESC, '\\', 0},
|
||||||
{ GRUB_PARSER_STATE_TEXT, GRUB_PARSER_STATE_ESC, '\\', 0},
|
|
||||||
|
|
||||||
{ GRUB_PARSER_STATE_ESC, GRUB_PARSER_STATE_TEXT, 0, 1},
|
{GRUB_PARSER_STATE_ESC, GRUB_PARSER_STATE_TEXT, 0, 1},
|
||||||
|
|
||||||
{ GRUB_PARSER_STATE_QUOTE, GRUB_PARSER_STATE_TEXT, '\'', 0},
|
{GRUB_PARSER_STATE_QUOTE, GRUB_PARSER_STATE_TEXT, '\'', 0},
|
||||||
|
|
||||||
{ GRUB_PARSER_STATE_DQUOTE, GRUB_PARSER_STATE_TEXT, '\"', 0},
|
{GRUB_PARSER_STATE_DQUOTE, GRUB_PARSER_STATE_TEXT, '\"', 0},
|
||||||
{ GRUB_PARSER_STATE_DQUOTE, GRUB_PARSER_STATE_QVAR, '$', 0},
|
{GRUB_PARSER_STATE_DQUOTE, GRUB_PARSER_STATE_QVAR, '$', 0},
|
||||||
|
|
||||||
{ GRUB_PARSER_STATE_VAR, GRUB_PARSER_STATE_VARNAME2, '{', 0},
|
{GRUB_PARSER_STATE_VAR, GRUB_PARSER_STATE_VARNAME2, '{', 0},
|
||||||
{ GRUB_PARSER_STATE_VAR, GRUB_PARSER_STATE_VARNAME, 0, 1},
|
{GRUB_PARSER_STATE_VAR, GRUB_PARSER_STATE_VARNAME, 0, 1},
|
||||||
{ GRUB_PARSER_STATE_VARNAME, GRUB_PARSER_STATE_TEXT, ' ', 1},
|
{GRUB_PARSER_STATE_VARNAME, GRUB_PARSER_STATE_TEXT, ' ', 1},
|
||||||
{ GRUB_PARSER_STATE_VARNAME2, GRUB_PARSER_STATE_TEXT, '}', 0},
|
{GRUB_PARSER_STATE_VARNAME2, GRUB_PARSER_STATE_TEXT, '}', 0},
|
||||||
|
|
||||||
{ GRUB_PARSER_STATE_QVAR, GRUB_PARSER_STATE_QVARNAME2, '{', 0},
|
{GRUB_PARSER_STATE_QVAR, GRUB_PARSER_STATE_QVARNAME2, '{', 0},
|
||||||
{ GRUB_PARSER_STATE_QVAR, GRUB_PARSER_STATE_QVARNAME, 0, 1},
|
{GRUB_PARSER_STATE_QVAR, GRUB_PARSER_STATE_QVARNAME, 0, 1},
|
||||||
{ GRUB_PARSER_STATE_QVARNAME, GRUB_PARSER_STATE_TEXT, '\"', 0},
|
{GRUB_PARSER_STATE_QVARNAME, GRUB_PARSER_STATE_TEXT, '\"', 0},
|
||||||
{ GRUB_PARSER_STATE_QVARNAME, GRUB_PARSER_STATE_DQUOTE, ' ', 1},
|
{GRUB_PARSER_STATE_QVARNAME, GRUB_PARSER_STATE_DQUOTE, ' ', 1},
|
||||||
{ GRUB_PARSER_STATE_QVARNAME2, GRUB_PARSER_STATE_DQUOTE, '}', 0},
|
{GRUB_PARSER_STATE_QVARNAME2, GRUB_PARSER_STATE_DQUOTE, '}', 0},
|
||||||
|
|
||||||
{ 0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,8 +73,8 @@ grub_parser_cmdline_state (grub_parser_state_t state, char c, char *result)
|
||||||
if (transition->input == c)
|
if (transition->input == c)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (transition->input == ' ' && ! grub_isalpha (c)
|
if (transition->input == ' ' && !grub_isalpha (c)
|
||||||
&& ! grub_isdigit (c) && c != '_')
|
&& !grub_isdigit (c) && c != '_')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* A less perfect match was found, use this one if no exact
|
/* A less perfect match was found, use this one if no exact
|
||||||
|
@ -84,7 +83,7 @@ grub_parser_cmdline_state (grub_parser_state_t state, char c, char *result)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! transition->from_state)
|
if (!transition->from_state)
|
||||||
transition = &default_transition;
|
transition = &default_transition;
|
||||||
|
|
||||||
if (transition->keep_value)
|
if (transition->keep_value)
|
||||||
|
@ -128,13 +127,13 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
|
||||||
|
|
||||||
/* Check if a variable was being read in and the end of the name
|
/* Check if a variable was being read in and the end of the name
|
||||||
was reached. */
|
was reached. */
|
||||||
if (! (check_varstate (state) && !check_varstate (newstate)))
|
if (!(check_varstate (state) && !check_varstate (newstate)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
*(vp++) = '\0';
|
*(vp++) = '\0';
|
||||||
val = grub_env_get (varname);
|
val = grub_env_get (varname);
|
||||||
vp = varname;
|
vp = varname;
|
||||||
if (! val)
|
if (!val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Insert the contents of the variable in the buffer. */
|
/* Insert the contents of the variable in the buffer. */
|
||||||
|
@ -145,11 +144,12 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
|
||||||
*argc = 0;
|
*argc = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (! rd || !*rd)
|
if (!rd || !*rd)
|
||||||
{
|
{
|
||||||
if (getline)
|
if (getline)
|
||||||
getline (&rd, 1);
|
getline (&rd, 1);
|
||||||
else break;
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rd)
|
if (!rd)
|
||||||
|
@ -190,7 +190,8 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
|
||||||
}
|
}
|
||||||
state = newstate;
|
state = newstate;
|
||||||
}
|
}
|
||||||
} while (state != GRUB_PARSER_STATE_TEXT && !check_varstate (state));
|
}
|
||||||
|
while (state != GRUB_PARSER_STATE_TEXT && !check_varstate (state));
|
||||||
|
|
||||||
/* A special case for when the last character was part of a
|
/* A special case for when the last character was part of a
|
||||||
variable. */
|
variable. */
|
||||||
|
@ -204,12 +205,12 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
|
||||||
|
|
||||||
/* Reserve memory for the return values. */
|
/* Reserve memory for the return values. */
|
||||||
args = grub_malloc (bp - buffer);
|
args = grub_malloc (bp - buffer);
|
||||||
if (! args)
|
if (!args)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
grub_memcpy (args, buffer, bp - buffer);
|
grub_memcpy (args, buffer, bp - buffer);
|
||||||
|
|
||||||
*argv = grub_malloc (sizeof (char *) * (*argc + 1));
|
*argv = grub_malloc (sizeof (char *) * (*argc + 1));
|
||||||
if (! *argv)
|
if (!*argv)
|
||||||
{
|
{
|
||||||
grub_free (args);
|
grub_free (args);
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
@ -229,10 +230,9 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct grub_handler_class grub_parser_class =
|
struct grub_handler_class grub_parser_class = {
|
||||||
{
|
|
||||||
.name = "parser"
|
.name = "parser"
|
||||||
};
|
};
|
||||||
|
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_parser_execute (char *source)
|
grub_parser_execute (char *source)
|
||||||
|
@ -242,7 +242,7 @@ grub_parser_execute (char *source)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (! source)
|
if (!source)
|
||||||
{
|
{
|
||||||
*line = 0;
|
*line = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
194
kern/partition.c
194
kern/partition.c
|
@ -17,40 +17,44 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
#include <grub/partition.h>
|
#include <grub/partition.h>
|
||||||
#include <grub/disk.h>
|
#include <grub/disk.h>
|
||||||
|
|
||||||
static grub_partition_map_t grub_partition_map_list;
|
grub_partition_map_t grub_partition_map_list;
|
||||||
|
|
||||||
void
|
static grub_partition_t
|
||||||
grub_partition_map_register (grub_partition_map_t partmap)
|
grub_partition_map_probe (const grub_partition_map_t partmap,
|
||||||
|
grub_disk_t disk, int partnum)
|
||||||
{
|
{
|
||||||
partmap->next = grub_partition_map_list;
|
grub_partition_t p = 0;
|
||||||
grub_partition_map_list = partmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
auto int find_func (grub_disk_t d, const grub_partition_t partition);
|
||||||
grub_partition_map_unregister (grub_partition_map_t partmap)
|
|
||||||
{
|
|
||||||
grub_partition_map_t *p, q;
|
|
||||||
|
|
||||||
for (p = &grub_partition_map_list, q = *p; q; p = &(q->next), q = q->next)
|
int find_func (grub_disk_t d __attribute__ ((unused)),
|
||||||
if (q == partmap)
|
const grub_partition_t partition)
|
||||||
{
|
{
|
||||||
*p = q->next;
|
if (partnum == partition->number)
|
||||||
break;
|
{
|
||||||
}
|
p = (grub_partition_t) grub_malloc (sizeof (*p));
|
||||||
}
|
if (! p)
|
||||||
|
|
||||||
int
|
|
||||||
grub_partition_map_iterate (int (*hook) (const grub_partition_map_t partmap))
|
|
||||||
{
|
|
||||||
grub_partition_map_t p;
|
|
||||||
|
|
||||||
for (p = grub_partition_map_list; p; p = p->next)
|
|
||||||
if (hook (p))
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
grub_memcpy (p, partition, sizeof (*p));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
partmap->iterate (disk, find_func);
|
||||||
|
if (grub_errno)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
grub_free (p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,28 +62,66 @@ grub_partition_t
|
||||||
grub_partition_probe (struct grub_disk *disk, const char *str)
|
grub_partition_probe (struct grub_disk *disk, const char *str)
|
||||||
{
|
{
|
||||||
grub_partition_t part = 0;
|
grub_partition_t part = 0;
|
||||||
|
grub_partition_t curpart = 0;
|
||||||
|
grub_partition_t tail;
|
||||||
|
const char *ptr;
|
||||||
|
|
||||||
auto int part_map_probe (const grub_partition_map_t partmap);
|
part = tail = disk->partition;
|
||||||
|
|
||||||
int part_map_probe (const grub_partition_map_t partmap)
|
for (ptr = str; *ptr;)
|
||||||
{
|
{
|
||||||
part = partmap->probe (disk, str);
|
grub_partition_map_t partmap;
|
||||||
if (part)
|
int num;
|
||||||
return 1;
|
const char *partname, *partname_end;
|
||||||
|
|
||||||
|
partname = ptr;
|
||||||
|
while (*ptr && grub_isalpha (*ptr))
|
||||||
|
ptr++;
|
||||||
|
partname_end = ptr;
|
||||||
|
num = grub_strtoul (ptr, (char **) &ptr, 0) - 1;
|
||||||
|
|
||||||
|
curpart = 0;
|
||||||
|
/* Use the first partition map type found. */
|
||||||
|
FOR_PARTITION_MAPS(partmap)
|
||||||
|
{
|
||||||
|
if (partname_end != partname &&
|
||||||
|
(grub_strncmp (partmap->name, partname, partname_end - partname)
|
||||||
|
!= 0 || partmap->name[partname_end - partname] != 0))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
disk->partition = part;
|
||||||
|
curpart = grub_partition_map_probe (partmap, disk, num);
|
||||||
|
disk->partition = tail;
|
||||||
|
if (curpart)
|
||||||
|
break;
|
||||||
|
|
||||||
if (grub_errno == GRUB_ERR_BAD_PART_TABLE)
|
if (grub_errno == GRUB_ERR_BAD_PART_TABLE)
|
||||||
{
|
{
|
||||||
/* Continue to next partition map type. */
|
/* Continue to next partition map type. */
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! curpart)
|
||||||
|
{
|
||||||
|
while (part)
|
||||||
|
{
|
||||||
|
curpart = part->parent;
|
||||||
|
grub_free (part);
|
||||||
|
part = curpart;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
curpart->parent = part;
|
||||||
return 1;
|
part = curpart;
|
||||||
|
if (! ptr || *ptr != ',')
|
||||||
|
break;
|
||||||
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use the first partition map type found. */
|
|
||||||
grub_partition_map_iterate (part_map_probe);
|
|
||||||
|
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,40 +130,51 @@ grub_partition_iterate (struct grub_disk *disk,
|
||||||
int (*hook) (grub_disk_t disk,
|
int (*hook) (grub_disk_t disk,
|
||||||
const grub_partition_t partition))
|
const grub_partition_t partition))
|
||||||
{
|
{
|
||||||
grub_partition_map_t partmap = 0;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
auto int part_map_iterate (const grub_partition_map_t p);
|
auto int part_iterate (grub_disk_t dsk, const grub_partition_t p);
|
||||||
auto int part_map_iterate_hook (grub_disk_t d,
|
|
||||||
const grub_partition_t partition);
|
|
||||||
|
|
||||||
int part_map_iterate_hook (grub_disk_t d __attribute__ ((unused)),
|
int part_iterate (grub_disk_t dsk,
|
||||||
const grub_partition_t partition __attribute__ ((unused)))
|
const grub_partition_t partition)
|
||||||
{
|
{
|
||||||
|
struct grub_partition p = *partition;
|
||||||
|
p.parent = dsk->partition;
|
||||||
|
dsk->partition = 0;
|
||||||
|
if (hook (dsk, &p))
|
||||||
|
{
|
||||||
|
ret = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (p.start != 0)
|
||||||
int part_map_iterate (const grub_partition_map_t p)
|
|
||||||
{
|
{
|
||||||
grub_dprintf ("partition", "Detecting %s...\n", p->name);
|
const struct grub_partition_map *partmap;
|
||||||
p->iterate (disk, part_map_iterate_hook);
|
dsk->partition = &p;
|
||||||
|
FOR_PARTITION_MAPS(partmap)
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
{
|
{
|
||||||
/* Continue to next partition map type. */
|
grub_err_t err;
|
||||||
grub_dprintf ("partition", "%s detection failed.\n", p->name);
|
err = partmap->iterate (dsk, part_iterate);
|
||||||
|
if (err)
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
return 0;
|
if (ret)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dsk->partition = p.parent;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_dprintf ("partition", "%s detection succeeded.\n", p->name);
|
{
|
||||||
partmap = p;
|
const struct grub_partition_map *partmap;
|
||||||
return 1;
|
FOR_PARTITION_MAPS(partmap)
|
||||||
|
{
|
||||||
|
grub_err_t err;
|
||||||
|
err = partmap->iterate (disk, part_iterate);
|
||||||
|
if (err)
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
if (ret)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_partition_map_iterate (part_map_iterate);
|
|
||||||
if (partmap)
|
|
||||||
ret = partmap->iterate (disk, hook);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -129,5 +182,32 @@ grub_partition_iterate (struct grub_disk *disk,
|
||||||
char *
|
char *
|
||||||
grub_partition_get_name (const grub_partition_t partition)
|
grub_partition_get_name (const grub_partition_t partition)
|
||||||
{
|
{
|
||||||
return partition->partmap->get_name (partition);
|
char *out = 0;
|
||||||
|
int curlen = 0;
|
||||||
|
grub_partition_t part;
|
||||||
|
for (part = partition; part; part = part->parent)
|
||||||
|
{
|
||||||
|
/* Even on 64-bit machines this buffer is enough to hold
|
||||||
|
longest number. */
|
||||||
|
char buf[grub_strlen (part->partmap->name) + 25];
|
||||||
|
int strl;
|
||||||
|
grub_snprintf (buf, sizeof (buf), "%s%d", part->partmap->name,
|
||||||
|
part->number + 1);
|
||||||
|
strl = grub_strlen (buf);
|
||||||
|
if (curlen)
|
||||||
|
{
|
||||||
|
out = grub_realloc (out, curlen + strl + 2);
|
||||||
|
grub_memcpy (out + strl + 1, out, curlen);
|
||||||
|
out[curlen + 1 + strl] = 0;
|
||||||
|
grub_memcpy (out, buf, strl);
|
||||||
|
out[strl] = ',';
|
||||||
|
curlen = curlen + 1 + strl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curlen = strl;
|
||||||
|
out = grub_strdup (buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
.globl _start
|
.globl _start
|
||||||
_start:
|
_start:
|
||||||
ba codestart
|
ba codestart
|
||||||
nop
|
mov %o4, %o0
|
||||||
|
|
||||||
. = EXT_C(_start) + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
|
. = EXT_C(_start) + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
|
||||||
|
|
||||||
|
@ -53,8 +53,17 @@ codestart:
|
||||||
or %o3, %lo(_end), %o3
|
or %o3, %lo(_end), %o3
|
||||||
sethi %hi(grub_total_module_size), %o4
|
sethi %hi(grub_total_module_size), %o4
|
||||||
lduw [%o4 + %lo(grub_total_module_size)], %o4
|
lduw [%o4 + %lo(grub_total_module_size)], %o4
|
||||||
|
|
||||||
add %o2, %o4, %o2
|
add %o2, %o4, %o2
|
||||||
add %o3, %o4, %o3
|
add %o3, %o4, %o3
|
||||||
|
|
||||||
|
/* Save ieee1275 stack for future use by booter. */
|
||||||
|
mov %o6, %o1
|
||||||
|
/* Our future stack. */
|
||||||
|
sethi %hi(GRUB_KERNEL_MACHINE_STACK_SIZE - 2047), %o5
|
||||||
|
or %o5, %lo(GRUB_KERNEL_MACHINE_STACK_SIZE - 2047), %o5
|
||||||
|
add %o3, %o5, %o6
|
||||||
|
|
||||||
sub %o2, 4, %o2
|
sub %o2, 4, %o2
|
||||||
sub %o3, 4, %o3
|
sub %o3, 4, %o3
|
||||||
1: lduw [%o2], %o5
|
1: lduw [%o2], %o5
|
||||||
|
@ -74,8 +83,9 @@ codestart:
|
||||||
cmp %o2, %o3
|
cmp %o2, %o3
|
||||||
blt,pt %xcc, 1b
|
blt,pt %xcc, 1b
|
||||||
nop
|
nop
|
||||||
|
sethi %hi(grub_ieee1275_original_stack), %o2
|
||||||
|
stx %o1, [%o2 + %lo(grub_ieee1275_original_stack)]
|
||||||
sethi %hi(grub_ieee1275_entry_fn), %o2
|
sethi %hi(grub_ieee1275_entry_fn), %o2
|
||||||
stx %o0, [%o2 + %lo(grub_ieee1275_entry_fn)]
|
|
||||||
call grub_main
|
call grub_main
|
||||||
nop
|
stx %o0, [%o2 + %lo(grub_ieee1275_entry_fn)]
|
||||||
1: ba,a 1b
|
1: ba,a 1b
|
||||||
|
|
|
@ -23,12 +23,15 @@
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
|
#include <grub/machine/boot.h>
|
||||||
#include <grub/machine/console.h>
|
#include <grub/machine/console.h>
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
#include <grub/machine/time.h>
|
#include <grub/machine/time.h>
|
||||||
#include <grub/ieee1275/ofdisk.h>
|
#include <grub/ieee1275/ofdisk.h>
|
||||||
#include <grub/ieee1275/ieee1275.h>
|
#include <grub/ieee1275/ieee1275.h>
|
||||||
|
|
||||||
|
grub_addr_t grub_ieee1275_original_stack;
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_exit (void)
|
grub_exit (void)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +107,8 @@ grub_machine_set_prefix (void)
|
||||||
static void
|
static void
|
||||||
grub_heap_init (void)
|
grub_heap_init (void)
|
||||||
{
|
{
|
||||||
grub_mm_init_region ((void *)(long)0x4000UL, 0x200000 - 0x4000);
|
grub_mm_init_region ((void *) (grub_modules_get_end ()
|
||||||
|
+ GRUB_KERNEL_MACHINE_STACK_SIZE), 0x200000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
142
lib/ieee1275/datetime.c
Normal file
142
lib/ieee1275/datetime.c
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
/* kern/cmos_datetime.c - CMOS datetime function.
|
||||||
|
*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2008,2009 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/datetime.h>
|
||||||
|
#include <grub/ieee1275/ieee1275.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
|
||||||
|
static char *rtc = 0;
|
||||||
|
|
||||||
|
static void
|
||||||
|
find_rtc (void)
|
||||||
|
{
|
||||||
|
auto int hook (struct grub_ieee1275_devalias *alias);
|
||||||
|
int hook (struct grub_ieee1275_devalias *alias)
|
||||||
|
{
|
||||||
|
if (grub_strcmp (alias->type, "rtc") == 0)
|
||||||
|
{
|
||||||
|
grub_dprintf ("datetime", "Found RTC %s\n", alias->path);
|
||||||
|
rtc = grub_strdup (alias->path);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_ieee1275_devices_iterate (hook);
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_err_t
|
||||||
|
grub_get_datetime (struct grub_datetime *datetime)
|
||||||
|
{
|
||||||
|
struct get_time_args
|
||||||
|
{
|
||||||
|
struct grub_ieee1275_common_hdr common;
|
||||||
|
grub_ieee1275_cell_t method;
|
||||||
|
grub_ieee1275_cell_t device;
|
||||||
|
grub_ieee1275_cell_t catch_result;
|
||||||
|
grub_ieee1275_cell_t year;
|
||||||
|
grub_ieee1275_cell_t month;
|
||||||
|
grub_ieee1275_cell_t day;
|
||||||
|
grub_ieee1275_cell_t hour;
|
||||||
|
grub_ieee1275_cell_t minute;
|
||||||
|
grub_ieee1275_cell_t second;
|
||||||
|
}
|
||||||
|
args;
|
||||||
|
int status;
|
||||||
|
grub_ieee1275_ihandle_t ihandle;
|
||||||
|
|
||||||
|
if (!rtc)
|
||||||
|
find_rtc ();
|
||||||
|
if (!rtc)
|
||||||
|
return grub_error (GRUB_ERR_IO, "no RTC found");
|
||||||
|
|
||||||
|
status = grub_ieee1275_open (rtc, &ihandle);
|
||||||
|
if (status == -1)
|
||||||
|
return grub_error (GRUB_ERR_IO, "couldn't open RTC");
|
||||||
|
|
||||||
|
INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 7);
|
||||||
|
args.device = (grub_ieee1275_cell_t) ihandle;
|
||||||
|
args.method = (grub_ieee1275_cell_t) "get-time";
|
||||||
|
|
||||||
|
status = IEEE1275_CALL_ENTRY_FN (&args);
|
||||||
|
|
||||||
|
grub_ieee1275_close (ihandle);
|
||||||
|
|
||||||
|
if (status == -1)
|
||||||
|
return grub_error (GRUB_ERR_IO, "get-time failed");
|
||||||
|
|
||||||
|
datetime->year = args.year;
|
||||||
|
datetime->month = args.month;
|
||||||
|
datetime->day = args.day;
|
||||||
|
datetime->hour = args.hour;
|
||||||
|
datetime->minute = args.minute;
|
||||||
|
datetime->second = args.second;
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_err_t
|
||||||
|
grub_set_datetime (struct grub_datetime *datetime)
|
||||||
|
{
|
||||||
|
struct set_time_args
|
||||||
|
{
|
||||||
|
struct grub_ieee1275_common_hdr common;
|
||||||
|
grub_ieee1275_cell_t method;
|
||||||
|
grub_ieee1275_cell_t device;
|
||||||
|
grub_ieee1275_cell_t year;
|
||||||
|
grub_ieee1275_cell_t month;
|
||||||
|
grub_ieee1275_cell_t day;
|
||||||
|
grub_ieee1275_cell_t hour;
|
||||||
|
grub_ieee1275_cell_t minute;
|
||||||
|
grub_ieee1275_cell_t second;
|
||||||
|
grub_ieee1275_cell_t catch_result;
|
||||||
|
}
|
||||||
|
args;
|
||||||
|
int status;
|
||||||
|
grub_ieee1275_ihandle_t ihandle;
|
||||||
|
|
||||||
|
if (!rtc)
|
||||||
|
find_rtc ();
|
||||||
|
if (!rtc)
|
||||||
|
return grub_error (GRUB_ERR_IO, "no RTC found");
|
||||||
|
|
||||||
|
status = grub_ieee1275_open (rtc, &ihandle);
|
||||||
|
if (status == -1)
|
||||||
|
return grub_error (GRUB_ERR_IO, "couldn't open RTC");
|
||||||
|
|
||||||
|
INIT_IEEE1275_COMMON (&args.common, "call-method", 8, 1);
|
||||||
|
args.device = (grub_ieee1275_cell_t) ihandle;
|
||||||
|
args.method = (grub_ieee1275_cell_t) "set-time";
|
||||||
|
|
||||||
|
args.year = datetime->year;
|
||||||
|
args.month = datetime->month;
|
||||||
|
args.day = datetime->day;
|
||||||
|
args.hour = datetime->hour;
|
||||||
|
args.minute = datetime->minute;
|
||||||
|
args.second = datetime->second;
|
||||||
|
|
||||||
|
status = IEEE1275_CALL_ENTRY_FN (&args);
|
||||||
|
|
||||||
|
grub_ieee1275_close (ihandle);
|
||||||
|
|
||||||
|
if (status == -1)
|
||||||
|
return grub_error (GRUB_ERR_IO, "set-time failed");
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
|
@ -59,7 +59,7 @@ typedef union {
|
||||||
double g;
|
double g;
|
||||||
} PROPERLY_ALIGNED_TYPE;
|
} PROPERLY_ALIGNED_TYPE;
|
||||||
|
|
||||||
#define gcry_assert(x) grub_assert_real(__FILE__, __LINE__, x)
|
#define gcry_assert(x) grub_assert_real(GRUB_FILE, __LINE__, x)
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
grub_assert_real (const char *file, int line, int cond)
|
grub_assert_real (const char *file, int line, int cond)
|
||||||
|
|
|
@ -140,7 +140,6 @@ grub_bsd_get_device (grub_uint32_t * biosdev,
|
||||||
grub_uint32_t * unit,
|
grub_uint32_t * unit,
|
||||||
grub_uint32_t * slice, grub_uint32_t * part)
|
grub_uint32_t * slice, grub_uint32_t * part)
|
||||||
{
|
{
|
||||||
char *p;
|
|
||||||
grub_device_t dev;
|
grub_device_t dev;
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_PCBIOS
|
#ifdef GRUB_MACHINE_PCBIOS
|
||||||
|
@ -154,22 +153,13 @@ grub_bsd_get_device (grub_uint32_t * biosdev,
|
||||||
dev = grub_device_open (0);
|
dev = grub_device_open (0);
|
||||||
if (dev && dev->disk && dev->disk->partition)
|
if (dev && dev->disk && dev->disk->partition)
|
||||||
{
|
{
|
||||||
char *p0;
|
if (dev->disk->partition->parent)
|
||||||
p0 = p = dev->disk->partition->partmap->get_name (dev->disk->partition);
|
|
||||||
if (p)
|
|
||||||
{
|
{
|
||||||
if ((p[0] >= '0') && (p[0] <= '9'))
|
*part = dev->disk->partition->number;
|
||||||
{
|
*slice = dev->disk->partition->parent->number + 1;
|
||||||
*slice = grub_strtoul (p, &p, 0);
|
|
||||||
|
|
||||||
if ((p) && (p[0] == ','))
|
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if ((p[0] >= 'a') && (p[0] <= 'z'))
|
*slice = dev->disk->partition->number + 1;
|
||||||
*part = p[0] - 'a';
|
|
||||||
}
|
|
||||||
grub_free (p0);
|
|
||||||
}
|
}
|
||||||
if (dev)
|
if (dev)
|
||||||
grub_device_close (dev);
|
grub_device_close (dev);
|
||||||
|
|
|
@ -514,7 +514,6 @@ grub_multiboot_add_module (grub_addr_t start, grub_size_t size,
|
||||||
void
|
void
|
||||||
grub_multiboot_set_bootdev (void)
|
grub_multiboot_set_bootdev (void)
|
||||||
{
|
{
|
||||||
char *p;
|
|
||||||
grub_uint32_t biosdev, slice = ~0, part = ~0;
|
grub_uint32_t biosdev, slice = ~0, part = ~0;
|
||||||
grub_device_t dev;
|
grub_device_t dev;
|
||||||
|
|
||||||
|
@ -530,22 +529,13 @@ grub_multiboot_set_bootdev (void)
|
||||||
dev = grub_device_open (0);
|
dev = grub_device_open (0);
|
||||||
if (dev && dev->disk && dev->disk->partition)
|
if (dev && dev->disk && dev->disk->partition)
|
||||||
{
|
{
|
||||||
char *p0;
|
if (dev->disk->partition->parent)
|
||||||
p = p0 = dev->disk->partition->partmap->get_name (dev->disk->partition);
|
|
||||||
if (p)
|
|
||||||
{
|
{
|
||||||
if ((p[0] >= '0') && (p[0] <= '9'))
|
part = dev->disk->partition->number;
|
||||||
{
|
slice = dev->disk->partition->parent->number;
|
||||||
slice = grub_strtoul (p, &p, 0) - 1;
|
|
||||||
|
|
||||||
if ((p) && (p[0] == ','))
|
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if ((p[0] >= 'a') && (p[0] <= 'z'))
|
slice = dev->disk->partition->number;
|
||||||
part = p[0] - 'a';
|
|
||||||
}
|
|
||||||
grub_free (p0);
|
|
||||||
}
|
}
|
||||||
if (dev)
|
if (dev)
|
||||||
grub_device_close (dev);
|
grub_device_close (dev);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/msdos_partition.h>
|
||||||
#include <grub/machine/biosnum.h>
|
#include <grub/machine/biosnum.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
#include <grub/video.h>
|
#include <grub/video.h>
|
||||||
|
@ -98,10 +99,22 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
|
||||||
dev = grub_device_open (0);
|
dev = grub_device_open (0);
|
||||||
if (dev && dev->disk && dev->disk->partition)
|
if (dev && dev->disk && dev->disk->partition)
|
||||||
{
|
{
|
||||||
grub_disk_read (dev->disk, dev->disk->partition->offset, 446, 64,
|
grub_disk_t disk = dev->disk;
|
||||||
|
|
||||||
|
if (disk)
|
||||||
|
{
|
||||||
|
grub_partition_t p = disk->partition;
|
||||||
|
|
||||||
|
if (p && grub_strcmp (p->partmap->name, "msdos") == 0)
|
||||||
|
{
|
||||||
|
disk->partition = p->parent;
|
||||||
|
grub_disk_read (disk, p->offset, 446, 64,
|
||||||
(void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
|
(void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
|
||||||
part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR
|
part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR
|
||||||
+ (dev->disk->partition->index << 4));
|
+ (p->index << 4));
|
||||||
|
disk->partition = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev)
|
if (dev)
|
||||||
|
|
|
@ -58,9 +58,6 @@ static grub_size_t linux_size;
|
||||||
|
|
||||||
static char *linux_args;
|
static char *linux_args;
|
||||||
|
|
||||||
typedef void (*kernel_entry_t) (unsigned long, unsigned long,
|
|
||||||
unsigned long, unsigned long, int (void *));
|
|
||||||
|
|
||||||
struct linux_bootstr_info {
|
struct linux_bootstr_info {
|
||||||
int len, valid;
|
int len, valid;
|
||||||
char buf[];
|
char buf[];
|
||||||
|
@ -92,7 +89,6 @@ static grub_err_t
|
||||||
grub_linux_boot (void)
|
grub_linux_boot (void)
|
||||||
{
|
{
|
||||||
struct linux_bootstr_info *bp;
|
struct linux_bootstr_info *bp;
|
||||||
kernel_entry_t linuxmain;
|
|
||||||
struct linux_hdrs *hp;
|
struct linux_hdrs *hp;
|
||||||
grub_addr_t addr;
|
grub_addr_t addr;
|
||||||
|
|
||||||
|
@ -141,8 +137,17 @@ grub_linux_boot (void)
|
||||||
grub_dprintf ("loader", "Jumping to Linux...\n");
|
grub_dprintf ("loader", "Jumping to Linux...\n");
|
||||||
|
|
||||||
/* Boot the kernel. */
|
/* Boot the kernel. */
|
||||||
linuxmain = (kernel_entry_t) linux_addr;
|
asm volatile ("sethi %hi(grub_ieee1275_entry_fn), %o1\n"
|
||||||
linuxmain (0, 0, 0, 0, grub_ieee1275_entry_fn);
|
"ldx [%o1 + %lo(grub_ieee1275_entry_fn)], %o4\n"
|
||||||
|
"sethi %hi(grub_ieee1275_original_stack), %o1\n"
|
||||||
|
"ldx [%o1 + %lo(grub_ieee1275_original_stack)], %o6\n"
|
||||||
|
"sethi %hi(linux_addr), %o1\n"
|
||||||
|
"ldx [%o1 + %lo(linux_addr)], %o5\n"
|
||||||
|
"mov %g0, %o0\n"
|
||||||
|
"mov %g0, %o2\n"
|
||||||
|
"mov %g0, %o3\n"
|
||||||
|
"jmp %o5\n"
|
||||||
|
"mov %g0, %o1\n");
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1390,7 +1390,7 @@ grub_cmd_xnu_splash (grub_extcmd_t cmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef GRUB_UTIL
|
#ifndef GRUB_MACHINE_EMU
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_xnu_resume (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_xnu_resume (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc, char *args[])
|
int argc, char *args[])
|
||||||
|
@ -1444,7 +1444,7 @@ GRUB_MOD_INIT(xnu)
|
||||||
N_("Load a splash image for XNU."),
|
N_("Load a splash image for XNU."),
|
||||||
xnu_splash_cmd_options);
|
xnu_splash_cmd_options);
|
||||||
|
|
||||||
#ifndef GRUB_UTIL
|
#ifndef GRUB_MACHINE_EMU
|
||||||
cmd_resume = grub_register_command ("xnu_resume", grub_cmd_xnu_resume,
|
cmd_resume = grub_register_command ("xnu_resume", grub_cmd_xnu_resume,
|
||||||
0, N_("Load XNU hibernate image."));
|
0, N_("Load XNU hibernate image."));
|
||||||
#endif
|
#endif
|
||||||
|
@ -1456,7 +1456,7 @@ GRUB_MOD_INIT(xnu)
|
||||||
|
|
||||||
GRUB_MOD_FINI(xnu)
|
GRUB_MOD_FINI(xnu)
|
||||||
{
|
{
|
||||||
#ifndef GRUB_UTIL
|
#ifndef GRUB_MACHINE_EMU
|
||||||
grub_unregister_command (cmd_resume);
|
grub_unregister_command (cmd_resume);
|
||||||
#endif
|
#endif
|
||||||
grub_unregister_command (cmd_mkext);
|
grub_unregister_command (cmd_mkext);
|
||||||
|
|
|
@ -19,32 +19,27 @@
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
|
|
||||||
#define DS(x) ((x) - segstart)
|
#define DS(x) ((x) - LOCAL (segstart))
|
||||||
|
|
||||||
segstart:
|
LOCAL (segstart):
|
||||||
VARIABLE(grub_machine_mmaphook_start)
|
VARIABLE(grub_machine_mmaphook_start)
|
||||||
.code16
|
.code16
|
||||||
VARIABLE(grub_machine_mmaphook_int12)
|
VARIABLE(grub_machine_mmaphook_int12)
|
||||||
push %ds
|
push %ds
|
||||||
push %cs
|
push %cs
|
||||||
pop %ds
|
pop %ds
|
||||||
#ifdef APPLE_CC
|
movw DS (LOCAL (kblow)), %ax
|
||||||
grub_machine_mmaphook_kblow_rel = DS (EXT_C (grub_machine_mmaphook_kblow))
|
|
||||||
movw (grub_machine_mmaphook_kblow_rel), %ax
|
|
||||||
#else
|
|
||||||
movw DS (EXT_C (grub_machine_mmaphook_kblow)), %ax
|
|
||||||
#endif
|
|
||||||
pop %ds
|
pop %ds
|
||||||
iret
|
iret
|
||||||
|
|
||||||
VARIABLE(grub_machine_mmaphook_int15)
|
VARIABLE(grub_machine_mmaphook_int15)
|
||||||
pushf
|
pushf
|
||||||
cmpw $0xe801, %ax
|
cmpw $0xe801, %ax
|
||||||
jz e801
|
jz LOCAL (e801)
|
||||||
cmpw $0xe820, %ax
|
cmpw $0xe820, %ax
|
||||||
jz e820
|
jz LOCAL (e820)
|
||||||
cmpb $0x88, %ah
|
cmpb $0x88, %ah
|
||||||
jz h88
|
jz LOCAL (h88)
|
||||||
popf
|
popf
|
||||||
/* ljmp */
|
/* ljmp */
|
||||||
.byte 0xea
|
.byte 0xea
|
||||||
|
@ -53,67 +48,44 @@ VARIABLE (grub_machine_mmaphook_int15offset)
|
||||||
VARIABLE (grub_machine_mmaphook_int15segment)
|
VARIABLE (grub_machine_mmaphook_int15segment)
|
||||||
.word 0
|
.word 0
|
||||||
|
|
||||||
e801:
|
LOCAL (e801):
|
||||||
popf
|
popf
|
||||||
push %ds
|
push %ds
|
||||||
push %cs
|
push %cs
|
||||||
pop %ds
|
pop %ds
|
||||||
#ifdef APPLE_CC
|
movw DS (LOCAL (kbin16mb)), %ax
|
||||||
grub_machine_mmaphook_kbin16mb_rel = DS (EXT_C (grub_machine_mmaphook_kbin16mb))
|
movw DS (LOCAL (m64kbin4gb)), %bx
|
||||||
grub_machine_mmaphook_64kbin4gb_rel = DS (EXT_C (grub_machine_mmaphook_64kbin4gb))
|
|
||||||
movw (grub_machine_mmaphook_kbin16mb_rel), %ax
|
|
||||||
movw (grub_machine_mmaphook_64kbin4gb_rel), %bx
|
|
||||||
#else
|
|
||||||
movw DS (EXT_C (grub_machine_mmaphook_kbin16mb)), %ax
|
|
||||||
movw DS (EXT_C (grub_machine_mmaphook_64kbin4gb)), %bx
|
|
||||||
#endif
|
|
||||||
movw %ax, %cx
|
movw %ax, %cx
|
||||||
movw %bx, %dx
|
movw %bx, %dx
|
||||||
pop %ds
|
pop %ds
|
||||||
clc
|
clc
|
||||||
iret
|
iret
|
||||||
|
|
||||||
h88:
|
LOCAL (h88):
|
||||||
popf
|
popf
|
||||||
push %ds
|
push %ds
|
||||||
push %cs
|
push %cs
|
||||||
pop %ds
|
pop %ds
|
||||||
#ifdef APPLE_CC
|
movw DS (LOCAL (kbin16mb)), %ax
|
||||||
movw (grub_machine_mmaphook_kbin16mb_rel), %ax
|
|
||||||
#else
|
|
||||||
movw DS (EXT_C (grub_machine_mmaphook_kbin16mb)), %ax
|
|
||||||
#endif
|
|
||||||
pop %ds
|
pop %ds
|
||||||
clc
|
clc
|
||||||
iret
|
iret
|
||||||
|
|
||||||
e820:
|
LOCAL (e820):
|
||||||
#ifdef APPLE_CC
|
|
||||||
mmaphook_mmap_rel = DS(mmaphook_mmap)
|
|
||||||
mmaphook_mmap_num_rel = DS(EXT_C(grub_machine_mmaphook_mmap_num))
|
|
||||||
#endif
|
|
||||||
popf
|
popf
|
||||||
push %ds
|
push %ds
|
||||||
push %cs
|
push %cs
|
||||||
pop %ds
|
pop %ds
|
||||||
cmpw $20, %cx
|
cmpw $20, %cx
|
||||||
jb errexit
|
jb LOCAL (errexit)
|
||||||
#ifdef APPLE_CC
|
cmpw DS (LOCAL (mmap_num)), %bx
|
||||||
cmpw (mmaphook_mmap_num_rel), %bx
|
jae LOCAL (errexit)
|
||||||
#else
|
|
||||||
cmpw DS (EXT_C (grub_machine_mmaphook_mmap_num)), %bx
|
|
||||||
#endif
|
|
||||||
jae errexit
|
|
||||||
cmp $0x534d4150, %edx
|
cmp $0x534d4150, %edx
|
||||||
jne errexit
|
jne LOCAL (errexit)
|
||||||
push %si
|
push %si
|
||||||
push %di
|
push %di
|
||||||
movw $20, %cx
|
movw $20, %cx
|
||||||
#ifdef APPLE_CC
|
movw $(DS(LOCAL (mmaphook_mmap))), %si
|
||||||
movl $(mmaphook_mmap_rel), %esi
|
|
||||||
#else
|
|
||||||
movw $(DS(mmaphook_mmap)), %si
|
|
||||||
#endif
|
|
||||||
mov %bx, %ax
|
mov %bx, %ax
|
||||||
imul $20, %ax
|
imul $20, %ax
|
||||||
add %ax, %si
|
add %ax, %si
|
||||||
|
@ -122,19 +94,15 @@ e820:
|
||||||
pop %si
|
pop %si
|
||||||
movl $20, %ecx
|
movl $20, %ecx
|
||||||
inc %bx
|
inc %bx
|
||||||
#ifdef APPLE_CC
|
cmpw DS(LOCAL (mmap_num)), %bx
|
||||||
cmpw (mmaphook_mmap_num_rel), %bx
|
jb LOCAL (noclean)
|
||||||
#else
|
|
||||||
cmpw DS(EXT_C(grub_machine_mmaphook_mmap_num)), %bx
|
|
||||||
#endif
|
|
||||||
jb noclean
|
|
||||||
xor %bx, %bx
|
xor %bx, %bx
|
||||||
noclean:
|
LOCAL (noclean):
|
||||||
mov $0x534d4150, %eax
|
mov $0x534d4150, %eax
|
||||||
pop %ds
|
pop %ds
|
||||||
clc
|
clc
|
||||||
iret
|
iret
|
||||||
errexit:
|
LOCAL (errexit):
|
||||||
mov $0x534d4150, %eax
|
mov $0x534d4150, %eax
|
||||||
pop %ds
|
pop %ds
|
||||||
stc
|
stc
|
||||||
|
@ -142,13 +110,18 @@ errexit:
|
||||||
iret
|
iret
|
||||||
|
|
||||||
VARIABLE(grub_machine_mmaphook_mmap_num)
|
VARIABLE(grub_machine_mmaphook_mmap_num)
|
||||||
|
LOCAL (mmap_num):
|
||||||
.word 0
|
.word 0
|
||||||
VARIABLE(grub_machine_mmaphook_kblow)
|
VARIABLE(grub_machine_mmaphook_kblow)
|
||||||
|
LOCAL (kblow):
|
||||||
.word 0
|
.word 0
|
||||||
VARIABLE (grub_machine_mmaphook_kbin16mb)
|
VARIABLE (grub_machine_mmaphook_kbin16mb)
|
||||||
|
LOCAL (kbin16mb):
|
||||||
.word 0
|
.word 0
|
||||||
VARIABLE (grub_machine_mmaphook_64kbin4gb)
|
VARIABLE (grub_machine_mmaphook_64kbin4gb)
|
||||||
|
LOCAL (m64kbin4gb):
|
||||||
.word 0
|
.word 0
|
||||||
mmaphook_mmap:
|
LOCAL (mmaphook_mmap):
|
||||||
/* Memory map is placed just after the interrupt handlers. */
|
/* Memory map is placed just after the interrupt handlers. */
|
||||||
VARIABLE(grub_machine_mmaphook_end)
|
VARIABLE(grub_machine_mmaphook_end)
|
||||||
|
.byte 0
|
||||||
|
|
|
@ -96,17 +96,12 @@ acorn_partition_map_iterate (grub_disk_t disk,
|
||||||
const grub_partition_t partition))
|
const grub_partition_t partition))
|
||||||
{
|
{
|
||||||
struct grub_partition part;
|
struct grub_partition part;
|
||||||
struct grub_disk raw;
|
|
||||||
struct linux_part map[LINUX_MAP_ENTRIES];
|
struct linux_part map[LINUX_MAP_ENTRIES];
|
||||||
int i;
|
int i;
|
||||||
grub_disk_addr_t sector;
|
grub_disk_addr_t sector = 0;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
/* Enforce raw disk access. */
|
err = acorn_partition_map_find (disk, map, §or);
|
||||||
raw = *disk;
|
|
||||||
raw.partition = 0;
|
|
||||||
|
|
||||||
err = acorn_partition_map_find (&raw, map, §or);
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -121,7 +116,7 @@ acorn_partition_map_iterate (grub_disk_t disk,
|
||||||
part.start = sector + map[i].start;
|
part.start = sector + map[i].start;
|
||||||
part.len = map[i].size;
|
part.len = map[i].size;
|
||||||
part.offset = 6;
|
part.offset = 6;
|
||||||
part.index = i;
|
part.number = part.index = i;
|
||||||
|
|
||||||
if (hook (disk, &part))
|
if (hook (disk, &part))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
@ -130,70 +125,21 @@ acorn_partition_map_iterate (grub_disk_t disk,
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static grub_partition_t
|
|
||||||
acorn_partition_map_probe (grub_disk_t disk, const char *str)
|
|
||||||
{
|
|
||||||
struct linux_part map[LINUX_MAP_ENTRIES];
|
|
||||||
struct grub_disk raw = *disk;
|
|
||||||
unsigned long partnum = grub_strtoul (str, 0, 10) - 1;
|
|
||||||
grub_disk_addr_t sector;
|
|
||||||
grub_err_t err;
|
|
||||||
grub_partition_t p;
|
|
||||||
|
|
||||||
/* Enforce raw disk access. */
|
|
||||||
raw.partition = 0;
|
|
||||||
|
|
||||||
/* Get the partition number. */
|
|
||||||
if (partnum > LINUX_MAP_ENTRIES)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
err = acorn_partition_map_find (&raw, map, §or);
|
|
||||||
if (err)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (map[partnum].magic != LINUX_NATIVE_MAGIC
|
|
||||||
&& map[partnum].magic != LINUX_SWAP_MAGIC)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
p = grub_malloc (sizeof (struct grub_partition));
|
|
||||||
if (! p)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
p->start = 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)
|
|
||||||
{
|
|
||||||
return grub_xasprintf ("%d", p->index + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Partition map type. */
|
/* Partition map type. */
|
||||||
static struct grub_partition_map grub_acorn_partition_map =
|
static struct grub_partition_map grub_acorn_partition_map =
|
||||||
{
|
{
|
||||||
.name = "part_acorn",
|
.name = "acorn",
|
||||||
.iterate = acorn_partition_map_iterate,
|
.iterate = acorn_partition_map_iterate,
|
||||||
.probe = acorn_partition_map_probe,
|
|
||||||
.get_name = acorn_partition_map_get_name
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GRUB_MOD_INIT(acorn_partition_map)
|
GRUB_MOD_INIT(part_acorn)
|
||||||
{
|
{
|
||||||
grub_partition_map_register (&grub_acorn_partition_map);
|
grub_partition_map_register (&grub_acorn_partition_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(acorn_partition_map)
|
GRUB_MOD_FINI(part_acorn)
|
||||||
{
|
{
|
||||||
grub_partition_map_unregister (&grub_acorn_partition_map);
|
grub_partition_map_unregister (&grub_acorn_partition_map);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,20 +76,15 @@ amiga_partition_map_iterate (grub_disk_t disk,
|
||||||
{
|
{
|
||||||
struct grub_partition part;
|
struct grub_partition part;
|
||||||
struct grub_amiga_rdsk rdsk;
|
struct grub_amiga_rdsk rdsk;
|
||||||
struct grub_disk raw;
|
|
||||||
int partno = 0;
|
int partno = 0;
|
||||||
int next = -1;
|
int next = -1;
|
||||||
unsigned pos;
|
unsigned pos;
|
||||||
|
|
||||||
/* Enforce raw disk access. */
|
|
||||||
raw = *disk;
|
|
||||||
raw.partition = 0;
|
|
||||||
|
|
||||||
/* The RDSK block is one of the first 15 blocks. */
|
/* The RDSK block is one of the first 15 blocks. */
|
||||||
for (pos = 0; pos < 15; pos++)
|
for (pos = 0; pos < 15; pos++)
|
||||||
{
|
{
|
||||||
/* Read the RDSK block which is a descriptor for the entire disk. */
|
/* Read the RDSK block which is a descriptor for the entire disk. */
|
||||||
if (grub_disk_read (&raw, pos, 0, sizeof (rdsk), &rdsk))
|
if (grub_disk_read (disk, pos, 0, sizeof (rdsk), &rdsk))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
if (grub_strcmp ((char *) rdsk.magic, "RDSK") == 0)
|
if (grub_strcmp ((char *) rdsk.magic, "RDSK") == 0)
|
||||||
|
@ -110,7 +105,7 @@ amiga_partition_map_iterate (grub_disk_t disk,
|
||||||
struct grub_amiga_partition apart;
|
struct grub_amiga_partition apart;
|
||||||
|
|
||||||
/* Read the RDSK block which is a descriptor for the entire disk. */
|
/* Read the RDSK block which is a descriptor for the entire disk. */
|
||||||
if (grub_disk_read (&raw, next, 0, sizeof (apart), &apart))
|
if (grub_disk_read (disk, next, 0, sizeof (apart), &apart))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
/* Calculate the first block and the size of the partition. */
|
/* Calculate the first block and the size of the partition. */
|
||||||
|
@ -123,7 +118,8 @@ amiga_partition_map_iterate (grub_disk_t disk,
|
||||||
* grub_be_to_cpu32 (apart.block_per_track));
|
* grub_be_to_cpu32 (apart.block_per_track));
|
||||||
|
|
||||||
part.offset = (grub_off_t) next * 512;
|
part.offset = (grub_off_t) next * 512;
|
||||||
part.index = partno;
|
part.number = partno;
|
||||||
|
part.index = 0;
|
||||||
part.partmap = &grub_amiga_partition_map;
|
part.partmap = &grub_amiga_partition_map;
|
||||||
|
|
||||||
if (hook (disk, &part))
|
if (hook (disk, &part))
|
||||||
|
@ -136,73 +132,20 @@ amiga_partition_map_iterate (grub_disk_t disk,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static grub_partition_t
|
|
||||||
amiga_partition_map_probe (grub_disk_t disk, const char *str)
|
|
||||||
{
|
|
||||||
grub_partition_t p = 0;
|
|
||||||
int partnum = 0;
|
|
||||||
char *s = (char *) str;
|
|
||||||
|
|
||||||
auto int find_func (grub_disk_t d, const grub_partition_t partition);
|
|
||||||
|
|
||||||
int find_func (grub_disk_t d __attribute__ ((unused)),
|
|
||||||
const grub_partition_t partition)
|
|
||||||
{
|
|
||||||
if (partnum == partition->index)
|
|
||||||
{
|
|
||||||
p = (grub_partition_t) grub_malloc (sizeof (*p));
|
|
||||||
if (! p)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
grub_memcpy (p, partition, sizeof (*p));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the partition number. */
|
|
||||||
partnum = grub_strtoul (s, 0, 10) - 1;
|
|
||||||
if (grub_errno)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (amiga_partition_map_iterate (disk, find_func))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
return p;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
grub_free (p);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static char *
|
|
||||||
amiga_partition_map_get_name (const grub_partition_t p)
|
|
||||||
{
|
|
||||||
return grub_xasprintf ("%d", p->index + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Partition map type. */
|
/* Partition map type. */
|
||||||
static struct grub_partition_map grub_amiga_partition_map =
|
static struct grub_partition_map grub_amiga_partition_map =
|
||||||
{
|
{
|
||||||
.name = "part_amiga",
|
.name = "amiga",
|
||||||
.iterate = amiga_partition_map_iterate,
|
.iterate = amiga_partition_map_iterate,
|
||||||
.probe = amiga_partition_map_probe,
|
|
||||||
.get_name = amiga_partition_map_get_name
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GRUB_MOD_INIT(amiga_partition_map)
|
GRUB_MOD_INIT(part_amiga)
|
||||||
{
|
{
|
||||||
grub_partition_map_register (&grub_amiga_partition_map);
|
grub_partition_map_register (&grub_amiga_partition_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(amiga_partition_map)
|
GRUB_MOD_FINI(part_amiga)
|
||||||
{
|
{
|
||||||
grub_partition_map_unregister (&grub_amiga_partition_map);
|
grub_partition_map_unregister (&grub_amiga_partition_map);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,17 +105,12 @@ apple_partition_map_iterate (grub_disk_t disk,
|
||||||
struct grub_partition part;
|
struct grub_partition part;
|
||||||
struct grub_apple_header aheader;
|
struct grub_apple_header aheader;
|
||||||
struct grub_apple_part apart;
|
struct grub_apple_part apart;
|
||||||
struct grub_disk raw;
|
|
||||||
int partno = 0, partnum = 0;
|
int partno = 0, partnum = 0;
|
||||||
unsigned pos;
|
unsigned pos;
|
||||||
|
|
||||||
/* Enforce raw disk access. */
|
|
||||||
raw = *disk;
|
|
||||||
raw.partition = 0;
|
|
||||||
|
|
||||||
part.partmap = &grub_apple_partition_map;
|
part.partmap = &grub_apple_partition_map;
|
||||||
|
|
||||||
if (grub_disk_read (&raw, 0, 0, sizeof (aheader), &aheader))
|
if (grub_disk_read (disk, 0, 0, sizeof (aheader), &aheader))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
if (grub_be_to_cpu16 (aheader.magic) != GRUB_APPLE_HEADER_MAGIC)
|
if (grub_be_to_cpu16 (aheader.magic) != GRUB_APPLE_HEADER_MAGIC)
|
||||||
|
@ -131,8 +126,10 @@ apple_partition_map_iterate (grub_disk_t disk,
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (grub_disk_read (&raw, pos / GRUB_DISK_SECTOR_SIZE,
|
part.offset = pos / GRUB_DISK_SECTOR_SIZE;
|
||||||
pos % GRUB_DISK_SECTOR_SIZE,
|
part.index = pos % GRUB_DISK_SECTOR_SIZE;
|
||||||
|
|
||||||
|
if (grub_disk_read (disk, part.offset, part.index,
|
||||||
sizeof (struct grub_apple_part), &apart))
|
sizeof (struct grub_apple_part), &apart))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
|
@ -156,6 +153,7 @@ apple_partition_map_iterate (grub_disk_t disk,
|
||||||
/ GRUB_DISK_SECTOR_SIZE;
|
/ GRUB_DISK_SECTOR_SIZE;
|
||||||
part.offset = pos;
|
part.offset = pos;
|
||||||
part.index = partno;
|
part.index = partno;
|
||||||
|
part.number = partno;
|
||||||
|
|
||||||
grub_dprintf ("partition",
|
grub_dprintf ("partition",
|
||||||
"partition %d: name %s, type %s, start 0x%x, len 0x%x\n",
|
"partition %d: name %s, type %s, start 0x%x, len 0x%x\n",
|
||||||
|
@ -179,73 +177,20 @@ apple_partition_map_iterate (grub_disk_t disk,
|
||||||
"Apple partition map not found");
|
"Apple partition map not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static grub_partition_t
|
|
||||||
apple_partition_map_probe (grub_disk_t disk, const char *str)
|
|
||||||
{
|
|
||||||
grub_partition_t p = 0;
|
|
||||||
int partnum = 0;
|
|
||||||
char *s = (char *) str;
|
|
||||||
|
|
||||||
auto int find_func (grub_disk_t d, const grub_partition_t partition);
|
|
||||||
|
|
||||||
int find_func (grub_disk_t d __attribute__ ((unused)),
|
|
||||||
const grub_partition_t partition)
|
|
||||||
{
|
|
||||||
if (partnum == partition->index)
|
|
||||||
{
|
|
||||||
p = (grub_partition_t) grub_malloc (sizeof (*p));
|
|
||||||
if (! p)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
grub_memcpy (p, partition, sizeof (*p));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the partition number. */
|
|
||||||
partnum = grub_strtoul (s, 0, 10) - 1;
|
|
||||||
if (grub_errno)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (apple_partition_map_iterate (disk, find_func))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
return p;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
grub_free (p);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static char *
|
|
||||||
apple_partition_map_get_name (const grub_partition_t p)
|
|
||||||
{
|
|
||||||
return grub_xasprintf ("%d", p->index + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Partition map type. */
|
/* Partition map type. */
|
||||||
static struct grub_partition_map grub_apple_partition_map =
|
static struct grub_partition_map grub_apple_partition_map =
|
||||||
{
|
{
|
||||||
.name = "part_apple",
|
.name = "apple",
|
||||||
.iterate = apple_partition_map_iterate,
|
.iterate = apple_partition_map_iterate,
|
||||||
.probe = apple_partition_map_probe,
|
|
||||||
.get_name = apple_partition_map_get_name
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GRUB_MOD_INIT(apple_partition_map)
|
GRUB_MOD_INIT(part_apple)
|
||||||
{
|
{
|
||||||
grub_partition_map_register (&grub_apple_partition_map);
|
grub_partition_map_register (&grub_apple_partition_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(apple_partition_map)
|
GRUB_MOD_FINI(part_apple)
|
||||||
{
|
{
|
||||||
grub_partition_map_unregister (&grub_apple_partition_map);
|
grub_partition_map_unregister (&grub_apple_partition_map);
|
||||||
}
|
}
|
||||||
|
|
97
partmap/bsdlabel.c
Normal file
97
partmap/bsdlabel.c
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
/* bsdlabel.c - Read BSD style partition tables. */
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2002,2004,2005,2006,2007,2008,2009 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/partition.h>
|
||||||
|
#include <grub/bsdlabel.h>
|
||||||
|
#include <grub/disk.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
|
||||||
|
static struct grub_partition_map grub_bsdlabel_partition_map;
|
||||||
|
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
bsdlabel_partition_map_iterate (grub_disk_t disk,
|
||||||
|
int (*hook) (grub_disk_t disk,
|
||||||
|
const grub_partition_t partition))
|
||||||
|
{
|
||||||
|
struct grub_partition_bsd_disk_label label;
|
||||||
|
struct grub_partition p;
|
||||||
|
grub_disk_addr_t delta = 0;
|
||||||
|
unsigned pos;
|
||||||
|
|
||||||
|
/* BSDLabel offsets are absolute even when it's embed inside partition. */
|
||||||
|
delta = grub_partition_get_start (disk->partition);
|
||||||
|
|
||||||
|
/* Read the BSD label. */
|
||||||
|
if (grub_disk_read (disk, GRUB_PC_PARTITION_BSD_LABEL_SECTOR,
|
||||||
|
0, sizeof (label), &label))
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
/* Check if it is valid. */
|
||||||
|
if (label.magic != grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
|
||||||
|
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
|
||||||
|
|
||||||
|
pos = sizeof (label) + GRUB_PC_PARTITION_BSD_LABEL_SECTOR
|
||||||
|
* GRUB_DISK_SECTOR_SIZE;
|
||||||
|
|
||||||
|
for (p.number = 0;
|
||||||
|
p.number < grub_cpu_to_le16 (label.num_partitions);
|
||||||
|
p.number++)
|
||||||
|
{
|
||||||
|
struct grub_partition_bsd_entry be;
|
||||||
|
|
||||||
|
p.offset = pos / GRUB_DISK_SECTOR_SIZE;
|
||||||
|
p.index = pos % GRUB_DISK_SECTOR_SIZE;
|
||||||
|
|
||||||
|
if (grub_disk_read (disk, p.offset, p.index, sizeof (be), &be))
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
p.start = grub_le_to_cpu32 (be.offset) - delta;
|
||||||
|
p.len = grub_le_to_cpu32 (be.size);
|
||||||
|
p.partmap = &grub_bsdlabel_partition_map;
|
||||||
|
|
||||||
|
if (be.fs_type != GRUB_PC_PARTITION_BSD_TYPE_UNUSED)
|
||||||
|
if (hook (disk, &p))
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
pos += sizeof (struct grub_partition_bsd_entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Partition map type. */
|
||||||
|
static struct grub_partition_map grub_bsdlabel_partition_map =
|
||||||
|
{
|
||||||
|
.name = "bsd",
|
||||||
|
.iterate = bsdlabel_partition_map_iterate,
|
||||||
|
};
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(part_bsd)
|
||||||
|
{
|
||||||
|
grub_partition_map_register (&grub_bsdlabel_partition_map);
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(part_bsd)
|
||||||
|
{
|
||||||
|
grub_partition_map_unregister (&grub_bsdlabel_partition_map);
|
||||||
|
}
|
|
@ -44,18 +44,13 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
||||||
struct grub_partition part;
|
struct grub_partition part;
|
||||||
struct grub_gpt_header gpt;
|
struct grub_gpt_header gpt;
|
||||||
struct grub_gpt_partentry entry;
|
struct grub_gpt_partentry entry;
|
||||||
struct grub_disk raw;
|
|
||||||
struct grub_msdos_partition_mbr mbr;
|
struct grub_msdos_partition_mbr mbr;
|
||||||
grub_uint64_t entries;
|
grub_uint64_t entries;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int last_offset = 0;
|
int last_offset = 0;
|
||||||
|
|
||||||
/* Enforce raw disk access. */
|
|
||||||
raw = *disk;
|
|
||||||
raw.partition = 0;
|
|
||||||
|
|
||||||
/* Read the protective MBR. */
|
/* Read the protective MBR. */
|
||||||
if (grub_disk_read (&raw, 0, 0, sizeof (mbr), &mbr))
|
if (grub_disk_read (disk, 0, 0, sizeof (mbr), &mbr))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
/* Check if it is valid. */
|
/* Check if it is valid. */
|
||||||
|
@ -67,7 +62,7 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
||||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no GPT partition map found");
|
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no GPT partition map found");
|
||||||
|
|
||||||
/* Read the GPT header. */
|
/* Read the GPT header. */
|
||||||
if (grub_disk_read (&raw, 1, 0, sizeof (gpt), &gpt))
|
if (grub_disk_read (disk, 1, 0, sizeof (gpt), &gpt))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
if (grub_memcmp (gpt.magic, grub_gpt_magic, sizeof (grub_gpt_magic)))
|
if (grub_memcmp (gpt.magic, grub_gpt_magic, sizeof (grub_gpt_magic)))
|
||||||
|
@ -78,7 +73,7 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
||||||
entries = grub_le_to_cpu64 (gpt.partitions);
|
entries = grub_le_to_cpu64 (gpt.partitions);
|
||||||
for (i = 0; i < grub_le_to_cpu32 (gpt.maxpart); i++)
|
for (i = 0; i < grub_le_to_cpu32 (gpt.maxpart); i++)
|
||||||
{
|
{
|
||||||
if (grub_disk_read (&raw, entries, last_offset,
|
if (grub_disk_read (disk, entries, last_offset,
|
||||||
sizeof (entry), &entry))
|
sizeof (entry), &entry))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
|
@ -90,16 +85,16 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
||||||
part.len = (grub_le_to_cpu64 (entry.end)
|
part.len = (grub_le_to_cpu64 (entry.end)
|
||||||
- grub_le_to_cpu64 (entry.start) + 1);
|
- grub_le_to_cpu64 (entry.start) + 1);
|
||||||
part.offset = entries;
|
part.offset = entries;
|
||||||
part.index = i;
|
part.number = i;
|
||||||
|
part.index = last_offset;
|
||||||
part.partmap = &grub_gpt_partition_map;
|
part.partmap = &grub_gpt_partition_map;
|
||||||
part.data = &entry;
|
|
||||||
|
|
||||||
grub_dprintf ("gpt", "GPT entry %d: start=%lld, length=%lld\n", i,
|
grub_dprintf ("gpt", "GPT entry %d: start=%lld, length=%lld\n", i,
|
||||||
(unsigned long long) part.start,
|
(unsigned long long) part.start,
|
||||||
(unsigned long long) part.len);
|
(unsigned long long) part.len);
|
||||||
|
|
||||||
if (hook (disk, &part))
|
if (hook (disk, &part))
|
||||||
return 1;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_offset += grub_le_to_cpu32 (gpt.partentry_size);
|
last_offset += grub_le_to_cpu32 (gpt.partentry_size);
|
||||||
|
@ -110,77 +105,23 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return GRUB_ERR_NONE;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static grub_partition_t
|
|
||||||
gpt_partition_map_probe (grub_disk_t disk, const char *str)
|
|
||||||
{
|
|
||||||
grub_partition_t p = 0;
|
|
||||||
int partnum = 0;
|
|
||||||
char *s = (char *) str;
|
|
||||||
|
|
||||||
auto int find_func (grub_disk_t d, const grub_partition_t partition);
|
|
||||||
|
|
||||||
int find_func (grub_disk_t d __attribute__ ((unused)),
|
|
||||||
const grub_partition_t partition)
|
|
||||||
{
|
|
||||||
if (partnum == partition->index)
|
|
||||||
{
|
|
||||||
p = (grub_partition_t) grub_malloc (sizeof (*p));
|
|
||||||
if (! p)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
grub_memcpy (p, partition, sizeof (*p));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the partition number. */
|
|
||||||
partnum = grub_strtoul (s, 0, 10) - 1;
|
|
||||||
if (grub_errno)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpt_partition_map_iterate (disk, find_func);
|
|
||||||
if (grub_errno)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
return p;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
grub_free (p);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static char *
|
|
||||||
gpt_partition_map_get_name (const grub_partition_t p)
|
|
||||||
{
|
|
||||||
return grub_xasprintf ("%d", p->index + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Partition map type. */
|
/* Partition map type. */
|
||||||
static struct grub_partition_map grub_gpt_partition_map =
|
static struct grub_partition_map grub_gpt_partition_map =
|
||||||
{
|
{
|
||||||
.name = "part_gpt",
|
.name = "gpt",
|
||||||
.iterate = gpt_partition_map_iterate,
|
.iterate = gpt_partition_map_iterate,
|
||||||
.probe = gpt_partition_map_probe,
|
|
||||||
.get_name = gpt_partition_map_get_name
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GRUB_MOD_INIT(gpt_partition_map)
|
GRUB_MOD_INIT(part_gpt)
|
||||||
{
|
{
|
||||||
grub_partition_map_register (&grub_gpt_partition_map);
|
grub_partition_map_register (&grub_gpt_partition_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(gpt_partition_map)
|
GRUB_MOD_FINI(part_gpt)
|
||||||
{
|
{
|
||||||
grub_partition_map_unregister (&grub_gpt_partition_map);
|
grub_partition_map_unregister (&grub_gpt_partition_map);
|
||||||
}
|
}
|
||||||
|
|
210
partmap/msdos.c
210
partmap/msdos.c
|
@ -27,87 +27,20 @@
|
||||||
static struct grub_partition_map grub_msdos_partition_map;
|
static struct grub_partition_map grub_msdos_partition_map;
|
||||||
|
|
||||||
|
|
||||||
/* Parse the partition representation in STR and return a partition. */
|
|
||||||
static grub_partition_t
|
|
||||||
grub_partition_parse (const char *str)
|
|
||||||
{
|
|
||||||
grub_partition_t p;
|
|
||||||
struct grub_msdos_partition *pcdata;
|
|
||||||
|
|
||||||
char *s = (char *) str;
|
|
||||||
|
|
||||||
p = (grub_partition_t) grub_malloc (sizeof (*p));
|
|
||||||
if (! p)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
pcdata = (struct grub_msdos_partition *) grub_malloc (sizeof (*pcdata));
|
|
||||||
if (! pcdata)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
p->data = pcdata;
|
|
||||||
p->partmap = &grub_msdos_partition_map;
|
|
||||||
|
|
||||||
/* Initialize some of the fields with invalid values. */
|
|
||||||
pcdata->bsd_part = pcdata->dos_type = pcdata->bsd_type = p->index = -1;
|
|
||||||
|
|
||||||
/* Get the DOS partition number. The number is counted from one for
|
|
||||||
the user interface, and from zero internally. */
|
|
||||||
pcdata->dos_part = grub_strtoul (s, &s, 0) - 1;
|
|
||||||
|
|
||||||
if (grub_errno)
|
|
||||||
{
|
|
||||||
/* Not found. Maybe only a BSD label is specified. */
|
|
||||||
pcdata->dos_part = -1;
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
else if (*s == ',')
|
|
||||||
s++;
|
|
||||||
|
|
||||||
if (*s)
|
|
||||||
{
|
|
||||||
if (*s >= 'a' && *s <= 'h')
|
|
||||||
{
|
|
||||||
pcdata->bsd_part = *s - 'a';
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*s)
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pcdata->dos_part == -1 && pcdata->bsd_part == -1)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
return p;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
grub_free (p);
|
|
||||||
grub_free (pcdata);
|
|
||||||
grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
pc_partition_map_iterate (grub_disk_t disk,
|
pc_partition_map_iterate (grub_disk_t disk,
|
||||||
int (*hook) (grub_disk_t disk,
|
int (*hook) (grub_disk_t disk,
|
||||||
const grub_partition_t partition))
|
const grub_partition_t partition))
|
||||||
{
|
{
|
||||||
struct grub_partition p;
|
struct grub_partition p;
|
||||||
struct grub_msdos_partition pcdata;
|
|
||||||
struct grub_msdos_partition_mbr mbr;
|
struct grub_msdos_partition_mbr mbr;
|
||||||
struct grub_msdos_partition_disk_label label;
|
|
||||||
struct grub_disk raw;
|
|
||||||
int labeln = 0;
|
int labeln = 0;
|
||||||
grub_disk_addr_t lastaddr;
|
grub_disk_addr_t lastaddr;
|
||||||
|
grub_disk_addr_t ext_offset;
|
||||||
/* Enforce raw disk access. */
|
|
||||||
raw = *disk;
|
|
||||||
raw.partition = 0;
|
|
||||||
|
|
||||||
p.offset = 0;
|
p.offset = 0;
|
||||||
pcdata.ext_offset = 0;
|
ext_offset = 0;
|
||||||
pcdata.dos_part = -1;
|
p.number = -1;
|
||||||
p.data = &pcdata;
|
|
||||||
p.partmap = &grub_msdos_partition_map;
|
p.partmap = &grub_msdos_partition_map;
|
||||||
|
|
||||||
/* Any value different than `p.offset' will satisfy the check during
|
/* Any value different than `p.offset' will satisfy the check during
|
||||||
|
@ -120,7 +53,7 @@ pc_partition_map_iterate (grub_disk_t disk,
|
||||||
struct grub_msdos_partition_entry *e;
|
struct grub_msdos_partition_entry *e;
|
||||||
|
|
||||||
/* Read the MBR. */
|
/* Read the MBR. */
|
||||||
if (grub_disk_read (&raw, p.offset, 0, sizeof (mbr), &mbr))
|
if (grub_disk_read (disk, p.offset, 0, sizeof (mbr), &mbr))
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
/* This is our loop-detection algorithm. It works the following way:
|
/* This is our loop-detection algorithm. It works the following way:
|
||||||
|
@ -150,13 +83,10 @@ pc_partition_map_iterate (grub_disk_t disk,
|
||||||
|
|
||||||
p.start = p.offset + grub_le_to_cpu32 (e->start);
|
p.start = p.offset + grub_le_to_cpu32 (e->start);
|
||||||
p.len = grub_le_to_cpu32 (e->length);
|
p.len = grub_le_to_cpu32 (e->length);
|
||||||
pcdata.bsd_part = -1;
|
|
||||||
pcdata.dos_type = e->type;
|
|
||||||
pcdata.bsd_type = -1;
|
|
||||||
|
|
||||||
grub_dprintf ("partition",
|
grub_dprintf ("partition",
|
||||||
"partition %d: flag 0x%x, type 0x%x, start 0x%llx, len 0x%llx\n",
|
"partition %d: flag 0x%x, type 0x%x, start 0x%llx, len 0x%llx\n",
|
||||||
p.index, e->flag, pcdata.dos_type,
|
p.index, e->flag, e->type,
|
||||||
(unsigned long long) p.start,
|
(unsigned long long) p.start,
|
||||||
(unsigned long long) p.len);
|
(unsigned long long) p.len);
|
||||||
|
|
||||||
|
@ -168,59 +98,15 @@ pc_partition_map_iterate (grub_disk_t disk,
|
||||||
if (! grub_msdos_partition_is_empty (e->type)
|
if (! grub_msdos_partition_is_empty (e->type)
|
||||||
&& ! grub_msdos_partition_is_extended (e->type))
|
&& ! grub_msdos_partition_is_extended (e->type))
|
||||||
{
|
{
|
||||||
pcdata.dos_part++;
|
p.number++;
|
||||||
|
|
||||||
if (hook (disk, &p))
|
if (hook (disk, &p))
|
||||||
return 1;
|
return grub_errno;
|
||||||
|
|
||||||
/* Check if this is a BSD partition. */
|
|
||||||
if (grub_msdos_partition_is_bsd (e->type))
|
|
||||||
{
|
|
||||||
/* Check if the BSD label is within the DOS partition. */
|
|
||||||
if (p.len <= GRUB_PC_PARTITION_BSD_LABEL_SECTOR)
|
|
||||||
{
|
|
||||||
grub_dprintf ("partition", "no space for disk label\n");
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
/* Read the BSD label. */
|
else if (p.number < 4)
|
||||||
if (grub_disk_read (&raw,
|
|
||||||
(p.start
|
|
||||||
+ GRUB_PC_PARTITION_BSD_LABEL_SECTOR),
|
|
||||||
0,
|
|
||||||
sizeof (label),
|
|
||||||
&label))
|
|
||||||
goto finish;
|
|
||||||
|
|
||||||
/* Check if it is valid. */
|
|
||||||
if (label.magic
|
|
||||||
!= grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
|
|
||||||
{
|
|
||||||
grub_dprintf ("partition",
|
|
||||||
"invalid disk label magic 0x%x on partition %d\n",
|
|
||||||
label.magic, p.index);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (pcdata.bsd_part = 0;
|
|
||||||
pcdata.bsd_part < grub_cpu_to_le16 (label.num_partitions);
|
|
||||||
pcdata.bsd_part++)
|
|
||||||
{
|
|
||||||
struct grub_msdos_partition_bsd_entry *be
|
|
||||||
= label.entries + pcdata.bsd_part;
|
|
||||||
|
|
||||||
p.start = grub_le_to_cpu32 (be->offset);
|
|
||||||
p.len = grub_le_to_cpu32 (be->size);
|
|
||||||
pcdata.bsd_type = be->fs_type;
|
|
||||||
|
|
||||||
if (be->fs_type != GRUB_PC_PARTITION_BSD_TYPE_UNUSED)
|
|
||||||
if (hook (disk, &p))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (pcdata.dos_part < 4)
|
|
||||||
/* If this partition is a logical one, shouldn't increase the
|
/* If this partition is a logical one, shouldn't increase the
|
||||||
partition number. */
|
partition number. */
|
||||||
pcdata.dos_part++;
|
p.number++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find an extended partition. */
|
/* Find an extended partition. */
|
||||||
|
@ -230,9 +116,9 @@ pc_partition_map_iterate (grub_disk_t disk,
|
||||||
|
|
||||||
if (grub_msdos_partition_is_extended (e->type))
|
if (grub_msdos_partition_is_extended (e->type))
|
||||||
{
|
{
|
||||||
p.offset = pcdata.ext_offset + grub_le_to_cpu32 (e->start);
|
p.offset = ext_offset + grub_le_to_cpu32 (e->start);
|
||||||
if (! pcdata.ext_offset)
|
if (! ext_offset)
|
||||||
pcdata.ext_offset = p.offset;
|
ext_offset = p.offset;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -247,86 +133,20 @@ pc_partition_map_iterate (grub_disk_t disk,
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static grub_partition_t
|
|
||||||
pc_partition_map_probe (grub_disk_t disk, const char *str)
|
|
||||||
{
|
|
||||||
grub_partition_t p;
|
|
||||||
struct grub_msdos_partition *pcdata;
|
|
||||||
|
|
||||||
auto int find_func (grub_disk_t d, const grub_partition_t partition);
|
|
||||||
|
|
||||||
int find_func (grub_disk_t d __attribute__ ((unused)),
|
|
||||||
const grub_partition_t partition)
|
|
||||||
{
|
|
||||||
struct grub_msdos_partition *partdata = partition->data;
|
|
||||||
|
|
||||||
if ((pcdata->dos_part == partdata->dos_part || pcdata->dos_part == -1)
|
|
||||||
&& pcdata->bsd_part == partdata->bsd_part)
|
|
||||||
{
|
|
||||||
grub_memcpy (p, partition, sizeof (*p));
|
|
||||||
p->data = pcdata;
|
|
||||||
grub_memcpy (pcdata, partdata, sizeof (*pcdata));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = grub_partition_parse (str);
|
|
||||||
if (! p)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
pcdata = p->data;
|
|
||||||
pc_partition_map_iterate (disk, find_func);
|
|
||||||
if (grub_errno)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
if (p->index < 0)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_DEVICE, "no such partition");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
return p;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
grub_free (p);
|
|
||||||
grub_free (pcdata);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static char *
|
|
||||||
pc_partition_map_get_name (const grub_partition_t p)
|
|
||||||
{
|
|
||||||
struct grub_msdos_partition *pcdata = p->data;
|
|
||||||
|
|
||||||
if (pcdata->bsd_part < 0)
|
|
||||||
return grub_xasprintf ("%d", pcdata->dos_part + 1);
|
|
||||||
else if (pcdata->dos_part < 0)
|
|
||||||
return grub_xasprintf ("%c", pcdata->bsd_part + 'a');
|
|
||||||
else
|
|
||||||
return grub_xasprintf ("%d,%c", pcdata->dos_part + 1,
|
|
||||||
pcdata->bsd_part + 'a');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Partition map type. */
|
/* Partition map type. */
|
||||||
static struct grub_partition_map grub_msdos_partition_map =
|
static struct grub_partition_map grub_msdos_partition_map =
|
||||||
{
|
{
|
||||||
.name = "part_msdos",
|
.name = "msdos",
|
||||||
.iterate = pc_partition_map_iterate,
|
.iterate = pc_partition_map_iterate,
|
||||||
.probe = pc_partition_map_probe,
|
|
||||||
.get_name = pc_partition_map_get_name
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GRUB_MOD_INIT(pc_partition_map)
|
GRUB_MOD_INIT(part_msdos)
|
||||||
{
|
{
|
||||||
grub_partition_map_register (&grub_msdos_partition_map);
|
grub_partition_map_register (&grub_msdos_partition_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(pc_partition_map)
|
GRUB_MOD_FINI(part_msdos)
|
||||||
{
|
{
|
||||||
grub_partition_map_unregister (&grub_msdos_partition_map);
|
grub_partition_map_unregister (&grub_msdos_partition_map);
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue