Commit graph

425 commits

Author SHA1 Message Date
davem
979b4fb416 * commands/lsmmap.c (grub_cmd_lsmmap): Add casts to avoid printf
warnings.
	* kern/ieee1275/openfw.c (grub_claimmap): Likewise.
	* disk/ieee1275/ofdisk.c (grub_ofdisk_open, grub_ofdisk_close,
	grub_ofdisk_read): Likewise, and deal similarly with the fact that
	ihandles have a 32-bit type but need to be stored in a "void *".
2009-04-30 01:18:43 +00:00
davem
0dcf7495d9 * disk/ieee1275/nand.c (grub_nand_iterate): Return
grub_devalias_iterate() result instead of unconditional 0.
	* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Likewise.
	Also, capture hook return value, either directly or via
	grub_children_iterate(), and propagate to caller.
	* include/grub/ieee1275/ieee1275.h (grub_devalias_iterate,
	grub_children_iterate): Return value is now 'int' instead of
	'grub_err_t'.
	* kern/ieee1275/openfw.c (grub_children_iterate): Fix to behave
	like a proper iterator, stopping when hooks return non-zero.
	(grub_devalias_iterate): Likewise.
2009-04-24 12:05:54 +00:00
davem
0d31250038 Avoiding openning same device multiple times in device iterator.
* kern/device.c (grub_device_iterate): Define struct part_ent,
	and use it to build a list of partitions in interate_disk() and
	iterate_partition().
2009-04-24 12:04:10 +00:00
davem
c8c08833e3 * kern/sparc64/ieee1275/openfw.c: Unused, delete. 2009-04-23 10:03:41 +00:00
davem
a1447506fe * util/sparc64/ieee1275/misc.c: New file.
* util/sparc64/ieee1275/grub-setup.c: New file.
	* util/sparc64/ieee1275/grub-ofpathname.c: New file.
	* util/sparc64/ieee1275/grub-mkimage.c: New file.
	* util/sparc64/ieee1275/grub-install.in: New file.
	* util/ieee1275/ofpath.c: New file.
	* util/ieee1275/devicemap.c: New file.
	* util/devicemap.c: New file.
	* util/deviceiter.c: New file.
	* kern/sparc64/ieee1275/init.c: New file.
	* include/grub/util/ofpath.h: New file.
	* include/grub/util/deviceiter.h: New file.
	* util/grub-mkdevicemap.c: Include deviceiter.h.
	Implement using grub_util_emit_devicemap_entry and
	grub_util_iterate_devices.
	* conf/i386-corebook.rmk: Build util/deviceiter.c and
	util/devicemap.c into grub-mkdevicemap
	* conf/i386-efi.rmk: Likewise.
	* conf/i386-ieee1275.rmk: Likewise.
	* conf/i386-pc.rmk: Likewise.
	* conf/powerpc-ieee1275.rmk: Likewise.
	* conf/sparc64-ieee1275.rmk: Add rules to build boot block
	images and installation utilities.  Build kernel as image
	instead of as elf binary.  Use common rules as much as possible.
2009-04-22 09:57:39 +00:00
davem
4e8269dad2 * include/grub/ieee1275/ieee1275.h (IEEE1275_MAX_PROP_LEN,
IEEE1275_MAX_PATH_LEN): Define.
	* kern/ieee1275/openfw.c (grub_children_iterate): Dynamically
	allocate 'childtype', 'childpath', 'childname', and 'fullname'.
	(grub_devalias_iterate): Dynamically allocate 'aliasname' and
	'devtype'.  Explicitly NULL terminate devalias expansion.
2009-04-22 09:46:54 +00:00
davem
f01005a832 * kern/ieee1275/mmap.c (grub_machine_mmap_iterate): If size_cells
is larger than address_cells, use that value for address_cells too.
2009-04-22 09:45:43 +00:00
proski
41bb0fe9a6 2009-04-15 Pavel Roskin <proski@gnu.org>
* include/grub/types.h: Rename ULONG_MAX to GRUB_ULONG_MAX and
	LONG_MAX to GRUB_LONG_MAX.  Introduce GRUB_LONG_MIN.  Update all
	users of ULONG_MAX, LONG_MAX and LONG_MIN to use the new
	definitions.
2009-04-15 20:45:09 +00:00
phcoder
6b4c4aa38b removed kern/loader which should have been removed by my previous commit 2009-04-15 16:39:02 +00:00
phcoder
5999d61917 2009-04-15 Vladimir Serbinenko <phcoder@gmail.com>
use grub_lltoa instead of grub_itoa and grub_ltoa for all purposes
	
	* kern/misc.c (grub_itoa): Removed function
	(grub_ltoa): likewise
	(grub_vsprintf): use grub_lltoa
2009-04-15 12:33:46 +00:00
davem
1d7a72fd8c * kern/dl.c (grub_dl_load_file): Close file immediately when
we are done using it.
2009-04-13 23:03:50 +00:00
davem
234022fe7b * kern/sparc64/ieee1275/ieee1275.c: New file.
* include/grub/sparc64/ieee1275/ieee1275.h (IEEE1275_MAP_WRITE,
	IEEE1275_MAP_READ, IEEE1275_MAP_EXEC, IEEE1275_MAP_LOCKED,
	IEEE1275_MAP_CACHED, IEEE1275_MAP_SE, IEEE1275_MAP_GLOBAL,
	IEEE1275_MAP_IE, IEEE1275_MAP_DEFAULT): Define.
	(grub_ieee1275_map_physical, grub_ieee1275_claim_vaddr,
	grub_ieee1275_alloc_physmem): Declare new exported functions.
2009-04-13 07:06:09 +00:00
davem
91c88b1219 * kern/sparc64/ieee1275/init.c: Delete, replace with...
* kern/sparc64/ieee1275/crt0.S: assembler implementation.
	* include/grub/sparc64/ieee1275/kernel.h: Declare grub_prefix[].
	(GRUB_MOD_ALIGN, GRUB_MOD_GAP, GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE,
	GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE,
	GRUB_KERNEL_MACHINE_COMPRESSED_SIZE, GRUB_KERNEL_MACHINE_PREFIX,
	GRUB_KERNEL_MACHINE_DATA_END): Define.
	(grub_kernel_image_size, grub_total_module_size): Declare.
2009-04-13 07:02:46 +00:00
davem
56bc2471ad * kern/misc.c (grub_ltoa): Fix cast when handling negative
values.  Noticed by Pavel Roskin.
2009-04-12 08:06:26 +00:00
davem
ed3d2bc23d * kern/misc.c (grub_ltoa): New function.
(grub_vsprintf): Use it to format 'long' integers.
2009-04-11 11:48:34 +00:00
davem
450e22389f * kern/ieee1275/init.c (grub_machine_init): Make 'actual' grub_ssize_t.
* kern/ieee1275/openfw.c (grub_children_iterate): Likewise.
	(grub_devalias_iterate): Likewise.
2009-04-11 03:09:17 +00:00
davem
d3bfb59c51 * disk/ieee1275/nand.c (grub_nand_open): All ieee1275 call arg
slots are of type grub_ieee1275_cell_t.
	(grub_nand_read): Likewise.
	* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_INVALID,
	IEEE1275_IHANDLE_INVALID): Use grub_ieee1275_cell_t since these
	macros are used to compare values in arg/ret block of the call.
	(grub_ieee1275_finddevice, grub_ieee1275_get_property,
	grub_ieee1275_next_property, grub_ieee1275_get_property_length,
	grub_ieee1275_instance_to_package, grub_ieee1275_package_to_path,
	grub_ieee1275_instance_to_path, grub_ieee1275_write,
	grub_ieee1275_read, grub_ieee1275_seek, grub_ieee1275_peer,
	grub_ieee1275_child, grub_ieee1275_parent, grub_ieee1275_open,
	grub_ieee1275_close, grub_ieee1275_set_property,
	grub_ieee1275_set_color): All ieee1275 call arg slots are of type
	grub_ieee1275_cell_t.
	* kern/ieee1275/openfw.c (grub_map): Likewise.
	* include/grub/ieee1275/ieee1275.h (grub_ieee1275_ihandle_t,
	grub_ieee1275_phandle_t): Define as grub_unit32_t type.
2009-04-11 03:07:58 +00:00
davem
ea3f72cf0e * kern/sparc64/cache.S: Fix grub_arch_sync_caches implementation. 2009-04-07 23:49:27 +00:00
davem
c2cdde70b3 * kern/sparc64/dl.c (grub_arch_dl_relocate_symbols): Add
support for R_SPARC_OLO10 relocations.  Fix compile warning for
	R_SPARC_WDISP30 case.
2009-04-07 23:48:28 +00:00
phcoder
05aaebfb7b 2009-04-05 Vladimir Serbinenko <phcoder@gmail.com>
Support for mtime and further expandability of dir command

	* include/grub/lib/datetime.h: moved to ...
	* include/grub/datetime.h: ... moved here and added 
	declaration of grub_unixtime2datetime. All users updated
	* include/grub/fs.h: new syntax for dir and mtime functionin 
	struct grub_fs 
	* include/grub/fshelp.h: new declarations of GRUB_FSHELP_TYPE_MASK
	and GRUB_FSHELP_FLAGS_MASK
	* commands/ls.c (grub_ls_list_files): Write mtime in long format
	* fs/ext2.c (grub_ext2_dir): use new dir syntax and supply mtime
	(grub_ext2_mtime): new function
	* fs/hfsplus.c (grub_hfsplus_dir): use new dir syntax and supply mtime
	(grub_hfsplus_mtime): new function
	* fs/ufs.c (GRUB_UFS_ATTR_TYPE): new definition
	(GRUB_UFS_ATTR_FILE): likewise
	(GRUB_UFS_ATTR_LNK): likewise
	(struct grub_ufs_sblock): new fields mtime
	(grub_ufs_read_inode): new parameter to read inode to a separate buffer
	all users updated
	(grub_ufs_dir): mtime support
	(grub_ufs_mtime): new function
	* fs/affs.c (grub_affs_dir): use new dir syntax
	* fs/afs.c (grub_afs_dir): likewise
	* fs/cpio.c (grub_cpio_dir): likewise
	* fs/fat.c (grub_fat_find_dir): likewise
	* fs/hfs.c (grub_hfs_dir): likewise
	* fs/iso9660.c (grub_iso9660_dir): likewise
	* fs/jfs.c (grub_jfs_dir): likewise
	* fs/minix.c (grub_minix_dir): likewise
	* fs/ntfs.c (grub_ntfs_dir): likewise
	* fs/reiserfs.c (grub_reiserfs_dir): likewise
	* fs/sfs.c (grub_sfs_dir): likewise
	* fs/xfs.c (grub_xfs_dir): likewise
	* util/hostfs.c (grub_hostfs_dir): likewise
	* lib/datetime.c: moved to ...
	* normal/datetime.c: ... moved here
	(grub_unixtime2datetime): new function
	* kern/rescue.c (grub_rescue_print_files): use new dir syntax
	* normal/completition.c (iterate_dir): use new dir syntax
	* normal/misc.c (grub_normal_print_device_info): tell the 
	last modification time of a volume
	* kern/fs.c (grub_fs_probe): updated dummy function to use new syntax 
	* conf/common.rmk: added lib/datetime.c to ls.mod
	* conf/i386-coreboot.rmk (grub_emu_SOURCES): add normal/datetime.c  
	(normal_mod_SOURCES): likewise
	(datetime_mod_SOURCES): Removed lib/datetime.c
	* conf/i386-efi.rmk: likewise
	* conf/i386-ieee1275.rmk: likewise	
	* conf/i386-pc.rmk: likewise
	* conf/powerpc-ieee1275.rmk: likewise
	* conf/sparc64-ieee1275.rmk: likewise	
	* conf/x86_64-efi.rmk: likewise
2009-04-05 20:19:05 +00:00
phcoder
a8c48fd53d 2009-03-29 Vladimir Serbinenko <phcoder@gmail.com>
Leak fixes

      * kern/disk.c (grub_disk_cache_store): Invalidate previous cache
      in case of collision
      * disk/scsi.c (grub_scsi_open): free scsi in case of error
2009-03-29 21:21:19 +00:00
robertmh
a9368fd30c 2009-03-28 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (pkglib_MODULES): Add `linux16.mod'.
        (linux16_mod_SOURCES, linux16_mod_CFLAGS, linux16_mod_LDFLAGS): New
        variables.  Use 16-bit loader.
        (linux_mod_SOURCES, linux_mod_CFLAGS, linux_mod_LDFLAGS): Use 32-bit
        loader.
        * kern/i386/loader.S (grub_linux_boot): Rename to ...
        (grub_linux16_boot): ... this.  Update all users.
        * loader/i386/linux.c (grub_linux32_boot): Rename to ...
        (grub_linux_boot): ... this.  Update all users.

        * loader/i386/pc/linux.c (GRUB_MOD_INIT(linux)): Rename to ...
        (GRUB_MOD_INIT(linux16)): ... this.  Rename `linux' and `initrd'
        commands to `linux16' and `initrd16'.
        (GRUB_MOD_FINI(linux)): Rename to ...
        (GRUB_MOD_FINI(linux16)): ... this.
