Commit graph

2193 commits

Author SHA1 Message Date
BVK Chaitanya
7d65244782 Elif support to GRUB script (by Deepak Vankadaru).
* tests/grub_script_if.in: New testcase.
	* conf/tests.rmk: Rule for new testcase.
	* script/parser.y: Grammar rules for elif.
2010-04-09 22:38:27 +05:30
BVK Chaitanya
34bb22dfa5 While and until loops support to GRUB script.
* include/grub/script_sh.h (grub_script_cmdwhile): New struct.
	(grub_script_create_cmdwhile): New function prototype.
	(grub_script_execute_cmdwhile): New function prototype.
	* script/execute.c (grub_script_execute_cmdwhile): New function.
	* script/parser.y (command): New commands.
	(whilecmd): New grammar rule.
	(untilcmd): New grammar rule.
	* script/script.c (grub_script_create_cmdwhile): New function.
	* util/grub-script-check.c (grub_script_execute_cmdwhile): New
	function.

	* tests/grub_script_while1.in: New testcase.
	* conf/tests.rmk: Rule for new testcase.
2010-04-09 22:04:21 +05:30
Vladimir 'phcoder' Serbinenko
e215d8e02a * util/grub.d/00_header.in: Add few missing quotes. Recognise *.jpeg
as *.jpg.
2010-04-09 17:44:03 +02:00
Mario Vazquez
d7c43ba1c0 GRUB_BACKGROUND support.
* util/grub-mkconfig.in: Export GRUB_BACKGROUND.
	* util/grub.d/00_header.in: Parse GRUB_BACKGROUND.
2010-04-09 17:37:38 +02:00
Vladimir 'phcoder' Serbinenko
d64795c0eb Load fonts and modules for gfxmenu in grub-mkconfig.
Idea by: Mario Vasquez

	* util/grub.d/00_header.in: Load pf2 and image modules.
2010-04-09 16:56:07 +02:00
Vladimir 'phcoder' Serbinenko
f267f83a13 grub-mkconfig multiple terminal support.
* util/grub-mkconfig.in: Handle multiple terminals correctly.
	* util/grub.d/00_header.in: Likewise.
2010-04-09 16:29:10 +02:00
Vladimir 'phcoder' Serbinenko
b7841cebaa 2010-04-09 Vladimir Serbinenko <phcoder@gmail.com>
* Makefile.in: Specify files explicitly instead of using $< and $@ since
	we use cd $(srcdir).
2010-04-09 16:18:25 +02:00
Colin Watson
df60998c64 * util/grub.d/10_linux.in: Only use the first word of
GRUB_DISTRIBUTOR for --class, to avoid problems if somebody puts
spaces in GRUB_DISTRIBUTOR.
* util/grub.d/10_kfreebsd.in: Likewise.
* util/grub.d/10_hurd.in: Likewise.
2010-04-08 10:54:44 +01:00
BVK Chaitanya
14e18ae351 Fix unit testing framework for Qemu 0.12.
* tests/util/grub-shell.in: Remove -serial stdio option.
2010-04-06 19:13:55 +05:30
BVK Chaitanya
fa09c82e6e updated changelog 2010-04-06 12:31:44 +05:30
BVK Chaitanya
daf892b3d4 POSIX header file wrappers.
* lib/posix_wrap/assert.h: New file. Wrapper for its POSIX
	equivalents.
	* lib/posix_wrap/ctype.h: Likewise.
	* lib/posix_wrap/errno.h: Likewise.
	* lib/posix_wrap/langinfo.h: Likewise.
	* lib/posix_wrap/limits.h: Likewise.
	* lib/posix_wrap/localcharset.h: Likewise.
	* lib/posix_wrap/stdint.h: Likewise.
	* lib/posix_wrap/stdio.h: Likewise.
	* lib/posix_wrap/stdlib.h: Likewise.
	* lib/posix_wrap/string.h: Likewise.
	* lib/posix_wrap/sys/types.h: Likewise.
	* lib/posix_wrap/unistd.h: Likewise.
	* lib/posix_wrap/wchar.h: Likewise.
	* lib/posix_wrap/wctype.h: Likewise.
	* conf/common.rmk (grub_script.yy.c): Remove #include elimination.
	(grub_script.yy.h): Likewise.
	* script/yylex.l: Remove POSIX emulation #defines.
	* Makefile.in (POSIX_CFLAGS): New variable.
	(GNULIB_UTIL_CFLAGS): Likewise.

	Regexp support.

	* conf/common.rmk (pkglib_MODULES): Add regexp.mod.
	(regexp_mod_SOURCES): New variable.
	(regexp_mod_CFLAGS): Likewise.
	(regexp_mod_LDFLAGS): Likewise.
	* commands/regexp.c: New file.
	* gnulib/regcomp.c: New file. Imported from gnulib.
	* gnulib/regex.c: Likewise.
	* gnulib/regex_internal.c: Likewise.
	* gnulib/regex_internal.h: Likewise.
	* gnulib/regexec.c: Likewise.
	* gnulib/regex.h: Likewise.
