* kern/i386/loader.S: New file.
* kern/i386/pc/startup.S (grub_linux_prot_size): Moved from here ...
* kern/i386/loader.S (grub_linux_prot_size)... to here.
* kern/i386/pc/startup.S (grub_linux_tmp_addr): Moved from here ...
* kern/i386/loader.S (grub_linux_tmp_addr)... to here.
* kern/i386/pc/startup.S (grub_linux_real_addr): Moved from here ...
* kern/i386/loader.S (grub_linux_real_addr)... to here.
* kern/i386/pc/startup.S (grub_linux_boot_zimage): Moved from here ...
* kern/i386/loader.S (grub_linux_boot_zimage)... to here.
* kern/i386/pc/startup.S (grub_linux_boot_bzimage): Moved from here ...
* kern/i386/loader.S (grub_linux_boot_bzimage)... to here.
* kern/i386/pc/startup.S (grub_multiboot_real_boot): Moved from here ...
* kern/i386/loader.S (grub_multiboot_real_boot)... to here.
* kern/i386/pc/startup.S (grub_multiboot2_real_boot): Moved from here ...
* kern/i386/loader.S (grub_multiboot2_real_boot)... to here.
* kern/i386/realmode.S: New file.
* kern/i386/pc/startup.S (protstack): Moved from here ...
* kern/i386/realmode.S (protstack)... to here.
* kern/i386/pc/startup.S (gdt): Moved from here ...
* kern/i386/realmode.S (gdt)... to here.
* kern/i386/pc/startup.S (prot_to_real): Moved from here ...
* kern/i386/realmode.S (prot_to_real)... to here.
* kern/i386/pc/startup.S: Include `kern/i386/loader.S' and
`kern/i386/realmode.S'.
* normal/misc.c (grub_normal_print_device_info): Do not probe for
filesystem when dev->disk is unset.
Do probe for filesystem even when dev->disk->has_partitions is set.
In case a filesystem is found, always report it.
In case it isn't, if dev->disk->has_partitions is set, report that
a partition table was found instead of reporting that no filesystem
could be identified.
* kern/powerpc/ieee1275/init.c: Rename HEAP_LIMIT to HEAP_MAX_ADDR,
and make it easier to figure out.
Add HEAP_MIN_SIZE and HEAP_MAX_ADDR definitions.
(grub_claim_heap): Use HEAP_MAX_ADDR rather than taking a parameter.
Do not avoid claiming a region above HEAP_MAX_ADDR if that would
leave us with less than HEAP_MIN_SIZE total heap.
Avoid our total amount of heap to surpass HEAP_MAX_SIZE.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_test_flag): Detect
SmartFirmware version updates (as released by Sven Luther), and avoid
setting GRUB_IEEE1275_FLAG_NO_PARTITION_0 or
GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS unless the running version is
known broken.
Do not use devices at boot in chainloading.
* loader/i386/pc/chainloader.c (boot_drive): New variable.
(boot_part_addr): Likewise.
(grub_chainloader_boot): Simply call grub_chainloader_real_boot
with BOOT_DRIVE and BOOT_PART_ADDR.
(grub_chainloader_cmd): Set BOOT_DRIVE and BOOT_PART_ADDR.
Reported by Hitoshi Ozeki <h-ozeki@ck2.so-net.ne.jp>.
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.
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.
* geninitheader.sh: Process file specified in first parameter rather
than hardcoding grub_modules_init.lst.
* geninit.sh: Likewise. Also, construct header name dynamicaly rather
than hardcoding grub_modules_init.h.
* conf/common.rmk: Rename grub_modules_init.[ch] files associated with
grub-emu to grub_emu_init.[ch]. Add rules to build analogous
grub_probe_init.[ch] and grub_setup_init.[ch].
* conf/powerpc-ieee1275.rmk (grub_emu_DEPENDENCIES): Replace
grub_modules_init.h with grub_emu_init.h.
(grub_probe_DEPENDENCIES, grub_probe_SOURCES): Add new
grub_probe_init.[ch] files.
* conf/i386-efi.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
(grub_setup_DEPENDENCIES, grub_setup_SOURCES): Add new
grub_setup_init.[ch] files.
* util/grub-emu.c: Replace grub_modules_init.h with grub_emu_init.h.
* util/grub-probe.c: Include grub_probe_init.h. Use grub_init_all()
to initialize modules rather than a list of hardcoded functions.
* util/i386/pc/grub-setup.c: Include grub_setup_init.h. Use
grub_init_all() to initialize modules rather than a list of hardcoded
functions.
* 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.
* conf/i386-pc.rmk (CLEANFILES): Removed for grub-mkrescue,
because this rule is automatically generated.
(grub-mkrescue): Removed for the same reason as above.
* util/i386/efi/grub-install.in: Allow `grub_probe --target=partmap'
invocation to fail, in order to support partition-less media.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Use grub-probe to determine
which fs or partmap modules are needed (akin to its sister scripts).
Also use grub-probe to get rid of unportable /proc/mounts check.
Print the same informational message that the other scripts do, before
exitting.
* util/update-grub_lib.in (font_path): New function. Determine wether
a font file can be found and, if so, echo the GRUB path to it.
* util/update-grub.in: Handle multiple terminals depending on user
input, platform availability and font file presence. Propagate
variables of our findings to /etc/grub.d/ children.
* util/grub.d/00_header.in: Handle multiple terminals, based on
environment setup by update-grub.
* 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.
* normal/command.c (grub_command_execute): Use NULL rather than 0 for
"pager" assignment.
* util/biosdisk.c (grub_util_biosdisk_get_grub_dev): Likewise for
"pcdata".
* util/grub-probe.c (probe): Likewise for "drive_name".
* util/i386/pc/grub-mkrescue.in: Add "set -e".
Add --pkglibdir=DIR option to override pkglibdir.
Mention --image-type=TYPE in help output.
Fix --grub-mkimage (it was a no-op).
Abort gracefuly when no parameter is given.
* util/update-grub_lib.in (convert_system_path_to_grub_path): Abort if
file doesn't exist, or if it is in a filesystem grub can't read.
* util/update-grub.in: Set fallback for GRUB_FS check to "unknown". Do
not abort if GRUB_DRIVE could not be defined. Rearrange generated
header comment to fit in 80 columns when the variables are resolved.
* util/grub.d/00_header.in: Only set root variable when GRUB_DRIVE
could be identified by update-grub. Remove redundant check for
unifont.pff existance (since convert_system_path_to_grub_path now
handles that).
* 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/update-grub_lib.in: New file.
* DISTLIST: Add update-grub_lib.in.
* conf/common.rmk: Generate update-grub_lib and install it in
$(lib_DATA).
* Makefile.in: Add install routine for $(lib_DATA).
* util/grub.d/00_header.in: Use convert_system_path_to_grub_path()
function provided by update-grub_lib to support arbitrary paths of
unifont.pff.
* util/update-grub.in: Use convert_system_path_to_grub_path() to
initialize GRUB_DRIVE_BOOT and GRUB_DRIVE_BOOT_GRUB variables.
* util/biosdisk.c (linux_find_partition): Allocate real_dev on the
stack instead of on the heap.
* kern/disk.c (grub_disk_read): Make sure tmp_buf is big enough
before doing a read on it.
* configure.ac: Only use -fno-stack-protector for the target
environment.