2009-03-28 12:53:16 +00:00
robertmh
c04d6e0548 2009-03-22 Vladimir Serbinenko <phcoder@gmail.com>
Move multiboot helper out of kernel

        * conf/i386-pc.rmk (multiboot_mod_SOURCES): Add
        `loader/i386/multiboot_helper.S'.
        * conf/i386-coreboot.rmk: Likewise
        * conf/i386-ieee1275.rmk: Likewise

        * kern/i386/loader.S: Move multiboot helpers from here...
        * loader/i386/multiboot_helper.S: ...moved here
        * include/grub/i386/loader.h: Move declarations of multiboot
        helpers from here...
        * include/grub/i386/multiboot.h: ...moved here
        * loader/i386/multiboot.c: Added include of grub/cpu/multiboot.h
2009-03-22 12:28:00 +00:00
okuji
42a5b3fcc7 2009-03-22 Yoshinori K. Okuji <okuji@enbug.org>
* kern/env.c (grub_env_context_open): Added an argument to specify
    whether a new context inherits exported variables from current
    one. This is useful when making a sandbox to interpret a config
    file.
    All callers updated.

    * include/grub/env.h (grub_env_context_open): Updated the prototype.
2009-03-22 10:45:06 +00:00
okuji
b28bbc4ef5 2009-03-22 Yoshinori K. Okuji <okuji@enbug.org>
* kern/env.c (grub_env_context_close): Fix memory leaks.
2009-03-22 10:38:19 +00:00
proski
fbc00b0ca1 2009-03-22 Pavel Roskin <proski@gno.org>
* kern/powerpc/ieee1275/startup.S: Replace EXT_C(start) with
	_start.
	* kern/i386/pc/startup.S: Likewise.
	* kern/i386/efi/startup.S: Likewise.
	* kern/i386/ieee1275/startup.S: Likewise.
	* kern/i386/coreboot/startup.S: Likewise.
	* kern/x86_64/efi/startup.S: Likewise.
2009-03-22 00:37:49 +00:00
proski
41473ac27f 2009-03-22 Pavel Roskin <proski@gno.org>
* aclocal.m4 (grub_CHECK_START_SYMBOL): Remove.
	* configure.ac: Don't call grub_CHECK_START_SYMBOL.
	* kern/i386/pc/startup.S: Use _start instead of START_SYMBOL.
2009-03-22 00:31:30 +00:00
bean
b1b797cb1b 2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
	<grub/normal.h> and <grub/arg.h>.
	(grub_cmd_blocklist): Use the new command interface.
	(GRUB_MOD_INIT): Likewise.
	(GRUB_MOD_FINI): Likewise.
	* commands/boot.c: Likewise.
	* commands/cat.c: Likewise.
	* commands/cmp.c: Likewise.
	* commands/configfile.c: Likewise.
	* commands/crc.c: Likewise.
	* commands/echo.c: Likewise.
	* commands/halt.c: Likewise.
	* commands/handler.c: Likewise.
	* commands/hdparm.c: Likewise.
	* commands/help.c: Likewise.
	* commands/hexdump.c: Likewise.
	* commands/loadenv.c: Likewise.
	* commands/ls.c: Likewise.
	* commands/lsmmap.c: Likewise.
	* commands/lspci.c: Likewise.
	* commands/loadenv.c: Likewise.
	* commands/read.c: Likewise.
	* commands/reboot.c: Likewise.
	* commands/search.c: Likewise.
	* commands/sleep.c: Likewise.
	* commands/test.c: Likewise.
	* commands/usbtest.c: Likewise.
	* commands/videotest.c: Likewise.
	* commands/i386/cpuid.c: Likewise.
	* commands/i386/pc/halt.c: Likewise.
	* commands/i386/pc/play.c: Likewise.
	* commands/i386/pc/pxecmd.c: Likewise.
	* commands/i386/pc/vbeinfo.c: Likewise.
	* commands/i386/pc/vbetest.c: Likewise.
	* commands/ieee1275/suspend.c: Likewise.
	* disk/loopback.c: Likewise.
	* font/font_cmd.c: Likewise.
	* hello/hello.c: Likewise.
	* loader/efi/appleloader.c: Likewise.
	* loader/efi/chainloader.c: Likewise.
	* loader/i386/bsd.c: Likewise.
	* loader/i386/efi/linux.c: Likewise.
	* loader/i386/ieee1275/linux.c: Likewise.
	* loader/i386/linux.c: Likewise.
	* loader/i386/pc/chainloader.c: Likewise.
	* loader/i386/pc/linux.c: Likewise.
	* loader/powerpc/ieee1275/linux.c: Likewise.
	* loader/multiboot_loader.c: Likewise.
	* term/gfxterm.c: Likewise.
	* term/i386/pc/serial.c: Likewise.
	* term/terminfo.c: Likewise.

	* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
	* term/i386/pc/vga.c: Likewise.
	* video/readers/jpeg.c: Likewise.
	* video/readers/png.c: Likewise.
	* video/readers/tga.c: Likewise.

	* util/grub-fstest (cmd_loopback): Removed.
	(cmd_blocklist): Likewise.
	(cmd_ls): Likewise.
	(grub_register_command): Likewise.
	(grub_unregister_command): Likewise.
	(execute_command): Use grub_command_find to locate command and execute
	it.

	* include/grub/efi/chainloader.h: Removed.
	* loader/efi/chainloader_normal.c: Likewise.
	* loader/i386/bsd_normal.c: Likewise.
	* loader/i386/pc/chainloader_normal.c: Likewise.
	* loader/i386/pc/multiboot_normal.c: Likewise.
	* loader/linux_normal.c: Likewise.
	* loader/multiboot_loader_normal.c: Likewise.
	* loader/powerpc/ieee1275/linux_normal.c: Likewise.

	* gencmdlist.sh: Scan new registration command grub_register_extcmd
	and grub_register_command_p1.

	* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
	kern/command.c, lib/arg.c and commands/extcmd.c.
	(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
	(minicmd_mod_SOURCES): New variable.
	(minicmd_mod_CFLAGS): Likewise.
	(minicmd_mod_LDFLAGS): Likewise.
	(extcmd_mod_SOURCES): Likewise.
	(extcmd_mod_CFLAGS): Likewise.
	(extcmd_mod_LDFLAGS): Likewise.
	(boot_mod_SOURCES): Removed.
	(boot_mod_CFLAGS): Likewise.
	(boot_mod_LDFLAGS): Likewise.

	* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
	kern/corecmd.c.
	(kernel_img_HEADERS): Add command.h.
	(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
	commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
	and lib/arg.c.
	(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
	_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
	remove the corresponding normal mode command.
	(normal_mod_SOURCES): Remove normal/arg.c.
	* conf/i386-coreboot.rmk: Likewise.
	* conf/i386-efi.rmk: Likewise.
	* conf/i386-ieee1275.rmk: Likewise.
	* conf/powerpc-ieee1275.rmk: Likewise.
	* conf/x86_64-efi.rmk: Likewise.

	* include/grub/arg.h: Move from here ...
	* include/grub/lib/arg.h: ... to here.

	* normal/arg.c: Move from here ...
	* lib/arg.c: ... to here.

	* commands/extcmd.c: New file.
	* commands/minicmd.c: Likewise.
	* include/grub/command.h: Likewise.
	* include/grub/extcmd.h: Likewise.
	* kern/command.c: Likewise.
	* kern/corecmd.c: Likewise.

	* kern/list.c (grub_list_iterate): Return int instead of void.
	(grub_list_insert): New function.
	(grub_prio_list_insert): Likewise.

	* kern/rescue.c (grub_rescue_command): Removed.
	(grub_rescue_command_list): Likewise.
	(grub_rescue_register_command): Likewise.
	(grub_rescue_unregister_command): Likewise.
	(grub_rescue_cmd_boot): Move to minicmd.c
	(grub_rescue_cmd_help): Likewise.
	(grub_rescue_cmd_info): Likewise.
	(grub_rescue_cmd_boot): Likewise.
	(grub_rescue_cmd_testload): Likewise.
	(grub_rescue_cmd_dump): Likewise.
	(grub_rescue_cmd_rmmod): Likewise.
	(grub_rescue_cmd_lsmod): Likewise.
	(grub_rescue_cmd_exit): Likewise.
	(grub_rescue_print_devices): Moved to corecmd.c.
	(grub_rescue_print_files): Likewise.
	(grub_rescue_cmd_ls): Likewise.
	(grub_rescue_cmd_insmod): Likewise.
	(grub_rescue_cmd_set): Likewise.
	(grub_rescue_cmd_unset): Likewise.
	(attemp_normal_mode): Use grub_command_find to get normal module.
	(grub_enter_rescue_mode): Use grub_register_core_commands to register
	commands, remove grub_rescue_regiter_command calls.

	* normal/command.c (grub_regiser_command): Removed.
	(grub_unregister_command): Likewise.
	(grub_command_find): Likewise.
	(grub_iterate_commands): Likewise.
	(rescue_command): Likewise.
	(export_command): Moved to corecmd.c.
	(set_command): Removed.
	(unset_command): Likewise.
	(insmod_command): Likewise.
	(rmmod_command): Likewise.
	(lsmod_command): Likewise.
	(grub_command_init): Likewise.

	* normal/completion.c (iterate_command): Use cmd->prio to check for
	active command.
	(complete_arguments): Use grub_extcmd_t structure to find options.
	(grub_normal_do_completion): Change function grub_iterate_commands to
	grub_command_iterate.

	* normal/execute.c (grub_script_execute_cmd): No need to parse
	argument here.

	* normal/main.c (grub_dyncmd_dispatcher): New function.
	(read_command_list): Register unload commands as dyncmd.
	(grub_cmd_normal): Use new command interface, register rescue,
	unregister normal at entry, register normal, unregister rescue at exit.

	* include/grub/list.h (grub_list_test_t): New type.
	(grub_list_iterate): Return int instead of void.
	(grub_list_insert): New function.
	(GRUB_AS_NAMED_LIST_P): New macro.
	(GRUB_AS_PRIO_LIST): Likewise.
	(GRUB_AS_PRIO_LIST_P): Likewise.
	(GRUB_PRIO_LIST_PRIO_MASK): New constant.
	(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
	(grub_prio_list): New structure.
	(grub_prio_list_insert): New function.
	(grub_prio_list_remove): New inline function.

	* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
	(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
	(GRUB_COMMAND_FLAG_MENU): Likewise.
	(GRUB_COMMAND_FLAG_BOTH): Likewise.
	(GRUB_COMMAND_FLAG_TITLE): Likewise.
	(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
	(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
	(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
	(grub_command): Likewise.
	(grub_register_command): Likewise.
	(grub_command_find): Likewise.
	(grub_iterate_commands): Likewise.
	(grub_command_init): Likewise.
	(grub_arg_parse): Likewise.
	(grub_arg_show_help): Likewise.

	* include/grub/rescue.h (grub_rescue_register_command): Removed.
	(grub_rescue_unregister_command): Likewise.

	* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
	grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
	grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.

	* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
	grub_rescue_cmd_initrd.
	* include/grub/i386/loader.h: Likewise.
	* include/grub/x86_64/loader.h: Likewise.

	* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
robertmh
aa9f3bffbd 2009-03-08 Robert Millan <rmh@aybabtu.com>
Make loader/i386/linux.c usable on i386-pc again.

        * kern/i386/pc/init.c (grub_machine_init): Disable addition of low
        memory to heap.
        * loader/i386/linux.c [GRUB_MACHINE_PCBIOS] (allocate_pages): Remove
        `#error' stanza.
2009-03-08 12:46:27 +00:00
bean
7e9ca17ace 2009-03-04 Bean <bean123ch@gmail.com>
* configure.ac: Only test -mcmodel=large option in x86_64-efi, also add
	another option -mno-red-zone.

	* commands/handler.c: Change module description.

	* kern/handler.c: Add missing space at the end of description line.

	* kern/list.c: Likewise.
2009-03-04 05:56:31 +00:00
bean
71b9f36193 2009-03-01 Bean <bean123ch@gmail.com>
* commands/terminal.c: Removed.

	* commands/handler.c: New file.

	* include/grub/list.h: Likewise.

	* include/grub/handler.h: Likewise.

	* kern/list.c: Likewise.

	* kern/handler.c: Likewise.

	* kern/term.h: Include header file <grub/handler.h>.
	(grub_term_input): Move next field to the beginning.
	(grub_term_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_output_class): Likewise.
	(grub_term_register_input): Changed to inline function.
	(grub_term_register_output): Likewise.
	(grub_term_unregister_input): Likewise.
	(grub_term_unregister_output): Likewise.
	(grub_term_set_current_input): Likewise.
	(grub_term_set_current_output): Likewise.
	(grub_term_get_current_input): Likewise.
	(grub_term_get_current_output): Likewise.
	(grub_term_iterate_input): Removed.
	(grub_term_iterate_output): Likewise.

	* kern/term.c (grub_term_list_input): Removed.
	(grub_term_list_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_output_class): Likewise.
	(grub_cur_term_input): Change varaible as macro.
	(grub_cur_term_output): Likewise.
	(grub_term_register_input): Removed.
	(grub_term_register_output): Likewise.
	(grub_term_unregister_input): Likewise.
	(grub_term_unregister_output): Likewise.
	(grub_term_set_current_input): Likewise.
	(grub_term_set_current_output): Likewise.
	(grub_term_iterate_input): Likewise.
	(grub_term_iterate_output): Likewise.
	(grub_term_get_current_input): Likewise.
	(grub_term_get_current_output): Likewise.

	* util/grub-editenv.c: Include header file <grub/handler.h>.
	(grub_term_get_current_input): Removed.
	(grub_term_get_current_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_outout_class): Likewise.

	* util/grub-fstest.c (grub_term_get_current_input): Removed.
	(grub_term_get_current_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_outout_class): Likewise.

	* util/grub-probe.c (grub_term_get_current_input): Removed.
	(grub_term_get_current_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_outout_class): Likewise.

	* util/i386/pc/grub-setup.c (grub_term_get_current_input): Removed.
	(grub_term_get_current_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_outout_class): Likewise.

	* conf/common.rmk (pkglib_MODULES): Replace terminal with handler.
	(terminal_mod_SOURCES): Likewise.
	(terminal_mod_CFLAGS): Likewise.
	(terminal_mod_LDFLAGS): Likewise.

	* conf/i386-pc.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_img_SOURCES): Add list.c and handler.c.
	(kernel_img_HEADERS): Add list.h and handler.h.

	* conf/i386-efi.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_mod_SOURCES): Add list.c and handler.c.
	(kernel_mod_HEADERS): Add list.h and handler.h.

	* conf/i386-coreboot.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_elf_SOURCES): Add list.c and handler.c.
	(kernel_elf_HEADERS): Add list.h and handler.h.

	* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_elf_SOURCES): Add list.c and handler.c.
	(kernel_elf_HEADERS): Add list.h and handler.h.

	* conf/x86_64-efi.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_mod_SOURCES): Add list.c and handler.c.
	(kernel_mod_HEADERS): Add list.h and handler.h.

	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_elf_SOURCES): Add list.c and handler.c.
	(kernel_elf_HEADERS): Add list.h and handler.h.
