* common.rmk (bin_UTILITIES): Add grub-pe2elf.
(grub_pe2elf_SOURCES): New macro.
(CLEANFILES): Add grub-pe2elf.
* include/grub/efi/pe32.h (GRUB_PE32_SCN_ALIGN_1BYTES): New constant.
(GRUB_PE32_SCN_ALIGN_2BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_4BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_8BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_16BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_32BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_64BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_SHIFT): Likewise.
(GRUB_PE32_SCN_ALIGN_MASK): Likewise.
(GRUB_PE32_SYM_CLASS_EXTERNAL): Likewise.
(GRUB_PE32_SYM_CLASS_STATIC): Likewise.
(GRUB_PE32_SYM_CLASS_FILE): Likewise.
(GRUB_PE32_DT_FUNCTION): Likewise.
(GRUB_PE32_REL_I386_DIR32): Likewise.
(GRUB_PE32_REL_I386_REL32): Likewise.
(grub_pe32_symbol): New structure.
(grub_pe32_reloc): Likewise.
* util/grub-pe2elf.c: New file.
* configure.ac: Set TARGET_OBJ2ELF if host os is cygwin. Don't test for
start symbol in non pc platform.
* genmk.rb: Use TARGET_OBJ2ELF to convert native object format to elf.
The following patches are from Christian Franke.
* include/grub/dl.h: Remove .previous, gas supports this only
for ELF format.
* include/grub/symbol.h [__CYGWIN__] (#define FUNCTION/VARIABLE):
Remove .type, gas supports this only for ELF format.
* kern/dl.c (grub_dl_resolve_dependencies): Add check for trailing
nullbytes in symbol table. This fixes an infinite loop if table is
zero filled.
* Makefile.in: Add autoconf replacements TARGET_IMG_LDSCRIPT,
TARGET_IMG_LDFLAGS and EXEEXT.
* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Replace -Wl,-N by
TARGET_IMG_LDFLAGS_AC.
(grub_CHECK_STACK_ARG_PROBE): New function.
* conf/i386-pc.rmk: Replace -Wl,-N by TARGET_IMG_LDFLAGS.
* conf/i386-pc-cygwin-ld-img.sc: New linker script.
* configure.ac: Add check for linker script "conf/${target}-img-ld.c"
to set TARGET_IMG_LD* accordingly.
Add check for Cygwin to set TARGET_MOD_OBJCOPY accordingly.
Add call to grub_CHECK_STACK_ARG_PROBE.
Use TARGET_IMG_LDFLAGS to check start, bss_start, end symbols.
* genkernsyms.sh.in: Handle HAVE_ASM_USCORE case.
* genmk.rb: Add EXEEXT to CLEANFILES.
* Makefile.in (MODULE_LDFLAGS): New variable.
* aclocal.m4 (grub_PROG_LD_BUILD_ID_NONE): New macro. Check if
the linker accepts --build-id=none.
* configure.ac: Call grub_PROG_LD_BUILD_ID_NONE. Substitute
MODULE_LDFLAGS.
* genmk.rb: Use MODULE_LDFLAGS when linking modules.
* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): take only .text
section into account, newer toolchains generate unique build ids
* configure.ac: remove the test for --build-id=none acceptance,
we want build ids to bre preserved
* genmk.rb: add -R .note.gnu.build-id to objcopy, so build id
far from other sections don't cause the raw binary images grow
size
* genmk.rb (Image): Copy `extra_flags' from here ...
(PModule): ... to here. Use it in `#{obj}: #{src}' rule.
* commands/i386/cpuid.c (grub_cmd_cpuid): Add __attribute__ ((unused))
to `argc' and `args' arguments.
Patch from Simon Peter <dn.tlp@gmx.net>:
* genmk.rb (Utility): Append $(#{src}_DEPENDENCIES) to #{obj} targets.
* conf/i386-pc.rmk: Replace grub-probe_DEPENDENCIES with
util/grub-probe.c_DEPENDENCIES. Replace grub-setup_DEPENDENCIES with
util/i386/pc/grub-setup.c_DEPENDENCIES.
* conf/i386-efi.rmk: Replace grub-probe_DEPENDENCIES with
util/grub-probe.c_DEPENDENCIES.
* conf/powerpc-ieee1275.rmk: Likewise.
* genmk.rb: Let GCC generate dependenceies the first time it
compiles a file; using the -MD option.
* conf/common.mk: Regenerate.
* conf/i386-pc.mk: Likewise.
* conf/i386-efi.mk: Likewise.
* conf/powerpc-ieee1275.mk: Likewise.
* conf/sparc64-ieee1275.mk: Likewise.
* conf/common.rmk (grub_modules_init.lst): Depends on
$(MODSRCFILES). Grep only the files in $(MODSRCFILES). Make sure
that the target does not exist before producing.
(grub_modules_init.h): Remove the target before generating.
(grub_emu_init.c): Likewise.
* genmk.rb (PModule::rule): Add source files into MODSRCFILES.
* genmk.rb (Image::rule): Set FLAG to CFLAGS or ASFLAGS instead of
TARGET_CFLAGS or TARGET_ASFLAGS. There is no reason why
target-specific flags should be prefixed.
(PModule::rule): Likewise.
* 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'.
* kern/rescue.c (grub_rescue_cmd_rmmod): If the reference count is
negative, unload the module.
* util/i386/pc/grub-setup.c (setup): The name of the PC partition
map is "pc_partition_map" but not "pc".
(usage): Fix the description. The options are --boot-image and
--core-image but not --boot-file or --core-file.
(main): If not specified explicitly, make BOOT_FILE and CORE_FILE
based on DEFAULT_BOOT_FILE and DEFAULT_CORE_FILE with DIR or
DEFAULT_DIRECTORY.
* util/i386/pc/grub-install.in: Do not specify --boot-file or
--core-file. Specify INSTALL_DEVICE as an argument.
* util/console.c: Include config.h.
[HAVE_NCURSeS_CURSES_H]: Include ncurses/curses.h.
[HAVE_NCURSES_H]: Include ncurses.h.
[HAVE_CURSES_H]: Include curses.h.
[!A_NORMAL] (A_NORMAL): Defined as zero.
[!A_STANDOUT] (A_STANDOUT): Likewise.
* conf/i386-pc.rmk (grub_emu_LDFLAGS): Use $(LIBCURSES) instead of
-lncurses.
* conf/powerpc-ieee1275.rmk (grub_emu_LDFLAGS): Likewise.
* configure.ac: Check for curses libraries and headers.
* Makefile.in (LIBCURSES): New variable.
* genmk.rb (Script::rule): Set the executable bits.
* util/i386/pc/biosdisk.c (grub_util_biosdisk_get_grub_dev): The
name of the PC partition map is "pc_partition_map" but not "pc".
* DISTLIST: Added util/i386/pc/grub-install.in.
* util/i386/pc/grub-install.in: New file.
* conf/i386-pc.rmk (sbin_SCRIPTS): New variable.
(grub_install_SOURCES): Likewise.
* genmk.rb: Added support for scripts.
(Script): New class.
(scripts): New variable.
* Makefile.in (install-local): Install sbin_SCRIPTS by
INSTALL_SCRIPT.
(uninstall): Remove sbin_SCRIPTS.
* util/i386/pc/grub-setup.c (main): If the argument is not a GRUB
device, try to get a GRUB device by
grub_util_biosdisk_get_grub_dev.
Free DEST_DEV.
* util/i386/pc/grub-mkdevicemap.c (usage): Remove a duplicated
description for --device-map.
* 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.
* configure.ac: Fix the test for cross-compiling.
* genmk.rb (Program): Use `$(CC)' instead of `$(BUILD_CC)'. Don't
define GRUB_UTIL anymore.
* util/powerpc/ieee1275/grub-mkimage.c (load_note): Endian fixes
so this function works on other systems than just big endian.
(load_modules): Likewise.
(add_segments): Likewise.
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.
* 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.
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.
* 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/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.
Use -mrtd and -mregparm=3 to reduce the generated code sizes.
This means that any missing prototypes could be fatal. Also, you
must take care when writing assembly code. See the comments at
the beginning of startup.S, for more details.
* kern/i386/pc/startup.S (pupa_halt): Modified for the new
compilation mechanism.
(pupa_chainloader_real_boot): Likewise.
(pupa_biosdisk_rw_int13_extensions): Likewise.
(pupa_biosdisk_rw_standard): Likewise.
(pupa_biosdisk_check_int13_extensions): Likewise.
(pupa_biosdisk_get_diskinfo_int13_extensions): Likewise.
(pupa_biosdisk_get_diskinfo_standard): Likewise.
(pupa_get_memsize): Likewise.
(pupa_get_mmap_entry): Likewise.
(pupa_console_putchar): Likewise.
(pupa_console_setcursor): Likewise.
(pupa_getrtsecs): Use pushl instead of push.
* kern/i386/pc/init.c (pupa_machine_init): Use the scratch
memory instead of the stack for a mmap entry, because some
BIOSes may ignore the maximum size and overflow.
* conf/i386-pc.rmk (COMMON_CFLAGS): Added -mrtd and -mregparm=3.
* genmk.rb (PModule#rule): Compile automatically generated
sources with module-specific CFLAGS as well as other sources.