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/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'.
* util/powerpc/ieee1275/grub-mkimage.c: Include <string.h>.
(note_path): Remove variable.
(GRUB_IEEE1275_NOTE_NAME): New macro.
(GRUB_IEEE1275_NOTE_TYPE): Likewise.
(grub_ieee1275_note_hdr): New structure.
(grub_ieee1275_note_desc): Likewise.
(grub_ieee1275_note): Likewise.
(load_note): Remove `dir' argument. All callers updated. Remove
`note_img' and `path'. Do not load a file from `note_path'.
Initialize a struct grub_ieee1275_note and write that to `out'.
Use GRUB_IEEE1275_MODULE_BASE instead of MODULE_BASE.
* 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.
* 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.
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.
* loader/powerpc/ieee1275/linux.c (grub_linux_init): Pass
grub_load_linux instead of grub_rescue_cmd_linux as second
argument of grub_rescue_register_command.
* Makefile.in (RMKFILES): Add conf/powerpc-ieee1275.rmk.
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.