2009-03-01 17:51:44 +00:00
robertmh
8cc50345f8 2009-02-27 Robert Millan <rmh@aybabtu.com>
* kern/misc.c (grub_strtoull): Fix bug (it mistakenly parsed the
        `0x' qualifier as 0 when base is specified as parameter).
2009-02-27 19:33:38 +00:00
bean
6e09b8b72e 2009-02-24 Bean <bean123ch@gmail.com>
* configure.ac: Check for -mcmodel=large in x86_64 target.

	* include/grub/efi/api.h (efi_call_10): New macro.
	(efi_wrap_10): New function.

	* include/grub/efi/pe32.h (GRUB_PE32_REL_BASE_HIGH): New macro.
	(GRUB_PE32_REL_BASED_HIGH): Likewise.
	(GRUB_PE32_REL_BASED_LOW): Likewise.
	(GRUB_PE32_REL_BASED_HIGHLOW): Likewise.
	(GRUB_PE32_REL_BASED_HIGHADJ): Likewise.
	(GRUB_PE32_REL_BASED_MIPS_JMPADDR): Likewise.
	(GRUB_PE32_REL_BASED_SECTION): Likewise.
	(GRUB_PE32_REL_BASED_REL): Likewise.
	(GRUB_PE32_REL_BASED_IA64_IMM64): Likewise.
	(GRUB_PE32_REL_BASED_DIR64): Likewise.
	(GRUB_PE32_REL_BASED_HIGH3ADJ): Likewise.

	* kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Fixed relocation
	issue.

	* kern/x86_64/efi/callwrap.S (efi_wrap_6): Bug fix.
	(efi_wrap_10): New function.

	* kern/x86_64/efi/startup.S (codestart): Use relative addressing.

	* loader/efi/appleloader.c (devpath_5): Add support for late 2008
	MB/MBP model (NV chipset).
	(devdata_devs): Add devpath_5 to the list.

	* load/i386/efi/linux.c (video_base): Remove variable.
	(RGB_MASK): New macro.
	(RGB_MAGIC): Likewise.
	(LINE_MIN): Likewise.
	(LINE_MAX): Likewise.
	(FBTEST_STEP): Likewise.
	(FBTEST_COUNT): Likewise.
	(fb_list): New variable.
	(grub_find_video_card): Remove function.
	(find_framebuf): New function.
	(grub_linux_setup_video): Use find_framebuf to get frame buffer and
	line length.

	* util/i386/efi/grub-mkimage.c (grub_reloc_section): Fix relocation
	problem for x86_64.
2009-02-24 13:19:46 +00:00
chrfranke
8fa4ea7017 2009-02-14 Vladimir Serbinenko <phcoder@gmail.com>
Corrected wrong declaration

	* kern/disk.c: corrected declaration of grub_disk_ata_pass_through.
2009-02-14 19:24:31 +00:00
chrfranke
9ff516f3eb 2009-02-14 Christian Franke <franke@computer.org>
* commands/hdparm.c: New file.  Provides `hdparm' command
	which sends ATA commands via grub_disk_ata_pass_through ().

	* conf/i386-pc.rmk: Add ata_pthru.mod and hdparm.mod.

	* disk/ata.c: Include <grub/ata.h>.  Move <grub/misc.h>
	and <grub/cpu/io.h> to include/grub/ata.h.
	(enum grub_ata_addressing_t): Move to include/grub/ata.h.
	(GRUB_CDROM_SECTOR_SIZE): Remove.
	(GRUB_ATA_*): Move to include/grub/ata.h.
	(GRUB_ATAPI_*): Likewise.
	(enum grub_ata_commands): Likewise.
	(enum grub_ata_timeout_milliseconds): Likewise.
	(struct grub_ata_device): Likewise.
	(grub_ata_regset): Likewise.
	(grub_ata_regget): Likewise.
	(grub_ata_regset2): Likewise.
	(grub_ata_regget2): Likewise.
	(grub_ata_check_ready): Likewise.
	(grub_ata_wait_not_busy): Remove static, exported in
	include/grub/ata.h.
	(grub_ata_wait_drq): Likewise.
	(grub_ata_pio_read): Likewise.

	* disk/ata_pthru.c: New file.  Provides grub_ata_pass_through ()
	function for hdparm.mod.

	* include/grub/ata.h: New file, contains declarations from
	disk/ata.c.
	(enum grub_ata_commands): Add new commands for commands/hdparm.c.

	* include/grub/disk.h (grub_disk_ata_pass_through_parms): New struct.
	(grub_disk_ata_pass_through): New exported variable.

	* kern/disk.c (grub_disk_ata_pass_through): New variable.
2009-02-14 12:57:55 +00:00
chaac
2b40d6bb9f 2009-02-08 Vesa Jääskeläinen <chaac@nic.fi>
* kern/mm.c: Add more comments.
2009-02-08 10:52:03 +00:00
proski
1806b56e2b 2009-01-26 Daniel Mierswa <impulze@impulze.org>
* kern/misc.c (grub_strcasecmp): New function.
	(grub_strcasecmp): Use grub_size_t instead of int for length.
	Fix return value.
	* include/grub/misc.h: Update function prototypes.
2009-01-26 04:22:44 +00:00
chrfranke
d31c24f1e0 2009-01-22 Christian Franke <franke@computer.org>
* kern/misc.c (grub_vsprintf): Fix size and termination of `format2'
	(precision) digit string.  Allow `.format2' without `format1' (width).
	Limit input chars for `%s' output to `format2' if specified.  This is
	compatible with standard printf ().
2009-01-22 20:27:52 +00:00
robertmh
f36cc10867 2009-01-10 Robert Millan <rmh@aybabtu.com>
Update a few copyright years which we forgot to do in 2008 (only for
            files whose changes made in 2008 were copyright-significant)

            * Makefile.in: Add 2008 to Copyright line.
            * disk/ieee1275/ofdisk.c: Likewise.
            * disk/efi/efidisk.c: Likewise.
            * kern/dl.c: Likewise.
            * kern/sparc64/ieee1275/init.c: Likewise.
            * kern/mm.c: Likewise.
            * kern/efi/mm.c: Likewise.
            * boot/i386/pc/boot.S: Likewise.
            * genfslist.sh: Likewise.
            * fs/iso9660.c: Likewise.
            * fs/hfs.c: Likewise.
            * fs/jfs.c: Likewise.
            * fs/minix.c: Likewise.
            * fs/ufs.c: Likewise.
            * gensymlist.sh.in: Likewise.
            * genkernsyms.sh.in: Likewise.
            * include/grub/misc.h: Likewise.
            * include/grub/types.h: Likewise.
            * include/grub/symbol.h: Likewise.
            * include/grub/elf.h: Likewise.
            * include/grub/kernel.h: Likewise.
            * include/grub/disk.h: Likewise.
            * include/grub/dl.h: Likewise.
            * include/grub/i386/linux.h: Likewise.
            * include/grub/i386/pc/biosdisk.h: Likewise.
            * include/grub/efi/api.h: Likewise.
            * include/grub/efi/pe32.h: Likewise.
            * include/grub/util/misc.h: Likewise.
            * normal/execute.c: Likewise.
            * normal/arg.c: Likewise.
            * normal/completion.c: Likewise.
            * normal/lexer.c: Likewise.
            * normal/parser.y: Likewise.
            * normal/misc.c: Likewise.
            * commands/i386/pc/vbeinfo.c: Likewise.
            * commands/hexdump.c: Likewise.
            * commands/terminal.c: Likewise.
            * commands/ls.c: Likewise.
            * commands/help.c: Likewise.
            * partmap/pc.c: Likewise.
            * loader/efi/chainloader.c: Likewise.
            * loader/multiboot_loader.c: Likewise.
            * loader/i386/pc/multiboot2.c: Likewise.
            * term/efi/console.c: Likewise.
            * term/i386/pc/serial.c: Likewise.
            * util/lvm.c: Likewise.
            * util/console.c: Likewise.
            * util/i386/efi/grub-mkimage.c: Likewise.
            * util/raid.c: Likewise.
2009-01-10 13:07:44 +00:00
chaac
1e901a7573 2009-01-02 Colin D Bennett <colin@gibibit.com>
New font engine.
	
	Additional changes by Vesa Jääskeläinen <chaac@nic.fi> to adapt to
	build system and fixed gfxterm.c to work with different	sized fonts.

	* configure.ac: Changed UNIFONT_HEX to UNIFONT_BDF.
	
	* configure: Re-generated.
	
	* DISTLIST: Removed font/manager.c.
	Added font/font.c.
	Added font/font_cmd.c.
	
	* Makefile.in: Changed UNIFONT_HEX to UNIFONT_BDF.  Added Font tool
	compilation.
	
	* include/grub/misc.h (grub_utf8_to_ucs4): Changed prototype.  Changed users.
	
	* kern/misc.c (grub_utf8_to_ucs4): Changed prototype. 

	* kern/term.c: Changed users of grub_utf8_to_ucs4.
	
	* normal/menu.c: Likewise.
		
	* conf/common.rmk (font_mod_SOURCES): Removed font/manager.c.
	(font_mod_SOURCES): Added font/font_cmd.c, font/font.c.
	
	* include/grub/font.h: Replaced with new file.
	
	* include/grub/video.h (GRUB_VIDEO_MODE_TYPE_ALPHA): Changed value.
	(GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED): Likewise.
	(GRUB_VIDEO_MODE_TYPE_COLOR_MASK): Likewise.
	(GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP): Added.
	(grub_video_blit_format): Added GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED.
	(grub_video_mode_info): Added bg_red, bg_green, bg_blue, bg_alpha, 
	fg_red, fg_green, fg_blue, fg_alpha.
	(grub_video_adapter): Removed blit_glyph.
	(grub_video_blit_glyph): Removed.	
	
	* font/manager.c: Removed file.
	
	* font/font.c: New file. 
	
	* font/font_cmd.c: Likewise.
	
	* video/video.c (grub_video_blit_glyph): Removed.
	
	* video/i386/pc/vbe.c (grub_video_vbe_map_rgb): Added 1-bit support.
	(grub_video_vbe_map_rgba): Likewise.
	(grub_video_vbe_unmap_color_int): Likewise.
	(grub_video_vbe_blit_glyph): Removed.
	(grub_video_vbe_adapter): Removed blit_glyph.
	
	* video/i386/pc/vbeutil.c (get_data_ptr): Added 1-bit support.
	(get_pixel): Likewise.
	(set_pixel): Likewise. 
	
	* commands/videotest.c (grub_cmd_videotest): Added more tests for fonts.
	
	* term/gfxterm.c: Adapted to new font engine.
	
	* term/i386/pc/vesafb.c: Marked as deprecated.  Made it compile.
	
	* term/i386/pc/vga.c: Likewise.
	
	* util/fonttool/src/org/gnu/grub/fonttool/BDFLoader.java: New file.
	
	* util/fonttool/src/org/gnu/grub/fonttool/CharDefs.java: Likewise.
	
	* util/fonttool/src/org/gnu/grub/fonttool/CharacterRange.java: Likewise.
	
	* util/fonttool/src/org/gnu/grub/fonttool/CharacterRange.java: Likewise.
	
	* util/fonttool/src/org/gnu/grub/fonttool/Converter.java: Likewise.
	
	* util/fonttool/src/org/gnu/grub/fonttool/Font.java: Likewise.
	
	* util/fonttool/src/org/gnu/grub/fonttool/Glyph.java: Likewise.
	
	* util/fonttool/src/org/gnu/grub/fonttool/PFF2Sections.java: Likewise.
	
	* util/fonttool/src/org/gnu/grub/fonttool/PFF2Writer.java: Likewise.

	* util/grub.d/00_header.in: Changed to use new loadfont command.
	
	* util/grub-mkconfig_lib.in: Changed font extension.
2009-01-02 15:26:06 +00:00
robertmh
80fc88f22d * kern/i386/loader.S (grub_multiboot_backward_relocator): Improve
comments.  Avoid copiing one more byte than necessary (just in case).
2008-11-22 15:00:39 +00:00
robertmh
79d29fd7b8 Harmonize ieee1275's grub_available_iterate() with the generic
grub_machine_mmap_iterate() interface (fixes a recently-introduced
        build problem on i386-ieee1275):
        * kern/ieee1275/openfw.c (grub_available_iterate): Moved from here ...
        * kern/ieee1275/mmap.c (grub_machine_mmap_iterate): ... here.  Add third
        parameter `type'.  Update all users of this function.
        * conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Add
        `kern/ieee1275/mmap.c'.
        * kern/ieee1275/init.c
        * include/grub/ieee1275/ieee1275.h (grub_available_iterate): Replace
        with ...
        (grub_machine_mmap_iterate): ... this.
        * include/grub/i386/pc/memory.h (grub_machine_mmap_iterate): Change
        return type to `grub_err_t'.  Update all implementations of this
        function prototype.
        * include/grub/i386/coreboot/memory.h (grub_machine_mmap_iterate):
        Likewise.
2008-11-20 20:30:24 +00:00
robertmh
3cf6ac19e1 2008-11-19 Robert Millan <rmh@aybabtu.com>
* kern/i386/coreboot/init.c (grub_time_tics): Remove variable.
        (grub_get_rtc, grub_exit): Abort with grub_fatal() if called.
2008-11-20 18:07:10 +00:00
robertmh
76679cd3a4 2008-11-12 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
        * conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
        (vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
        variables.
        * conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
        `term/i386/pc/console.c' with `term/i386/vga_common.c'.

        * kern/i386/coreboot/init.c (grub_machine_init): Replace call to
        grub_console_init() with call to grub_vga_text_init().
        (grub_machine_fini): Replace call to
        grub_console_fini() with call to grub_vga_text_fini() and
        grub_at_keyboard_fini().

        * include/grub/i386/pc/console.h: Include `<grub/term.h>'.
        (grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
        (grub_console_setcolorstate, grub_console_setcolor)
        (grub_console_getcolor): New function prototypes.

        * term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
        (grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
        (grub_vga_text_setcursor): Static-ize.
        (grub_vga_text_term): New structure.
        (GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.

        * term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
        (grub_console_cur_color, grub_console_standard_color)
        (grub_console_normal_color, grub_console_highlight_color)
        (map_char, grub_console_putchar, grub_console_getcharwidth)
        (grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
        (grub_console_getcolor): Move from here ...
        * term/i386/vga_common.c: ... to here (same function names).
2008-11-12 15:02:17 +00:00
robertmh
95b841d37b 2008-11-12 Robert Millan <rmh@aybabtu.com>
Use newly-added Multiboot support in coreboot.

        * conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
        `kern/i386/coreboot/mmap.c' with `kern/i386/multiboot_mmap.c'.

        * kern/i386/coreboot/startup.S: Enable Multiboot header, fix its
        alignment, set `MULTIBOOT_MEMORY_INFO' flag.
        (codestart): Store the MBI in `startup_multiboot_info' when we're
        being loaded using Multiboot.

        * kern/i386/coreboot/init.c (grub_machine_init): Move
        grub_at_keyboard_init() call to beginning of function (useful for
        debugging).  Call grub_machine_mmap_init() before attempting to use
        grub_machine_mmap_iterate().
        (grub_lower_mem, grub_upper_mem): Move from here ...
        * kern/i386/multiboot_mmap.c (grub_lower_mem, grub_upper_mem): ... to
        here (new file).

        * include/grub/i386/coreboot/memory.h (grub_machine_mmap_init): New
        function prototype.
2008-11-11 23:27:18 +00:00
robertmh
761ca975a9 2008-11-12 Robert Millan <rmh@aybabtu.com>
Fix a regression introduced by the at_keyboard.mod split.  Because
        some terminals are default on some platforms and non-default on
        others, the first terminal being registered determines which is
        going to be default.

        * kern/term.c (grub_term_register_input): If this is the first
        terminal being registered, set it as the current one.
        (grub_term_register_output): Likewise.

        * term/efi/console.c (grub_console_init): Do not call
        grub_term_set_current_output() or grub_term_set_current_input().
        * term/ieee1275/ofconsole.c (grub_console_init): Likewise.
        * term/i386/pc/console.c (grub_console_init): Likewise.
        (grub_console_fini): Do not call grub_term_set_current_input()
        (but leave grub_term_set_current_output() to restore text mode).
2008-11-11 23:16:54 +00:00
robertmh
651c29b79e 2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:

            * conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
            (at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
            (at_keyboard_mod_LDFLAGS): New variables.

            Actual terminal split:

            * include/grub/term.h (struct grub_term): Split in ...
            (struct grub_term_input): ... this, and ...
            (struct grub_term_output): ... this.  Update all users.
            (grub_term_set_current): Split in ...
            (grub_term_set_current_input): ... this, and ...
            (grub_term_set_current_output): ... this.
            (grub_term_get_current): Split in ...
            (grub_term_get_current_input): ... this, and ...
            (grub_term_get_current_output): ... this.
            (grub_term_register): Split in ...
            (grub_term_register_input): ... this, and ...
            (grub_term_register_output): ... this.
            (grub_term_unregister): Split in ...
            (grub_term_unregister_input): ... this, and ...
            (grub_term_unregister_output): ... this.
            (grub_term_iterate): Split in ...
            (grub_term_iterate_input): ... this, and ...
            (grub_term_iterate_output): ... this.

            * kern/term.c (grub_term_list): Split in ...
            (grub_term_list_input): ... this, and ...
            (grub_term_list_output): ... this.  Update all users.
            (grub_cur_term): Split in ...
            (grub_cur_term_input): ... this, and ...
            (grub_cur_term_output): ... this.  Update all users.
            (grub_term_set_current): Split in ...
            (grub_term_set_current_input): ... this, and ...
            (grub_term_set_current_output): ... this.
            (grub_term_get_current): Split in ...
            (grub_term_get_current_input): ... this, and ...
            (grub_term_get_current_output): ... this.
            (grub_term_register): Split in ...
            (grub_term_register_input): ... this, and ...
            (grub_term_register_output): ... this.
            (grub_term_unregister): Split in ...
            (grub_term_unregister_input): ... this, and ...
            (grub_term_unregister_output): ... this.
            (grub_term_iterate): Split in ...
            (grub_term_iterate_input): ... this, and ...
            (grub_term_iterate_output): ... this.

            * kern/misc.c (grub_abort): Split use of grub_term_get_current() into
            a check for input and one for output (and only attempt to get keys
            from user when input works).

            * util/grub-probe.c (grub_term_get_current): Split in ...
            (grub_term_get_current_input): ... this, and ...
            (grub_term_get_current_output): ... this.
            * util/grub-fstest.c: Likewise.
            * util/i386/pc/grub-setup.c: Likewise.
            * util/grub-editenv.c: Likewise.

            Portability adjustments:

            * conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
            `term/i386/pc/at_keyboard.c'.
            * kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
            grub_keyboard_controller_init() (now handled by terminal .init).
            * kern/i386/coreboot/init.c (grub_machine_init): Add call to
            grub_at_keyboard_init().
            * include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
            (grub_console_checkkey, grub_console_getkey): Remove (now provided by
            at_keyboard.mod via input terminal interface).
            * include/grub/i386/coreboot/console.h: Convert into a stub for
            `<grub/i386/pc/console.h>'.

            Migrate full terminals to new API:

            * term/efi/console.c (grub_console_term): Split into ...
            (grub_console_term_input): ... this, and ...
            (grub_console_term_output): ... this.  Update all users.
            * term/ieee1275/ofconsole.c: Remove __i386__ hack.
            (grub_ofconsole_init): Split into ...
            (grub_ofconsole_init_input): ... this, and ...
            (grub_ofconsole_init_output): ... this.
            (grub_ofconsole_term): Split into ...
            (grub_ofconsole_term_input): ... this, and ...
            (grub_ofconsole_term_output): ... this.  Update all users.
            * term/i386/pc/serial.c (grub_serial_term): Split into ...
            (grub_serial_term_input): ... this, and ...
            (grub_serial_term_output): ... this.  Update all users.
            * term/i386/pc/console.c (grub_console_term): Split into ...
            (grub_console_term_input): ... this, and ...
            (grub_console_term_output): ... this.  Update all users.
            (grub_console_term_input): Only enable it on PC/BIOS platform.
            (grub_console_init): Remove grub_keyboard_controller_init() call.

            Migrate input terminals to new API:

            * term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
            `i386' and `i386/pc' to enable build on x86_64 (this driver is
            i386-specific anyway).
            (grub_console_checkkey): Rename to ...
            (grub_at_keyboard_checkkey): ... this.  Static-ize.  Update all
            users.
            (grub_keyboard_controller_orig): New variable.
            (grub_console_getkey): Rename to ...
            (grub_at_keyboard_getkey): ... this.  Static-ize.  Update all
            users.
            (grub_keyboard_controller_init): Static-ize.  Save original
            controller value so that it can be restored ...
            (grub_keyboard_controller_fini): ... here (new function).
            (grub_at_keyboard_term): New structure.
            (GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
            functions.

            Migrate output terminals to new API:

            * term/i386/pc/vga.c (grub_vga_term): Change type to
            `struct  grub_term_output'.  Remove `.checkkey' and `.getkey'
            members.  Update all users.
            * term/gfxterm.c (grub_video_term): Change type to
            `struct  grub_term_output'.  Remove `.checkkey' and `.getkey'
            members.  Update all users.
            * include/grub/i386/pc/console.h (grub_console_checkkey)
            (grub_console_getkey): Do not export (no longer needed by gfxterm,
            etc).

            Migrate `terminal' command and userland tools to new API:

            * commands/terminal.c (grub_cmd_terminal): Split into ...
            (grub_cmd_terminal_input): ... this, and ...
            (grub_cmd_terminal_output): ... this.
            (GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
            `terminal_input' and `terminal_output'.
            * util/grub.d/00_header.in: Adjust `terminal' calls to new
            `terminal_input' / `terminal_output' API.
            * util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
            ${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
            provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
bean
556f377582 2008-11-03 Bean <bean123ch@gmail.com>
* kern/elf.c (grub_elf32_load): Revert to previous code.
	(grub_elf64_load): Likewise.

	* loader/i386/bsd.c (grub_bsd_elf32_hook): Change return address.
2008-11-03 13:08:21 +00:00
chrfranke
9035dce47f 2008-09-19 Christian Franke <franke@computer.org>
* aclocal.m4 (grub_CHECK_ENABLE_EXECUTE_STACK): New function.
	* configure.ac: Call grub_CHECK_ENABLE_EXECUTE_STACK.
	* include/grub/misc.h [NEED_ENABLE_EXECUTE_STACK]:
	Export __enable_execute_stack() to modules.
	* kern/misc.c [NEED_ENABLE_EXECUTE_STACK] (__enable_execute_stack):
	New function.
2008-09-19 06:55:20 +00:00
robertmh
4cebd25a85 2008-08-30 Robert Millan <rmh@aybabtu.com>
* kern/i386/pc/startup.S (multiboot_header): Force 4-byte alignment
        as required by Multiboot spec (it was already 4-byte aligned, but
        only by chance).
2008-08-30 17:51:24 +00:00
proski
e3925185cc 2008-08-29 Pavel Roskin <proski@gnu.org>
* kern/powerpc/ieee1275/crt0.S: Rename to ...
	* kern/powerpc/ieee1275/startup.S: ... this.
	* conf/powerpc-ieee1275.rmk: Adjust for the above.
	* DISTLIST: Likewise.
2008-08-29 21:54:26 +00:00
proski
b497a269db 2008-08-29 Pavel Roskin <proski@gnu.org>
* kern/powerpc/ieee1275/crt0.S: Include grub/symbol.h and
	grub/cpu/kernel.h.  Add start label for consistency with other
	platforms.  Add grub_prefix immediately after start.  Add jump
	to the code after grub_prefix.
	* include/grub/powerpc/kernel.h: Provide valid values for
	GRUB_KERNEL_CPU_PREFIX and GRUB_KERNEL_CPU_DATA_END.
2008-08-29 21:46:17 +00:00
robertmh
deceb3ecd3 2008-08-17 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/i386/pc/mmap.c'.

        * include/grub/i386/pc/init.h (GRUB_MACHINE_MEMORY_AVAILABLE)
        (GRUB_MACHINE_MEMORY_RESERVED): New macros.
        (grub_machine_mmap_iterate): New function declaration.
        * include/grub/multiboot.h (struct grub_multiboot_mmap_entry): New
        structure.
        (GRUB_MMAP_MEMORY_AVAILABLE, GRUB_MMAP_MEMORY_RESERVED): New
        macros.

        * kern/i386/pc/init.c (grub_machine_init): Replace hardcoded region
        type check value with `GRUB_MACHINE_MEMORY_AVAILABLE'.
        Move e820 parsing from here ...
        * kern/i386/pc/mmap.c: New file.
        (grub_machine_mmap_iterate): ... to here.

        * include/grub/i386/coreboot/memory.h: Remove `<grub/err.h>'.
        (GRUB_LINUXBIOS_MEMORY_AVAILABLE): Rename (for consistency) to ...
        (GRUB_MACHINE_MEMORY_AVAILABLE): ... this.  Update all users.
        (grub_available_iterate): Redeclare to return `void', and redeclare
        its hook to use grub_uint64_t as addr and size parameters, and rename
        to ...
        (grub_machine_mmap_iterate): ... this.  Update all users.

        * kern/i386/coreboot/mmap.c (grub_mmap_iterate): Simplify parser loop
        to make it more readable.  Rename to ...
        (grub_machine_mmap_iterate): ... this.

        * loader/i386/pc/multiboot.c (mmap_addr, mmap_length): New variables.
        (grub_get_multiboot_mmap_len, grub_fill_multiboot_mmap): New functions.
        (grub_multiboot): Allocate an extra region after the payload, and fill
        it with a Multiboot memory map.  Adjust a.out loader to calculate size
        with the extra space.
        (grub_multiboot_load_elf32): Adjust elf32 loader to calculate size
        with the extra space.
2008-08-17 16:32:18 +00:00
bean
42ce5170b7 2008-08-15 Bean <bean123ch@gmail.com>
* conf/i386-pc.rmk (pkglib_MODULES): Add datetime.mod, date.mod
	and datehook.mod.
	(datetime_mod_SOURCES): New macro.
	(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/i386-coreboot.rmk (pkglib_MODULES): Add datetime.mod, date.mod
	and datehook.mod.
	(datetime_mod_SOURCES): New macro.
	(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/i386-ieee1275.rmk (pkglib_MODULES): Add datetime.mod, date.mod
	and datehook.mod.
	(datetime_mod_SOURCES): New macro.
	(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/i386-efi.rmk (pkglib_MODULES): Add datetime.mod, date.mod
	and datehook.mod.
	(datetime_mod_SOURCES): New macro.
	(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/x86_64-efi.rmk (pkglib_MODULES): Add datetime.mod, date.mod
	and datehook.mod.
	(datetime_mod_SOURCES): New macro.
	(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.

	* kern/env.c (grub_env_insert): Fix a bug in prevp pointer.

	* commands/date.c: New file.

	* hook/datehook.c: Likewise.

	* include/grub/lib/datetime.h: Likewise.

	* include/grub/i386/cmos.h: Likewise.

	* lib/datetime.c: Likewise.

	* lib/i386/datetime.c: Likewise.

	* lib/efi/datetime.c: Likewise.
2008-08-15 15:39:02 +00:00
robertmh
eba0ce9f97 2008-08-14 Robert Millan <rmh@aybabtu.com>
* conf/common.rmk (bin_UTILITIES): Add `grub-mkelfimage'.
        (grub_mkelfimage_SOURCES): New variable.
        (util/elf/grub-mkimage.c_DEPENDENCIES): Likewise.

        * conf/i386-coreboot.rmk (bin_UTILITIES, grub_mkimage_SOURCES)
        (grub_mkimage_LDFLAGS, util/elf/grub-mkimage.c_DEPENDENCIES): Remove.
        * conf/powerpc-ieee1275.rmk: Likewise.
        * conf/i386-ieee1275.rmk: Likewise.

        * kern/ieee1275/init.c: Include `<grub/cpu/kernel.h>'.
        * kern/i386/coreboot/init.c: Likewise.

        * kern/i386/ieee1275/startup.S: Replace `<grub/machine/kernel.h>'
        with `<grub/cpu/kernel.h>'.
        (GRUB_KERNEL_MACHINE_PREFIX, GRUB_KERNEL_MACHINE_DATA_END): Renamed
        to ...
        (GRUB_KERNEL_CPU_PREFIX, GRUB_KERNEL_CPU_DATA_END): ... this.
        * kern/i386/coreboot/startup.S: Likewise.

        * include/grub/powerpc/ieee1275/kernel.h (GRUB_MOD_ALIGN)
        (GRUB_MOD_GAP): Remove.
        * include/grub/powerpc/kernel.h: New file.
        * include/grub/i386/ieee1275/kernel.h (GRUB_KERNEL_MACHINE_PREFIX)
        (GRUB_KERNEL_MACHINE_DATA_END): Remove.
        * include/grub/i386/kernel.h: New file.
        * include/grub/i386/coreboot/kernel.h (GRUB_MOD_ALIGN)
        (GRUB_MOD_GAP, GRUB_KERNEL_MACHINE_PREFIX)
        (GRUB_KERNEL_MACHINE_DATA_END): Remove.

        * util/ieee1275/grub-install.in (grub_mkimage): Initialize to use
        `grub-mkelfimage'.
        Use --directory when invoking grub_mkimage.

        * util/elf/grub-mkimage.c: Include `<grub/cpu/kernel.h>'.
        (add_segments): Replace GRUB_KERNEL_MACHINE_DATA_END and
        GRUB_KERNEL_MACHINE_PREFIX with GRUB_KERNEL_CPU_DATA_END
        and GRUB_KERNEL_CPU_PREFIX.
2008-08-14 18:59:33 +00:00
fzielcke
b86408f869 2008-08-14 Felix Zielcke <fzielcke@z-51.de>
* include/grub/err.h (grub_err_printf): New function prototype.
        * util/misc.c (grub_err_printf): New function.
        * kern/misc.c [! GRUB_UTIL] (grub_err_printf): New alias for
        grub_printf.
        * kern/err.c (grub_print_error): Use grub_err_printf.
2008-08-14 18:46:47 +00:00
robertmh
371458b576 2008-08-12 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Move part
        of the relocation code from here ...
        (grub_multiboot): ... to here.
        (forward_relocator, backward_relocator): Move from here ...
        * kern/i386/loader.S (grub_multiboot_forward_relocator)
        (grub_multiboot_backward_relocator): ... to here.
        (grub_multiboot_real_boot): Use %edx for entry offset.  Put Multiboot
        magic in %eax.  Use %ebp for jumping (so %edx is not trashed).
        * include/grub/i386/loader.h (grub_multiboot_forward_relocator)
        (grub_multiboot_forward_relocator_end)
        (grub_multiboot_backward_relocator)
        (grub_multiboot_backward_relocator_end): New variables.
2008-08-12 15:40:26 +00:00
robertmh
20024ab021 2008-08-11 Robert Millan <rmh@aybabtu.com>
* kern/i386/linuxbios/startup.S: Move from here ...
        * kern/i386/coreboot/startup.S: ... to here.

        * kern/i386/linuxbios/init.c: Move from here ...
        * kern/i386/coreboot/init.c: ... to here.

        * kern/i386/linuxbios/table.c: Move from here ...
        * kern/i386/coreboot/mmap.c: ... to here.

        * conf/i386-coreboot.rmk (kernel_elf_SOURCES): Update moved files.
2008-08-11 14:57:39 +00:00
robertmh
e352e9cde3 2008-08-11 Robert Millan <rmh@aybabtu.com>
* kern/device.c (grub_device_open): Do not handle grub_disk_open()
        errors.  Leave it to the upper layer to handle them.
2008-08-11 10:33:14 +00:00
robertmh
042bd419da 2008-08-08 Robert Millan <rmh@aybabtu.com>
* kern/disk.c: Replace `<grub/machine/time.h>' with `<grub/time.h>'.
        (grub_last_time): Change type to grub_uint64_t.
        (grub_disk_open): Migrate code from to using grub_get_time_ms().
        (grub_disk_close): Likewise.

        * normal/menu.c: Replace `<grub/machine/time.h>' with `<grub/time.h>'.
        (run_menu): Migrate code from to using grub_get_time_ms().

        * util/misc.c (grub_get_time_ms): New function.
2008-08-07 23:48:13 +00:00
chrfranke
5c41d44d7d 2008-08-07 Christian Franke <franke@computer.org>
* kern/i386/pit.c (TIMER2_SPEAKER): New define.
	(TIMER2_GATE): Likewise.
	(grub_pit_wait): Add enable/disable of the timer2 gate
	bit of port 0x61.  This fixes a possible infinite loop.
2008-08-07 19:43:36 +00:00
bean
5ebc275d6f 2008-08-07 Bean <bean123ch@gmail.com>
* conf/x86_64-efi.rmk (kernel_mod_SOURCES): Add kern/time.c,
	kern/i386/tsc.c and kern/i386/pit.c.

	* include/grub/i386/tsc.h (grub_cpu_is_cpuid_supported): Handle
	x86_64 platform.

	* kern/i386/efi/init.c: Replace <grub/cpu/tsc.h> with
	<grub/i386/tsc.h>.

	* kern/i386/pit.c: Replace <grub/cpu/io.h> with <grub/i386/io.h>.
2008-08-07 19:21:25 +00:00
proski
337f5a1e93 2008-08-06 Pavel Roskin <proski@gnu.org>
* kern/i386/pit.c: Include `<grub/i386/pit.h>'.
2008-08-06 13:28:28 +00:00
robertmh
057bc4acaf 2008-08-06 Robert Millan <rmh@aybabtu.com>
* conf/i386-coreboot.rmk (kernel_elf_ASFLAGS): New variable.
        * kern/i386/tsc.c: Include `<grub/i386/pit.h>'.
2008-08-06 12:27:28 +00:00
robertmh
a55d42e0e0 2008-08-06 Robert Millan <rmh@aybabtu.com>
* conf/i386-coreboot.rmk (pkglib_MODULES): Add `reboot.mod' and
        `halt.mod'.
        (reboot_mod_SOURCES, reboot_mod_CFLAGS, reboot_mod_LDFLAGS)
        (halt_mod_SOURCES, halt_mod_CFLAGS, halt_mod_LDFLAGS): New variables.

        * kern/i386/halt.c: New file.
        * kern/i386/reboot.c: Likewise.
        * include/grub/i386/reboot.h: Likewise.
        * include/grub/i386/halt.h: Likewise.

        * commands/halt.c [! GRUB_MACHINE_IEEE1275 ! GRUB_MACHINE_EFI]:
        Include `<grub/cpu/halt.h>'.
        * commands/reboot.c [! GRUB_MACHINE_IEEE1275 ! GRUB_MACHINE_EFI]
        [! GRUB_MACHINE_PCBIOS]: Include `<grub/cpu/reboot.h>'.

        * term/i386/pc/at_keyboard.c: Include `<grub/cpu/at_keyboard.h>'.
        (SHIFT_L, SHIFT_R, CTRL, ALT, CAPS_LOCK, KEYBOARD_REG_DATA)
        (KEYBOARD_REG_STATUS, KEYBOARD_COMMAND_ISREADY, KEYBOARD_COMMAND_READ)
        (KEYBOARD_COMMAND_WRITE, KEYBOARD_COMMAND_REBOOT)
        (KEYBOARD_SCANCODE_SET1, KEYBOARD_ISMAKE, KEYBOARD_ISREADY)
        (KEYBOARD_SCANCODE, OLPC_UP, OLPC_DOWN, OLPC_LEFT, OLPC_RIGHT): Move
        from here ...
        * include/grub/i386/at_keyboard.h: ... to here.
2008-08-06 00:20:04 +00:00
robertmh
24371d2620 2008-08-05 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/i386/pit.c'.
        * conf/i386-efi.rmk (kernel_mod_SOURCES): Likewise.
        * conf/i386-coreboot.rmk (kernel_elf_SOURCES): Likewise. Also add
        `kern/i386/tsc.c', `kern/generic/rtc_get_time_ms.c' and
        `kern/generic/millisleep.c'.

        * kern/i386/tsc.c (calibrate_tsc): Rewrite using grub_pit_wait()
        instead of grub_get_rtc().
        (grub_tsc_init): Initialize `tsc_boot_time'.

        * kern/i386/linuxbios/init.c (grub_millisleep): Remove stub.
        (grub_machine_init): Use grub_tsc_init() rather than
        installing an RTC-based handler via grub_install_get_time_ms().

        * kern/i386/pit.c: New file.
        * include/grub/i386/pit.h: Likewise.
2008-08-05 20:24:00 +00:00
bean
9e7007b310 2008-08-05 Bean <bean123ch@gmail.com>
* boot/i386/pc/pxeboot.S (_start): Use drive number 0x7F for pxe.

	* conf/i386-pc.rmk (kernel_img_HEADERS): Add machine/pxe.h.
	(pkglib_MODULES): Add pxe.mod and pxecmd.mod.
	(pxe_mod_SOURCES): New macro.
	(pxe_mod_CFLAGS): Likewise.
	(pxe_mod_LDFLAGS): Likewise.
	(pxecmd_mod_SOURCES): Likewise.
	(pxecmd_mod_CFLAGS): Likewise.
	(pxecmd_mod_LDFLAGS): Likewise.

	* kern/i386/pc/startup.S (grub_pxe_scan): New function.
	(grub_pxe_call): Likewise.

	* include/grub/disk.h (grub_disk_dev_id): Add GRUB_DISK_DEVICE_PXE_ID.

	* commands/i386/pc/pxecmd.c: New file.

	* disk/i386/pc/pxe.c: Likewise.

	* include/grub/i386/pc/pxe.h: Likewise.
2008-08-05 15:15:59 +00:00
marco_g
748d089ee3 actually add kern/time.c 2008-08-05 12:38:12 +00:00
marco_g
a829251bdb Urgh, and now actually add the files :-) 2008-08-05 12:26:29 +00:00
marco_g
9c2ff3eefe 2008-08-05 Colin D Bennett <colin@gibibit.com>
High resolution timer support.  Implemented for x86 CPUs using TSC.
	Extracted generic grub_millisleep() so it's linked in only as needed.
	This requires a Pentium compatible CPU; if the RDTSC instruction is
	not supported, then it falls back on the generic grub_get_time_ms()
	implementation that uses the machine's RTC.

	* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/time.c',
	`kern/i386/tsc.c', `kern/generic/rtc_get_time_ms.c' and
	`kern/generic/millisleep.c'.

	* conf/i386-efi.rmk (kernel_mod_SOURCES): Add `kern/i386/tsc.c',
	`kern/generic/rtc_get_time_ms.c' and `kern/generic/millisleep.c'.

	* conf/x86_64-efi.rml (kernel_mod_SOURCES): Add
	`kern/generic/millisleep.c' and `kern/generic/rtc_get_time_ms.c'.

	* conf/sparc64-ieee1275.rmk (kernel_elf_SOURCES): Likewise.

	* conf/powerpc-ieee1275.rmk (kernel_elf_SOURCES): Add
	`kern/generic/millisleep.c'.

	* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Likewise.

	* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Add `kern/time.c'.

	* kern/generic/rtc_get_time_ms.c: New file.

	* kern/generic/millisleep.c: New file.
 	
	* kern/misc.c: Don't include
	<kern/time.h> anymore.
	(grub_millisleep_generic): Removed.

	* commands/sleep.c (grub_interruptible_millisleep): Uses
	grub_get_time_ms() instead of grub_get_rtc().

	* include/grub/i386/tsc.h (grub_get_tsc): New file.  New inline
	function.
	(grub_cpu_is_cpuid_supported): New inline function.
	(grub_cpu_is_tsc_supported): New inline function.
	(grub_tsc_init): New function prototype.
	(grub_tsc_get_time_ms): New function prototype.

	* kern/i386/tsc.c (grub_get_time_ms): New file.

	* include/grub/time.h: Include <grub/types.h.
	(grub_millisleep_generic): Removed.
	(grub_get_time_ms): New prototype.
	(grub_install_get_time_ms): New prototype.
	(grub_rtc_get_time_ms): New prototype.

	* kern/time.c (grub_get_time_ms): New function.
	(grub_install_get_time_ms): New function.

	* kern/i386/efi/init.c: Include <grub/cpu/tsc.h>.  Don't include
	<grub/time.h> anymore.
	(grub_millisleep): Removed.
	(grub_machine_init): Call grub_tsc_init.

	* kern/i386/linuxbios/init.c (grub_machine_init): Install the RTC
	get_time_ms() implementation.

	* kern/sparc64/ieee1275/init.c (grub_millisleep): Removed.
	(ieee1275_get_time_ms): New function.
	(grub_machine_init): Install get_time_ms() implementation.

	* kern/i386/pc/init.c: Include <grub/cpu/tsc.h>.
	(grub_machine_init): Call grub_tsc_init().
	(grub_millisleep): Removed.
 
	* kern/ieee1275/init.c (grub_millisleep): Removed.
	(grub_machine_init): Install ieee1275_get_time_ms()
	implementation.
	(ieee1275_get_time_ms): New function.
	(grub_get_rtc): Now calls ieee1275_get_time_ms(), which does the
	real work.
2008-08-05 11:54:37 +00:00
proski
8d23f50773 2008-08-04 Pavel Roskin <proski@gnu.org>
* kern/main.c: Include grub/mm.h.
2008-08-04 22:54:06 +00:00
robertmh
2d52f57f10 2008-08-03 Robert Millan <rmh@aybabtu.com>
* kern/i386/pc/init.c (make_install_device): Check for `grub_prefix'
        instead of `grub_install_dos_part' to determine whether a drive needs
        to be prepended to prefix (`grub_install_dos_part' is not reliable,
        because it can be overriden when loading GRUB via Multiboot).
2008-08-02 23:24:34 +00:00
robertmh
3bd0a12aca 2008-08-02 Robert Millan <rmh@aybabtu.com>
* disk/memdisk.c (memdisk_size): Don't initialize.
        (GRUB_MOD_INIT(memdisk)): Find memdisk using grub_module_iterate().

        * include/grub/i386/pc/kernel.h
        (GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE): Remove macro.
        (GRUB_KERNEL_MACHINE_PREFIX, GRUB_KERNEL_MACHINE_DATA_END): Shift.
        (grub_memdisk_image_size, grub_arch_memdisk_addr)
        (grub_arch_memdisk_size): Remove.

        * include/grub/kernel.h (struct grub_module_header): Remove `offset'
        field (was only used to transfer a constant).  Add `type' field to
        support multiple module types.
        (grub_module_iterate): New function.

        * kern/device.c (grub_device_open): Do not hide error messages
        when grub_disk_open() fails.  Use grub_print_error() instead.

        * kern/i386/pc/init.c (grub_arch_modules_addr)
        (grub_arch_memdisk_size): Remove functions.
        (grub_arch_modules_addr): Return the module address in high memory
        (now that it isn't copied anymore).

        * kern/i386/pc/startup.S (grub_memdisk_image_size): Remove variable.
        (codestart): Don't add grub_memdisk_image_size to %ecx in LZMA
        decompression routine (grub_total_module_size already includes that
        now).  Don't copy modules back to low memory.

        * kern/main.c: Include `<grub/mm.h>'.
        (grub_load_modules): Split out (and use) ...
        (grub_module_iterate): ... this function, which iterates through
        module objects and runs a hook.
        Comment out grub_mm_init_region() call, as it would cause non-ELF
        modules to be overwritten.

        * util/i386/pc/grub-mkimage.c (generate_image): Instead of appending
        the memdisk image in its own region, make it part of the module list.
        * util/elf/grub-mkimage.c (options): Add "memdisk"|'m' option.
        (main): Parse --memdisk|-m option, and pass user-provided path as
        parameter to generate_image().
        (add_segments): Pass `memdisk_path' down to load_modules().
        (load_modules): Embed memdisk image in module section when requested.
        * util/i386/efi/grub-mkimage.c (make_mods_section): Initialize
        `header.type' instead of `header.offset'.

        * conf/powerpc-ieee1275.rmk (pkglib_MODULES): Add `memdisk.mod'.
        (memdisk_mod_SOURCES, memdisk_mod_CFLAGS)
        (memdisk_mod_LDFLAGS): New variables.
        * conf/i386-coreboot.rmk: Likewise.
        * conf/i386-ieee1275.rmk: Likewise.
2008-08-02 12:17:44 +00:00
robertmh
a927cc7383 2008-08-02 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (playground, forward_relocator)
        (backward_relocator): New variables.  Used to allocate and relocate
        the payload, respectively.
        (grub_multiboot_load_elf32): Load into heap instead of requested
        address, install the appropiate relocator code in each bound of
        the payload, and set the entry point such that
        grub_multiboot_real_boot() will jump to one of them.

        * kern/i386/loader.S (grub_multiboot_payload_size)
        (grub_multiboot_payload_orig, grub_multiboot_payload_dest)
        (grub_multiboot_payload_entry_offset): New variables.
        (grub_multiboot_real_boot): Set cpu context to what the relocator
        expects, and jump to the relocator instead of the payload.

        * include/grub/i386/loader.h (grub_multiboot_payload_size)
        (grub_multiboot_payload_orig, grub_multiboot_payload_dest)
        (grub_multiboot_payload_entry_offset): Export.
2008-08-02 12:12:14 +00:00
robertmh
edb3d5c272 Add missing copyright years for recent changes 2008-07-31 19:33:23 +00:00
robertmh
ae88bca301 2008-07-30 Robert Millan <rmh@aybabtu.com>
* kern/ieee1275/init.c (grub_machine_set_prefix): If `grub_prefix'
        is non-empty, use it to set the `prefix' environment variable instead
        of the usual approach.
        * kern/i386/linuxbios/init.c (make_install_device): Remove function.
        (grub_machine_set_prefix): Use `grub_prefix' to set the `prefix'
        environment variable instead of dummy make_install_device().

        * kern/i386/ieee1275/startup.S: Include `<grub/machine/kernel.h>'.
        (start): Insert a data section, with `grub_prefix' variable.
        * kern/i386/linuxbios/startup.S: Likewise.

        * include/grub/powerpc/ieee1275/kernel.h [!ASM_FILE] (grub_prefix):
        New variable reference.
        * include/grub/i386/ieee1275/kernel.h (GRUB_KERNEL_MACHINE_PREFIX):
        New macro.  Defines offset of `grub_prefix' within startup.S (relative
        to `start').
        (GRUB_KERNEL_MACHINE_DATA_END): New macro.  Defines the end of data
        section within startup.S (relative to `start').
        * include/grub/i386/coreboot/kernel.h: Likewise.

        * util/elf/grub-mkimage.c (add_segments): Receive `prefix' parameter.
        Overwrite grub_prefix with its contents, at the beginning of the
        first segment.
        (main): Understand -p|--prefix.
2008-07-30 10:42:11 +00:00
bean
2a8a80e4f4 2008-07-24 Bean <bean123ch@gmail.com>
* common.rmk (bin_UTILITIES): Add grub-pe2elf.
	(grub_pe2elf_SOURCES): New macro.
	(CLEANFILES): Add grub-pe2elf.

	* include/grub/efi/pe32.h (GRUB_PE32_SCN_ALIGN_1BYTES): New constant.
	(GRUB_PE32_SCN_ALIGN_2BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_4BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_8BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_16BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_32BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_64BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_SHIFT): Likewise.
	(GRUB_PE32_SCN_ALIGN_MASK): Likewise.
	(GRUB_PE32_SYM_CLASS_EXTERNAL): Likewise.
	(GRUB_PE32_SYM_CLASS_STATIC): Likewise.
	(GRUB_PE32_SYM_CLASS_FILE): Likewise.
	(GRUB_PE32_DT_FUNCTION): Likewise.
	(GRUB_PE32_REL_I386_DIR32): Likewise.
	(GRUB_PE32_REL_I386_REL32): Likewise.
	(grub_pe32_symbol): New structure.
	(grub_pe32_reloc): Likewise.

	* util/grub-pe2elf.c: New file.

	* configure.ac: Set TARGET_OBJ2ELF if host os is cygwin. Don't test for
	start symbol in non pc platform.

	* genmk.rb: Use TARGET_OBJ2ELF to convert native object format to elf.

	The following patches are from Christian Franke.

	* include/grub/dl.h: Remove .previous, gas supports this only
	for ELF format.

	* include/grub/symbol.h [__CYGWIN__] (#define FUNCTION/VARIABLE):
	Remove .type, gas supports this only for ELF format.

	* kern/dl.c (grub_dl_resolve_dependencies): Add check for trailing
	nullbytes in symbol table. This fixes an infinite loop if table is
	zero filled.

	* Makefile.in: Add autoconf replacements TARGET_IMG_LDSCRIPT,
	TARGET_IMG_LDFLAGS and EXEEXT.

	* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Replace -Wl,-N by
	TARGET_IMG_LDFLAGS_AC.
	(grub_CHECK_STACK_ARG_PROBE): New function.

	* conf/i386-pc.rmk: Replace -Wl,-N by TARGET_IMG_LDFLAGS.

	* conf/i386-pc-cygwin-ld-img.sc: New linker script.

	* configure.ac: Add check for linker script "conf/${target}-img-ld.c"
	to set TARGET_IMG_LD* accordingly.
	Add check for Cygwin to set TARGET_MOD_OBJCOPY accordingly.
	Add call to grub_CHECK_STACK_ARG_PROBE.
	Use TARGET_IMG_LDFLAGS to check start, bss_start, end symbols.

	* genkernsyms.sh.in: Handle HAVE_ASM_USCORE case.

	* genmk.rb: Add EXEEXT to CLEANFILES.
2008-07-24 14:56:30 +00:00
bean
18eeaf04d7 2008-07-21 Bean <bean123ch@gmail.com>
* kern/i386/pc/startup.S (gate_a20_try_bios): Change test order for
	a20. Run keyboard test last, as it will cause macbook to halt.
2008-07-21 10:40:01 +00:00
proski
b095e2adbf 2008-07-18 Pavel Roskin <proski@gnu.org>
* kern/dl.c: Go back to using GRUB_CPU_SIZEOF_VOID_P.  We cannot
	load foreign architecture modules correctly anyway.  Keep
	support for loading host architecture modules, whether we
	compile them or not.
2008-07-18 16:11:35 +00:00
proski
8aaedab414 Typo fix 2008-07-18 03:47:33 +00:00
proski
4ad2d0499c 2008-07-17 Pavel Roskin <proski@gnu.org>
* disk/efi/efidisk.c: Fix format warnings on x86_64.
	* kern/efi/efi.c: Likewise.
2008-07-18 01:11:33 +00:00
bean
2001169405 2008-07-17 Bean <bean123ch@gmail.com>
* conf/i386/efi.rmk (pkglib_MODULES): add pci.mod and lspci.mod.
	(appleldr_mod_SOURCE): New variavle.
	(appleldr_mod_CFLAGS): Likewise.
	(appleldr_mod_LDFLAGS): Likewise.
	(pci_mod_SOURCES): Likewise.
	(pci_mod_CFLAGS): Likewise.
	(pci_mod_LDFLAGS): Likewise.
	(lspci_mod_SOURCES): Likewise.
	(lspci_mod_CFLAGS): Likewise.
	(lspci_mod_LDFLAGS): Likewise.

	* conf/x86_64-efi.rmk: New file.

	* disk/efi/efidisk.c (grub_efidisk_read): Wrap efi calls with efi_call_N
	macro.
	(grub_efidisk_write): Likewise.

	* include/efi/api.h (efi_call_0): New macro.
	(efi_call_1): Likewise.
	(efi_call_2): Likewise.
	(efi_call_3): Likewise.
	(efi_call_4): Likewise.
	(efi_call_5): Likewise.
	(efi_call_6): Likewise.

	* include/grub/efi/chainloader.h (grub_chainloader_cmd): Rename to
	grub_rescue_cmd_chainloader.

	* include/grub/efi/pe32.h (GRUB_PE32_MACHINE_X86_64): New macro.
	(grub_pe32_optional_header): Change some fields based on i386 or
	x86_64 platform.
	(GRUB_PE32_PE32_MAGIC): Likewise.

	* include/grub/efi/uga_draw.h: New file.

	* include/grub/elf.h (STN_ABS): New constant.
	(R_X86_64_NONE): Relocation constant for x86_64.
	(R_X86_64_64): Likewise.
	(R_X86_64_PC32): Likewise.
	(R_X86_64_GOT32): Likewise.
	(R_X86_64_PLT32): Likewise.
	(R_X86_64_COPY): Likewise.
	(R_X86_64_GLOB_DAT): Likewise.
	(R_X86_64_JUMP_SLOT): Likewise.
	(R_X86_64_RELATIVE): Likewise.
	(R_X86_64_GOTPCREL): Likewise.
	(R_X86_64_32): Likewise.
	(R_X86_64_32S): Likewise.
	(R_X86_64_16): Likewise.
	(R_X86_64_PC16): Likewise.
	(R_X86_64_8): Likewise.
	(R_X86_64_PC8): Likewise.

	* include/grub/i386/efi/pci.h: New file.

	* include/grub/i386/linux.h (GRUB_LINUX_EFI_SIGNATURE):
	Change it value based on platform.
	(GRUB_LINUX_EFI_SIGNATURE_0204): New constant.
	(GRUB_E820_RAM): Likewise.
	(GRUB_E820_RESERVED): Likewise.
	(GRUB_E820_ACPI): Likewise.
	(GRUB_E820_NVS): Likewise.
	(GRUB_E820_EXEC_CODE): Likewise.
	(GRUB_E820_MAX_ENTRY): Likewise.
	(grub_e820_mmap): New structure.
	(linux_kernel_header): Change the efi field according to different
	kernel version, also field from linux_kernel_header.

	* include/grub/kernel.h (grub_module_info): Add padding for x86_64.

	* include/grub/pci.h (GRUB_PCI_ADDR_SPACE_MASK): New constant.
	(GRUB_PCI_ADDR_SPACE_MEMORY): Likewise.
	(GRUB_PCI_ADDR_SPACE_IO): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_MASK): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_32): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_1M): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_64): Likewise.
	(GRUB_PCI_ADDR_MEM_PREFETCH): Likewise.
	(GRUB_PCI_ADDR_MEM_MASK): Likewise.
	(GRUB_PCI_ADDR_IO_MASK): Likewise.

	* include/grub/x86_64/efi/kernel.h: New file.

	* include/grub/x86_64/efi/loader.h: Likewise.

	* include/grub/x86_64/efi/machine.h: Likewise.

	* include/grub/x86_64/efi/pci.h: Likewise.

	* include/grub/x86_64/efi/time.h: Likewise.

	* include/grub/x86_64/linux.h: Likewise.

	* include/grub/x86_64/setjmp.h: Likewise.

	* include/grub/x86_64/time.h: Likewise.

	* include/grub/x86_64/types.h: Likewise.

	* kern/dl.c (GRUB_CPU_SIZEOF_VOID_P): Changed to
	 GRUB_TARGET_SIZEOF_VOID_P.

	* kern/efi/efi.c (grub_efi_locate_protocol): Wrap efi calls.
	(grub_efi_locate_handle): Likewise.
	(grub_efi_open_protocol): Likewise.
	(grub_efi_set_text_mode): Likewise.
	(grub_efi_stall): Likewise.
	(grub_exit): Likewise.
	(grub_reboot): Likewise.
	(grub_halt): Likewise.
	(grub_efi_exit_boot_services): Likewise.
	(grub_get_rtc): Likewise.

	* kern/efi/mm.c (MEMORY_MAP_SIZE): Change to 0x3000 for new models.
	(GRUB_CPU_SIZEOF_VOID_P): Changed to GRUB_TARGET_SIZEOF_VOID_P.
	(grub_efi_allocate_pages): Wrap efi calls.
	(grub_efi_free_pages): Wrap efi calls.
	(grub_efi_get_memory_map): Wrap efi calls.

	* kern/x86_64/dl.c: New file.

	* kern/x86_64/efi/callwrap.S: Likewise.

	* kern/x86_64/efi/startup.S: Likewise.

	* loader/efi/appleloader.c: Likewise.

	* loader/efi/chainloader.c (cmdline): New variable.
	(grub_chainloader_unload): Wrap efi calls.
	(grub_chainloader_boot): Likewise.
	(grub_rescue_cmd_chainloader): Wrap efi calls, handle
	command line.

	* loader/efi/chainloader_normal.c (chainloader_command):
	Change grub_chainloader_cmd to grub_rescue_cmd_chainloader, pass
	command line.

	* loader/i386/efi/linux.c (allocate_pages): Change allocation
	method.
	(grub_e820_add_region): New function.
	(grub_linux_boot): Construct e820 map from efi map, handle x86_64
	booting.
	(grub_find_video_card): New function.
	(grub_linux_setup_video): New function.
	(grub_rescue_cmd_linux): Probe for video information.

	* normal/x86_64/setjmp.S: New file.

	* term/efi/console.c (map_char): New function.
	(grub_console_putchar): Map unicode char.
	(grub_console_checkkey): Wrap efi calls.
	(grub_console_getkey): Likewise.
	(grub_console_getwh): Likewise.
	(grub_console_gotoxy): Likewise.
	(grub_console_cls): Likewise.
	(grub_console_setcolorstate): Likewise.
	(grub_console_setcursor): Likewise.

	* util/i386/efi/grub-mkimage.c: Add support for x86_64.
2008-07-17 09:50:26 +00:00
proski
506b2b3e2b 2008-07-15 Pavel Roskin <proski@gnu.org>
* kern/i386/ieee1275/init.c: Include grub/cache.h.
2008-07-15 13:29:53 +00:00
proski
c4cd51d7a4 2008-07-15 Pavel Roskin <proski@gnu.org>
* kern/ieee1275/ieee1275.c (grub_ieee1275_get_integer_property):
	Fix comparison between signed and unsigned.
2008-07-15 13:22:27 +00:00
proski
407aceb4da 2008-07-14 Pavel Roskin <proski@gnu.org>
* kern/env.c (grub_register_variable_hook): Don't copy empty
	string, it leaks memory.  Pass "" to grub_env_set(), it should
	handle constant strings.
2008-07-14 05:03:19 +00:00
proski
e4e8eaa5b3 2008-07-14 Pavel Roskin <proski@gnu.org>
* commands/blocklist.c (grub_cmd_blocklist): Fix format warning.
	* commands/cmp.c (grub_cmd_cmp): Likewise.
	* kern/dl.c (grub_dl_flush_cache): Likewise.
	(grub_dl_load_core): Likewise.
	* kern/elf.c (grub_elf32_load_phdrs): Likewise.
	(grub_elf64_load_phdrs): Likewise.
2008-07-14 04:46:19 +00:00
bean
aa24b516a2 2008-07-13 Bean <bean123ch@gmail.com>
* Makefile.in (enable_lzo): New rule.

	* conf/i386-pc.rmk (grub_mkimage_SOURCES): New test with enable_lzo.

	* configure.ac (ENABLE_LZO): New option --enable-lzo.

	* boot/i386/pc/lnxboot.S: #include <config.h>.

	* include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_RAW_SIZE): Change
	its value accordding to the compression algorithm used, lzo or lzma.

	* util/i386/pc/grub-mkimage.c (compress_kernel): Use different
	compression algorithm according to configure macro.

	* kern/i386/pc/startup.S (codestart): Likewise.

	* kern/i386/pc/lzma_decode.S: New file.

	* include/grub/lib/LzFind.h: Likewise.

	* include/grub/lib/LzHash.h: Likewise.

	* include/grub/lib/LzmaDec.h: Likewise.

	* include/grub/lib/LzmaEnc.h: Likewise.

	* include/grub/lib/LzmaTypes.h: Likewise.

	* lib/LzFind.c: Likewise.

	* lib/LzmaDec.c: Likewise.

	* lib/LzmaEnc.c: Likewise.