2010-04-06 01:17:32 +05:30
Vladimir 'phcoder' Serbinenko
974ac4f755 * loader/i386/multiboot_mbi.c (grub_multiboot_load): Correctly report
unsupported video mode types.
2010-04-05 16:06:16 +02:00
Vladimir 'phcoder' Serbinenko
2622c3ffb0 * kern/i386/pc/startup.S (grub_getrtsecs): Removed (dead code). 2010-04-05 15:59:32 +02:00
Vladimir 'phcoder' Serbinenko
064cb524ec * include/grub/i386/pc/init.h (grub_get_mmap_entry): Don't export.
* conf/i386-pc.rmk (kernel_img_HEADERS): Remove machine/init.h.
2010-04-05 15:57:40 +02:00
Vladimir 'phcoder' Serbinenko
a8c3b552a7 Remove unused grub_vga_get_font.
* kern/i386/pc/startup.S (grub_vga_get_font): Removed.
	* include/grub/i386/pc/vga.h (grub_vga_get_font): Likewise.
2010-04-04 14:12:11 +02:00
Grégoire Sutre
187bbe3d9c * kern/misc.c: Disable the __enable_execute_stack hack for utilities.
* include/grub/misc.h: Likewise.
2010-04-03 21:00:21 +02:00
Grégoire Sutre
b9396631bc * util/grub-install.in: Add `|| exit 1' to all grub-probe calls
for which failure is fatal.
2010-04-03 20:52:06 +02:00
Grégoire Sutre
50479febcf * util/grub-install.in: Use mkdir -p to create grub directory.
* util/i386/efi/grub-install.in: Likewise.
	* util/ieee1275/grub-install.in: Likewise.
2010-04-03 20:48:36 +02:00
Grégoire Sutre
b1654fdfe1 * Makefile.in (LEX): new variable. 2010-04-03 20:35:13 +02:00
Grégoire Sutre
bd5a6415b0 * util/i386/efi/grub-dumpdevtree: replaced the non-portable `==' by
`=' and added double quotes on operands of this equality test.
2010-04-03 20:23:21 +02:00
Vladimir 'phcoder' Serbinenko
3db3a82b75 * Makefile.in (uninstall): Remove a leftover debug echo.
Reported by: Grégoire Sutre
2010-04-03 20:12:43 +02:00
Vladimir 'phcoder' Serbinenko
3802341279 MIPS multiboot2 support.
* conf/mips.rmk (pkglib_MODULES): Add multiboot2.mod.
	(multiboot2_mod_SOURCES): New variable.
	(multiboot2_mod_CFLAGS): Likewise.
	(multiboot2_mod_LDFLAGS): Likewise.
	(multiboot2_mod_ASFLAGS): Likewise.
	* include/grub/i386/multiboot.h (MULTIBOOT_INITIAL_STATE): New
	definition.
	(MULTIBOOT_ENTRY_REGISTER): Likewise.
	(MULTIBOOT_MBI_REGISTER): Likewise.
	(MULTIBOOT_ARCHITECTURE_CURRENT): Likewise.
	(MULTIBOOT_ELF32_MACHINE): Likewise.
	(MULTIBOOT_ELF64_MACHINE): Likewise.
	* include/grub/mips/multiboot.h: New file.
	* include/grub/video.h (grub_video_driver_id): New type
	GRUB_VIDEO_DRIVER_SM712.
	(grub_video_get_info_and_fini): Export.
	(grub_video_get_palette): Likewise.
	(grub_video_get_driver_id): Likewise.
	* include/multiboot2.h: Resynced with spec.
	* loader/i386/multiboot.c: Moved from here ...
	* loader/multiboot.c: ... here. All users updated.
	(grub_multiboot_boot): Use platform-specific macros.
	* loader/i386/multiboot_elfxx.c: Moved from here ...
	* loader/multiboot_elfxx.c: ... here. All users updated.
	(E_MACHINE): Use MULTIBOOT_ELF32_MACHINE and MULTIBOOT_ELF64_MACHINE.
	* loader/i386/multiboot_mbi2.c (grub_multiboot_load): Check arcitecture.
	* video/sm712.c (grub_video_sm712_adapter): Add missing id field.
2010-04-03 14:37:13 +02:00
Vladimir 'phcoder' Serbinenko
47674667e3 Import gnulib argp module.
* gnulib/argp-ba.c: New file.
	* gnulib/argp-eexst.c: Likewise.
	* gnulib/argp-fmtstream.c: Likewise.
	* gnulib/argp-fmtstream.h: Likewise.
	* gnulib/argp-fs-xinl.c: Likewise.
	* gnulib/argp-help.c: Likewise.
	* gnulib/argp-namefrob.h: Likewise.
	* gnulib/argp-parse.c: Likewise.
	* gnulib/argp-pin.c: Likewise.
	* gnulib/argp-pv.c: Likewise.
	* gnulib/argp-pvh.c: Likewise.
	* gnulib/argp-version-etc.c: Likewise.
	* gnulib/argp-version-etc.h: Likewise.
	* gnulib/argp-xinl.c: Likewise.
	* gnulib/argp.h: Likewise.
2010-04-03 00:45:01 +02:00
Vladimir 'phcoder' Serbinenko
495442ed02 * kern/device.c (grub_device_iterate): Clear errors after failed
opening device.
2010-03-31 22:03:48 +02:00
Vladimir 'phcoder' Serbinenko
f9fd65df54 * kern/ieee1275/openfw.c (grub_children_iterate): Skip device itself if
returned by firmware.
2010-03-31 22:01:37 +02:00
Vladimir 'phcoder' Serbinenko
af09641e2b * loader/i386/multiboot_mbi2.c (retrieve_video_parameters): Fix compilation on coreboot and qemu 2010-03-30 11:18:29 +02:00
Vladimir 'phcoder' Serbinenko
016883a55c * include/multiboot2.h: Resync with spec. 2010-03-28 14:19:41 +02:00
Vladimir 'phcoder' Serbinenko
f97e1f7d0a Multiboot2 tag support
* conf/i386.rmk (multiboot2_mod_SOURCES): Replace
	loader/i386/multiboot_mbi.c with loader/i386/multiboot_mbi2.c.
	Remove loader/multiboot_loader.c.
	* include/grub/i386/multiboot.h (grub_multiboot_real_boot): Removed.
	(grub_multiboot2_real_boot): Likewise.
	* include/grub/multiboot.h (grub_multiboot_set_accepts_video): Removed.
	(grub_get_multiboot_mmap_count): New proto.
	(grub_fill_multiboot_mmap): Likewise.
	(grub_multiboot_set_video_mode): Likewise.
	(grub_multiboot_set_console): Likewise.
	(grub_multiboot_load): Likewise.
	(grub_multiboot_load_elf): Likewise.
	(GRUB_MULTIBOOT_CONSOLE_EGA_TEXT): New definition.
	(GRUB_MULTIBOOT_CONSOLE_FRAMEBUFFER): Likewise.
	* include/multiboot.h: Resynced with specification.
	* include/multiboot2.h: Resynced with specification.
	* loader/i386/multiboot_mbi.c (DEFAULT_VIDEO_MODE): Moved from here...
	* loader/i386/multiboot.c (DEFAULT_VIDEO_MODE): ... here.
	* loader/i386/multiboot_mbi.c (HAS_VGA_TEXT): Moved from here ..
	* include/grub/multiboot.h (GRUB_MACHINE_HAS_VGA_TEXT): ... here. All
	users updated.
	* loader/i386/multiboot_mbi.c (accepts_video): Moved from here...
	* loader/i386/multiboot.c (accepts_video): ... here. All users updated.
	* loader/i386/multiboot_mbi.c (grub_multiboot_set_accepts_video):
	Removed.
	* loader/i386/multiboot_mbi.c (grub_get_multiboot_mmap_len):
	Moved from here...
	* loader/i386/multiboot.c (grub_get_multiboot_mmap_len): ... here.
	* loader/i386/multiboot_mbi.c (grub_fill_multiboot_mmap):
	Moved from here...
	* loader/i386/multiboot.c (grub_fill_multiboot_mmap): ... here.
	* loader/i386/multiboot_mbi.c (set_video_mode): Moved from here...
	* loader/i386/multiboot.c (grub_multiboot_set_video_mode): ... here.
	All users updated.
	* loader/i386/multiboot_mbi2.c: New file.
2010-03-28 13:53:23 +02:00
Vladimir 'phcoder' Serbinenko
3506b90b0d 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 12:53:40 +01:00
Grégoire Sutre
394a3120a7 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 12:19:32 +01:00
Vladimir 'phcoder' Serbinenko
969d1c782d 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-27 00:04:14 +01:00
BVK Chaitanya
8d2977bb7a fix for final semicolon bug 2010-03-26 23:57:06 +05:30
BVK Chaitanya
a7bd6915e1 testcase for blank lines in grub script 2010-03-26 23:41:46 +05:30
Vladimir 'phcoder' Serbinenko
e4ff66281a Merge grub-file into mainline 2010-03-26 17:11:52 +01:00
Vladimir 'phcoder' Serbinenko
6a5cf6b696 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 16:40:41 +01:00
BVK Chaitanya
746d90457a 2010-01-12 BVK Chaitanya <bvk.groups@gmail.com>
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.
2010-03-26 21:00:15 +05:30
Vladimir 'phcoder' Serbinenko
18486b18cd 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-26 15:55:50 +01:00
Adrian Glaubitz
a3940f8874 * kern/dl.c (grub_dl_resolve_symbols): Improve error message
grammar.
2010-03-24 12:54:39 +00:00
21b9992685 * .bzrignore: Add grub-bin2h, grub-reboot, and grub-set-default. 2010-03-24 12:50:15 +00:00
Colin Watson
bed1d3524e * 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-21 23:04:02 +00:00
Colin Watson
c9f5842752 * .bzrignore: Add gentrigtables, grub-script-check,
grub_script_check_init.c, grub_script_check_init.h, and
trigtables.c.
2010-03-19 11:28:05 +00:00
Vladimir 'phcoder' Serbinenko
f84afb2775 * kern/parser.c: Indented. 2010-03-18 00:19:30 +01:00
Vladimir 'phcoder' Serbinenko
ed0e3d30cd * term/i386/pc/vesafb.c: Removed (orphaned, deprecated and broken). 2010-03-17 08:22:45 +01:00
Vladimir 'phcoder' Serbinenko
0ea81d9845 * video/fb/fbblit.c (grub_video_fbblit_blend_XXXA8888_1bit): Handle
alpha_mask_size == 0 case.
2010-03-17 00:16:11 +01:00
BVK Chaitanya
0cdc2a095b 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 22:37:17 +05:30
Vladimir 'phcoder' Serbinenko
1d63a066e2 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 17:17:49 +01:00
Colin King
463ac55fac 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.

	Also-By: Colin Watson <cjwatson@ubuntu.com>
2010-03-14 15:47:05 +00:00
Colin Watson
08e46ededa 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 15:39:14 +00:00
Vladimir 'phcoder' Serbinenko
4a6d2d06db 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 16:29:52 +01:00
Vladimir 'phcoder' Serbinenko
91fdd2ed34 * 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 15:51:08 +01:00