* include/grub/normal.h (grub_halt_init): New prototype.
(grub_halt_fini): Likewise.
(grub_reboot_init): Likewise.
(grub_reboot_fini): Likewise.
* util/grub-emu.c: Include signal.h.
(main_env): New global variable.
(grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot
catch C-c.
(grub_machine_fini): New function.
(main): Call grub_halt_init and grub_reboot_init before
grub_main, and grub_reboot_fini and grub_halt_fini after it.
Call setjmp with MAIN_ENV to go back afterwards.
Call grub_machine_fini right before return.
* include/grub/util/misc.h: Include setjmp.h.
(main_env): New prototype.
* include/grub/kernel.h (grub_machine_fini): New prototype.
* include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise.
* include/grub/i386/pc/console.h (grub_console_fini): Likewise.
* disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function.
* kern/i386/pc/init.c (grub_machine_fini): Likewise.
* term/i386/pc/console.c (grub_console_fini): Likewise.
* util/i386/pc/misc.c: New file.
* conf/i386-pc.rmk (grub_emu_SOURCES): Added
util/i386/pc/misc.c, commands/i386/pc/halt.c and
commands/i386/pc/reboot.c.
* include/grub/dl.h (grub_dl_check_header): New prototype.
(grub_arch_dl_check_header): Change return type to grub_err_t,
remove size parameter and export function. Update all callers.
* kern/dl.c (grub_dl_check_header): New function.
(grub_dl_load_core): Use `grub_dl_check_header' instead of
`grub_arch_dl_check_header'. Check ELF type. Check if sections
are inside the core.
* kern/i386/dl.c (grub_arch_dl_check_header): Remove arch
independent ELF header checks.
* kern/powerpc/dl.c (grub_arch_dl_check_header): Likewise.
* loader/i386/pc/multiboot.c (grub_rescue_cmd_multiboot): Use
`grub_dl_check_header' instead of explicit checks. Check for the
ELF type.
* loader/powerpc/ieee1275/linux.c (grub_rescue_cmd_linux): Use
`grub_dl_check_header' instead of explicit checks. Remove arch
specific ELF header checks.
* kern/partition.c (grub_partition_probe): Clear `grub_errno' and
return 0 if `grub_errno' is GRUB_ERR_BAD_PART_TABLE.
(part_map_iterate): Clear `grub_errno' and return 0 if
`partmap->iterate' returns GRUB_ERR_BAD_PART_TABLE.
* partmap/amiga.c (amiga_partition_map_iterate): Return
GRUB_ERR_BAD_PART_TABLE if no partition map magic is found.
* partmap/apple.c (apple_partition_map_iterate): Likewise.
* include/grub/powerpc/ieee1275/loader.h (grub_load_linux):
Removed prototype.
(grub_rescue_cmd_linux): New prototype.
(grub_rescue_cmd_initrd): Likewise.
* powerpc/ieee1275/linux.c (grub_linux_boot): Remove struct
`bi_rec'.
(grub_linux_release_mem): Release the memory for the initrd.
(grub_load_linux): Renamed from this...
(grub_rescue_cmd_linux): ...To this. Changed all callers.
Changed `entry' not to be static. Loop over memory regions to
find another one when the default fails.
(grub_rescue_cmd_initrd): New function.
(grub_linux_init): Remove function.
(grub_linux_fini): Likewise.
(GRUB_MOD_INIT): Register `initrd'.
(GRUB_MOD_FINI): Unregister `initrd'.
* powerpc/ieee1275/linux_normal.c (grub_linux_normal_init):
Function removed.
(grub_linux_normal_fini): Likewise.
(GRUB_MOD_INIT): Register `initrd'.
(GRUB_MOD_FINI): Unregister `initrd'.
* normal/menu.c (TERM_WIDTH): Macro redefined.
(TERM_TOP_BORDER_Y): Likewise.
(draw_border): Replaced while-loop by a for-loop. Make the number
of lines consistent with the number of lines displayed in
print_entries. Added a margin below the rectangle.
(print_entry): Make the entry fit in the rectangle.
(print_entries): Display the scroll arrows next to the right
border.
* fs/minix.c (grub_minix_find_file): Reserve more space for
`fpath' so the \0 can be stored. Use `grub_strcpy' instead of
`grub_strncpy' to copy `path' into it.
Add the loopback device, a device via which files can be accessed
as devices.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `disk/loopback.c'.
(pkgdata_MODULES): Add loopback.mod.
(loopback_mod_SOURCES): New variable.
(loopback_mod_CFLAGS): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add
`disk/loopback.c'.
(pkgdata_MODULES): Add loopback.mod.
(loopback_mod_SOURCES): New variable.
(loopback_mod_CFLAGS): Likewise.
* disk/loopback.c: new file.
* include/grub/normal.h (grub_loop_init): New prototype.
(grub_loop_fini): New prototype.
* util/grub-emu.c (main): Initialize and de-initialize loopback
support.
* include/grub/disk.h (grub_disk_dev_id): Add
`GRUB_DISK_DEVICE_LOOPBACK_ID'.
* include/grub/mm.h (grub_mm_init_region): Change the type of the
`unsigned' arguments to `grub_size_t'.
(grub_malloc): Likewise.
(grub_realloc): Likewise.
(grub_memalign): Likewise.
* kern/i386/dl.c (grub_arch_dl_check_header): Likewise.
* kern/powerpc/dl.c (grub_arch_dl_check_header): Likewise.
* util/misc.c (grub_malloc): Likewise.
(grub_realloc): Likewise.
* kern/mm.c (get_header_from_pointer): Change the casts to
`unsigned' into a cast to `grub_size_t'.
* fs/fshelp.c (grub_fshelp_find_file): The `oldnode' should always
point to `currnode' when `currnode' is changed.
* util/grub-emu.c (main): Initialize `progname'. Reported by Nico
Schottelius <nico-linux@schottelius.org>.
* util/powerpc/ieee1275/grub-mkimage.c: Include <string.h>.
(note_path): Remove variable.
(GRUB_IEEE1275_NOTE_NAME): New macro.
(GRUB_IEEE1275_NOTE_TYPE): Likewise.
(grub_ieee1275_note_hdr): New structure.
(grub_ieee1275_note_desc): Likewise.
(grub_ieee1275_note): Likewise.
(load_note): Remove `dir' argument. All callers updated. Remove
`note_img' and `path'. Do not load a file from `note_path'.
Initialize a struct grub_ieee1275_note and write that to `out'.
Use GRUB_IEEE1275_MODULE_BASE instead of MODULE_BASE.
* boot/powerpc/ieee1275/cmain.c (grub_ieee1275_realmode): New
variable.
(find_options): New function.
(cmain): Call find_options.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_realmode): New extern variable.
* kern/powerpc/ieee1275/openfw.c (grub_claimmap): Only call
grub_map if grub_ieee1275_realmode is false.
* normal/cmdline.c (grub_cmdline_get): Redone logic so no empty
lines are inserted and make it work like readline. Reported by
Vincent Pelletier <subdino2004@yahoo.fr>.
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
* fs/ext2.c (grub_ext2_open): Don't use data after freeing it.
(grub_ext2_dir): Likewise. Don't return in case of an error, jump
to fail instead. Reported by Vincent Pelletier
<subdino2004@yahoo.fr>.
* fs/fshelp.c (grub_fshelp_find_file): Don't free `oldnode' when
it is not allocated. Reported by Vincent Pelletier
<subdino2004@yahoo.fr>.
* normal/cmdline.c (grub_tab_complete): Add a blank line to the
output so the output looks better.
Modulize the partition map support and add support for the amiga
partition map.
* commands/ls.c: Include <grub/partition.h> instead of
<grub/machine/partition.h>.
* kern/disk.c: Likewise.
* kern/rescue.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* normal/cmdline.c: Likewise.
* kern/powerpc/ieee1275/init.c: Likewise.
(grub_machine_init): Call `grub_pc_partition_map_init',
`grub_amiga_partition_map_init' and
`grub_apple_partition_map_init'.
* conf/i386-pc.rmk (kernel_img_SOURCES): Remove
`disk/i386/pc/partition.c'. Add `kern/partition.c'.
(kernel_img_HEADERS): Remove `machine/partition.h'. Add
`partition.h' and `pc_partition.h'.
(grub_setup_SOURCES): Remove
`disk/i386/pc/partition.c'. Add `kern/partition.c',
`partmap/amiga.c', `partmap/apple.c' and `partmap/pc.c'.
(grub_emu_SOURCES): Likewise.
(pkgdata_MODULES): Add `amiga.mod', `apple.mod' and `pc.mod'.
(amiga_mod_SOURCES, amiga_mod_CFLAGS, apple_mod_SOURCES)
(apple_mod_CFLAGS, pc_mod_SOURCES, pc_mod_CFLAGS): New variables.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Remove
`disk/powerpc/ieee1275/partition.c'. Add `kern/partition.c',
`partmap/amiga.c', `partmap/apple.c' and `partmap/pc.c'.
(grubof_SOURCES): Likewise.
* disk/i386/pc/partition.c: File removed.
* disk/powerpc/ieee1275/partition.c: Likewise.
* include/grub/powerpc/ieee1275/partition.h: Likewise.
* include/grub/i386/pc/partition.h: Likewise.
* kern/partition.c: New file.
* partmap/amiga.c: Likewise.
* partmap/apple.c: Likewise.
* partmap/pc.c: Likewise.
* include/grub/partition.h: Likewise..
* include/grub/pc_partition.h: Likewise.
* util/grub-emu.c: Include <grub/partition.h> instead of
<grub/machine/partition.h>.
(main): Call `grub_pc_partition_map_init',
`grub_amiga_partition_map_init' and
`grub_apple_partition_map_init' and deinitialize afterwards.
* util/i386/pc/biosdisk.c: Include `#include
<grub/partition.h>' and `include <grub/pc_partition.h>' instead of
`<grub/machine/partition.h>'.
* util/i386/pc/grub-setup.c: Likewise.
* util/i386/pc/biosdisk.c: Likewise.
(grub_util_biosdisk_get_grub_dev): Only access the PC specific
partition information in case of a PC partition.
* util/i386/pc/grub-setup.c: Include `#include
<grub/partition.h>' and `include <grub/pc_partition.h>' instead of
`<grub/machine/partition.h>'.
(setup): Only access the PC specific partition information in case
of a PC partition.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Skip any
property named `name'. Correctly handle the error returned by
`grub_ieee1275_finddevice' if a device can not be opened.
* term/i386/pc/vga.c (VGA_HEIGHT): Changed to 350.
(PAGE_OFFSET): New macro.
(CRTC_ADDR_PORT): Likewise.
(CRTC_DATA_PORT): Likewise.
(START_ADDR_HIGH_REGISTER): Likewise.
(START_ADDR_LOW_REGISTER): Likewise.
(GRAPHICS_ADDR_PORT): Likewise.
(GRAPHICS_DATA_PORT): Likewise.
(READ_MAP_REGISTER): Likewise.
(INPUT_STATUS1_REGISTER): Likewise.
(INPUT_STATUS1_VERTR_BIT): Likewise.
(page): New variable.
(wait_vretrace): New function.
(set_read_map): Likewise.
(set_start_address): Likewise.
(grub_vga_init): Use mode 0x10 instead of mode 0x12. Switch to
the right page.
(check_vga_mem): Take the page into account.
(write_char): Likewise.
(write_cursor): Likewise.
(scroll_up): Likewise. Copy the page to the page that is not
shown and switch between both pages.
(grub_vga_putchar): Fix off by one error.
(grub_vga_cls): Wait for the vertical retrace. Take the page into
account.
* disk/powerpc/ieee1275/ofdisk.c (grub_ofdisk_open): Do not
append ":0" to devpath if the GRUB_IEEE1275_NO_PARTITION_0 flag is
set in grub_ieee1275_flags.
* include/grub/powerpc/ieee1275/ieee1275.h (abort): Add function
prototype.
* kern/powerpc/ieee1275/init.c (grub_machine_init): Call
grub_console_init first.
Change the memory range used for grub_ieee1275_claim and
grub_mm_init_region.
Print an error message if the claim fails.
Include <grub/misc.h>.
* disk/powerpc/ieee1275/ofdisk.c (grub_ofdisk_iterate):
Call grub_children_iterate for device nodes of type `scsi',
`ide', or `ata'.
(grub_ofdisk_open): Remove manual device alias resolution.
Fix memory leak when device cannot be opened.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_children_iterate): New prototype.
* kern/powerpc/ieee1275/openfw.c (grub_children_iterate):
New function.
* boot/powerpc/ieee1275/ieee1275.c (grub_ieee1275_get_property):
Return -1 if args.size was -1.
* boot/powerpc/ieee1275/cmain.c (grub_ieee1275_flags): New global.
(cmain): Accept 3 parameters. Test for 0xdeadbeef, indicating Old
World Macintosh. If Old Wold, set flag in grub_ieee1275_flags; claim
Open Firmware's memory for it; claim memory from _start to _end.
* boot/powerpc/ieee1275/crt0.S (__bss_start): New extern.
(_end): New extern.
(_start): Zero BSS from __bss_start to _end.
* include/grub/powerpc/ieee1275/ieee1275.h (grub_ieee1275_flags):
New extern.
(GRUB_IEEE1275_NO_PARTITION_0): New #define.
* boot/powerpc/ieee1275/ieee1275.c (grub_ieee1275_claim): change
void * arguments to grub_addr_t. All callers updated. Also make
the `result' argument optional.
(grub_ieee1275_release): change void * arguments to grub_addr_t.
All callers updated.
* commands/ls.c (grub_ls_list_files): Use the string following the
initial ')', if present, as the filesystem path.
* kern/rescue.c (grub_rescue_cmd_ls): Likewise.
* conf/powerpc-ieee1275.rmk (grubof_SOURCES): List crt0.S first.
Make the source code of the menu interface more readable.
* normal/menu.c: Include grub/mm.h.
(TERM_WIDTH): New macro.
(TERM_HEIGHT): Likewise.
(TERM_INFO_HEIGHT): Likewise.
(TERM_MARGIN): Likewise.
(TERM_SCROLL_WIDTH): Likewise.
(TERM_TOP_BORDER_Y): Likewise.
(TERM_LEFT_BORDER_X): Likewise.
(TERM_BORDER_WIDTH): Likewise.
(TERM_MESSAGE_HEIGHT): Likewise.
(TERM_BORDER_HEIGHT): Likewise.
(TERM_NUM_ENTRIES): Likewise.
(TERM_FIRST_ENTRY_Y): Likewise.
(TERM_ENTRY_WIDTH): Likewise.
(TERM_CURSOR_X): Likewise.
(draw_border): Use macros instead of magic numbers.
(print_entry): Likewise.
(print_entries): Likewise.
(run_menu): Likewise. Also, handle the key 'e'.
(run_menu_entry): Ignore empty command lines.
(print_message): Added a new argument EDIT. If EDIT is true,
print a different message.
(init_page): Likewise.
(edit_menu_entry): New function. Not implemented yet.
Add `linux.mod' and `multiboot.mod' so linux and multiboot kernels
can be loaded from normal mode.
* conf/i386-pc.rmk (pkgdata_MODULES): Add `linux.mod' and
`multiboot.mod'.
(linux_mod_SOURCES, linux_mod_CFLAGS, multiboot_mod_SOURCES)
(multiboot_mod_CFLAGS): New variables.
* loader/i386/pc/linux_normal.c: New file.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/i386/pc/linux.c (grub_rescue_cmd_initrd): Don't use the
attribute `unused'.
* fs/ext2.c (grub_ext2_iterate_dir): Fix typos in inode type. Use
`fdiro' to read the mode information from instead of `diro'.
* fs/fshelp.c (grub_fshelp_find_file): Set type to foundtype after
looking up a symlink.
* include/grub/normal.h (GRUB_COMMAND_FLAG_NO_ARG_PARSE): New
macro.
* normal/command.c (grub_command_execute): Don't parse the
arguments when `GRUB_COMMAND_FLAG_NO_ARG_PARSE' is set in the
flags of the command.
* normal/menu.c (grub_menu_run): Fix typo.
From Hollis Blanchard <hollis@penguinppc.org>:
* kern/misc.c (memmove): New alias for grub_memmove.
(memcmp): New alias for grub_memcmp.
(memset): New alias for grub_memset.
* boot/powerpc/ieee1275/ieee1275.c (grub_ieee1275_get_property):
Change "int handle" to "grub_ieee1275_phandle_t handle".
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_get_property): Likewise.
Added normal mode command `chainloader' as module chain.mod, which
depends on normal.mod and _chain.mod.
* conf/i386-pc.rmk (pkgdata_MODULES): Add `chain.mod'.
(chain_mod_SOURCES, chain_mod_CFLAGS): Variables added.
* include/grub/i386/pc/loader.h (grub_rescue_cmd_chainloader):
Deleted prototype.
* loader/i386/pc/chainloader.c (grub_rescue_cmd_chainloader): All
but arguments parsing moved to ...
(grub_chainloader_cmd): ... here. New function.
* include/grub/i386/pc/chainloader.h: New file.
* loader/i386/pc/chainloader_normal.c: Likewise.