2008-07-13 01:55:15 +00:00
proski
bcd35b903d 2008-07-04 Pavel Roskin <proski@gnu.org>
* kern/i386/linuxbios/init.c (grub_machine_init): Cast addr to
	grub_addr_t before casting it to the void pointer to fix a
	warning.  Non-addressable regions are discarded earlier.
	(grub_arch_modules_addr): Cast _end to grub_addr_t.
	* kern/i386/linuxbios/table.c: Include grub/misc.h.
	(check_signature): Don't shadow table_header.
	(grub_linuxbios_table_iterate): Cast numeric constants to
	grub_linuxbios_table_header_t.
	* include/grub/i386/linuxbios/init.h: Add noreturn attribute to
	grub_stop().
2008-07-04 03:26:10 +00:00
proski
af58ab3dbc 2008-07-04 Pavel Roskin <proski@gnu.org>
* kern/ieee1275/init.c: Cast _start and _end to grub_addr_t to
	prevent warnings.
2008-07-04 03:01:55 +00:00
robertmh
8516d2a8e1 2008-07-04 Robert Millan <rmh@aybabtu.com>
This fixes a performance issue when pc & gpt partmap iterators
        didn't abort iteration even after our hook found what it was
        looking for (often causing expensive probes of non-existant drives).

        Some callers relied on previous buggy behaviour, since they would
        rise an error when their own hooks caused early abortion of its
        iteration.

        * kern/device.c (grub_device_open): Improve error message.
        * disk/lvm.c (grub_lvm_open): Likewise.
        * disk/raid.c (grub_raid_open): Likewise.

        * partmap/pc.c (pc_partition_map_iterate): Abort parent iteration
        when hook requests it, independently of grub_errno.
        (pc_partition_map_probe): Do not fail when find_func() caused
        early abortion of pc_partition_map_iterate().

        * partmap/gpt.c (gpt_partition_map_iterate): Abort parent iteration
        when hook requests it, independently of grub_errno.
        (gpt_partition_map_probe): Do not fail when find_func() caused
        early abortion of gpt_partition_map_iterate().

        * kern/partition.c (grub_partition_iterate): Abort parent iteration
        when hook requests it, independently of grub_errno.  Do not fail when
        part_map_iterate_hook() caused early abortion of p->iterate().

        * util/biosdisk.c (grub_util_biosdisk_get_grub_dev): Do not fail
        when grub_partition_iterate() returned with non-zero.
