* include/grub/i386/pc/kernel.h: Include `<grub/symbol.h>'.
* include/grub/kernel.h (grub_arch_memdisk_addr,
grub_arch_memdisk_size): Moved from here ...
* include/grub/i386/pc/kernel.h (grub_arch_memdisk_addr,
grub_arch_memdisk_size): ... to here.
* 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().
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.
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().
* 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().
* 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.
* include/grub/util/getroot.h (grub_dev_abstraction_types): New enum.
(grub_util_get_dev_abstraction): New function prototype.
* util/getroot.c: Include `<grub/util/getroot.h>'
(grub_util_get_grub_dev): Move detection of abstraction type to ...
(grub_util_get_dev_abstraction): ... here (new function).
* util/grub-probe.c: Convert PRINT_* to an enum. Add
`PRINT_ABSTRACTION'.
(probe): Probe for abstraction type when requested.
(main): Understand `--target=abstraction'.
* util/i386/efi/grub-install.in: Add abstraction module to core
image when it is found to be necessary.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Likewise.
* util/update-grub_lib.in (font_path): Return system path without
converting to GRUB path.
* util/update-grub.in: Convert system path returned by font_path()
to a GRUB path. Use `grub-probe -t abstraction' to determine what
abstraction module is needed for loading fonts (if any). Export
that as `GRUB_PRELOAD_MODULES'.
* util/grub.d/00_header.in: Process `GRUB_PRELOAD_MODULES' (print
insmod commands).
* include/grub/normal.h (grub_env_write_color_normal): New prototype.
(grub_env_write_color_highlight): Likewise.
(grub_wait_after_message): Likewise.
* normal/color.c: New file.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* conf/i386-efi.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* conf/i386-linuxbios.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* normal/menu_entry.c (run): Rely on grub_wait_after_message()
for waiting after a message is printed.
* normal/main.c (read_config_file): Likewise.
(grub_normal_init): Register grub_env_write_color_normal() and
grub_env_write_color_highlight() hooks. Mark `color_normal' and
`color_highlight' variables as global.
* normal/menu.c (grub_wait_after_message): New function.
(grub_color_menu_normal): New variable. Replaces ...
(GRUB_COLOR_MENU_NORMAL): ... this macro.
(grub_color_menu_highlight): New variable. Replaces ...
(GRUB_COLOR_MENU_HIGHLIGHT): ... this macro.
(draw_border): Set color state to `GRUB_TERM_COLOR_NORMAL' instead of
`GRUB_TERM_COLOR_STANDARD'.
(print_message): Use `grub_setcolorstate' to reload colors. Rename
`normal_code' and `highlight_code' to `old_color_normal' and
`old_color_highlight', respectively.
(grub_menu_init_page): Update colors when drawing the menu, based on
`menu_color_normal' and `menu_color_highlight' variables.
(grub_menu_run): Rely on grub_wait_after_message() for waiting after
a message is printed.
* include/grub/video.h: Added grub_video_unmap_color and
grub_video_get_active_render_target.
(grub_video_adapter): Added unmap_color and get_active_render_target.
* video/video.c: Added grub_video_unmap_color and
grub_video_get_active_render_target.
(grub_video_get_info): Changed method to accept NULL pointer as an
argument to allow detection of active video adapter.
* video/i386/pc/vbe.c: Renamed grub_video_vbe_unmap_color as
grub_video_vbe_unmap_color_int.
Added grub_video_vbe_unmap_color and
grub_video_vbe_get_active_render_target.
(grub_video_vbe_adapter): Added unmap_color and
get_active_render_target.
* video/i386/pc/vbeblit.c: Replaced grub_video_vbe_unmap_color usage
with grub_video_vbe_unmap_color_int.
* term/gfxterm.c (DEFAULT_STANDARD_COLOR): Added.
(DEFAULT_NORMAL_COLOR): Likewise.
(DEFAULT_HIGHLIGHT_COLOR) Likewise.
(DEFAULT_FG_COLOR): Removed.
(DEFAULT_BG_COLOR): Likewise.
(DEFAULT_CURSOR_COLOR): Changed value.
(grub_virtual_screen): Added standard_color_setting,
normal_color_setting, highlight_color_setting and term_color.
(grub_virtual_screen): Removed fg_color_setting and bg_color_setting.
(bitmap_width): Added.
(bitmap_height): Likewise.
(bitmap): Likewise.
(set_term_color): Likewise.
(grub_virtual_screen_setup): Changed to use new terminal coloring
settings.
(grub_gfxterm_init): Added init for bitmap.
(grub_gfxterm_fini): Added destroy for bitmap.
(redraw_screen_rect): Updated to use background bitmap and new
terminal coloring.
(scroll_up): Added optimization for case when there is no bitmap.
(grub_gfxterm_cls): Fixed to use correct background color.
(grub_virtual_screen_setcolorstate): Changed to use new terminal
coloring.
(grub_virtual_screen_setcolor): Likewise.
(grub_virtual_screen_getcolor): Added.
(grub_gfxterm_background_image_cmd): Likewise.
(grub_video_term): Added setcolor and getcolor.
(MOD_INIT): Added registration of background_image command.
(MOD_TERM): Added unregistration for background_image command.
* include/grub/term.h (struct grub_term): Add `getcolor' function.
(grub_getcolor): New function.
* kern/term.c (grub_getcolor): New function.
* normal/menu.c (GRUB_COLOR_MENU_NORMAL): New macro.
(GRUB_COLOR_MENU_HIGHLIGHT): New macro.
(print_entry): Set normal and highlight colors to
`GRUB_COLOR_MENU_NORMAL' and `GRUB_COLOR_MENU_HIGHLIGHT',
respectively, before printing and restore them to old
values afterwards.
(grub_menu_init_page): Likewise. Fill an additional colored space
that would otherwise be left blank.
* term/efi/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/ieee1275/ofconsole.c (grub_ofconsole_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/serial.c (grub_serial_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vesafb.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vga.c (grub_vga_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/gfxterm.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* include/grub/i386/efi/machine.h: New file.
* include/grub/i386/linuxbios/machine.h: Likewise.
* include/grub/i386/pc/machine.h: Likewise.
* include/grub/powerpc/ieee1275/machine.h: Likewise.
* include/grub/sparc64/ieee1275/machine.h: Likewise.
* term/i386/pc/serial.c: Include <grub/machine/machine.h>.
(serial_hw_io_addr): New variable.
(serial_hw_get_port): Obtain port address from `serial_hw_io_addr'
instead of `(unsigned short *) 0x400'.
* kern/disk.c (grub_disk_firmware_fini)
(grub_disk_firmware_is_tainted): New variables.
* include/grub/disk.h (grub_disk_firmware_fini)
(grub_disk_firmware_is_tainted): Likewise.
* disk/i386/pc/biosdisk.c (GRUB_MOD_FINI(biosdisk)): Moved from here ...
(grub_disk_biosdisk_fini): ... to here.
(GRUB_MOD_FINI(biosdisk)): Implement using grub_disk_biosdisk_fini().
(GRUB_MOD_INIT(biosdisk)): Abort when `grub_disk_firmware_is_tainted'
is set. Register grub_disk_biosdisk_fini() in
`grub_disk_firmware_fini'.
* disk/ata.c: Remove `<grub/machine/biosdisk.h>'.
(GRUB_MOD_INIT(ata)): Remove grub_biosdisk_fini() call.
Use `grub_disk_firmware_is_tainted' and `grub_disk_firmware_fini'
to finish existing firmware disk interface.
* conf/i386-linuxbios.rmk (pkgdata_MODULES): Add `ata.mod'.
(ata_mod_SOURCES): New variable.
(ata_mod_CFLAGS): Likewise.
(ata_mod_LDFLAGS): Likewise.
* include/grub/i386/pc/init.h (grub_lower_mem): Moved from here ...
* include/grub/i386/pc/memory.h (grub_lower_mem): ... to here.
* include/grub/i386/pc/init.h (grub_upper_mem): Moved from here ...
* include/grub/i386/pc/memory.h (grub_upper_mem): ... to here.
* include/grub/i386/pc/memory.h: Include `<grub/symbol.h>' and
`<grub/types.h>'.
* loader/i386/pc/multiboot.c: Include `<grub/machine/memory.h>'.
for powerpc & i386-pc. This patch was more so started by Hollis
Blanchard getting multiboot 2 working for powerpc and I added to it
and cleaned it up.
One of the ideas with this patch is to keep everything under one
command for the user. So instead of having a "multiboot2" & "module2"
command, I created a proxy like mechanism so that you have only one
command for both multiboot 1 & 2 ... "multiboot". This is where
"loader/multiboot_loader.c" comes from. I could have integrated things
more but I figure the current approach will less likely break
anything.
So if your OS is multiboot 2 capable, the user would do the following
to load it up from a grub prompt:
grub> multiboot <location of kernel> <kernel args>
grub> module <some image> <multiboot tag> <image arguments>
grub> module <isome mage> <multiboot tag> <image arguments>
grub .....
The other thing that this patch does is it begins to make the
multiboot 1 code a bit more architecture agnostic so IF someone wanted
to implement it on another architecture they can.
A bit of file moving around and definition renaming is also apart of
this patch. I have also taken the time to make sure that it does not
break multiboot 1 loading on i386-pc. But mulitboot 2 may still need a
little more testing and work for i386-pc. Powerpc multiboot 2 has been
heavily tested and does work.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
GRUB_IEEE1275_FLAG_BROKEN_OUTPUT flag.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Set this
flag when running on SmartFirmware.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid running
"output-device output" command when GRUB_IEEE1275_FLAG_BROKEN_OUTPUT
was set.
* kern/powerpc/ieee1275/openfw.c (grub_ieee1275_encode_devname):
Increase partno when GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS flag is set,
rather than decreasing it.
* util/i386/pc/grub-setup.c (setup): When embedding is required, but
there's not enough space to do it, fail in the same way as when it
can't be done because there are no partitions.
* util/powerpc/ieee1275/grub-install.in: Improve error message shown
when nvsetenv failed.
* include/grub/i386/pc/kernel.h: Define GRUB_KERNEL_MACHINE_DATA_END to
indicate end of data section in kernel image.
* include/grub/i386/efi/kernel.h: Define GRUB_KERNEL_MACHINE_PREFIX and
GRUB_KERNEL_MACHINE_DATA_END.
* kern/i386/pc/startup.S: Do not initialize grub_prefix, only reserve
space for it.
* kern/i386/efi/startup.S: Likewise.
* util/i386/pc/grub-mkimage.c: Initialize grub_prefix to /boot/grub
during image generation. Implement --prefix option to override this
patch.
* util/i386/efi/grub-mkimage.c: Likewise.
* util/update-grub_lib.in (convert_system_path_to_grub_path): Split
code to make path relative to its root into a separate function.
* util/i386/pc/grub-install.in: Use newly provided
make_system_path_relative_to_its_root() to convert ${grubdir}, then
pass the result to grub-install --prefix.
* include/grub/util/misc.h: Define DEFAULT_DIRECTORY and
DEFAULT_DEVICE_MAP.
* util/grub-emu.c: Use above definitions from misc.h instead of
defining them.
* util/grub-mkdevicemap.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-probe.c: Likewise.
(probe): Abort with grub_util_error() when either
grub_guess_root_device or grub_util_get_grub_dev fails.
* conf/powerpc-ieee1275.rmk: Enable grub-mkdevicemap and grub-probe.
* include/grub/partition.h: Declare grub_apple_partition_map_init and
grub_apple_partition_map_fini.
* util/biosdisk.c
(grub_util_biosdisk_open): Replace BLKGETSIZE with BLKGETSIZE64 (needed
to access >2 TiB disks).
Print disk->total_sectors with %llu instead of %lu, since this
variable is always 64-bit (prevents wrong disk size from being displayed
on either >2 TiB disk or big-endian CPU).
(grub_util_biosdisk_get_grub_dev): Convert gpt_partition_map handling
into a generic case that supports all (sane) partition maps.
Stop using grub_cpu_to_le32() on dos_part / bsd_part since it actually
breaks big-endian.
* util/grub-probe.c: Call grub_apple_partition_map_init() before probe()
and grub_apple_partition_map_fini() after that.
* util/getroot.c (grub_guess_root_device): Remove RAID and LVM
code, first search for device in /dev/mapper, then in /dev.
(grub_util_get_grub_dev): New function.
* include/grub/util/getroot.h (grub_util_get_grub_dev): Add
prototype.
* util/grub-probe.c (probe): Remove check for RAID, call
grub_util_get_grub_dev() instead of
grub_util_biosdisk_get_grub_dev().
* util/grub-emu.c (main): Call grub_util_get_grub_dev() instead of
grub_util_biosdisk_get_grub_dev().
* util/i386/pc/grub-setup.c (main): Likewise.
* include/grub/i386/pc/util/biosdisk.h: Moved to ...
* include/grub/util/biosdisk.h: ... here.
* util/i386/pc/biosdisk.c: Moved to ...
* util/biosdisk.c: ... here.
* util/i386/pc/getroot.c: Moved to ...
* util/getroot.c: ... here.
* util/i386/pc/grub-mkdevicemap.c: Moved to ...
* util/grub-mkdevicemap.c: ... here.
* util/i386/pc/grub-probe.c: Moved to ...
* util/grub-probe.c: ... here.
* conf/powerpc-ieee1275.rmk (kernel_elf_LDFLAGS): Link at 64KB.
* kern/powerpc/ieee1275/init.c (_end): Add declaration.
(_start): Likewise.
(grub_arch_modules_addr): Return address after `_end'.
* util/powerpc/ieee1275/grub-mkimage.c: Include grub/misc.h.
(load_modules): Use new parameter as `p_paddr' and `p_vaddr'.
(add_segments): Calculate `_end' from phdr size and location.
(ALIGN_UP): Moved to ...
* include/grub/misc.h: here.
* include/grub/powerpc/ieee1275/kernel.h (GRUB_IEEE1275_MOD_ALIGN):
New macro.
(GRUB_IEEE1275_MODULE_BASE): Removed.
* include/grub/err.h (grub_err_t): Add `GRUB_ERR_MENU'.
* kern/env.c (grub_env_unset): Don't free the member `value' when
the type is GRUB_ENV_VAR_DATA, in this case it's a user defined
pointer.
* normal/main.c (current_menu): Removed.
(free_menu): Unset the `menu' environment variable.
(grub_normal_menu_addentry): Make use of the environment variable
`menu', instead of using the global `current_menu'. Allocate
memory for the sourcecode of this entry.
(read_config_file): New argument `nested', changed all callers.
Only in the case of a new context, initialize a new menu. Set the
`menu' environment variable.
(grub_normal_execute): Don't set and unset the environment
variable `menu' here anymore. Only free the menu when leaving the
context.
* util/i386/pc/biosdisk.c (linux_find_partition): Fixed a memory
leak.
* kern/disk.c (grub_disk_read): When there is a read error, always
try to read only the necessary data.
* conf/i386-pc.rmk (grub_probe_SOURCES): Add disk/lvm.c and
disk/raid.c.
* include/grub/disk.h [GRUB_UTIL] (grub_raid_init): New
prototype.
[GRUB_UTIL] (grub_raid_fini): Likewise.
[GRUB_UTIL] (grub_lvm_init): Likewise.
[GRUB_UTIL] (grub_lvm_fini): Likewise.
* util/i386/pc/grub-probe.c (probe): Check whether DEVICE_NAME is
RAID device and copy DEVICE_NAME to DRIVE_NAME in that case.
(main): Call grub_raid_init(), grub_lvm_init(), grub_lvm_fini()
and grub_raid_fini().
* DISTLIST: Added commands/echo.c, disk/lvm.c, disk/raid.c,
include/grub/bitmap.h, include/grub/lvm.h, include/grub/raid.h,
include/grub/i386/pc/vbeutil.h, include/grub/util/lvm.h,
include/grub/util/raid.h, util/lvm.c, util/raid.c, video/bitmap.c,
video/readers/tga.c and video/i386/pc/vbeutil.c.
2006-10-14 Jeroen Dekkers <jeroen@dekkers.cx>
Added support for RAID and LVM.
* disk/lvm.c: New file.
* disk/raid.c: Likewise.
* include/grub/lvm.h: Likewise.
* include/grub/raid.h: Likewise.
* include/grub/util/lvm.h: Likewise.
* include/grub/util/raid.h: Likewise.
* util/lvm.c: Likewise.
* util/raid.c: Likewise.
* include/grub/disk.h (grub_disk_dev_id): Add
GRUB_DISK_DEVICE_RAID_ID and GRUB_DISK_DEVICE_LVM_ID.
(grub_disk_get_size): New prototype.
* kern/disk.c (grub_disk_open): Check whether grub_partition_probe()
returns a partition.
(grub_disk_get_size): New function.
* kern/i386/pc/init.c (make_install_device): Copy the prefix
verbatim if grub_install_dos_part is -2.
* util/i386/pc/getroot.c (grub_guess_root_device): Support RAID
and LVM devices.
* util/i386/pc/grub-setup.c (setup): New argument
MUST_EMBED. Force embedding of GRUB when the argument is
true. Close FILE before returning.
(main): Add support for RAID and LVM.
* conf/common.rmk: Add RAID and LVM modules.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add util/raid.c and
util/lvm.c.
(grub_emu_SOURCES): Add disk/raid.c and disk/lvm.c.
* kern/misc.c (grub_strstr): New function.
* include/grub/misc.h (grub_strstr): New prototype.
* include/grub/powerpc/libgcc.h (__floatdisf): New prototype.
(__cmpdi): Likewise.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Pass 0 as
`flags' to `grub_ieee1275_next_property'. Change `pathlen' to type
`grub_ssize_t'.
* kern/powerpc/ieee1275/cmain.c: include grub/misc.h.
* loader/powerpc/ieee1275/linux.c (grub_linux_boot): Change `actual'
to type `grub_ssize_t'.
(grub_rescue_cmd_linux): Cast -1 to `grub_off_t'.
Move the prototypes of grub_setjmp and grub_longjmp to
cpu/setjmp.h, so that each architecture may specify different
attributes.
* include/grub/i386/setjmp.h (grub_setjmp): New prototype.
(grub_longjmp): Likewise.
* include/grub/powerpc/setjmp.h (grub_setjmp): Likewise..
(grub_longjmp): Likewise.
* include/grub/sparc64/setjmp.h (grub_setjmp): Likewise..
(grub_longjmp): Likewise.
* include/grub/setjmp.h [!GRUB_UTIL] (grub_setjmp): Removed.
[!GRUB_UTIL] (grub_longjmp): Removed.
* disk/i386/pc/biosdisk.c (struct grub_biosdisk_drp): Moved to ...
(struct grub_biosdisk_dap): Likewise.
* include/grub/i386/pc/biosdisk.h: ... to here. Also corrected
linkage settings for all functions.
* util/misc.c: Include config.h.
[!HAVE_MEMALIGN]: Do not include malloc.h.
(grub_memalign): Use posix_memalign, if present. Then, use
memalign, if present. Otherwise, emit an error.
* util/grub-emu.c: Do not include malloc.h.
* include/grub/util/misc.h: Include unistd.h. This is required for
FreeBSD, because off_t is defined in unistd.h. Reported by Harley
D. Eades III <hde@foobar-qux.org>.
* configure.ac (AC_GNU_SOURCE): Added.
(AC_CHECK_FUNCS): Check posix_memalign and memalign for the host
type.
* include/grub/types.h (grub_host_addr_t): Rename to
grub_target_addr_t.
(grub_host_off_t): Rename to grub_target_off_t.
(grub_host_size_t): Rename to grub_target_size_t.
(grub_host_ssize_t): Rename to grub_target_ssize_t.
Refer to GRUB_TARGET_SIZEOF_VOID_P to define those variables.
* include/grub/kernel.h (struct grub_module_header): Change type
of OFFSET to grub_target_off_t and type of SIZE to grub_target_size_t.
(grub_module_info): Likewise.
Clean up the code to support 64-bit addressing in disks and
files. This change is not enough for filesystems yet.
* util/i386/pc/grub-setup.c (struct boot_blocklist): Change the
type of "start" to grub_uint64_t.
(setup): Change the types of KERNEL_SECTOR and FIRST_SECTOR to
grub_disk_addr_t * and grub_disk_addr_t. Fix the format string in
save_first_sector and save_blocklists. Use grub_le_to_cpu64 to
convert addresses.
* util/i386/pc/biosdisk.c (open_device): Change the type of SECTOR
to grub_disk_addr_t.
* partmap/gpt.c (gpt_partition_map_iterate): Fix the format
string.
* partmap/pc.c (pc_partition_map_iterate): Likewise.
* partmap/amiga.c (amiga_partition_map_iterate): Cast RDSK.MAGIC
to char *.
* normal/script.c (grub_script_parse): Remove unused MEMFREE.
* normal/parser.y (YYLTYPE_IS_TRIVIAL): New macro.
* normal/lexer.c (grub_script_yyerror): Specify unused to LEX.
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf64): Cast -1
to grub_off_t, to detect an error from grub_file_seek.
(grub_multiboot_load_elf32): Likewise.
* kern/misc.c (grub_strtoul): Use grub_strtoull. Return the
maximum unsigned long value when an overflow is detected.
(grub_strtoull): New function.
(grub_divmod64): Likewise.
(grub_lltoa): use grub_divmod64.
* kern/fs.c (struct grub_fs_block): Change the type of "offset" to
grub_disk_addr_t.
(grub_fs_blocklist_open): Increase P if P is not NULL to advance
the pointer to next character. Use grub_strtoull instead of
grub_strtoul.
(grub_fs_blocklist_read): Change the types of SECTOR, OFFSET and
SIZE to grub_disk_addr_t, grub_off_t and grub_size_t,
respectively.
* kern/file.c (grub_file_read): Prevent an oveflow of LEN, as the
return value is signed.
(grub_file_seek): Change the type of OLD to grub_off_t. Do not
test if OFFSET is less than zero, as OFFSET is unsigned now.
* kern/disk.c (struct grub_disk_cache): Change the type of
"sector" to grub_disk_addr_t.
(grub_disk_cache_get_index): Change the type of SECTOR to
grub_disk_addr_t. Calculate the hash with SECTOR casted to
unsigned after shifting.
(grub_disk_cache_invalidate): Change the type of SECTOR to
grub_disk_addr_t.
(grub_disk_cache_unlock): Likewise.
(grub_disk_cache_store): Likewise.
(grub_disk_check_range): Change the types of SECTOR, OFFSET, SIZE,
START and LEN to grub_disk_addr_t *, grub_off_t *, grub_size_t,
grub_disk_addr_t and grub_uint64_t, respectively.
(grub_disk_read): Use an unsigned variable REAL_OFFSET for the
body, as the value of OFFSET is tweaked by
grub_disk_check_range. Change the types of START_SECTOR, LEN and
POS to grub_disk_addr_t, grub_size_t and grub_size_t,
respectively.
(grub_disk_write): Use an unsigned variable REAL_OFFSET for the
body, as the value of OFFSET is tweaked by
grub_disk_check_range. Change the types of LEN and N to
grub_size_t.
* io/gzio.c (struct grub_gzio): Change the types of "data_offset"
and "saved_offset" to grub_off_t.
(test_header): Cast BUF to char *.
(get_byte): Cast GZIO->DATA_OFFSET to grub_off_t. Cast GZIO->INBUF
to char *.
(grub_gzio_read): Change the types of OFFSET and SIZE to
grub_off_t and grub_size_t, respectively.
* include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_FORCE_LBA):
Removed.
(GRUB_BOOT_MACHINE_BOOT_DRIVE): Changed to 0x4c.
(GRUB_BOOT_MACHINE_KERNEL_ADDRESS): Changed to 0x40.
(GRUB_BOOT_MACHINE_KERNEL_SEGMENT): Changed to 0x42.
(GRUB_BOOT_MACHINE_DRIVE_CHECK): Changed to 0x4e.
(GRUB_BOOT_MACHINE_LIST_SIZE): Increased to 12.
* include/grub/types.h (grub_off_t): Unconditionally set to
grub_uint64_t.
(grub_disk_addr_t): Changed to grub_uint64_t.
* include/grub/partition.h (struct grub_partition): Change the
types of "start", "len" and "offset" to grub_disk_addr_t,
grub_uint64_t and grub_disk_addr_t, respectively.
(grub_partition_get_start): Return grub_disk_addr_t.
(grub_partition_get_len): Return grub_uint64_t.
* include/grub/misc.h (grub_strtoull): New prototype.
(grub_divmod64): Likewise.
* include/grub/fshelp.h (grub_fshelp_read_file): Change the types
of SECTOR, LEN and FILESIZE to grub_disk_addr_t, grub_size_t and
grub_off_t, respectively.
All callers and references changed.
* include/grub/fs.h (struct grub_fs): Change the type of LEN to
grub_size_t in "read".
All callers and references changed.
* include/grub/file.h (struct grub_file): Change the types of
"offset" and "size" to grub_off_t and grub_off_t,
respectively. Change the type of SECTOR to grub_disk_addr_t in
"read_hook".
(grub_file_read): Change the type of LEN to grub_size_t.
(grub_file_seek): Return grub_off_t. Change the type of OFFSET to
grub_off_t.
(grub_file_size): Return grub_off_t.
(grub_file_tell): Likewise.
All callers and references changed.
* include/grub/disk.h (struct grub_disk_dev): Change the types of
SECTOR and SIZE to grub_disk_addr_t and grub_size_t in "read" and
"write".
(struct grub_disk): Change the type of "total_sectors" to
grub_uint64_t. Change the type of SECTOR to grub_disk_addr_t in
"read_hook".
(grub_disk_read): Change the types of SECTOR, OFFSET and SIZE to
grub_disk_addr_t, grub_off_t and grub_size_t, respectively.
(grub_disk_write): Likewise.
All callers and references changed.
* fs/iso9660.c (grub_iso9660_susp_iterate): Cast parameters to
char * for grub_strncmp to silence gcc.
(grub_iso9660_mount): Likewise.
(grub_iso9660_mount): Likewise.
(grub_iso9660_read_symlink): Likewise. Also, remove the nonsense
return statement.
(grub_iso9660_iterate_dir): Likewise.
(grub_iso9660_label): Cast DATA->VOLDESC.VOLNAME to char *.
* fs/hfs.c (grub_hfs_read_file): Change the types of SECTOR and
LEN to grub_disk_addr_t and grub_size_t, respectively.
* fs/hfsplus.c (grub_hfsplus_read_file): Likewise.
* fs/jfs.c (grub_jfs_read_file): Likewise.
* fs/minix.c (grub_jfs_read_file): Likewise.
* fs/sfs.c (grub_jfs_read_file): Likewise.
* fs/ufs.c (grub_jfs_read_file): Likewise.
* fs/xfs.c (grub_jfs_read_file): Likewise.
* fs/fat.c (grub_fat_read_data): Change the types of SECTOR, LEN
and SIZE to grub_disk_addr_t, grub_size_t and grub_size_t,
respectively.
* fs/ext2.c (grub_ext2_read_block): When an error happens, set
BLKNR to -1 instead of returning GRUB_ERRNO.
(grub_ext2_read_file): Change the types of SECTOR and
LEN to grub_disk_addr_t and grub_size_t, respectively.
* fs/affs.c (grub_affs_read_file): Change the types of SECTOR and
LEN to grub_disk_addr_t and grub_size_t, respectively.
* font/manager.c (grub_font_get_glyph): Cast BITMAP to char * for
grub_file_read.
* disk/ieee1275/ofdisk.c (grub_ofdisk_read): Fix the format
string. Do not cast SECTOR explicitly.
* disk/i386/pc/biosdisk.c (grub_biosdisk_open): Change the type of
TOTAL_SECTORS to grub_uint64_t. Do not mask DRP->TOTAL_SECTORS.
(grub_biosdisk_rw): Change the types of SECTOR and SIZE to
grub_disk_addr_t and grub_size_t, respectively. If the sector is
over 2TB and LBA mode is not supported, raise an error.
(get_safe_sectors): New function.
(grub_biosdisk_read): Use get_safe_sectors.
(grub_biosdisk_write): Likewise.
* disk/efi/efidisk.c (grub_efidisk_read): Fix the format string.
(grub_efidisk_write): Likewise.
* disk/loopback.c (delete_loopback): Cosmetic changes.
(grub_cmd_loopback): Likewise. Also, test NEWDEV->FILENAME
correctly.
(grub_loopback_open): Likewise.
(grub_loopback_read): Likewise. Also, change the type of POS to
grub_off_t, and fix the usage of grub_memset.
* commands/i386/pc/play.c: Include grub/machine/time.h.
* commands/ls.c (grub_ls_list_files): Use "llu" instead of "d" to
print FILE->SIZE.
* commands/configfile.c: Include grub/env.h.
* commands/cmp.c (grub_cmd_cmp): Do not use ERR, but use
GRUB_ERRNO directly instead. Change the type of POS to
grub_off_t. Follow the coding standard.
* commands/blocklist.c: Include grub/partition.h.
(grub_cmd_blocklist): Return an error if the underlying device is
not a disk. Take the starting sector of a partition into account,
if a partition is used.
* boot/i386/pc/diskboot.S (bootloop): Adapted to the new offset of
a length field.
(lba_mode): Support 64-bit addresses.
(chs_mode): Likewise.
(copy_buffer): Adapted to the new offsets of a length field and a
segment field.
(blocklist_default_start): Allocate 64-bit space.
* boot/i386/pc/boot.S (force_lba): Removed.
(boot_drive): Moved to under KERNEL_SECTOR.
(kernel_sector): Moved to under KENREL_SEGMENT. Allocate 64-bit
space.
(real_start): Set %si earlier. Remove code for FORCE_LBA, since it
is useless.
(lba_mode): Refactored to support a 64-bit address. More size
optimization.
(setup_sectors): Likewise.
* include/grub/script.h (grub_script_cmdif): Renamed field 'bool' to
'exec_to_evaluate'. Renamed field 'true' to 'exec_on_true'. Renamed
field 'false' to 'exec_on_false'.
(grub_script_create_cmdif): Renamed argument names to reflect above
changes.
* normal/execute.c (grub_script_execute_cmdif): Likewise.
* normal/script.c (grub_script_create_cmdif): Likewise.
* fs/hfsplus.c (grub_hfsplus_btree_recoffset): Moved to near the
top.
(grub_hfsplus_btree_recptr): Likewise.
(grub_hfsplus_find_block): Do not take RETRY any longer. Use
FILEBLOCK both to pass a block number and store next block
number.
(grub_hfsplus_read_block): Rewritten heavily to support an extent
overflow file correctly. Specify errors appropriately, because
fshelp expects that GRUB_ERRNO is set when fails. Reuse
grub_hfsplus_btree_recptr to get the pointer to a found key.
(grub_hfsplus_btree_search): Return 1 instead of 0 when no match
is found.
* conf/i386-efi.rmk (pkgdata_MODULES): Added _linux.mod and
linux.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.
* DISTLIST: Added loader/i386/efi/linux.c,
loader/i386/efi/linux_normal.c and
include/grub/i386/efi/loader.h.
* loader/i386/efi/linux.c: New file.
* loader/i386/efi/linux_normal.c: Likewise.
* include/grub/i386/efi/loader.h: Likewise.
* commands/blocklist.c: New file.
* DISTLIST: Added commands/blocklist.c.
* term/efi/console.c (grub_console_highlight_color): Use a lighter
color for the background, and a daker color for the foreground.
(grub_console_checkkey): Return READ_KEY.
(grub_console_cls): Set the background to
GRUB_EFI_BACKGROUND_BLACK temporarily to clean out the screen.
* kern/efi/efi.c (grub_efi_exit_boot_services): New function.
* include/grub/i386/linux.h (struct linux_kernel_params): Fixed
the size of "padding5", "hd0_drive_info" and "hd1_drive_info".
* include/grub/efi/efi.h (grub_efi_exit_boot_services): New
prototype.
* include/grub/efi/api.h (GRUB_EFI_TEXT_ATTR): Do not shift
BG. The spec is wrong again.
* include/grub/normal.h [GRUB_UTIL] (grub_blocklist_init): New
prototype.
[GRUB_UTIL] (grub_blocklist_fini): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Added
commands/blocklist.c.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
* conf/common.rmk (pkgdata_MODULES): Added blocklist.mod.
(blocklist_mod_SOURCES): New variable.
(blocklist_mod_CFLAGS): Likewise.
(blocklist_mod_LDFLAGS): Likewise.
* kern/i386/pc/startup.S: Include grub/cpu/linux.h instead of
grub/machine/linux.h
* loader/i386/pc/linux.c: Likewise.
* include/grub/i386/pc/linux.h: Moved to ...
* include/grub/i386/linux.h: ... here.
* include/grub/i386/linux.h (struct linux_kernel_params): New
struct.
Use the environment context in the menu. Remove the commands
"default" and "timeout", and use variables instead.
* normal/menu.c: Include grub/env.h.
(print_entry): Cast TITLE to silence gcc.
(get_timeout): New function.
(set_timeout): Likewise.
(get_entry_number): Likewise.
(run_menu): Use a default entry, a fallback entry and a timeout
in the environment variables "default", "fallback" and
"timeout". Also, tweak the default entry if it is not within the
current menu entries.
(grub_menu_run): Use a fallback entry in the environment variable
"fallback".
* normal/main.c (read_config_file): Do not initialize
NEWMENU->DEFAULT_ENTRY, NEWMENU->FALLBACK_ENTRY or
NEWMENU->TIMEOUT.
(grub_normal_execute): Use a data slot to store the menu.
* include/grub/normal.h (struct grub_menu): Removed default_entry,
fallback_entry and timeout.
(struct grub_menu_list): Removed.
(grub_menu_list_t): Likewise.
(struct grub_context): Likewise.
(grub_context_t): Likewise.
(grub_context_get): Likewise.
(grub_context_get_current_menu): Likewise.
(grub_context_push_menu): Likewise.
(grub_context_pop_menu): Likewise.
(grub_default_init): Likewise.
(grub_default_fini): Likewise.
(grub_timeout_init): Likewise.
(grub_timeout_fini): Likewise.
* conf/sparc64-ieee1275.rmk (pkgdata_MODULES): Removed default.mod
and timeout.mod.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Removed
commands/default.c, commands/timeout.c and normal/context.c.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/i386-pc.rmk (grub_emu_SOURCES): Removed commands/default.c,
commands/timeout.c and normal/context.c.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/i386-efi.rmk (grub_emu_SOURCES): Removed
commands/default.c, commands/timeout.c and normal/context.c.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/common.rmk (pkgdata_MODULES): Removed default.mod and
timeout.mod.
(default_mod_SOURCES): Removed.
(default_mod_CFLAGS): Likewise.
(default_mod_LDFLAGS): Likewise.
(timeout_mod_SOURCES): Removed.
(timeout_mod_CFLAGS): Likewise.
(timeout_mod_LDFLAGS): Likewise.
* DISTLIST: Removed commands/default.c, commands/timeout.c and
normal/context.c.
* commands/default.c: Removed.
* commands/timeout.c: Likewise.
* normal/context.c: Likewise.
* kern/env.c (struct grub_env_context): Removed "sorted". Renamed
"next" to "prev" for readability.
(struct grub_env_sorted_var): New struct.
(grub_env_context): Renamed to ...
(initial_context): ... this.
(grub_env_var_context): Renamed to ...
(current_context): ... this.
(grub_env_find): Look only at CURRENT_CONTEXT.
(grub_env_context_open): Rewritten to copy exported variables from
previous context.
(grub_env_context_close): Rewritten according to the new
scheme. Also, add an assertion to prevent the initial context from
removed.
(grub_env_insert): Removed the code for the sorted list.
(grub_env_remove): Likewise.
(grub_env_export): Simply mark the variable with
GRUB_ENV_VAR_GLOBAL.
(grub_env_set): A cosmetic change for naming consistency.
(grub_env_get): Likewise.
(grub_env_unset): Likewise.
(grub_env_iterate): Rewritten to sort variables within this
function.
(grub_register_variable_hook): Fixed for naming consistency. Call
grub_env_find again, only if NAME is not found at the first time.
(mangle_data_slot_name): New function.
(grub_env_set_data_slot): Likewise.
(grub_env_get_data_slot): Likewise.
(grub_env_unset_data_slot): Likewise.
* include/grub/env.h (grub_env_var_type): New enum.
(GRUB_ENV_VAR_LOCAL): New constant.
(GRUB_ENV_VAR_GLOBAL): Likewise.
(GRUB_ENV_VAR_DATA): Likewise.
(struct grub_env_var): Removed "sort_next" and "sort_prevp". Added
"type".
(grub_env_set): Replace VAR with NAME for consistency.
(grub_register_variable_hook): Likewise.
(grub_env_export): Specify the name of the argument.
(grub_env_set_data_slot): New prototype.
(grub_env_get_data_slot): Likewise.
(grub_env_unset_data_slot): Likewise.
Extend the loader so that GRUB can accept a loader which comes
back to GRUB when a loaded image exits. Also, this change adds
support for a chainloader on EFI.
* term/efi/console.c: Include grub/misc.h.
(grub_console_checkkey): Display a scan code on the top for
debugging. This will be removed once the EFI port gets stable.
Correct the scan code mapping.
* kern/efi/mm.c (sort_memory_map): Sort in a descending order to
allocate memory from larger regions, in order to reduce the number
of allocated regions. Otherwise, the MacOSX loader panics.
(filter_memory_map): Avoid less than 1MB for compatibility with
other loaders.
(add_memory_regions): Allocate from the tail of a region, if
possible, to avoid allocating a region near to 1MB, for the MacOSX
loader.
* kern/efi/init.c (grub_efi_set_prefix): Specify
GRUB_EFI_IMAGE_HANDLE to grub_efi_get_loaded_image.
* kern/efi/efi.c (grub_efi_get_loaded_image): Accept a new
argument IMAGE_HANDLE and specify it to get a loaded image.
(grub_arch_modules_addr): Specify GRUB_EFI_IMAGE_HANDLE to
grub_efi_get_loaded_image.
(grub_efi_get_filename): Divide the legnth by the size of
grub_efi_char16_t.
(grub_efi_get_device_path): New function.
(grub_efi_print_device_path): Print End Device Path nodes. Divide
the length by the size of grub_efi_char16_t for a file path device
path node.
* kern/loader.c (grub_loader_noreturn): New variable.
(grub_loader_set): Accept a new argument NORETURN. Set
GRUB_LOADER_NORETURN to NORETURN.
All callers changed.
(grub_loader_boot): If GRUB_LOADER_NORETURN is false, do not call
grub_machine_fini.
* include/grub/efi/efi.h (grub_efi_get_device_path): New
prototype.
(grub_efi_get_loaded_image): Take an argument to specify an image
handle.
* include/grub/loader.h (grub_loader_set): Added one more argument
NORETURN.
* disk/efi/efidisk.c (make_devices): Use grub_efi_get_device_path
instead of grub_efi_open_protocol.
(grub_efidisk_get_device_name): Likewise.
(grub_efidisk_close): Print a newline.
(grub_efidisk_get_device_handle): Fixed to use
GRUB_EFI_DEVICE_PATH_SUBTYPE instead of
GRUB_EFI_DEVICE_PATH_TYPE.
* disk/efi/efidisk.c (device_path_guid): Moved to ...
* kern/efi/efi.c (device_path_guid): ... here.
* conf/i386-efi.rmk (pkgdata_MODULES): Added _chain.mod and
chain.mod.
(kernel_mod_HEADERS): Added efi/disk.h.
(_chain_mod_SOURCES): New variable.
(_chain_mod_CFLAGS): Likewise.
(_chain_mod_LDFLAGS): Likewise.
(chain_mod_SOURCES): Likewise.
(chain_mod_CFLAGS): Likewise.
(chain_mod_LDFLAGS): Likewise.
* DISTLIST: Added include/grub/efi/chainloader.h,
loader/efi/chainloader.c and loader/efi/chainloader_normal.c.
* include/grub/efi/chainloader.h: New file.
* loader/efi/chainloader.c: Likewise.
* loader/efi/chainloader_normal.c: Likewise.
* commands/configfile.c (grub_cmd_configfile): Execute the
configfile within its own context.
* include/grub/env.h (grub_env_context_open): New prototype.
(grub_env_context_close): Likewise.
* kern/env.c (grub_env): Removed.
(grub_env_sorted): Likewise.
(grub_env_context): New variable.
(grub_env_var_context): Likewise.
(grub_env_find): Search both the active context and the global
context.
(grub_env_context_open): New function.
(grub_env_context_close): Likewise.
(grub_env_insert): Likewise.
(grub_env_remove): Likewise.
(grub_env_export): Likewise.
(grub_env_set): Changed to use helper functions to avoid code
duplication.
(grub_env_iterate): Rewritten so both the current context and the
global context are being used.
* normal/command.c (export_command): New function.
(grub_command_init): Register the `export' function.
A new machine-specific function "grub_machine_set_prefix" is
defined. This is called after loading modules, so that a prefix
initialization can use modules. Also, this change adds an
intensive debugging feature for the memory manager via the
configure option "--enable-mm-debug".
* partmap/gpt.c (gpt_partition_map_iterate): Add one more into
PART.LEN.
* kern/sparc64/ieee1275/init.c (abort): Removed.
(grub_stop): Likewise.
(grub_exit): New function.
(grub_set_prefix): Renamed to ...
(grub_machine_set_prefix): ... this.
(grub_machine_init): Do not call grub_set_prefix.
* kern/powerpc/ieee1275/init.c (grub_set_prefix): Renamed to ...
(grub_machine_set_prefix): ... this.
(grub_machine_init): Do not call grub_set_prefix.
* kern/i386/pc/init.c (grub_machine_set_prefix): New function.
(grub_machine_init): Do not set the prefix here.
* kern/i386/efi/init.c (grub_machine_set_prefix): New function.
* kern/efi/init.c: Include grub/mm.h.
(grub_efi_set_prefix): New function.
* kern/efi/efi.c (grub_exit): Call grub_efi_fini.
(grub_efi_get_filename): New function.
(grub_print_device_path): Renamed to ...
(grub_efi_print_device_path): ... this.
* kern/mm.c [MM_DEBUG] (grub_malloc): Undefined.
[MM_DEBUG] (grub_realloc): Likewise.
[MM_DEBUG] (grub_free): Likewise.
[MM_DEBUG] (grub_memalign): Likewise.
[MM_DEBUG] (grub_mm_debug): New variable.
[MM_DEBUG] (grub_debug_malloc): New function.
[MM_DEBUG] (grub_debug_free): New function.
[MM_DEBUG] (grub_debug_realloc): New function.
[MM_DEBUG] (grub_debug_memalign): New function.
* kern/misc.c (grub_abort): Print a newline to distinguish
the message.
* kern/main.c (grub_main): Call grub_machine_set_prefix and
grub_set_root_dev after loading modules. This is necessary when
setting a prefix depends on modules.
* include/grub/efi/efi.h (grub_print_device_path): Renamed to ...
(grub_efi_print_device_path): ... this.
(grub_efi_get_filename): New prototype.
(grub_efi_set_prefix): Likewise.
* include/grub/efi/disk.h: Include grub/efi/api.h, grub/symbol.h
and grub/disk.h.
(grub_efidisk_get_device_handle): New prototype.
(grub_efidisk_get_device_name): Likewise.
* include/grub/mm.h: Include config.h.
(MM_DEBUG): Removed.
[MM_DEBUG && !GRUB_UTIL] (grub_mm_debug): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_malloc): New macro.
[MM_DEBUG && !GRUB_UTIL] (grub_realloc): Likewise.
[MM_DEBUG && !GRUB_UTIL] (grub_memalign): Likewise.
[MM_DEBUG && !GRUB_UTIL] (grub_free): Likewise.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_malloc): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_realloc): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_memalign): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_free): New prototype.
* include/grub/kernel.h (grub_machine_set_prefix): New prototype.
* disk/efi/efidisk.c: Include grub/partition.h.
(iterate_child_devices): New function.
(add_device): First, compare only last device path nodes, so that
devices are sorted by the types.
(grub_efidisk_get_device_handle): New function.
(grub_efidisk_get_device_name): Likewise.
* configure.ac (--enable-mm-debug): New option to enable the
memory manager debugging feature. This makes the binary much
bigger, so is disabled by default.
Use grub_abort instead of grub_stop, and grub_exit must be
define in each architecture now. Also, this change adds support
for EFI disks.
* util/i386/pc/grub-probefs.c: Include grub/term.h.
(grub_getkey): New function.
(grub_term_get_current): Likewise.
* util/i386/pc/grub-setup.c: Include grub/term.h.
(grub_getkey): New function.
(grub_term_get_current): Likewise.
* util/misc.c (grub_stop): Renamed to ...
(grub_exit): ... this.
* kern/powerpc/ieee1275/init.c (abort): Renamed to ...
(grub_exit): ... this.
(grub_machine_init): Use grub_abort instead of abort.
(grub_stop): Removed.
* kern/powerpc/ieee1275/cmain.c (cmain): Use grub_abort instead of
abort.
* kern/i386/pc/startup.S (grub_exit): New function.
(cold_reboot): New label.
* kern/efi/init.c: Include grub/efi/disk.h and grub/env.h.
(grub_efi_init): Call grub_efidisk_init.
(grub_efi_fini): Call grub_efidisk_fini.
* kern/efi/efi.c: Include grub/mm.h.
(grub_efi_console_control_guid): Renamed to ...
(console_control_guid): ... this.
(grub_efi_loaded_image_guid): Renamed to ...
(loaded_image_guid): ... this.
(grub_efi_locate_handle): New function.
(grub_efi_open_protocol): Likewise.
(grub_efi_set_text_mode): Use CONSOLE_CONTROL_GUID instead of
GRUB_EFI_CONSOLE_CONTROL_GUID.
(grub_efi_exit): Removed.
(grub_stop): Likewise.
(grub_efi_get_loaded_image): Use grub_efi_open_protocol.
(grub_exit): New function.
(grub_print_device_path): Likewise.
* kern/rescue.c (grub_rescue_cmd_exit): New function.
(grub_enter_rescue_mode): Register "exit".
* kern/misc.c (grub_real_dprintf): A cosmetic change.
(grub_abort): New function.
* kern/err.c (grub_fatal): Use grub_abort instead of grub_stop.
* include/grub/sparc64/ieee1275/kernel.h (abort): Removed.
* include/grub/powerpc/ieee1275/kernel.h (abort): Removed.
* include/grub/efi/efi.h (grub_efi_exit): Removed.
(grub_print_device_path): New prototype.
(grub_efi_locate_handle): Likewise.
(grub_efi_open_protocol): Likewise.
* include/grub/efi/disk.h (grub_efidisk_fini): New file.
* disk/efi/efidisk.c: Likewise.
* DISTLIST: Added disk/efi/efidisk.c and include/grub/efi/disk.h.
* include/grub/efi/console_control.h
(GRUB_EFI_CONSOLE_CONTROL_GUID): Use an array for the last 8 bytes.
* include/grub/efi/api.h (GRUB_EFI_LOADED_IMAGE_GUID): Specify the
last 8 bytes as an array.
(GRUB_EFI_DISK_IO_GUID): New macro.
(GRUB_EFI_BLOCK_IO_GUID): Likewise.
(GRUB_EFI_DEVICE_PATH_GUID): Likewise.
(grub_efi_ipv6_address_t): Change the type to grub_uint16_t from
grub_uint8_t.
(struct grub_efi_guid): Use an array to specify the last 8 bytes.
(struct grub_efi_device_path): Rename the member "sub_type" to
"subtype".
(GRUB_EFI_DEVICE_PATH_TYPE): New macro.
(GRUB_EFI_DEVICE_PATH_SUBTYPE): Likewise.
(GRUB_EFI_DEVICE_PATH_LENGTH): Likewise.
(GRUB_EFI_END_DEVICE_PATH_TYPE): Likewise.
(GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE): Likewise.
(GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE): Likewise.
(GRUB_EFI_END_ENTIRE_DEVICE_PATH): Likewise.
(GRUB_EFI_NEXT_DEVICE_PATH): Likewise.
(GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE): Likewise.
(GRUB_EFI_PCI_DEVICE_PATH_SUBTYPE): Likewise.
(struct grub_efi_pci_device_path): New structure.
(grub_efi_pci_device_path_t): New type.
(GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_pccard_device_path): New structure.
(grub_efi_pccard_device_path_t): New type.
(GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_memory_mapped_device_path): New structure.
(grub_efi_memory_mapped_device_path_t): New type.
(GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_vendor_device_path): New structure.
(grub_efi_vendor_device_path_t): New type.
(GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_controller_device_path): New structure.
(grub_efi_controller_device_path_t): New type.
(GRUB_EFI_ACPI_DEVICE_PATH_TYPE): New macro.
(GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE): Likewise.
(struct grub_efi_acpi_device_path): New structure.
(grub_efi_acpi_device_path_t): New type.
(GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_expanded_acpi_device_path): New structure.
(grub_efi_expanded_acpi_device_path_t): New type.
(GRUB_EFI_EXPANDED_ACPI_HIDSTR): New macro.
(GRUB_EFI_EXPANDED_ACPI_UIDSTR): Likewise.
(GRUB_EFI_EXPANDED_ACPI_CIDSTR): Likewise.
(GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE): Likewise.
(GRUB_EFI_ATAPI_DEVICE_PATH_SUBTYPE): Likewise.
(struct grub_efi_atapi_device_path): New structure.
(grub_efi_atapi_device_path_t): New type.
(GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_fibre_channel_device_path): New structure.
(grub_efi_fibre_channel_device_path_t): New type.
(GRUB_EFI_1394_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_1394_device_path): New structure.
(grub_efi_1394_device_path_t): New type.
(GRUB_EFI_USB_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_usb_device_path): New structure.
(grub_efi_usb_device_path_t): New type.
(GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_usb_class_device_path): New structure.
(grub_efi_usb_class_device_path_t): New type.
(GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_i2o_device_path): New structure.
(grub_efi_i2o_device_path_t): New type.
(GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_mac_address_device_path): New structure.
(grub_efi_mac_address_device_path_t): New type.
(GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_ipv4_device_path): New structure.
(grub_efi_ipv4_device_path_t): New type.
(GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_ipv6_device_path): New structure.
(grub_efi_ipv6_device_path_t): New type.
(GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_infiniband_device_path): New structure.
(grub_efi_infiniband_device_path_t): New type.
(GRUB_EFI_UART_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_uart_device_path): New structure.
(grub_efi_uart_device_path_t): New type.
(GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_vendor_messaging_device_path): New structure.
(grub_efi_vendor_messaging_device_path_t): New type.
(GRUB_EFI_MEDIA_DEVICE_PATH_TYPE): New macro.
(GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE): Likewise.
(struct grub_efi_hard_drive_device_path): New structure.
(grub_efi_hard_drive_device_path_t): New type.
(GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_cdrom_device_path): New structure.
(grub_efi_cdrom_device_path_t): New type.
(GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_vendor_media_device_path): New structure.
(grub_efi_vendor_media_device_path_t): New type.
(GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_file_path_device_path): New structure.
(grub_efi_file_path_device_path_t): New type.
(GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_protocol_device_path): New structure.
(grub_efi_protocol_device_path_t): New type.
(GRUB_EFI_BIOS_DEVICE_PATH_TYPE): New macro.
(GRUB_EFI_BIOS_DEVICE_PATH_SUBTYPE): Likewise.
(struct grub_efi_bios_device_path): New structure.
(grub_efi_bios_device_path_t): New type.
(struct grub_efi_disk_io): New structure.
(grub_efi_disk_io_t): New type.
(struct grub_efi_block_io_media): New structure.
(grub_efi_block_io_media_t): New type.
(struct grub_efi_block_io): New structure.
(grub_efi_block_io_t): New type.
* include/grub/misc.h (grub_stop): Removed.
(grub_exit): New prototype.
(grub_abort): Likewise.
* include/grub/disk.h (enum grub_disk_dev_id): Added
GRUB_DISK_DEVICE_EFIDISK_ID.
* conf/i386-efi.rmk (kernel_mod_SOURCES): Added
disk/efi/efidisk.c.
(kernel_syms.lst): Remove the target if an error occurs.
Add support for pre-loaded modules into the EFI port.
* util/i386/efi/grub-mkimage.c (make_mods_section): Rewritten
completely. Accept one more argument DIR. The caller has changed.
* kern/i386/efi/init.c (grub_arch_modules_addr): Removed.
* kern/efi/efi.c: Include grub/efi/pe32.h and grub/kernel.h.
(grub_efi_loaded_image_guid): New variable.
(grub_efi_get_loaded_image): New function.
(grub_arch_modules_addr): Likewise.
* include/grub/efi/efi.h (grub_efi_get_loaded_image): New
prototype.
* include/grub/efi/api.h (GRUB_EFI_LOADED_IMAGE_GUID): New macro.
(struct grub_efi_loaded_image): New structure.
(grub_efi_loaded_image_t): New type.
* DISTLIST: Added include/grub/i386/pc/vbeblit.h,
include/grub/i386/pc/vbefill.h, video/i386/pc/vbeblit.c,
video/i386/pc/vbefill.c.
* conf/i386-pc.rmk (vbe_mod_SOURCES): Added video/i386/pc/vbeblit.c,
video/i386/pc/vbefill.c.
* include/grub/video.h (grub_video_blit_format): New enum.
(grub_video_mode_info): Added new member blit_format.
(grub_video_get_blit_format): New function prototype.
* include/grub/i386/pc/vbe.h (grub_video_vbe_get_video_ptr): New
function prototype.
(grub_video_vbe_map_rgb): Likewise.
(grub_video_vbe_unmap_color): Likewise.
* include/grub/i386/pc/vbeblit.h: New file.
* include/grub/i386/pc/vbefill.h: New file.
* video/video.c (grub_video_get_blit_format): New function.
(grub_video_vbe_get_video_ptr): Re-declared as non-static.
(grub_video_vbe_map_rgb): Likewise.
(grub_video_vbe_unmap_color): Likewise.
* video/i386/pc/vbe.c (grub_video_vbe_fill_rect): Changed to use more
optimized fills.
(grub_video_vbe_blit_render_target): Changed to use more optimized
blits.
(grub_video_vbe_setup): Added detection for optimized settings.
(grub_video_vbe_create_render_target): Likewise.
* video/i386/pc/vbeblit.c: New file.
* video/i386/pc/vbefill.c: New file.
* include/grub/normal.h: Include <grub/script.h>.
(grub_command_list): Removed struct.
(grub_command_list_t): Removed type.
(grub_menu_entry): Remove members `num' and `command_list'. Add
members `commands' and `sourcecode'.
* include/grub/script.h: Add inclusion guards.
(grub_script_cmd_menuentry): New struct.
(grub_script_execute_menuentry): New prototype.
(grub_script_lexer_record_start): Likewise.
(grub_script_lexer_record_stop): Likewise.
* normal/execute.c (grub_script_execute_menuentry): New function.
* normal/lexer.c (record, recording, recordpos, recordlen): New
variables.
(grub_script_lexer_record_start): New function.
(grub_script_lexer_record_stop): Likewise.
(recordchar): Likewise.
(nextchar): Likewise.
(grub_script_yylex): Use `nextchar' to fetch new characters. Use
2048 as the buffer size. Add the tokens `menuentry' and `@'.
* normal/main.c: Include <grub/parser.h> and <grub/script.h>
(current_menu): New variable.
(free_menu): Mainly rewritten.
(grub_normal_menu_addentry): New function.
(read_config_file): Rewritten.
* normal/menu.c (run_menu_entry): Mainly rewritten.
* normal/menu_entry.c (make_screen): Rewritten te code to insert
the menu entry.
(run): Mainly rewritten.
* normal/parser.y (menu_entry): New variable.
(GRUB_PARSER_TOKEN_MENUENTRY): New token.
(menuentry): New rule.
(command): Add `menuentry'.
(if_statement): Allow additional returns before `fi'.
* normal/script.c (grub_script_create_cmdmenu): New function.
* fs/hfs.c: Include <grub/hfs.h>. Added reference to the official
documentation.
(GRUB_HFS_EMBED_HFSPLUS_SIG): New macro.
(grub_hfs_mount): Grammar fix in error. Make sure this is not an
embedded HFS+ filesystem.
(GRUB_HFS_MAGIC, grub_hfs_extent, grub_hfs_datarecord_t)
(grub_hfs_sblock): Move from here...
* include/grub/hfs.h: To here... New file.
* fs/hfsplus.c: Include <grub/hfs.h>. Added reference to the official
documentation.
(GRUB_HFSPLUS_MAGIC, GRUB_HFSPLUSX_MAGIC, GRUB_HFSPLUS_SBLOCK):
New macros.
(grub_hfsplus_volheader): Change type of member `magic' to
`grub_uint16_t'.
(grub_hfsplus_data): Add new member `embedded_offset'.
(grub_hfsplus_read_block): Add the HFS+ wrapper offset to the
returned block.
(grub_hfsplus_mount): Read the HFS+ wrapper if it exists.
Calculate the offset.
* kern/err.c (grub_error_push): Added new function to support error
stacks.
(grub_error_pop): Likewise.
(grub_error_stack_items): New local variable to support error stacks.
(grub_error_stack_pos): Likewise.
(grub_error_stack_assert): Likewise.
(GRUB_ERROR_STACK_SIZE): Added new define to configure maximum error
stack depth.
(grub_print_error): Added support to print errors from error stack.
* include/grub/err.h (grub_error_push): Added function prototype.
(grub_error_pop): Likewise.
* conf/common.rmk (grub_modules_init.lst): Use `-printf "%P\n"'
and `cd' to make sure the filename is not prefixed with a
directory name.
(pkgdata_MODULES): Add `gpt.mod'.
(gpt_mod_SOURCES): New variable.
(gpt_mod_CFLAGS): Likewise.
(gpt_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `partmap/gpt.c'.
* include/grub/pc_partition.h (GRUB_PC_PARTITION_TYPE_GPT_DISK):
New macro.
* partmap/gpt.c: New file.
* partmap/pc.c (pc_partition_map_iterate): Don't continue when a
GPT partition map is detected.
* include/grub/parser.h: New file.
* kern/parser.c: Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/parser.c'.
(grub_setup_SOURCES): Likewise.
(grub_probefs_SOURCES): Likewise.
(grub_emu_SOURCES): Likewise.
(kernel_img_HEADERS): Add `parser.h'.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add `parser.h'.
(grub_emu_SOURCES): Add `kern/parser.c'.
(grubof_SOURCES): Likewise.
* conf/sparc64-ieee1275.rmk (grubof_HEADERS): Add `parser.h'.
(grubof_SOURCES): Add `kern/parser.c'.
* include/grub/misc.h (grub_split_cmdline): Removed prototype.
* kern/misc.c (grub_split_cmdline): Removed function.
* kern/rescue.c: Include <grub/parser.h>.
(grub_enter_rescue_mode): Use `grub_parser_split_cmdline' instead
of `grub_split_cmdline'.
* normal/command.c: Include <grub/parser.h>.
(grub_command_execute): Use `grub_parser_split_cmdline' instead
of `grub_split_cmdline'.
* normal/completion.c: Include <grub/parser.h>.
(cmdline_state): New variable.
(iterate_dir): End the filename with a quote depending on the
command line state.
(get_state): new function.
(grub_normal_do_completion): Use `grub_parser_split_cmdline' to
split the arguments and determine the current argument. When the
argument string is not quoted, escape all spaces.
* include/grub/sparc64/libgcc.h: New file.
* conf/sparc64-ieee1275.rmk (COMMON_ASFLAGS): Remove -Av9.
(normal_mod_SOURCES): Use normal/sparc64/setjmp.S instead of
normal/sparc64/setjmp.c.
* fs/xfs.c (grub_xfs_iterate_dir): Change the type of BLK to
grub_uint64_t.
Call the hook with a NUL-terminated filename.
(grub_xfs_mount): Use grub_be_to_cpu32 instead of
grub_cpu_to_be32.
* kern/term.c (cursor_state): New variable.
(grub_term_set_current): Reset the cursor state on a new
terminal.
(grub_setcursor): Rewritten to use CURSOR_STATE.
(grub_getcursor): New function.
* include/grub/term.h (grub_getcursor): New prototype.
* io/gzio.c (test_header): Align BUF for accessing it as 32-bit
integers on ARM. Reported by Timothy Baldwin
<T.E.Baldwin99@members.leeds.ac.uk>.
* configure.ac: Accept `x86_64' as host_cpu. In that case add
`-m32' to CFLAGS.
* genmk.rb (class PModule): Always use `$(#{prefix}_LDFLAGS)' when
linking.
* conf/i386-pc.rmk (COMMON_CFLAGS): Add `-m32'.
(COMMON_LDFLAGS): New variable.
(kernel_img_LDFLAGS): Include `COMMON_FLAGS'.
(_chain_mod_LDFLAGS, fshelp_mod_LDFLAGS, fat_mod_LDFLAGS)
(ext2_mod_LDFLAGS, ufs_mod_LDFLAGS, minix_mod_LDFLAGS)
(hfs_mod_LDFLAGS, jfs_mod_LDFLAGS, iso9660_mod_LDFLAGS)
(xfs_mod_LDFLAGS, _linux_mod_LDFLAGS, linux_mod_LDFLAGS)
(normal_mod_LDFLAGS, hello_mod_LDFLAGS, boot_mod_LDFLAGS)
(terminal_mod_LDFLAGS, ls_mod_LDFLAGS, cmp_mod_LDFLAGS)
(cat_mod_LDFLAGS, help_mod_LDFLAGS, reboot_mod_LDFLAGS)
(halt_mod_LDFLAGS, vga_mod_LDFLAGS, font_mod_LDFLAGS)
(terminfo_mod_LDFLAGS, serial_mod_LDFLAGS, _multiboot_mod_LDFLAGS)
(multiboot_mod_LDFLAGS, amiga_mod_LDFLAGS, apple_mod_LDFLAGS)
(pc_mod_LDFLAGS, sun_mod_LDFLAGS, loopback_mod_LDFLAGS)
(default_mod_LDFLAGS, timeout_mod_LDFLAGS, configfile_mod_LDFLAGS)
(vbe_mod_LDFLAGS, vesafb_mod_LDFLAGS, vbeinfo_mod_LDFLAGS)
(vbetest_mod_LDFLAGS, search_mod_LDFLAGS, gzio_mod_LDFLAGS): New
variables.
(normal_mod_ASFLAGS): Add `-m32'.
* include/grub/types.h (grub_host_addr_t, grub_host_off_t)
(grub_host_size_t, grub_host_ssize_t): New types.
(grub_addr_t, grub_off_t, grub_size_t, grub_ssize_t): Make type
dependant of `GRUB_CPU_SIZEOF_VOID_P' instead on
`GRUB_HOST_SIZEOF_VOID_P'.
* include/grub/kernel.h (struct grub_module_header): Type of
member offset changed to `grub_host_off_t'. Type of member size
changed to `grub_host_size_t'.
(struct grub_module_info): Type of member offset changed to
`grub_host_off_t'. Type of member size changed to
`grub_host_size_t'.
Make GRUB's kernel compliant to Multiboot Specification.
* kern/i386/pc/startup.S (multiboot_header): New label.
(multiboot_entry): Likewise.
(multiboot_trampoline): Likewise.
* include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_RAW_SIZE):
Increased to 0x4A0.
* fs/xfs.c (grub_xfs_iterate_dir): Fix a syntax error. You may not
put parentheses after a question mark.
[!GRUB_UTIL] (my_mod): New variable.
* util/grub-emu.c (main): Call grub_xfs_init and grub_xfs_fini.
* include/grub/normal.h (enum grub_completion_type): Added
`GRUB_COMPLETION_TYPE_ARGUMENT'.
* normal/cmdline.c (print_completion): Handle
the `GRUB_COMPLETION_TYPE_ARGUMENT' type.
* normal/menu_entry.c (store_completion): Likewise.
* normal/completion.c (complete_arguments): New function.
(grub_normal_do_completion): Call `complete_arguments' when the
current words start with a dash.
* configure.ac: Add support for sparc64 host with ieee1275
firmware.
* configure: Generated from configure.ac.
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Use grub_ssize_t
instead of int.
(grub_ofdisk_read): Likewise.
(grub_ofdisk_open): Use %p to print pointer values, and cast the
pointers as (void *) to remove a warning.
(grub_ofdisk_close): Likewise.
(grub_ofdisk_read): Likewise.
* kern/ieee1275/ieee1275.c (grub_ieee1275_exit): This never
returns, so make it return void to remove a warning.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_exit):
Corresponding prototype change.
* kern/mm.c (grub_mm_init_region): Use %p to print pointer
values, and cast the pointers as (void *) to remove a warning.
(grub_mm_dump): Likewise.
* conf/sparc64-ieee1275.mk: New file.
* conf/sparc64-ieee1275.rmk: Likewise.
* include/grub/sparc64/setjmp.h: Likewise.
* include/grub/sparc64/types.h: Likewise.
* include/grub/sparc64/ieee1275/console.h: Likewise.
* include/grub/sparc64/ieee1275/ieee1275.h: Likewise.
* include/grub/sparc64/ieee1275/kernel.h: Likewise.
* include/grub/sparc64/ieee1275/time.h: Likewise.
* kern/sparc64/cache.c: Likewise.
* kern/sparc64/dl.c: Likewise.
* kern/sparc64/ieee1275/init.c: Likewise.
* kern/sparc64/ieee1275/openfw.c: Likewise.
* util/console.c (grub_ncurses_putchar): If C is greater than
0x7f, set C to a question mark.
(grub_ncurses_getcharwidth): New function.
(grub_ncurses_term): Specify grub_ncurses_getcharwidth as
getcharwidth.
* normal/menu.c (print_entry): Made aware of Unicode. First,
convert TITLE to UCS-4, and predict the cursor position by
grub_getcharwidth.
* include/grub/misc.h (grub_utf8_to_ucs4): Specify the qualifier
const to SRC.
* kern/misc.c (grub_utf16_to_utf8): Likewise.
* partmap/pc.c (pc_partition_map_iterate): Include the value of an
invalid magic in thre error.
* commands/search.c: New file.
* util/grub-emu.c (main): Call grub_search_init and
grub_search_fini.
* kern/rescue.c (grub_rescue_print_disks): Removed.
(grub_rescue_print_devices): New function.
(grub_rescue_cmd_ls): Use grub_device_iterate with
grub_rescue_print_devices instead of grub_disk_dev_iterate with
grub_rescue_print_disks.
* kern/partition.c (grub_partition_iterate): Return the result of
PARTMAP->ITERATE instead of GRUB_ERRNO.
* kern/device.c: Include grub/partition.h.
(grub_device_iterate): New function.
* include/grub/partition.h (grub_partition_iterate): Return int
instead of grub_err_t.
* include/grub/normal.h [GRUB_UTIL] (grub_search_init): New
prototype.
[GRUB_UTIL] (grub_search_fini): Likewise.
* include/grub/device.h (grub_device_iterate): New prototype.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Added
commands/search.c.
(pkgdata_MODULES): Added search.mod.
(search_mod_SOURCES): New variable.
(search_mod_CFLAGS): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Added commands/search.c.
(pkgdata_MODULES): Added search.mod.
(search_mod_SOURCES): New variable.
(search_mod_CFLAGS): Likewise.
* commands/ls.c (grub_ls_list_disks): Renamed to ...
(grub_ls_list_devices): ... this, and use grub_device_iterate.
All callers changed.
* DISTLIST: Added commands/search.c.
* kern/term.c (grub_putchar): Use grub_utf8_to_ucs4 for the
conversion.
(grub_getcharwidth): New function.
* kern/misc.c (grub_utf8_to_ucs4): New function.
* include/grub/term.h (struct grub_term): Added a new member
"getcharwidth".
(grub_getcharwidth): New prototype.
* include/grub/misc.h (grub_utf8_to_ucs4): New prototype.
* term/i386/pc/console.c (map_char): New function. Segregated from
grub_console_putchar.
(grub_console_putchar): Use map_char.
(grub_console_getcharwidth): New function.
(grub_console_term): Specified grub_console_getcharwidth as
getcharwidth.
* term/i386/pc/vga.c (grub_vga_getcharwidth): New function.
(grub_vga_term): Specified grub_vga_getcharwidth as getcharwidth.
* term/i386/pc/vesafb.c (grub_virtual_screen_setup): Return
GRUB_ERRNO.
(grub_vesafb_init): Do not use RC. Instead, use GRUB_ERRNO. Rely
on grub_strtoul completely.
(write_char): Declare local variables in the beginning of the
function.
(grub_vesafb_getcharwidth): New function.
(grub_vesafb_term): Specified grub_vesafb_getcharwidth as
getcharwidth.
* normal/misc.c: New file.
* DISTLIST: Added normal/misc.c.
* partmap/amiga.c (amiga_partition_map_iterate): Add an argument
DISK to HOOK. Call HOOK with DISK.
* partmap/apple.c (apple_partition_map_iterate): Likewise.
* partmap/pc.c (pc_partition_map_iterate): Likewise.
* partmap/sun.c (sun_partition_map_iterate): Likewise.
* normal/menu_entry.c (struct screen): Added a new member
"completion_shown".
(completion_buffer): New global variable.
(make_screen): Set SCREEN->COMPLETION_SHOWN to zero.
(store_completion): New function.
(complete): Likewise.
(clear_completions): Likewise.
(grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero,
call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is
a tab, call complete.
* normal/completion.c (disk_dev): Removed.
(print_simple_completion): Likewise.
(print_partition_completion): Likewise.
(print_func): New global variable.
(add_completion): Do not take the arguments WHAT or PRINT any
longer. Added a new argument TYPE. Instead of printing directly,
call PRINT_FUNC if not NULL.
All callers changed.
(complete_device): Use a local variable DEV instead of
DISK_DEV. Do not move CURRENT_WORD to the end of a device name.
(grub_normal_do_completion): Take a new argument HOOK. Do not
initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an
empty string, return NULL instead.
All callers changed.
* normal/cmdline.c (print_completion): New function.
* kern/partition.c (grub_partition_iterate): Add an argument DISK
to HOOK.
All callers changed.
* kern/disk.c (grub_print_partinfo): Removed.
* include/grub/partition.h (struct grub_partition_map): Add a new
argument DISK into HOOK of ITERATE.
(grub_partition_iterate): Add a new argument DISK to HOOK.
* include/grub/normal.h (enum grub_completion_type): New enum.
(grub_completion_type_t): New type.
(GRUB_COMPLETION_TYPE_COMMAND): New constant.
(GRUB_COMPLETION_TYPE_DEVICE): Likewise.
(GRUB_COMPLETION_TYPE_PARTITION): Likewise.
(GRUB_COMPLETION_TYPE_FILE): Likewise.
(grub_normal_do_completion): Added a new argument HOOK.
(grub_normal_print_device_info): New prototype.
* include/grub/disk.h (grub_print_partinfo): Removed.
* conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c.
(normal_mod_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* commands/ls.c (grub_ls_list_disks): Use
grub_normal_print_device_info instead of grub_print_partinfo. Free
PNAME.
(grub_ls_list_files): Use grub_normal_print_device_info instead of
duplicating the code.
* normal/menu.c (run_menu_entry):
* normal/command.c (grub_command_execute): If INTERACTIVE is
false and GRUB_COMMAND_FLAG_NO_ECHO is not specified, print
CMDLINE. Disable the pager if INTERACTIVE is true.
All callers are changed.
* normal/main.c (grub_normal_execute): Read command.lst and fs.lst
before reading a config file.
* normal/main.c (read_config_file): Even if a command is not
found, register it if it is within an entry.
* util/grub-emu.c: Include sys/types.h and unistd.h.
(options): Added --hold.
(struct arguments): Added a new member "hold".
(parse_opt): If KEY is 'H', set ARGS->HOLD to ARG or -1 if ARG is
missing.
(main): Initialize ARGS.HOLD to zero. Wait until ARGS.HOLD is
cleared by a debugger, if it is not zero.
* include/grub/normal.h (grub_command_execute): Add an argument
INTERACTIVE.
* DISTLIST: Added normal/completion.c.
* normal/completion.c: New file.
* term/i386/pc/console.c (grub_console_getwh): New function.
(grub_console_term): Assign grub_console_getwh to getwh.
* normal/cmdline.c (grub_tab_complete): Removed. Now the same
function is defined in normal/completion.c as
grub_normal_do_completion.
(grub_cmdline_get): Use grub_normal_do_completion instead of
grub_tab_complete.
* kern/partition.c (grub_partition_map_iterate): Return 1 if HOOK
returns non-zero, otherwise return 0.
(grub_partition_iterate): First, probe the partition map. Then,
call ITERATE only for this partition map.
* kern/misc.c (grub_strncmp): Rewritten.
* kern/disk.c (grub_disk_dev_iterate): Return 1 if P->ITERATE
returns non-zero. Otherwise return 0.
* include/grub/partition.h (grub_partition_map_iterate): Return
int instead of void.
* include/grub/normal.h (grub_normal_do_completion): New prototype.
* include/grub/misc.h (grub_strncmp): Change the type of N to
grub_size_t.
* include/grub/disk.h (grub_disk_dev_iterate): Return int instead
of void.
* normal/menu.c (draw_border): Cast GRUB_TERM_BORDER_WIDTH to
unsigned explictly before comparing it with I.
* kern/main.c (grub_env_write_root): Add the attribute unused into
VAR.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Added
normal/completion.c.
(normal_mod_SOURCES): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* normal/command.c (grub_iterate_commands): If ITERATE returns
non-zero, return one immediately.
* util/i386/pc/grub-install.in (grub_probefs): New variable.
(modules): Likewise.
(usage): Added descriptions for --modules and --grub-probefs.
Handle --modules and --grub-probefs. Save the arguments in MODULES
and GRUB_PROBEFS, respectively.
Auto-detect a filesystem module against GRUBDIR. If the result is
empty and modules are not specified explicitly, abort the
installation. Add the result to MODULES.
* DISTLIST: Removed boot/powerpc/ieee1275/ieee1275.c,
disk/powerpc/ieee1275/ofdisk.c,
include/grub/powerpc/ieee1275/init.h and
term/powerpc/ieee1275/ofconsole.c.
Added disk/ieee1275/ofdisk.c, kern/ieee1275/of.c and
term/ieee1275/ofconsole.c.
* include/grub/powerpc/ieee1275/console.h: Resurrected.
* COPYING: Upgraded to the latest version. Only the address of the
FSF office has changed.
* conf/i386-pc.rmk (kernel_img_HEADERS): Reordered for
readablity.
* config.guess: Updated to the latest version from gnulib.
* config.sub: Likewise.
* install.sh: Likewise.
* mkinstalldirs: Likewise.
* include/grub/console.h: Removed. This file is arch-specific. Do
not put this in include/grub.
* include/grub/i386/pc/console.h: Resurrected.
* util/console.c: Include grub/machine/console.h instead of
grub/console.h.
* util/grub-emu.c: Likewise.
* kern/term.c (grub_putcode): Use `grub_getwh' instead of
hardcoded value.
From Vincent Pelletier <subdino2004@yahoo.fr>
* include/grub/term.h (GRUB_TERM_WIDTH, GRUB_TERM_HEIGHT):
Redefined to use grub_getwh.
(grub_term): New member named getwh.
(grub_getwh): New prototype.
* kern/term.c (grub_getwh): New function.
* term/i386/pc/console.c (grub_console_getwh): New function.
(grub_console_term): New member `getwh'.
* term/i386/pc/vga.c (grub_vga_getwh): New function.
(grub_vga_term): New member `getwh'.
* term/sparc64/ofconsole.c (grub_ofconsole_readkey): Use
grub_ssize_t.
(grub_ofconsole_getw): New function.
(grub_ofconsole_init): Use grub_ssize_t and unsigned char.
(grub_ofconsole_term): New field named getwh and new initial
value.
* include/grub/powerpc/ieee1275/ieee1275.h: Move ...
* include/grub/ieee1275/ieee1275.h: ... to here. All users updated.
Move `abort', `grub_reboot', and `grub_halt' prototypes ...
* include/grub/powerpc/ieee1275/kernel.h: ... to here.
* commands/ieee1275/halt.c: Include <grub/machine/kernel.h> instead
of <grub/machine/ieee1275.h>.
* commands/ieee1275/reboot.c: Likewise.
* boot/powerpc/ieee1275/ieee1275.c: Move ...
* kern/ieee1275.c: ... to here. All users updated. Change all
parameter structs to use new type `grub_ieee1275_cell_t'.
* term/powerpc/ieee1275/ofconsole.c: Move ...
* term/ieee1275/ofconsole.c: ... to here. All users updated.
* disk/powerpc/ieee1275/ofdisk.c: Move ...
* disk/ieee1275/ofdisk.c: ... to here. All users updated.
* boot/powerpc/ieee1275/cmain.c: Change `grub_ieee1275_entry_fn' type
to return int.
* include/grub/i386/pc/console.h: Move to include/grub/console.h.
Remove unused prototypes. All users updated.
* include/grub/powerpc/ieee1275/console.h: Removed.
* include/grub/powerpc/ieee1275/ieee1275.h: Define
`grub_ieee1275_cell_t'.
* kern/powerpc/ieee1275/openfw.c: Include <grub/machine/kernel.h>.
Cast comparisons with -1 to the correct type.
* loader/powerpc/ieee1275/linux.c (kernel_entry_t): Change parameter
type to match `grub_ieee1275_entry_fn'.
Change the semantics of variable hooks. They now return strings
instead of error values.
* util/i386/pc/grub-setup.c: Include grub/env.h.
(setup): Use grub_device_set_root instead of grub_env_set.
* kern/rescue.c (grub_rescue_cmd_root): Use grub_env_set and
grub_env_get instead of grub_device_set_root and
grub_device_get_root, respectively.
* kern/main.c (grub_env_write_root): New function.
(grub_set_root_dev): Register grub_env_write_hook for "root". Use
grub_env_set instead of grub_device_set_root.
* kern/env.c (HASHSZ): Reduced to 13, because GRUB does not need
many variables.
(grub_env_set): Set ENV->VALUE to the result of ENV->WRITE_HOOK
rather than calling ENV->WRITE_HOOK afterwards.
(grub_env_get): Return the result of ENV->READ_HOOK rather than
passing a pointer of a pointer.
(grub_register_variable_hook): Change the types of "read_hook" and
"write_hook" to grub_env_read_hook_t and grub_env_write_hook_t,
respectively.
Allocate the default empty string on the heap, because this string
may be freed later.
* kern/device.c: Include grub/env.h.
(grub_device_set_root): Removed.
(grub_device_get_root): Likewise.
(grub_device_open): Use grub_env_get instead of
grub_device_get_root.
* include/grub/env.h (grub_env_read_hook_t): New type.
(grub_env_write_hook_t): Likewise.
(grub_env_var): Change the types of "read_hook" and "write_hook"
to grub_env_read_hook_t and grub_env_write_hook_t, respectively.
(grub_register_variable_hook): Likewise.
* include/grub/device.h (grub_device_set_root): Removed.
(grub_device_set_root): Likewise.
* fs/fat.c (grub_fat_dir): Make a copy of PATH in DIRNAME, and
make sure that DIRNAME terminates with '/', so that
grub_fat_find_dir will fail if PATH is not a directory.
* commands/ls.c (grub_ls_list_files): Remove the qualifier const
from DIRNAME.
Use the qualifier auto for print_files and print_files_long.
If FS->DIR sets GRUB_ERRNO to GRUB_ERR_BAD_FILE_TYPE, try DIRNAME
as a regular file.
Put a newline only if there is no error.
(grub_cmd_ls): Remove grub_ls_print_files, because this is not
used.
* commands/cat.c (GRUB_MOD_INIT): Use better documentation.
(grub_cat_init): Likewise.
* loader/i386/pc/chainloader_normal.c (GRUB_MOD_INIT): Likewise.
(options): Likewise.
* commands/configfile.c (GRUB_MOD_INIT): Likewise.
(grub_configfile_init): Likewise.
* font/manager.c (GRUB_MOD_INIT): Likewise.
* commands/help.c (GRUB_MOD_INIT): Likewise.
(grub_help_init): Likewise.
* normal/command.c (grub_command_init): Likewise.
* loader/i386/pc/linux_normal.c (GRUB_MOD_INIT): Likewise.
* disk/loopback.c (grub_loop_init): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/ls.c (grub_ls_init): Likewise.
(GRUB_MOD_INIT): Likewise.
(options): Likewise.
* commands/boot.c (grub_boot_init): Likewise.
(GRUB_MOD_INIT): Likewise.
* loader/i386/pc/multiboot_normal.c (GRUB_MOD_INIT): Likewise.
* commands/i386/pc/reboot.c (grub_reboot_init): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/cmp.c (grub_cmp_init): Likewise.
(GRUB_MOD_INIT): Likewise.
* normal/arg.c: Use <> instead of "" to include header files.
(SHORT_ARG_HELP): New macro.
(SHORT_ARG_USAGE): Likewise.
(help_options): Specify SHORT_ARG_HELP and SHORT_ARG_USAGE instead
of 'h' and 'u' for help and usage, respectively. Use more GNU-like
descriptions.
(find_short): Check if C is 'h' or 'u' explicitly.
(grub_arg_show_help): Use space characters instead of tabs. Treat
SHORT_ARG_HELP and SHORT_ARG_USAGE exceptionally so that -h and -u
are shown with --help and --usage only if they are not used for
the command itself.
(parse_option): Use SHORT_ARG_HELP and SHORT_ARG_USAGE instead of
'h' and 'u'.
* include/grub/arg.h (struct grub_arg_option): Add the qualifier
const into "longarg". Change the type of "shortarg" to int.
* boot/i386/pc/boot.S (boot_drive_check): New label.
* include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_DRIVE_CHECK): New
macro.
* util/i386/pc/grub-setup.c (setup): Added a workaround for BIOSes
which do not pass a boot drive correctly. Copied from GRUB Legacy.
* kern/i386/pc/startup.S (grub_gate_a20): Rewritten for
robustness. This routine now supports a BIOS call and System
Control Port A to modify the gate A20.
* include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_RAW_SIZE):
Increased to 0x440.
* DISTLIST: Added genfslist.sh.
* normal/main.c (fs_module_list): New variable.
(autoload_fs_module): New function.
(read_fs_list): Likewise.
(grub_normal_execute): Call read_fs_list.
* kern/fs.c (grub_fs_autoload_hook): New variable.
(grub_fs_probe): Added support for auto-loading.
* include/grub/normal.h (struct grub_fs_module_list): New struct.
(grub_fs_module_list_t): New type.
* include/grub/fs.h (grub_fs_autoload_hook_t): New type.
(grub_fs_autoload_hook): New prototype.
* genfslist.sh: New file.
* genmk.rb: Added a rule to generate a filesystem list.
* boot/powerpc/ieee1275/cmain.c (module_info): Remove definition.
(grub_ieee1275_chosen): New variable.
(cmain): Initialize and use `grub_ieee1275_chosen' instead of
`chosen'.
* boot/powerpc/ieee1275/crt0.S (init_stack): Remove stack space.
* boot/powerpc/ieee1275/ieee1275.c (grub_ieee1275_get_property):
Rename first argument to `phandle' for consistency.
(grub_ieee1275_get_property_length): Likewise.
(grub_ieee1275_next_property): Likewise. Change type of first argument
to grub_ieee1275_phandle_t.
* include/grub/powerpc/ieee1275/ieee1275.h (grub_ieee1275_entry_fn):
Move export next to declaration.
(grub_ieee1275_chosen): New variable.
* include/grub/powerpc/ieee1275/kernel.h (GRUB_IEEE1275_MODULE_BASE):
Correct cosmetic typo.
* kern/powerpc/ieee1275/init.c (grub_set_prefix): Use
`grub_ieee1275_chosen'.
* kern/powerpc/ieee1275/openfw.c (grub_map): Likewise.
* loader/powerpc/ieee1275/linux.c (grub_linux_boot): Likewise.
(grub_rescue_cmd_linux): Set `initrd_addr' to 0.
* term/powerpc/ieee1275/ofconsole.c (grub_ofconsole_refresh): Use
`grub_ieee1275_chosen'.
Automatic loading of commands is supported.
* normal/main.c (read_command_list): New function.
(grub_normal_execute): Call read_command_list.
* normal/command.c (grub_register_command): Return zero or CMD.
Allocate CMD->NAME from the heap.
Initialize CMD->MODULE_NAME to zero.
Find the same name as well. If the same command is found and it is
a dummy command, overwrite members. If it is not a dummy command,
return zero.
(grub_unregister_command): Free Q->NAME and Q->MODULE_NAME.
(grub_command_find): If a dummy command is found, load a module
and retry to find a command only once.
* normal/cmdline.c (grub_tab_complete): Call grub_command_find to
make sure that each command is loaded.
* include/grub/normal.h (GRUB_COMMAND_FLAG_NOT_LOADED): New
macro.
(struct grub_command): Remove const from the member `name'.
Add a new member `module_name'.
(grub_register_command): Return grub_command_t.
* commands/help.c (grub_cmd_help): Call grub_command_find to make
sure that each command is loaded.
* genmk.rb (PModule::rule): Specify a module name without the
suffix ".mod" to gencmdlist.sh.
* commands/default.h: New file.
* commands/timeout.h: Likewise.
* normal/context.c: Likewise.
* util/misc.c: Do not include sys/times.h.
Include sys/time.h and grub/machine/time.h.
(grub_get_rtc): Rewritten with gettimeofday.
* util/grub-emu.c (main): Call grub_default_init and
grub_timeout_init before grub_normal_init, and call
grub_timeout_fini and grub_default_fini after grub_main.
* util/console.c (grub_ncurses_checkkey): Return the read
character or -1.
* normal/menu.c (run_menu): Set MENU->TIMEOUT to -1 once it
timeouts.
* normal/main.c (read_config_file): Push MENU. If this fails,
print an error and wait for a user input.
Print an error only if GRUB_ERRNO is not GRUB_ERR_NONE.
If a menu is empty or an error occurs, pop MENU.
(grub_normal_execute): Pop and free MENU after grub_menu_run
returns.
* kern/loader.c (grub_loader_boot): Call grub_machine_fini.
* include/grub/powerpc/ieee1275/time.h [GRUB_UTIL]: Do not
include time.h.
[GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as
without GRUB_UTIL.
* include/grub/i386/pc/time.h [GRUB_UTIL]: Do not include
time.h.
[GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as
without GRUB_UTIL.
* include/grub/normal.h (struct grub_menu_list): New struct.
(grub_menu_list_t): New type.
(struct grub_context): New struct.
(grub_context_t): New type.
(grub_register_command): Got rid of EXPORT_FUNC.
(grub_unregister_command): Likewise.
(grub_context_get): New prototype.
(grub_context_get_current_menu): Likewise.
(grub_context_push_menu): Likewise.
(grub_context_pop_menu): Likewise.
[GRUB_UTIL] (grub_default_init): Likewise.
[GRUB_UTIL] (grub_default_fini): Likewise.
[GRUB_UTIL] (grub_timeout_init): Likewise.
[GRUB_UTIL] (grub_timeout_fini): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Added commands/default.c,
commands/timeout.c and normal/context.c.
(pkgdata_MODULES): Added default.mod and timeout.mod.
(normal_mod_SOURCES): Added normal/context.c.
(default_mod_SOURCES): New variable.
(default_mod_CFLAGS): Likewise.
(timeout_mod_SOURCES): Likewise.
(timeout_mod_CFLAGS): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Copied from
conf/i386-pc.rmk.
(pkgdata_MODULES): Added default.mod and timeout.mod.
(normal_mod_SOURCES): Added normal/context.c.
(default_mod_SOURCES): New variable.
(default_mod_CFLAGS): Likewise.
(timeout_mod_SOURCES): Likewise.
(timeout_mod_CFLAGS): Likewise.
* Makefile.in (all-local): Added $(MKFILES).
* 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.
* 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'.
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>.
* 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.
* 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.
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.
* 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.
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.
* conf/i386-pc.rmk (kernel_img_SOURCES): Added kern/fshelp.c.
(grub_mkimage_LDFLAGS): Likewise.
(grub_emu_SOURCES): Likewise.
(kernel_img_HEADERS): Added fshelp.h.
* fs/ext2.c: Include <grub/fshelp.h>.
(FILETYPE_REG): New macro.
(FILETYPE_INO_REG): Likewise.
(grub_ext_sblock): Renamed to `grub_ext2_sblock'.
Changed all users.
(ext2_block_group): Renamed to `grub_ext2_block_group'. Changed
all users.
(grub_fshelp_node): New struct.
(grub_ext2_data): Added member `diropen'. Changed member `inode'
to a pointer.
(grub_ext2_get_file_block): Removed function.
(grub_ext2_read_block): New function.
(grub_ext2_read_file): Replaced parameter `data' by `node'.
This function was written.
(grub_ext2_mount): Read the root inode. Create a diropen struct.
(grub_ext2_find_file): Removed function.
(grub_ext2_read_symlink): New function.
(grub_ext2_iterate_dir): Likewise.
(grub_ext2_open): Rewritten.
(grub_ext2_dir): Rewritten.
* include/grub/fshelp.h: New file.
* fs/fshelp.c: Likewise.
* normal/menu.c: Include grub/loader.h and grub/machine/time.h.
(print_message): Add a missing newline.
(run_menu): Added timeout support.
(run_menu_entry): New local function.
(grub_menu_run): Added support for booting.
* kern/loader.c (grub_loader_is_loaded): New function.
* include/grub/powerpc/ieee1275/time.h: Include grub/symbol.h.
(grub_get_rtc): Exported.
* include/grub/i386/pc/time.h: Include grub/symbol.h.
(grub_get_rtc): Exported.
* include/grub/normal.h (struct grub_command_list): Remove
constant from the member `command'.
* include/grub/loader.h (grub_loader_is_loaded): Declared.
* include/grub/err.h (GRUB_ERR_INVALID_COMMAND): New constant.
* conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/time.h.
Add support for the JFS filesystem.
* fs/jfs.c: New file.
* include/grub/fs.h (grub_jfs_init): New prototype.
(grub_jfs_fini): New prototype.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add fs/jfs.c.
(grub_emu_SOURCES): Likewise.
(pkgdata_MODULES): Add jfs.mod.
(jfs_mod_SOURCES): New variable.
(jfs_mod_CFLAGS): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add fs.jfs.c.
(grubof_SOURCES): Likewise.
* util/grub-emu.c (main): Initialize and deinitialize JFS support.
* fs/fat.c (grub_fat_find_dir): Convert the filename little
endian to the host endian.
(grub_fat_utf16_to_utf8): Move function from there...
* kern/misc.c (grub_utf16_to_utf8): ...to here. Do not convert
the endianess of the source string anymore.
* include/grub/misc.h (grub_utf16_to_utf8): New prototype.
* commands/boot.c (grub_boot_init) [GRUB_UTIL]: Make conditional.
(grub_boot_fini) [GRUB_UTIL]: Likewise.
(GRUB_MOD_INIT) [!GRUB_UTIL]: Likewise.
(GRUB_MOD_FINI) [!GRUB_UTIL]: Likewise.
* fs/hfs.c (grub_hfs_find_node): Add a prototype for `node_found'.
(grub_hfs_iterate_dir): Make the function static. Add prototypes
for `node_found' and `it_dir'.
(grub_hfs_dir): Add prototype for `dir_hook'.
* fs/minix.c (grub_minix_get_file_block): Add prototype for
`grub_get_indir'. Rename `indir' in two blocks to `indir16'
and `indir32' to silence a gcc warning.
* include/grub/fs.h (grub_hfs_init): New prototype.
(grub_hfs_fini): Likewise.
Each disk device has its own id now. This is useful to make use
of multiple disk devices.
* include/grub/disk.h (grub_disk_dev_id): New enum.
(GRUB_DISK_DEVICE_BIOSDISK_ID): New constant.
(GRUB_DISK_DEVICE_OFDISK_ID): Likewise.
* disk/i386/pc/biosdisk.c (grub_biosdisk_dev): Specify
GRUB_DISK_DEVICE_BIOSDISK_ID as an id.
* disk/powerpc/ieee1275/ofdisk.c (grub_ofdisk_dev): Specify
GRUB_DISK_DEVICE_OFDISK_ID as an id.
* util/i386/pc/biosdisk.c (grub_util_biosdisk_dev): Specify
GRUB_DISK_DEVICE_BIOSDISK_ID as an id.
* include/grub/disk.h (struct grub_disk_dev): Added a new member
"id" which is used by the cache manager.
* normal/main.c (grub_normal_init_page): Use "GNU GRUB" instead
of just "GRUB".
* include/grub/arg.h (GRUB_ARG_OPTION_OPTIONAL): Surround macro
with parentheses.
* fs/ext2.c (FILETYPE_UNKNOWN): New macro.
(grub_ext2_dir): In case the directory entry type is unknown, read
it from the inode.
Add support for UFS version 1 and 2. Add support for the minix
filesystem version 1 and 2, both the variants with 14 and 30 long
filenames.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add fs/ufs.c and
fs/minix.c.
(grub_emu_SOURCES): Likewise.
(pkgdata_MODULES): Add ufs.mod and minix.mod.
(ufs_mod_SOURCES): New variable.
(ufs_mod_CFLAGS): Likewise.
(minix_mod_SOURCES): Likewise.
(minix_mod_CFLAGS): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add fs/ufs.c and
fs/minix.c.
(grubof_SOURCES): Likewise.
* fs/ufs.c: New file.
* fs/minix.c: New file.
* include/grub/fs.h (grub_ufs_init): New prototype.
(grub_ufs_fini): Likewise.
(grub_minix_init): Likewise.
(grub_minix_fini): Likewise.
* util/grub-emu.c (main): Initialize and deinitialize UFS and
minix fs.
All symbols prefixed with PUPA_ and pupa_ are renamed to GRUB_
and grub_, respectively. Because the conversion is trivial and
mechanical, I omit the details here. Please refer to the CVS
if you need more information.
Add support for the newworld apple macintosh (PPC). This has been
tested on the powerbook 2000 only. It only adds support for
generic ieee1275 functions, console and disk support. This should
be easy to port to other architectures with support for Open
Firmware.
* configure.ac: Accept the powerpc as host_cpu. In the case of
the powerpc cpu set the host_vendor to ieee1275. Make sure the i386
specific tests are only executed while building for the i386.
Inverse test for crosscompile.
* genmk.rb (Utility): Allow assembler files.
* normal/cmdline.c (pupa_tab_complete): Reset pupa_errno.
* conf/powerpc-ieee1275.rmk: New file.
* disk/powerpc/ieee1275/ofdisk.c: Likewise.
* disk/powerpc/ieee1275/partition.c: Likewise.
* include/pupa/powerpc/ieee1275/biosdisk.h: Likewise.
* include/pupa/powerpc/ieee1275/console.h: Likewise.
* include/pupa/powerpc/ieee1275/partition.h: Likewise.
* include/pupa/powerpc/ieee1275/time.h: Likewise.
* include/pupa/powerpc/ieee1275/util/biosdisk.h: Likewise.
* include/pupa/powerpc/ieee1275/multiboot.h: Likewise.
* include/pupa/powerpc/ieee1275/loader.h
* include/pupa/powerpc/setjmp.h: Likewise.
* include/pupa/powerpc/types.h: Likewise.
* kern/powerpc/ieee1275/init.c: Likewise.
* kern/powerpc/ieee1275/openfw.c: Likewise.
* term/powerpc/ieee1275/ofconsole.c: Likewise.
These files were written by Johan Rydberg
(jrydberg@night.trouble.net) and I only modified them slightly.
* boot/powerpc/ieee1275/cmain.c: New file.
* boot/powerpc/ieee1275/crt0.S: Likewise.
* boot/powerpc/ieee1275/ieee1275.c: Likewise.
* include/pupa/powerpc/ieee1275/ieee1275.h: Likewise.
* commands/boot.c: New file.
* commands/cat.c: Likewise.
* commands/cmp.c: Likewise.
* commands/ls.c: Likewise.
* commands/terminal.c: Likewise.
* normal/command.c: Include <pupa/env.h> and <pupa/dl.h>.
(pupa_register_command): Changed interface to match the new
argument parser.
(pupa_command_execute): Changed (almost rewritten) so it uses
pupa_split_command. Added support for setting variables using the
syntax `foo=bar'.
(rescue_command): Changed to work with the new argument parser.
(terminal_command): Moved from here to commands/terminal.c.
(set_command): New function.
(unset_command): New function.
(insmod_command): New function.
(rmmod_command): New function.
(lsmod_command): New function.
(pupa_command_init): Don't initialize the command terminal
anymore. Initialize the commands set, unset, insmod, rmmod and
lsmod.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/env.c.
(kernel_img_HEADERS): Add arg.h and env.h.
(pupa_mkimage_LDFLAGS): Add kern/env.c.
(pupa_emu_SOURCES): Add kern/env.c, commands/ls.c,
commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c,
normal/arg.c.
(pkgdata_MODULES): Add ls.mod, boot.mod, cmp.mod, cat.mod and
terminal.mod.
(normal_mod_SOURCES): Add normal/arg.c and normal/arg.c.
(boot_mod_SOURCES): New variable.
(terminal_mod_SOURCES): Likewise.
(ls_mod_SOURCES): Likewise.
(cmp_mod_SOURCES): Likewise.
(cat_mod_SOURCES): Likewise.
* normal/arg.c: New file.
* kern/env.c: Likewise.
* include/pupa/arg.h: Likewise.
* include/pupa/env.h: Likewise.
* font/manager.c (font_command): Changed to match argument parsing
interface changes.
(PUPA_MOD_INIT): Likewise.
* hello/hello.c (pupa_cmd_hello): Likewise.
(PUPA_MOD_INIT): Likewise.
* include/pupa/disk.h: Include <pupa/device.h>.
(pupa_print_partinfo): New prototype.
* include/pupa/dl.h (pupa_dl_set_prefix): Prototype removed.
(pupa_dl_get_prefix): Likewise.
* include/pupa/misc.h: Include <pupa/err.h>.
(pupa_isgraph): New prototype.
(pupa_isdigit): Likewise.
(pupa_split_cmdline): Likewise.
* include/pupa/normal.h: Include <pupa/arg.h>.
(pupa_command): Changed the prototype of the member `func' to
match the argument parsing interface. Added member `options'.
(pupa_register_command): Updated to match function.
(pupa_arg_parse): New prototype.
(pupa_hello_init) [PUPA_UTIL]: New prototype.
(pupa_hello_fini) [PUPA_UTIL]: Likewise.
(pupa_ls_init) [PUPA_UTIL]: Likewise.
(pupa_ls_fini) [PUPA_UTIL]: Likewise.
(pupa_cat_init) [PUPA_UTIL]: Likewise.
(pupa_cat_fini) [PUPA_UTIL]: Likewise.
(pupa_boot_init) [PUPA_UTIL]: Likewise.
(pupa_boot_fini) [PUPA_UTIL]: Likewise.
(pupa_cmp_init) [PUPA_UTIL]: Likewise.
(pupa_cmp_fini) [PUPA_UTIL]: Likewise.
(pupa_terminal_init) [PUPA_UTIL]: Likewise.
(pupa_terminal_fini) [PUPA_UTIL]: Likewise.
* kern/disk.c: Include <pupa/file.h>.
(pupa_print_partinfo): New function.
* kern/dl.c: Include <pupa/env.h>.
(pupa_dl_dir): Variable removed.
(pupa_dl_load): Use the environment variable `prefix' instead of
the variable pupa_dl_dir.
(pupa_dl_set_prefix): Function removed.
(pupa_dl_get_prefix): Likewise.
* kern/i386/pc/init.c: Include <pupa/env.h>.
(pupa_machine_init): Use the environment variable `prefix' instead of
using pupa_dl_set_prefix to set the prefix.
* kern/main.c: Include <pupa/env.h>.
(pupa_set_root_dev): Use the environment variable `prefix' instead of
using pupa_dl_get_prefix to get the prefix.
* kern/misc.c: Include <pupa/env.h>.
(pupa_isdigit): New function.
(pupa_isgraph): Likewise.
(pupa_ftoa): Likewise.
(pupa_vsprintf): Added support for printing values of the type
`double'. Make it possible to format variable output when using
formatting like `%1.2%f'.
(pupa_split_cmdline): New function.
* kern/rescue.c: Include <pupa/env.h>.
(next_word): Removed function.
(pupa_rescue_cmd_prefix): Likewise.
(pupa_rescue_cmd_set): New function.
(pupa_rescue_cmd_unset): New function.
(pupa_enter_rescue_mode): Use the `pupa_split_cmdline' function to
split the command line instead of splitting it here. Added
support for setting variables using the syntax `foo=bar'. Don't
initialize the prefix command anymore. Initialized the set and
unset commands.
* normal/cmdline.c: Include <pupa/env.h>.
(pupa_tab_complete): Added prototypes for print_simple_completion,
print_partition_completion, add_completion, iterate_commands,
iterate_dev, iterate_part and iterate_dir. Moved code to print
partition information from here to kern/disk.c.
(pupa_cmdline_run): Don't check if the funtion exists anymore.
* normal/main.c: Include <pupa/env.h>.
(pupa_rescue_cmd_normal): Use the environment variable `prefix'
instead of using pupa_dl_get_prefix to get the prefix.
* term/i386/pc/vga.c: Include <pupa/arg.h>.
(check_vga_mem): Cast pointers to `void *' to silence a gcc
warning.
(pupa_vga_putchar) [! DEBUG_VGA]: Removed for this case.
(pupa_vga_setcolor): Declare unused variables with `__attribute__
((unused))' to silence a gcc warning.
(pupa_vga_setcolor): Likewise.
(debug_command): Changed to match argument parsing
interface changes.
* util/pupa-emu.c: Include <pupa/env.h>.
(options): Added 0's for unused fields to silence a gcc warning.
(argp): Likewise.
(main): Use the environment variable `prefix' instead of using
pupa_dl_set_prefix to set the prefix. Initialize the commands ls,
boot, cmp, cat and terminal. Finish the commands boot, cmp, cat
and terminal.
* util/i386/pc/getroot.c: Include <pupa/i386/pc/util/biosdisk.h>.
* util/misc.c: Include <malloc.h>.
(pupa_malloc): Rewritten so errors are correctly reported.
(pupa_realloc): Likewise.
(pupa_memalign): Likewise.
(pupa_mm_init_region): Declare unused variables with
`__attribute__ ((unused))' to silence a gcc warning.
* normal/i386/setjmp.S: Remove tab at the end of the file to
silence a gcc warning.
* loader/i386/pc/linux.c (pupa_rescue_cmd_initrd): Declare unused
variables with `__attribute__ ((unused))' to silence a gcc
warning.
* loader/i386/pc/multiboot.c (pupa_multiboot_unload): Make the
local variable i unsigned to silence a gcc warning.
* kern/term.c: Include <pupa/misc.h>.
(pupa_more_lines): New variable.
(pupa_more): Likewise.
(pupa_putcode): When the pager is active pause at the end of every
screen.
(pupa_set_more): New function.
* include/pupa/term.h (pupa_set_more): New prototype.
* fs/ext2.c (pupa_ext2_read_file): Correct the value of BLOCKEND
when it is EXT2_BLOCK_SIZE (data). New argument READ_HOOK, all
callers changed. Set DATA->DISK->READ_HOOK to READ_HOOK before
reading and reset it after reading.
(pupa_ext2_close): Return PUPA_ERR_NONE.
* include/pupa/i386/pc/linux.h (PUPA_LINUX_INITRD_MAX_ADDRESS):
Correct value.
(struct linux_kernel_header): Add kernel_version and
initrd_addr_max.
* loader/i386/pc/linux.c (pupa_rescue_cmd_linux): Check whether
pupa_file_read succeeds.
(pupa_rescue_cmd_initrd): Implement.
* disk/i386/pc/biosdisk.c (pupa_biosdisk_open): Correctly check
for available extensions.
* include/pupa/i386/pc/time.h: New file.
* kern/disk.c: Include <pupa/machine/time.h>.
(PUPA_CACHE_TIMEOUT): New macro.
(pupa_last_time): New variable.
(pupa_disk_open): Flush the cache when there was a timeout.
(pupa_disk_close): Reset the timer.
* kern/i386/pc/startup.S (pupa_get_rtc): Renamed from
pupa_currticks.
* util/misc.c: Include <sys/times.h>
(pupa_get_rtc): New function.
* README: In the pupa-mkimage example use _chain instead of chain
and ext2 instead of fat.
* TODO: Replace ext2fs with jfs as an example. Add an item for
adding journal playback for ext2fs.
* conf/i386-pc.rmk (pupa_setup_SOURCES): Added fs/ext2.c.
(pkgdata_MODULES): Added ext2.mod.
(ext2_mod_SOURCES): New variable.
(ext2_mod_CFLAGS): Likewise.
* include/pupa/err.h (pupa_err_t): Added PUPA_ERR_SYMLINK_LOOP.
* include/pupa/misc.h (pupa_strncpy): New prototype.
(pupa_strcat): Likewise.
(pupa_strncmp): Likewise.
* kern/misc.c (pupa_strcat): Enable function.
(pupa_strncpy): New function.
(pupa_strncmp): Likewise.
* kern/disk.c (pupa_disk_read): Set pupa_errno to PUPA_ERR_NONE
when the read failed before retrying.
* util/i386/pc/biosdisk.c (_LARGEFILE_SOURCE): Removed.
(_FILE_OFFSET_BITS): Likewise.
* configure.ac: Added AC_SYS_LARGEFILE.
I forgot to check in these changes for a long time. This adds
incomplete support for VGA console, and this is still very
buggy. Also, a lot of consideration is required for I18N,
UNICODE, and VGA font issues. Therefore, assume that this is
such that "better than nothing".
* font/manager.c: New file.
* include/pupa/font.h: Likewise.
* include/pupa/i386/pc/vga.h: Likewise.
* term/i386/pc/vga.c: Likewise.
* util/unifont2pff.rb: Likewise.
* conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/vga.h.
(pkgdata_MODULES): Added vga.mod and font.mod.
(vga_mod_SOURCES): New variables.
(vga_mod_CFLAGS): Likewise.
(font_mod_SOURCES): Likewise.
(font_mod_CFLAGS): Likewise.
* include/pupa/err.h (PUPA_ERR_BAD_FONT): New constant.
* include/pupa/term.h: Include pupa/err.h.
(struct pupa_term): Added init and fini.
Changed the argument of putchar to pupa_uint32_t.
* include/pupa/i386/pc/console.h: Include pupa/symbol.h.
(pupa_console_real_putchar): New prototype.
(pupa_console_putchar): Removed.
(pupa_console_checkkey): Exported.
(pupa_console_getkey): Likewise.
* kern/misc.c (pupa_vsprintf): Add support for UNICODE
characters.
* kern/term.c (pupa_term_set_current): Rewritten.
(pupa_putchar): Likewise.
(pupa_putcode): New function.
* kern/i386/pc/startup.S (pupa_console_putchar): Renamed to ...
(pupa_console_real_putchar): ... this.
(pupa_vga_set_mode): New function.
(pupa_vga_get_font): Likewise.
* normal/command.c: Include pupa/term.h.
(terminal_command): New function.
(pupa_command_init): Register the command "terminal".
* normal/menu.c (DISP_LEFT): Changed to a UNICODE value.
(DISP_UP): Likewise.
(DISP_RIGHT): Likewise.
(DISP_DOWN): Likewise.
(DISP_HLINE): Likewise.
(DISP_VLINE): Likewise.
(DISP_UL): Likewise.
(DISP_UR): Likewise.
(DISP_LL): Likewise.
(DISP_LR): Likewise.
* term/i386/pc/console.c (pupa_console_putchar): New function.
* kern/i386/pc/lzo1x.S: New file.
* util/i386/pc/pupa-mkimage.c: Include lzo1x.h.
(compress_kernel): New variable.
(generate_image): Heavily modified to support compressing a
large part of the core image.
* util/misc.c (pupa_util_read_image): Fix a file descriptor
leak.
(pupa_util_load_image): New function.
* kern/i386/pc/startup.S: Include pupa/machine/kernel.h.
(pupa_compressed_size): New variable.
(codestart): Enable Gate A20 here.
Decompress the compressed part of the core image.
Rearrange the code to put functions and variables which are
required for initialization in the non-compressed part.
Include lzo1x.S.
* kern/i386/pc/init.c (pupa_machine_init): Don't enable Gate A20
here.
* include/pupa/util/misc.h (pupa_util_write_image): Declared.
* include/pupa/i386/pc/kernel.h
(PUPA_KERNEL_MACHINE_COMPRESSED_SIZE): New macro.
(PUPA_KERNEL_MACHINE_INSTALL_DOS_PART): Increased by 4.
(PUPA_KERNEL_MACHINE_INSTALL_BSD_PART): Likewise.
(PUPA_KERNEL_MACHINE_PREFIX): Likewise.
(PUPA_KERNEL_MACHINE_RAW_SIZE): New macro.
* conf/i386-pc.rmk (pupa_mkimage_LDFLAGS): New variable.
* genmk.rb (Image#rule): Put LDFLAGS at the end of a line.
(Utility#rule): Likewise.
* configure.ac: Check if LZO is available.
* include/pupa/normal.h: New file.
* include/pupa/setjmp.h: Likewise.
* include/pupa/i386/setjmp.h: Likewise.
* normal/cmdline.c: Likewise.
* normal/command.c: Likewise.
* normal/main.c: Likewise.
* normal/menu.c: Likewise.
* normal/i386/setjmp.S: Likewise.
* loader/i386/pc/linux.c (pupa_rescue_cmd_linux): Made global.
(pupa_rescue_cmd_initrd): Likewise.
* loader/i386/pc/chainloader.c (pupa_rescue_cmd_chainloader):
Likewise.
* kern/i386/pc/startup.S (translation_table): New variable.
(translate_keycode): New function.
(pupa_console_getkey): Call translate_keycode.
* kern/rescue.c (attempt_normal_mode): New function.
(pupa_enter_rescue_mode): Attempt to execute the normal mode. If
it failed, print a message.
* kern/mm.c (pupa_real_malloc): Print more information when a
free magic is broken.
(pupa_free): If the first free header is not free actually, set
it to P.
* kern/main.c (pupa_load_normal_mode): Just load the module
"normal".
(pupa_main): Don't print the message
"Entering into rescue mode..." here.
* include/pupa/i386/pc/loader.h (pupa_rescue_cmd_initrd):
Declared.
(pupa_rescue_cmd_initrd): Likewise.
(pupa_rescue_cmd_initrd): Likewise.
* include/pupa/symbol.h (FUNCTION): Specify the type.
(VARIABLE): Likewise.
* include/pupa/err.h (pupa_err_t): Added
PUPA_ERR_UNKNOWN_COMMAND.
* include/pupa/dl.h (pupa_dl_set_prefix): Exported.
(pupa_dl_get_prefix): Likewise.
* conf/i386-pc.rmk (pkgdata_MODULES): Added normal.mod.
Added _chain.mod and _linux.mod instead of chain.mod and
linux.mod.
(chain_mod_SOURCES): Renamed to ...
(_chain_mod_SOURCES): ... this.
(chain_mod_CFLAGS): Renamed to ...
(_chain_mod_CFLAGS): ... this.
(linux_mod_SOURCES): Renamed to ...
(_linux_mod_SOURCES): ... this.
(linux_mod_CFLAGS): Renamed to ...
(_linux_mod_CFLAGS): ... this.
(normal_mod_SOURCES): New variable.
(normal_mod_CFLAGS): Likewise.
(normal_mod_ASFLAGS): Likewise.
2003-01-18 Yoshinori K. Okuji <okuji@enbug.org>
* kern/rescue.c (pupa_rescue_cmd_rmmod): Call pupa_dl_unload, if
possible.
* kern/dl.c (pupa_dl_ref): Refer dependending modules
recursively.
(pupa_dl_unref): Unrefer depending modules recursively.
Don't call pupa_dl_unload implicitly, because PUPA can crash if
a module is unloaded before one depending on that module is
unloaded.
(pupa_dl_unload): Unload depending modules explicitly,
if possible.
* include/pupa/i386/pc/linux.h: New file.
* loader/i386/pc/linux.c: Likewise.
* loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector):
Removed.
(pupa_chainloader_unload): Return PUPA_ERR_NONE.
(pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead
of PUPA_CHAINLOADER_BOOT_SECTOR.
* kern/i386/pc/startup.S: Include pupa/machine/linux.h.
(pupa_linux_prot_size): New variable.
(pupa_linux_tmp_addr): Likewise.
(pupa_linux_real_addr): Likewise.
(pupa_linux_boot_zimage): New function.
(pupa_linux_boot_bzimage): Likewise.
* kern/i386/pc/init.c (struct mem_region): New structure.
(MAX_REGIONS): New macro.
(mem_regions): New variable.
(num_regions): Likewise.
(pupa_os_area_addr): Likewise.
(pupa_os_area_size): Likewise.
(pupa_lower_mem): Likewise.
(pupa_upper_mem): Likewise.
(add_mem_region): New function.
(compact_mem_regions): Likewise.
(pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to
the size of the conventional memory and that of so-called upper
memory (before the first memory hole).
Instead of adding each found region to free memory, use
add_mem_region and add them after removing overlaps.
Also, add only 1/4 of the upper memory to free memory. The rest
is used for loading OS images. Maybe this is ad hoc, but this
makes it much easier to relocate OS images when booting.
* kern/rescue.c (pupa_rescue_cmd_module): Removed.
(pupa_enter_rescue_mode): Don't register initrd and module.
* kern/mm.c: Include pupa/dl.h.
* kern/main.c: Include pupa/file.h and pupa/device.h.
* kern/loader.c (pupa_loader_load_module_func): Removed.
(pupa_loader_load_module): Likewise.
* kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of
``.o''.
* include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared.
(pupa_linux_tmp_addr): Likewise.
(pupa_linux_real_addr): Likewise.
(pupa_linux_boot_zimage): Likewise.
(pupa_linux_boot_bzimage): Likewise.
* include/pupa/i386/pc/init.h (pupa_lower_mem): Declared.
(pupa_upper_mem): Likewise.
(pupa_gate_a20): Don't export, because turning off Gate A20 in a
module is too dangerous.
* include/pupa/loader.h (pupa_os_area_addr): Declared.
(pupa_os_area_size): Likewise.
(pupa_loader_set): Remove the first argument. Loader doesn't
manage modules or initrd any longer.
(pupa_loader_load_module): Removed.
* conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod.
(linux_mod_SOURCES): New variable.
(linux_mod_CFLAGS): Likewise.
* util/i386/pc/pupa-setup.c (setup): Convert the endianness of
the length of a blocklist correctly.
* util/i386/pc/biosdisk.c (pupa_util_biosdisk_open) [__linux__]:
Use ioctl only if the OS file is a block device.
(pupa_util_biosdisk_open): Don't use ST.ST_BLOCKS, because it is
not very useful for normal files.
* kern/main.c (pupa_set_root_dev): New function.
(pupa_load_normal_mode): Likewise.
(pupa_main): Call those above.
* include/pupa/types.h (pupa_swap_bytes16): Cast the result to
pupa_uint16_t.
* include/pupa/kernel.h (pupa_enter_normal_mode): Removed.
* util/i386/pc/pupa-setup.c: Include pupa/machine/kernel.h.
(setup): Configure the installed partition information and the
dl prefix.
* loader/i386/pc/chainloader.c (my_mod): New variable.
(pupa_chainloader_unload): New function.
(pupa_rescue_cmd_chainloader): Refer itself.
(PUPA_MOD_INIT): Save its own module in MY_MOD.
* kern/i386/pc/startup.S (install_partition): Removed.
(version_string): Likewise.
(config_file): Likewise.
(pupa_install_dos_part): New variable.
(pupa_install_bsd_part): Likewise.
(pupa_prefix): Likewise.
(pupa_chainloader_real_boot): Call pupa_dl_unload_all.
* kern/i386/pc/init.c: Include pupa/machine/kernel.h, pupa/dl.h
and pupa/misc.h.
(make_install_device): New function.
(pupa_machine_init): Set the dl prefix.
* kern/rescue.c: Include pupa/rescue.h and pupa/dl.h.
(buf): Renamed to ...
(linebuf): ... this.
(pupa_rescue_cmd_prefix): New function.
(pupa_rescue_cmd_insmod): Likewise.
(pupa_rescue_cmd_rmmod): Likewise.
(pupa_rescue_cmd_lsmod): Likewise.
(pupa_enter_rescue_mode): Register new commands: prefix, insmod,
rmmod and lsmod.
* kern/mm.c (pupa_memalign): If failed even after invalidating
disk caches, unload unneeded modules and retry.
* kern/misc.c (pupa_memmove): New function.
(pupa_memcpy): Removed.
(pupa_strcpy): New function.
(pupa_itoa): Made static.
* kern/dl.c (pupa_dl_iterate): New function.
(pupa_dl_ref): Likewise.
(pupa_dl_unref): Likewise.
(pupa_dl_unload): Return if succeeded or not.
(pupa_dl_unload_unneeded): New function.
(pupa_dl_unload_all): Likewise.
(pupa_dl_init): Renamed to ...
(pupa_dl_set_prefix): ... this.
(pupa_dl_get_prefix): New function.
* include/pupa/i386/pc/kernel.h: Include pupa/types.h.
(PUPA_KERNEL_MACHINE_INSTALL_DOS_PART): New macro.
(PUPA_KERNEL_MACHINE_INSTALL_BSD_PART): Likewise.
(PUPA_KERNEL_MACHINE_PREFIX): Likewise.
(pupa_install_dos_part): Declared.
(pupa_install_bsd_part): Likewise.
(pupa_prefix): Likewise.
(pupa_boot_drive): Likewise.
* include/pupa/types.h: Fix a typo.
* include/pupa/misc.h (pupa_memcpy): New macro. Just an alias to
pupa_memmove.
(pupa_memmove): Declared.
(pupa_strcpy): Likewise.
* include/pupa/dl.h (PUPA_MOD_INIT): Change the prototype. Now
pupa_mod_init takes one argument, its own module.
(pupa_dl_unload_unneeded): Declared.
(pupa_dl_unload_all): Likewise.
(pupa_dl_ref): Likewise.
(pupa_dl_unref): Likewise.
(pupa_dl_iterate): Likewise.
(pupa_dl_init): Renamed to ...
(pupa_dl_set_prefix): ... this.
(pupa_dl_get_prefix): Declared.
* fs/fat.c [!PUPA_UTIL] (my_mod): New variable.
(pupa_fat_dir) [!PUPA_UTIL]: Prevent the fat module from being
unloaded.
(pupa_fat_open) [!PUPA_UTIL]: Refer itself if succeeded.
(pupa_fat_close) [!PUPA_UTIL]: Unrefer itself.
* configure.ac (tmp_CFLAGS): Added -Wshadow, -Wpointer-arith,
-Wmissing-prototypes, -Wundef and -Wstrict-prototypes.
* include/i386/pc/util/biosdisk.h: New file.
* util/i386/pc/biosdisk.c: Likewise.
* util/i386/pc/pupa-setup.c: Likewise.
* Makefile.in (INCLUDE_DISTFILES): Added
include/pupa/i386/pc/util/biosdisk.h.
(UTIL_DISTFILES): Added biosdisk.c and pupa-setup.c under the
directory util/i386/pc.
(install-local): Added a rule for sbin_UTILITIES.
(uninstall): Likewise.
* util/i386/pc/pupa-mkimage.c (usage): Fix a typo in the doc.
* util/misc.c (xrealloc): New function.
(pupa_malloc): Likewise.
(pupa_free): Likewise.
(pupa_realloc): Likewise.
(pupa_stop): Likewise.
(pupa_putchar): Likewise.
* kern/disk.c (pupa_disk_read): Prevent L from underflowing.
* include/pupa/util/misc.h (xrealloc): Declared.
* include/pupa/i386/pc/boot.h (PUPA_BOOT_MACHINE_BPB_START): New
macro.
(PUPA_BOOT_MACHINE_BPBEND): Renamed to ...
(PUPA_BOOT_MACHINE_BPB_END): ... this.
* include/pupa/fs.h [PUPA_UTIL] (pupa_fat_init): Declared.
[PUPA_UTIL] (pupa_fat_fini): Likewise.
* fs/fat.c [PUPA_UTIL] (pupa_fat_init): Defined. Maybe a better
way should be implemented.
[PUPA_UTIL] (pupa_fat_fini): Likewise.
* disk/i386/pc/biosdisk.c (pupa_biosdisk_call_hook): Increase
the size of NAME for safety.
(pupa_biosdisk_iterate): Search hard disks to 0x90 instead of
0x88.
* conf/i386-pc.rmk (sbin_UTILITIES): New variable.
(pupa_setup_SOURCES): Likewise.
* genmk.rb (Utility#rule): Add $(BUILD_CFLAGS) into the rules.