2008-07-03 22:56:43 +00:00
bean
d4156eeedf 2008-07-02 Bean <bean123ch@gmail.com>
* include/grub/ieee1275.h (grub_ieee1275_flag): New constant
	GRUB_IEEE1275_FLAG_CANNOT_INTERPRET, GRUB_IEEE1275_FLAG_FORCE_CLAIM
	and GRUB_IEEE1275_FLAG_NO_ANSI.

	* kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set flag
	GRUB_IEEE1275_FLAG_CANNOT_INTERPRET, GRUB_IEEE1275_FLAG_FORCE_CLAIM
	and GRUB_IEEE1275_FLAG_NO_ANSI for Open Hackware.

	* kern/ieee1275/ieee1275.c (grub_ieee1275_interpret): Return
	immediately if GRUB_IEEE1275_FLAG_CANNOT_INTERPRET is set.

	* kern/ieee1275/init.c (grub_claim_heap): Claim memory directly if
	GRUB_IEEE1275_FLAG_FORCE_CLAIM is set.

	* term/ieee1275/ofconsole.c (grub_ofconsole_writeesc): Don't output
	esc sequence on non ANSI terminal.
	(grub_ofconsole_gotoxy): Emulate backspace key on non ANSI terminal.

	* util/elf/grub-mkimage.c (add_segments): Move ELF header to the
	beginning of file.
2008-07-02 07:38:46 +00:00
robertmh
aebe3d13bb 2008-06-26 Robert Millan <rmh@aybabtu.com>
* disk/fs_uuid.c: New file.
        * conf/common.rmk (pkglib_MODULES): Add `fs_uuid.mod'.
        (fs_uuid_mod_SOURCES, fs_uuid_mod_CFLAGS)
        (fs_uuid_mod_LDFLAGS): New variables.
        * include/grub/disk.h (grub_disk_dev_id): Add
        `GRUB_DISK_DEVICE_UUID_ID'.
        * kern/disk.c (grub_disk_dev_iterate): Allow disk devices not to
        implement iterate().
2008-06-26 14:26:07 +00:00
robertmh
650e1c79b9 2008-06-19 Robert Millan <rmh@aybabtu.com>
* kern/main.c (grub_main): Export `prefix' variable inmediately
        after it has been set by grub_machine_set_prefix().
2008-06-19 20:08:57 +00:00
proski
95614c84f8 2008-06-15 Pavel Roskin <proski@gnu.org>
* commands/ls.c (grub_ls_list_files): Use integer calculations
	for human readable format, avoid floating point use.
	* kern/misc.c (grub_ftoa): Remove.
	(grub_vsprintf): Remove floating point support.
2008-06-16 00:42:48 +00:00
robertmh
a920728493 2008-06-15 Robert Millan <rmh@aybabtu.com>
* util/i386/pc/grub-mkimage.c (generate_image): If we included a drive
        in our prefix, set install_{dos,bsd}_part = -2 to indicate this can be
        skipped later.
        (main): If a memdisk was requested, add "(memdisk)" drive explicitly to
        the beginning of the prefix.

        * kern/i386/pc/init.c (make_install_device): Remove memdisk check.
        It is assumed that if we have a memdisk, grub-mkimage has set
        grub_prefix to include the "(memdisk)" drive in it.
2008-06-15 18:21:16 +00:00
robertmh
ce525529f9 2008-06-08 Robert Millan <rmh@aybabtu.com>
Based on description from Pavel:
        * kern/disk.c (grub_disk_check_range): Rename to ...
        (grub_disk_adjust_range): ... this.  Add a comment explaining the
        tasks performed by this function.
2008-06-08 19:46:43 +00:00
robertmh
c5e3cfba13 2008-06-06 Robert Millan <rmh@aybabtu.com>
Ensure GRUB_KERNEL_MACHINE_DATA_END is always consistent with the
        rest of GRUB, and breakage doesn't happen if its value were modified.

        * include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_RAW_SIZE):
        Redefine as an offset from `GRUB_KERNEL_MACHINE_DATA_END' instead of
        a constant (same value).
        * kern/i386/pc/startup.S: Replace hardcoded `0x50' with
        `GRUB_KERNEL_MACHINE_DATA_END' (same value).
2008-06-06 16:29:19 +00:00
bean
a079699e97 2008-05-15 Bean <bean123ch@gmail.com>
* kern/i386/pc/startup.S (grub_console_getkey): Workaround for the
	keyboard hang problem in apple's intel mac.
2008-05-15 11:51:22 +00:00
bean
25f16ec1f6 2008-04-25 Bean <bean123ch@gmail.com>
* Makefile.in (RMKFILES): Add missing arch i386-ieee1275 and
	i386-linuxbios.

	* commands/hexdump.c (grub_cmd_hexdump): Support dumping of device,
	change the buffer size to 4096 for cdrom device.

	* conf/i386-ieee1275.rmk (pkglib_MODULES): Add _linux.mod, linux.mod
	and nand.mod.
	(_linux_mod_SOURCES): New variable.
	(_linux_mod_CFLAGS): Likewise.
	(_linux_mod_LDFLAGS): Likewise.
	(linux_mod_SOURCES): Likewise.
	(linux_mod_CFLAGS): Likewise.
	(linux_mod_LDFLAGS): Likewise.
	(nand_mod_SOURCES): Likewise.
	(nand_mod_CFLAGS): Likewise.
	(nand_mod_LDFLAGS): Likewise.

	* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Return
	GRUB_ERR_UNKNOWN_DEVICE instead of GRUB_ERR_BAD_DEVICE if no device
	type property. (nand device in olpc don't have this property)

	* include/grub/disk.h (grub_disk_dev_id): New macro
	GRUB_DISK_DEVICE_NAND_ID.

	* include/grub/i386/ieee1275/loader.h (grub_rescue_cmd_linux): New
	function prototype.
	(grub_rescue_cmd_initrd): Likewise.

	* include/grub/i386/linux.h (GRUB_LINUX_OFW_SIGNATURE): New macro.
	(linux_kernel_params): Add new member ofw_signature, ofw_num_items,
	ofw_cif_handler and ofw_idt, adjust padding number.

	* include/grub/i386/pc/memory.h (grub_upper_mem): Export it if
	GRUB_MACHINE_IEEE1275 is defined.

	* include/grub/ieee1275/ieee1275.h (grub_available_iterate):
	Use NESTED_FUNC_ATTR attribute on the hook parameter.

	* kern/powerpc/ieee1275/init.c (grub_claim_heap): Use NESTED_FUNC_ATTR
	on nested function heap_init.
	(grub_upper_mem): New variable for i386-ieee1275.
	(grub_get_extended_memory): New function for i386-ieee1275.
	(grub_machine_init): Call grub_get_extended_memory for i386-ieee1275.

	* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Use
	NESTED_FUNC_ATTR on the hook parameter. Don't quit if no device type
	property.

	* loader/i386/ieee1275/linux.c: New file.

	* loader/i386/ieee1275/linux_normal.c: New file.

	* disk/ieee1275/nand.c: New file.
2008-04-25 19:41:51 +00:00
robertmh
602566f64a 2008-04-18 Robert Millan <rmh@aybabtu.com>
Restructures early code path on ieee1275 to unify grub_main() as
        the first C function that is executed in every platform.

        * include/grub/ieee1275/ieee1275.h (grub_ieee1275_init): New prototype.
        * kern/i386/ieee1275/startup.S (_start): Jump to grub_main() instead of
        cmain().
        * kern/powerpc/ieee1275/crt0.S (_start): Likewise.
        * kern/ieee1275/cmain.c (cmain): Rename to ...
        * kern/ieee1275/cmain.c (grub_ieee1275_init): ... this.
        * kern/ieee1275/init.c (grub_machine_init): Call grub_ieee1275_init()
        at the beginning.
2008-04-18 15:53:20 +00:00
robertmh
bfb1f1a2bc 2008-04-15 Robert Millan <rmh@aybabtu.com>
* disk/lvm.c: Update copyright year.
        * kern/misc.c: Likewise.
2008-04-15 13:28:14 +00:00
robertmh
9fe8603472 2008-04-13 Robert Millan <rmh@aybabtu.com>
* kern/misc.c (grub_strncat): Fix off-by-one error.
        Reported by Zhang Huan <zhanghuan@nrchpc.ac.cn>

        * kern/env.c (grub_env_context_close): Clear current context, not
        previous one.
        Patch from Zhang Huan <zhanghuan@nrchpc.ac.cn>

        * kern/misc.c (grub_strcat): Minor speed optimization (same code size).
2008-04-13 14:58:42 +00:00
robertmh
a91627b40a 2008-04-12 Robert Millan <rmh@aybabtu.com>
* kern/powerpc/ieee1275/init.c: Move from here ...
        * kern/ieee1275/init.c: ... to here.  Update all users.

        * kern/powerpc/ieee1275/cmain.c: Move from here ...
        * kern/ieee1275/cmain.c: ... to here.  Update all users.

        * kern/powerpc/ieee1275/openfw.c: Move from here ...
        * kern/ieee1275/openfw.c: ... to here.  Update all users.

        * loader/powerpc/ieee1275/multiboot2.c: Move from here ...
        * loader/ieee1275/multiboot2.c: ... to here.  Update all users.
2008-04-12 21:09:36 +00:00
proski
070e49e4e8 2008-04-04 Pavel Roskin <proski@gnu.org>
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
	Fix signedness warnings.
	* kern/powerpc/ieee1275/openfw.c (grub_available_iterate):
	Likewise.
	* util/ieee1275/get_disk_name.c: Include config.h so that
	_GNU_SOURCE is defined and getline() is declared.  Mark an
	unused argument as such.  Fix a signedness warning.
2008-04-04 06:45:07 +00:00
proski
17c74c21f0 2008-03-30 Pavel Roskin <proski@gnu.org>
* kern/i386/pc/startup.S (real_to_prot): Use %cs prefix to load
	GDT.  This is more robust, as %ds can change.
	(grub_biosdisk_rw_int13_extensions): Don't clear %ds before
	calling real_to_prot().
	(grub_biosdisk_get_diskinfo_int13_extensions): Likewise.
2008-03-30 04:13:47 +00:00
proski
80a3e68b59 2008-03-28 Pavel Roskin <proski@gnu.org>
* kern/i386/pc/startup.S: Assert that uncompressed functions
	don't spill beyond GRUB_KERNEL_MACHINE_RAW_SIZE.
	* kern/i386/pc/lzo1x.S: Remove all .align directives in the
	code, as they push parts of the code (error handlers) beyond
	GRUB_KERNEL_MACHINE_RAW_SIZE.  Speed is not as important in this
	code as correctness and size.
2008-03-28 17:16:46 +00:00
proski
77bcd27207 2008-03-28 Pavel Roskin <proski@gnu.org>
* kern/i386/pc/startup.S
	(grub_biosdisk_get_diskinfo_int13_extensions): When converting
	data block address to the real mode, keep offset minimal.  This
	works around a bug in AWARD BIOS on old Athlon systems, which
	makes CD detection hang.
2008-03-28 17:06:29 +00:00
bean
bf962df2da 2008-03-24 Bean <bean123ch@gmail.com>
* disk/i386/pc/biosdisk.c (cd_start): Removed.
	(cd_count): Removed.
	(cd_drive): New variable.
	(grub_biosdisk_get_drive): Don't check for (cdN) device.
	(grub_biosdisk_call_hook): Likewise.
	(grub_biosdisk_iterate): Change cdrom detection method.
	(grub_biosdisk_open): Replace cd_start with cd_drive.
	(GRUB_MOD_INIT): Use grub_biosdisk_get_cdinfo_int13_extension to
	detect cdrom device.

	* include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_MACHINE_CDROM_START):
	Removed.
	(GRUB_BIOSDISK_MACHINE_CDROM_END): Removed.
	(GRUB_BIOSDISK_CDTYPE_NO_EMUL): New macro.
	(GRUB_BIOSDISK_CDTYPE_1_2_M): Likewise.
	(GRUB_BIOSDISK_CDTYPE_1_44_M): Likewise.
	(GRUB_BIOSDISK_CDTYPE_2_88_M): Likewise.
	(GRUB_BIOSDISK_CDTYPE_HARDDISK): Likewise.
	(GRUB_BIOSDISK_CDTYPE_MASK): Likewise.
	(grub_biosdisk_cdrp): New structure.
	(grub_biosdisk_get_cdinfo_int13_extensions): New function.

	* include/grub/i386/pc/kernel.h (grub_boot_drive): Export this variable.

	* kern/i386/pc/init.c (make_install_device): Don't use (cdN) as root
	device.

	* kern/i386/pc/startup.S (grub_biosdisk_get_cdinfo_int13_extensions):
	New function.
2008-03-24 04:13:37 +00:00
proski
79ff665f5e 2008-02-19 Pavel Roskin <proski@gnu.org>
* kern/rescue.c (grub_enter_rescue_mode): Improve initial
	message.
2008-02-19 19:52:42 +00:00
bean
d38e24c285 2008-02-19 Bean <bean123ch@gmail.com>
* conf/i386-pc.rmk (pkglib_MODULES): Add aout.mod _bsd.mod and bsd.mod.
	(aout_mod_SOURCES): New variable.
	(aout_mod_CFLAGS): Likewise.
	(aout_mod_LDFLAGS): Likewise.
	(_bsd_mod_SOURCES): New variable.
	(_bsd_mod_CFLAGS): Likewise.
	(_bsd_mod_LDFLAGS): Likewise.
	(bsd_mod_SOURCES): New variable.
	(bsd_mod_CFLAGS): Likewise.
	(bsd_mod_LDFLAGS): Likewise.

	* include/grub/aout.h: New file.

	* include/grub/i386/loader.h (grub_unix_real_boot): New function.

	* include/grub/i386/bsd.h: New file.

	* include/grub/i386/pc/init.h (grub_get_mmap_entry): Use EXPORT_FUNC
	to make it public.

	* kern/elf.c (grub_elf32_load): Get the physical address after the hook
	function is called, so that it's possible to change it inside the hook.
	(grub_elf64_load): Likewise.
	(grub_elf_file): Don't close the file if elf header is not found.
	(grub_elf_close): Close the file if grub_elf_file fails (The new
	grub_elf_file won't close it).
	(grub_elf32_size): Use NESTED_FUNC_ATTR for nested function calcsize.
	(grub_elf64_size): Likewise.

	* kern/i386/loader.S (grub_unix_real_boot): New function.

	* loader/aout.c: New file.

	* loader/i386/bsd.c: New file.

	* loader/i386/bsd_normal.c: New file.

	* loader/i386/pc/multiboot.c (grub_multiboot): Handle a.out format.

	* loader/multiboot2.c (grub_multiboot2): Reset grub_errno so that it
	can test othe formats.
2008-02-19 16:40:45 +00:00
robertmh
0de8be863b 2008-02-13 Robert Millan <rmh@aybabtu.com>
* conf/i386-linuxbios.rmk (grub_emu_SOURCES): Remove
        `commands/i386/pc/halt.c' and `commands/i386/pc/reboot.c'.
        * kern/i386/linuxbios/init.c (grub_halt, grub_reboot): Remove stubs.
2008-02-13 20:04:37 +00:00
boeglin
f714229e34 2008-02-12 Alexandre Boeglin <alex@boeglin.org>
* conf/i386-efi.rmk (grub_emu_SOURCES): Replace commands/i386/pc/halt.c and
  reboot.c by commands/halt.c and reboot.c.
  (grub_install_SOURCES): Add halt.mod and reboot.mod.
  (halt_mod_SOURCES): New variable.
  (halt_mod_CFLAGS): Likewise.
  (halt_mod_LDFLAGS): Likewise.
  (reboot_mod_SOURCES): Likewise.
  (reboot_mod_CFLAGS): Likewise.
  (reboot_mod_LDFLAGS): Likewise.

  * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Replace commands/ieee1275/halt.c
  and reboot.c by commands/halt.c and reboot.c.
  (halt_mod_SOURCES): Likewise.
  (reboot_mod_SOURCES): Likewise.

  * conf/i386-pc.rmk (grub_emu_SOURCES): Replace commands/i386/pc/reboot.c by
  commands/reboot.c.
  (reboot_mod_SOURCES): Likewise.

  * commands/i386/pc/reboot.c: merge this file ...

  * commands/ieee1275/reboot.c: ... and this file ...

  * commands/reboot.c: ... to this file.
  Add some precompiler directive to include the correct header for each
  machine.

  * commands/ieee1275/halt.c: move this file ...

  * commands/halt.c: ... to here.
  Add some precompiler directive to include the correct header for each
  machine.

  * include/grub/efi/efi.h (grub_reboot): New function declaration.
  (grub_halt): Likewise.

  * kern/efi/efi.c (grub_reboot): New function.
  (grub_halt): Likewise.
2008-02-12 23:47:07 +00:00
robertmh
b5db202af3 2008-02-10 Robert Millan <rmh@aybabtu.com>
* kern/main.c (grub_load_normal_mode): Do not reset `grub_errno'.  Call
        grub_print_error() instead.  This will let user know why we're entering
        rescue mode.
        Based on suggestions from Sam Morris.
2008-02-10 17:05:10 +00:00
robertmh
0d9ff7f075 2008-02-08 Christian Franke <franke@computer.org>
* commands/cat.c (grub_cmd_cat): Print '\r' as hex to
        avoid overwriting previous output.
        * kern/rescue.c (grub_rescue_cmd_cat): Likewise.
2008-02-09 11:02:26 +00:00
robertmh
554f018744 2008-02-08 Robert Millan <rmh@aybabtu.com>
* disk/raid.c (grub_raid_open, grub_raid_scan_device): Add a few
        grub_dprintf() calls.
        * kern/disk.c (grub_disk_read): Include grub_errmsg in out of range
        error message.
2008-02-08 12:22:51 +00:00
robertmh
409480b7a2 2008-02-05 Robert Millan <rmh@aybabtu.com>
* include/grub/term.h (GRUB_TERM_LEFT, GRUB_TERM_RIGHT)
        (GRUB_TERM_UP, GRUB_TERM_DOWN, GRUB_TERM_HOME, GRUB_TERM_END)
        (GRUB_TERM_DC, GRUB_TERM_PPAGE, GRUB_TERM_NPAGE, GRUB_TERM_ESC)
        (GRUB_TERM_TAB, GRUB_TERM_BACKSPACE): New macros.

        * kern/i386/pc/startup.S: Include `<grub/term.h>'.
        (translation_table): Replace hardcoded values with macros
        provided by `<grub/term.h>'.

        * term/i386/pc/at_keyboard.c: Include `<grub/term.h>'.
        (keyboard_map): Correct/add a few values, with macros provided
        by `<grub/term.h>'.
        (keyboard_map_shift): Zero values that don't differ from their
        `keyboard_map' equivalents.
        (grub_console_checkkey): Optimize KEYBOARD_STATUS_CAPS_LOCK toggling.
        Discard the second scan code that is always sent by Caps lock.
        Only use `keyboard_map_shift' when it provides a non-zero value,
        otherwise fallback to `keyboard_map'.
2008-02-05 10:23:24 +00:00
okuji
9be6b98b6f 2008-02-03 Yoshinori K. Okuji <okuji@enbug.org>
Add support for having a grub directory in a different drive. This
    is still only the data handling part.

    * kern/i386/pc/startup.S (multiboot_trampoline): Set %dh to 0xFF.
    (codestart): Save %dh in GRUB_ROOT_DRIVE.
    (grub_root_drive): New variable.

    * kern/i386/pc/init.c (make_install_device): Use GRUB_ROOT_DRIVE
    instead of GRUB_BOOT_DRIVE to construct a device name. Set
    GRUB_ROOT_DRIVE to GRUB_BOOT_DRIVE if it is 0xFF, otherwise use it
    as it was.

    * include/grub/i386/pc/kernel.h (grub_root_drive): New prototype.

    * include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_ROOT_DRIVE): New
    macro.
    (GRUB_BOOT_MACHINE_DRIVE_CHECK): Set to 0x4f.

    * boot/i386/pc/pxeboot.S (_start): Set %dh to 0xFF. For now, this
    is bogus, because PXE booting does not specify any drive
    correctly.

    * boot/i386/pc/lnxboot.S (reg_edx): Set the second byte to 0xFF. I
    am not sure if this is really correct.

    * boot/i386/pc/cdboot.S: Set %dh to 0xFF, because the root drive
    is always identical to the boot drive when booting from a CD.

    * boot/i386/pc/boot.S (MOV_MEM_TO_AL): Removed. Not needed any
    longer.
    (root_drive): New variable.
    (real_start): Unconditionally set %dh to ROOT_DRIVE.
    (setup_sectors): Push %dx right after popping it, because %dh will
    be modified later.
    (copy_buffer): Restore %dx.
2008-02-03 18:56:08 +00:00
proski
fa370ea61b 2008-02-03 Pavel Roskin <proski@gnu.org>
* a/kern/i386/pc/startup.S (grub_chainloader_real_boot): Pop
	%edx and %esi from stack only after grub_gate_a20() is called.
	grub_gate_a20() clobbers %edx.
2008-02-03 18:04:36 +00:00
bean
9be665dd11 2008-01-31 Bean <bean123ch@gmail.com>
* conf/i386-pc.rmk (pkglib_IMAGES): Add cdboot.img.
        (cdboot_img_SOURCES): New variable.
        (cdboot_img_ASFLAGS): New variable.
        (cdboot_img_LDFLAGS): New variable.

        * boot/i386/pc/cdboot.S: New file.

        * disk/i386/pc/biosdisk.c (cd_start): New variable.
        (cd_count): Likewise.
        (grub_biosdisk_get_drive): Add support for cd device.
        (grub_biosdisk_call_hook): Likewise.
        (grub_biosdisk_iterate): Likewise.
        (grub_biosdisk_open): Likewise.
        (GRUB_BIOSDISK_CDROM_RETRY_COUNT): New macro.
        (grub_biosdisk_rw): Support reading from cd device.
        (GRUB_MOD_INIT): Iterate cd devices.

        * include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_FLAG_CDROM): New macro.
        (GRUB_BIOSDISK_MACHINE_CDROM_START): Likewise.
        (GRUB_BIOSDISK_MACHINE_CDROM_END): Likewise.

        * kern/i386/pc/init.c (make_install_device): Check for cd device.
2008-02-03 08:27:15 +00:00
robertmh
60b6be74b9 2008-02-01 Robert Millan <rmh@aybabtu.com>
* kern/disk.c (grub_disk_read, grub_disk_write): Add grub_dprintf()
        call at beginning of function.
2008-02-01 00:50:19 +00:00
robertmh
ae5a9cd7b2 2008-01-30 Tristan Gingold <gingold@free.fr>
* kern/rescue.c: Silently accept empty lines.
2008-01-30 14:42:09 +00:00
robertmh
11cc30ac40 2008-01-28 Robert Millan <rmh@aybabtu.com>
* include/grub/i386/linuxbios/kernel.h (GRUB_MOD_GAP): New macro.
        * kern/powerpc/ieee1275/init.c (grub_arch_modules_addr): Remove
        `ifndef GRUB_MOD_GAP' hack.
        * util/elf/grub-mkimage.c (add_segments): Likewise.
2008-01-28 16:58:13 +00:00
robertmh
3abc589f93 2008-01-27 Robert Millan <rmh@aybabtu.com>
* kern/powerpc/ieee1275/init.c (grub_arch_modules_addr): Skip
        `GRUB_MOD_GAP' for platforms in which it's not defined.
2008-01-27 23:00:49 +00:00
proski
3f51de772d * include/grub/powerpc/ieee1275/kernel.h: Introduce GRUB_MOD_GAP
to create a gap between _end and the modules added to the image
with grub-mkrescue.  That fixes "CLAIM failed" on PowerMAC.
* kern/powerpc/ieee1275/init.c: Use GRUB_MOD_GAP.
* util/elf/grub-mkimage.c (add_segments): Likewise.
2008-01-27 20:30:58 +00:00
proski
2033f53e0a * kern/dl.c (grub_dl_load): Don't abort if prefix is not set,
just return an error.
2008-01-26 20:34:58 +00:00
robertmh
b95f71b5a3 2008-01-25 Robert Millan <rmh@aybabtu.com>
Revert my previous commits (based on wrong assumption of how grub_errno
        works).

        * kern/disk.c (grub_disk_open): Stop reseting grub_errno.
        * kern/file.c (grub_file_open): Likewise.
2008-01-25 20:57:40 +00:00
proski
d08bbb491e * include/grub/ieee1275/ieee1275.h: Introduce flag for firmwares
that hang if GRUB tries to setup colors.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Don't set
colors for firmwares that don't support it.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag):
Recognize Open Hack'Ware, set flags to work around its
limitations.
2008-01-24 08:21:43 +00:00
robertmh
605e36ed3e 2008-01-24 Robert Millan <rmh@aybabtu.com>
* kern/file.c (grub_file_open): Do not account previous failures of
        unrelated functions when grub_errno is checked for.
        Reported by Oleg Strikov.
2008-01-24 00:06:55 +00:00
robertmh
15c80c098c 2008-01-23 Robert Millan <rmh@aybabtu.com>
* include/grub/i386/ieee1275/loader.h: Include `<grub/types.h>',
        `<grub/symbol.h>' and `<grub/multiboot.h>'.
        (grub_multiboot2_real_boot): New function prototype.

        * include/grub/i386/pc/memory.h: Include `<grub/machine/machine.h>'.
        [!GRUB_MACHINE_IEEE1275] (grub_lower_mem, grub_upper_mem): Disable.

        * kern/i386/ieee1275/init.c (grub_os_area_addr)
        (grub_os_area_size, grub_lower_mem, grub_upper_mem): Remove variables.
2008-01-23 19:21:19 +00:00
robertmh
305338fdf5 2008-01-23 Robert Millan <rmh@aybabtu.com>
* kern/mm.c (grub_mm_init_region): Replace grub_dprintf() call with
        #ifdef'ed out grub_printf().
2008-01-23 14:57:40 +00:00
robertmh
5882ae4b0e 2008-01-23 Robert Millan <rmh@aybabtu.com>
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Add
        `term/i386/pc/at_keyboard.c'.
        (pkglib_MODULES): Add `serial.mod'.
        (serial_mod_SOURCES): New variable.
        (serial_mod_CFLAGS): Likewise.
        (serial_mod_LDFLAGS): Likewise.

        * include/grub/i386/ieee1275/console.h: Add `<grub/symbol.h>'.  Remove
        `<grub/powerpc/ieee1275/console.h>'.
        (grub_keyboard_controller_init): New function prototype.
        (grub_console_checkkey): Likewise.
        (grub_console_getkey): Likewise.

        * kern/powerpc/ieee1275/init.c (grub_machine_init): Initialize AT
        keyboard on i386.

        * term/ieee1275/ofconsole.c (grub_ofconsole_term): On i386, use
        grub_ofconsole_checkkey() and grub_ofconsole_getkey() for input.
2008-01-23 11:57:22 +00:00
robertmh
06ab530333 2008-01-23 Robert Millan <rmh@aybabtu.com>
* kern/i386/pc/init.c (make_install_device): When memdisk image is
        present, "(memdisk)/boot/grub" becomes the default prefix.

        * util/i386/pc/grub-mkrescue.in: Switch to a minimal core.img plus
        a memdisk tarball with all the modules.  Add --overlay=DIR option that
        allows users to overlay additional files into the image.
2008-01-23 11:25:52 +00:00
robertmh
dbb475a441 2008-01-23 Robert Millan <rmh@aybabtu.com>
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Add `machine/loader.h'
        and `machine/memory.h'.
        (pkglib_MODULES): Add `multiboot.mod' and `_multiboot.mod'.
        (_multiboot_mod_SOURCES): New variable.
        (_multiboot_mod_CFLAGS): Likewise.
        (_multiboot_mod_LDFLAGS): Likewise.
        (multiboot_mod_SOURCES): Likewise.
        (multiboot_mod_CFLAGS): Likewise.
        (multiboot_mod_LDFLAGS): Likewise.

        * include/grub/i386/ieee1275/loader.h: New file.

        * include/grub/i386/ieee1275/machine.h: Likewise.

        * include/grub/i386/ieee1275/memory.h: Likewise.

        * include/grub/i386/pc/init.h (grub_os_area_addr): Remove (redundant)
        variable declaration.
        (grub_os_area_size): Likewise.

        * kern/i386/ieee1275/init.c (grub_os_area_addr, grub_os_area_size)
        (grub_lower_mem, grub_upper_mem): New variables.
        (grub_stop_floppy): New function (just to make
        grub_multiboot2_real_boot() happy).

        * kern/i386/ieee1275/startup.S: Include `<grub/machine/memory.h>',
        `<grub/cpu/linux.h>', `<multiboot.h>' and `<multiboot2.h>'.
        (grub_stop): New function.
        Include `"../realmode.S"' and `"../loader.S"'.

        * loader/multiboot_loader.c: Include `<grub/machine/machine.h>'.
        Replace `__i386__' #ifdefs with `GRUB_MACHINE_PCBIOS'.

        * loader/powerpc/ieee1275/multiboot2.c (grub_mb2_arch_boot): On i386,
        rely on grub_multiboot2_real_boot() for final boot.
2008-01-23 09:57:26 +00:00
robertmh
2563862970 2008-01-22 Robert Millan <rmh@aybabtu.com>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): When
        `GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' flag is set, skip any
        device that doesn't look like an SD card.
        * include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
        `GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' flag.
        * kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag): Detect
        OLPC laptop, and set `GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' when
        found.
2008-01-22 20:13:14 +00:00
robertmh
9dad816d3d 2008-01-22 Robert Millan <rmh@aybabtu.com>
* kern/powerpc/ieee1275/init.c (grub_claim_heap): Add sanity check to
        avoid claiming over our own code.
2008-01-22 20:10:27 +00:00
robertmh
bc2d8ac639 2008-01-21 Robert Millan <rmh@aybabtu.com>
* kern/mm.c (grub_mm_init_region): Improve debug message.
2008-01-21 20:59:05 +00:00
robertmh
0d8837b229 2008-01-21 Robert Millan <rmh@aybabtu.com>
* include/grub/ieee1275/ieee1275.h: Add 2008 to Copyright line for
        recent changes.
        * kern/elf.c: Likewise.
        * kern/ieee1275/ieee1275.c: Likewise.
        * kern/powerpc/ieee1275/openfw.c: Likewise.
        * term/ieee1275/ofconsole.c: Likewise.
2008-01-21 14:22:38 +00:00
robertmh
6c391b218e 2008-01-21 Robert Millan <rmh@aybabtu.com>
Mostly based on bugfix from Bean.

        * kern/elf.c (grub_elf32_phdr_iterate): Use `NESTED_FUNC_ATTR'
        attribute with hook() parameter.
        (grub_elf32_load): Use `NESTED_FUNC_ATTR' with grub_elf32_load_segment()
        declaration.
        (grub_elf64_phdr_iterate): Use `NESTED_FUNC_ATTR'
        attribute with hook() parameter.
        (grub_elf64_load): Use `NESTED_FUNC_ATTR' with grub_elf64_load_segment()
        declaration.
2008-01-20 23:47:54 +00:00
robertmh
55a581dc06 2008-01-21 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_HEADERS): Add `machine/kernel.h'.
        (pkglib_MODULES): Add `memdisk.mod'.
        (memdisk_mod_SOURCES): New variable.
        (memdisk_mod_CFLAGS): Likewise.
        (memdisk_mod_LDFLAGS): Likewise.

        * disk/memdisk.c: New file.

        * include/grub/disk.h (grub_disk_dev_id): Add
        `GRUB_DISK_DEVICE_MEMDISK_ID'.

        * include/grub/i386/pc/kernel.h
        (GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE): New macro.
        (GRUB_KERNEL_MACHINE_PREFIX): Increment by 4.
        (grub_kernel_image_size): New variable declaration.
        (grub_total_module_size): Likewise.
        (grub_memdisk_image_size): Likewise.

        * include/grub/i386/pc/memory.h
        (GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR): New macro.

        * include/grub/kernel.h: Include `<grub/symbol.h>'.
        (grub_arch_memdisk_addr): New variable declaration.
        (grub_arch_memdisk_size): Likewise.

        * kern/i386/pc/init.c (grub_arch_memdisk_addr): New function.
        (grub_arch_memdisk_size): Likewise.

        * kern/i386/pc/startup.S (grub_memdisk_image_size): New variable.
        (codestart): Replace hardcoded `0x100000' with
        `GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR' macro.

        * util/i386/pc/grub-mkimage.c: Include `<grub/misc.h>'.
        (generate_image): Add `memdisk_path' parameter.  When `memdisk_path' is
        not NULL, append the contents of the file it refers to, at the end of
        the compressed kernel image.  Initialize `grub_memdisk_image_size'
        variable (at `GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE' offset).
        (options): Add "memdisk"|'m' option.
        (main): Parse --memdisk|-m option, and pass user-provided path as
        parameter to generate_image().
2008-01-20 23:20:36 +00:00
robertmh
3d7f54c94d 2008-01-20 Robert Millan <rmh@aybabtu.com>
* kern/sparc64/ieee1275/openfw.c (grub_devalias_iterate): Copy debug
        grub_dprintf() calls from here ...
        * kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): ... to here.
2008-01-20 17:20:48 +00:00
robertmh
0bf74728de 2008-01-20 Robert Millan <rmh@aybabtu.com>
Fix detection of "real mode" when /options/real-mode? doesn't exist.

        * include/grub/ieee1275/ieee1275.h (grub_ieee1275_mmu): New variable
        declaration.
        * kern/powerpc/ieee1275/cmain.c (grub_ieee1275_mmu): New variable.
        (grub_ieee1275_find_options): If `grub_ieee1275_mmu' is 0, set
        `GRUB_IEEE1275_FLAG_REAL_MODE'.
        (cmain): Intialize `grub_ieee1275_mmu' (using /chosen/mmu integer
        property).
        * kern/powerpc/ieee1275/openfw.c (grub_map): Rely on pre-initialized
        `grub_ieee1275_mmu' rather than obtaining a handler on every call.
2008-01-20 14:08:54 +00:00
robertmh
33bf70a759 2008-01-19 Robert Millan <rmh@aybabtu.com>
Get rid of confusing function (superceeded by
        `grub_ieee1275_get_integer_property')
        * include/grub/ieee1275/ieee1275.h (grub_ieee1275_decode_int_4): Remove
        prototype.
        * kern/ieee1275/ieee1275.c (grub_ieee1275_decode_int_4): Remove
        function.
        * term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid use of
        grub_ieee1275_decode_int_4(), by obtaining integer properties directly
        in native endianess from grub_ieee1275_get_integer_property().
2008-01-19 22:31:04 +00:00
robertmh
e2da7d26bb 2008-01-19 Robert Millan <rmh@aybabtu.com>
* kern/powerpc/ieee1275/openfw.c (grub_halt): Issue "power-off"
        command after "shut-down", since implementations differ on which
        the command for halt is.
2008-01-19 22:19:20 +00:00
robertmh
5f5a7c1518 2008-01-19 Robert Millan <rmh@aybabtu.com>
PowerPC changes provided by Pavel Roskin.

        * kern/powerpc/ieee1275/cmain.c (cmain): Don't take any arguments.
        * kern/powerpc/ieee1275/crt0.S: Store r5 in grub_ieee1275_entry_fn,
        don't rely on cmain() doing it.
        * kern/i386/ieee1275/startup.S (_start): Store %eax in
        grub_ieee1275_entry_fn, don't rely on cmain() doing it.
2008-01-19 11:41:00 +00:00
robertmh
1210e168fe 2008-01-16 Robert Millan <rmh@aybabtu.com>
* include/grub/i386/linuxbios/memory.h
        (GRUB_MEMORY_MACHINE_LINUXBIOS_TABLE_ADDR): Remove macro.
        * kern/i386/linuxbios/table.c (grub_linuxbios_table_iterate): Do not
        receive `table_header' as argument.  Instead, probe for it in the
        known memory ranges where it can be present.
        (grub_available_iterate): Do not pass a fixed `table_header' address
        to grub_linuxbios_table_iterate().
2008-01-16 21:03:07 +00:00
robertmh
3d04eab83e 2008-01-15 Robert Millan <rmh@aybabtu.com>
* configure.ac: Add `i386-ieee1275' to the list of supported targets.
        * conf/i386-ieee1275.rmk: New file.
        * include/grub/i386/ieee1275/console.h: Likewise.
        * include/grub/i386/ieee1275/ieee1275.h: Likewise.
        * include/grub/i386/ieee1275/kernel.h: Likewise.
        * include/grub/i386/ieee1275/time.h: Likewise.
        * kern/i386/ieee1275/init.c: Likewise.
        * kern/i386/ieee1275/startup.S: Likewise.
2008-01-15 20:05:44 +00:00
robertmh
d1bc1b738c 2008-01-15 Robert Millan <rmh@aybabtu.com>
* kern/misc.c (grub_vsprintf): Do not reset `longlongfmt' to zero
        when pointers are 32-bit (but still do set it to one when they are
        64-bit).
2008-01-15 17:22:09 +00:00
robertmh
66a6580720 2008-01-15 Robert Millan <rmh@aybabtu.com>
* include/grub/ieee1275/ieee1275.h
        (grub_ieee1275_get_integer_property): New function prototype.

        * kern/ieee1275/ieee1275.c: Include `<grub/types.h>'.
        (grub_ieee1275_get_integer_property): New function.  Wraps around
        grub_ieee1275_get_property() to handle endianess.

        * kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Replace
        grub_ieee1275_get_property() with grub_ieee1275_get_integer_property()
        where appropiate.
        * kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Likewise.
        (grub_map): Likewise.
        * kern/sparc64/ieee1275/openfw.c (grub_map): Likewise.
2008-01-15 16:14:33 +00:00
robertmh
87ae25ebfd 2008-01-15 Robert Millan <rmh@aybabtu.com>
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Obtain
        actual size of `available' from grub_ieee1275_get_property(), and
        restrict parsing to that bound.
2008-01-15 12:13:45 +00:00
robertmh
c86f14693a 2008-01-14 Robert Millan <rmh@aybabtu.com>
* kern/powerpc/ieee1275/init.c (grub_exit): Reimplement as a wrapper
        for grub_ieee1275_exit(), in order to improve portability.
2008-01-14 14:30:59 +00:00