merge mainline into ahci
This commit is contained in:
commit
548937c6d6
70 changed files with 2735 additions and 287 deletions
|
@ -31,7 +31,6 @@ genkernsyms.sh
|
|||
gensymlist.sh
|
||||
gentrigtables
|
||||
grub-bin2h
|
||||
grub-dumpbios
|
||||
grub-editenv
|
||||
grub-emu
|
||||
grub_emu_init.c
|
||||
|
|
315
ChangeLog
315
ChangeLog
|
@ -1,3 +1,318 @@
|
|||
2011-05-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
FreeDOS direct loading support.
|
||||
|
||||
* docs/grub.texi (Supported OS): Add FreeDOS.
|
||||
* grub-core/Makefile.core.def (freedos): New module.
|
||||
* grub-core/lib/i386/relocator.c (grub_relocator16_ebx): New extern
|
||||
variable.
|
||||
(grub_relocator16_boot): Handle %ebx.
|
||||
* grub-core/lib/i386/relocator16.S: Likewise.
|
||||
* grub-core/loader/i386/pc/freedos.c: New file.
|
||||
|
||||
2011-05-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Long Linux command line support.
|
||||
|
||||
* grub-core/loader/i386/linux.c (GRUB_LINUX_CL_END_OFFSET): Removed.
|
||||
(maximal_cmdline_size): New variable.
|
||||
(allocate_pages): Use maximal_cmdline_size.
|
||||
(grub_cmd_linux): Set and use maximal_cmdline_size.
|
||||
* grub-core/loader/i386/pc/linux.c (GRUB_LINUX_CL_END_OFFSET): Removed.
|
||||
(allocate_pages): Use maximal_cmdline_size.
|
||||
(grub_cmd_linux): Set and use maximal_cmdline_size.
|
||||
* include/grub/i386/linux.h (GRUB_LINUX_SETUP_MOVE_SIZE): Removed.
|
||||
(linux_kernel_header): Add fields kernel_alignment, relocatable, pad
|
||||
and cmdline_size.
|
||||
|
||||
2011-05-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
2011-05-18 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
Improve devmapper support
|
||||
|
||||
* grub-core/kern/emu/getroot.c (grub_util_is_dmraid): Removed.
|
||||
(grub_util_is_lvm): New function.
|
||||
(grub_util_get_dev_abstraction): Assume dmraid if not lvm rather
|
||||
than lvm if not dmraid.
|
||||
Handle mapped md nodes.
|
||||
* grub-core/kern/emu/hostdisk.c (device_is_mapped): Rename to ...
|
||||
(grub_util_device_is_mapped): ... this. Make always available. All users
|
||||
updated.
|
||||
(grub_util_get_dm_node_linear_info) [HAVE_DEVICE_MAPPER]: New function.
|
||||
(convert_system_partition_to_system_disk): Handle lvm, mpath and
|
||||
dmraid nodes.
|
||||
* include/grub/emu/misc.h (grub_util_device_is_mapped): New proto.
|
||||
|
||||
2011-05-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Unify grub-mkrescue (except powerpc) and grrub-mknetdir across platforms
|
||||
|
||||
* grub-core/Makefile.am (platform_DATA): Add modinfo.sh.
|
||||
* grub-core/modinfo.sh.in: New file.
|
||||
* grub-core/Makefile.core.def (modinfo.sh): New script.
|
||||
* util/grub-mknetdir.in: Use modinfo.sh.
|
||||
* util/grub-mkrescue.in: Likewise.
|
||||
|
||||
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/ia64/dl_helper.c (grub_ia64_dl_get_tramp_got_size):
|
||||
Fix potential usage of Elf32 instead of Elf64 when compiling on
|
||||
32-bit architecture. Add endianness macros while on it.
|
||||
|
||||
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Use mipsel- rather than mips- in directories involving mipsel ports to
|
||||
allow both endiannesses coexist.
|
||||
|
||||
* configure.ac: proparate target_cpu=mipsel rather than resetting to
|
||||
mips. All conditions adjusted.
|
||||
* tests/util/grub-shell-tester.in: Remove gratuitious target_cpu
|
||||
variable.
|
||||
* util/grub-install.in: Adjust conditions to take renaming into account.
|
||||
* util/grub-mkimage.c (image_targets): Likewise. New target
|
||||
mips-qemu_mips-elf for bigendian mips.
|
||||
|
||||
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Avoid unnecessary copying on MIPS.
|
||||
|
||||
* grub-core/boot/decompressor/none.c (grub_decompress_core): Exit
|
||||
early if src == dest.
|
||||
* util/grub-mkimage.c (generate_image): Arange for src == dest if
|
||||
compression is none.
|
||||
|
||||
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Reduce memory footprint on SGI by putting modules before the kernel
|
||||
as opposed to after.
|
||||
|
||||
* grub-core/Makefile.core.def (kernel): Increase linking address.
|
||||
(none_decompress): Likewise.
|
||||
(xz_decompress): Likewise.
|
||||
* grub-core/boot/mips/startup_raw.S: Use prewritten uncompression
|
||||
address.
|
||||
* grub-core/kern/mips/arc/init.c (grub_machine_init): Handle memory
|
||||
layout change.
|
||||
(grub_arch_modules_addr): New function.
|
||||
* grub-core/kern/mips/init.c (grub_arch_modules_addr): Moved from here...
|
||||
* grub-core/kern/mips/loongson/init.c (grub_arch_modules_addr): .. here
|
||||
* grub-core/kern/mips/qemu_mips/init.c (grub_arch_modules_addr): ... and
|
||||
here.
|
||||
* grub-core/kern/mips/startup.S (total_size): Rename to ...
|
||||
(grub_total_modules_size): ... this. Make global.
|
||||
[GRUB_MACHINE_ARC]: Don't attempt to move modules out of the bss.
|
||||
* include/grub/offsets.h (GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR):
|
||||
New definition.
|
||||
(GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR): Likewise.
|
||||
(GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_ADDR): Likewise.
|
||||
(GRUB_KERNEL_MACHINE_UNCOMPRESSED_ADDR): Likewise.
|
||||
(GRUB_KERNEL_MIPS_ARC_LINK_ADDR): Increased.
|
||||
* util/grub-mkimage.c (image_target_desc): New flag
|
||||
PLATFORM_FLAGS_MODULES_BEFORE_KERNEL.
|
||||
(image_targets): Set PLATFORM_FLAGS_MODULES_BEFORE_KERNEL on mips-arc.
|
||||
(generate_image): Handle images with modules before kernel.
|
||||
|
||||
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Prevent potential loss of memory map by overwrite on qemu-mips.
|
||||
|
||||
* grub-core/boot/mips/startup_raw.S [GRUB_MACHINE_MIPS_QEMU_MIPS]:
|
||||
Save ram size in $s4.
|
||||
* grub-core/kern/mips/qemu_mips/init.c (RAMSIZE): Removed.
|
||||
All users changed to grub_arch_memsize.
|
||||
* grub-core/kern/mips/startup.S (grub_arch_machine): Restrict to
|
||||
Loongson.
|
||||
[GRUB_MACHINE_MIPS_QEMU_MIPS]: Save grub_arch_memsize.
|
||||
* grub-core/loader/mips/linux.c (grub_linux_boot): Pass memory size.
|
||||
* include/grub/mips/qemu_mips/memory.h (grub_arch_memsize): New
|
||||
external variable.
|
||||
|
||||
2011-05-17 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* .bzrignore: Remove grub-dumpbios.
|
||||
|
||||
2011-05-17 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/20_linux_xen.in: Honour GRUB_CMDLINE_LINUX_XEN_REPLACE
|
||||
and GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT, which replace
|
||||
GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT (complementing the
|
||||
existing options which append).
|
||||
* docs/grub.texi (Simple configuration): Document new options.
|
||||
Reported by: Ian Jackson. Fixes Debian bug #617538.
|
||||
|
||||
2011-05-17 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-fstest.c (cmd_cat): New function.
|
||||
(fstest): Handle CMD_CAT.
|
||||
(options): Add cat.
|
||||
(argp_parser): Handle cat.
|
||||
|
||||
2011-05-17 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* Makefile.util.def (grub-bin2h): Don't install.
|
||||
* docs/man/grub-bin2h.h2m: Remove.
|
||||
|
||||
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/mips/startup.S (grub_arch_cpuclock): Move to the right
|
||||
place.
|
||||
|
||||
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Reenable qemu-mips port.
|
||||
|
||||
* configure.ac: Handle --target=qemu-mips and --target=qemu_mips.
|
||||
Fix small arc bug while on it.
|
||||
* gentpl.py: Handle qemu_mips.
|
||||
* grub-core/Makefile.am: Likewise.
|
||||
* grub-core/Makefile.core.def: Likewise.
|
||||
* grub-core/disk/ata.c [GRUB_MACHINE_MIPS_QEMU_MIPS]: Remove
|
||||
inappropriate includes.
|
||||
(grub_ata_pciinit) [GRUB_MACHINE_MIPS_QEMU_MIPS]: Removed.
|
||||
(grub_ata_initialize): [GRUB_MACHINE_MIPS_QEMU_MIPS]: Rewritten.
|
||||
* grub-core/kern/main.c (grub_modules_get_end)
|
||||
[GRUB_MACHINE_MIPS_QEMU_MIPS]: Enable.
|
||||
* grub-core/kern/mips/qemu-mips: Moved to ..
|
||||
* grub-core/kern/mips/qemu_mips: ... this.
|
||||
* grub-core/kern/mips/qemu_mips/init.c (grub_get_rtc): Removed.
|
||||
(grub_machine_init): Call terminfo_init and serial_init.
|
||||
* grub-core/kern/mips/startup.S: Change MIPS_LOONGSON to MACHINE.
|
||||
* grub-core/loader/mips/linux.c (params) [GRUB_MACHINE_MIPS_QEMU_MIPS]:
|
||||
New variable.
|
||||
(grub_linux_boot) [GRUB_MACHINE_MIPS_QEMU_MIPS]: Handle the qemu-mips
|
||||
parameter passing.
|
||||
(grub_linux_unload) [GRUB_MACHINE_MIPS_QEMU_MIPS]: Free params.
|
||||
(grub_cmd_linux) [GRUB_MACHINE_MIPS_QEMU_MIPS]: Handle params.
|
||||
(grub_cmd_initrd) [GRUB_MACHINE_MIPS_QEMU_MIPS]: Likewise.
|
||||
* include/grub/mips/qemu_mips/cmos.h: New file.
|
||||
* include/grub/mips/qemu-mips/kernel.h: Don't include cpu/kernel.h.
|
||||
* include/grub/mips/qemu-mips/memory.h (grub_machine_mmap_iterate):
|
||||
Removed.
|
||||
* include/grub/mips/qemu-mips/serial.h (GRUB_MACHINE_SERIAL_PORTS):
|
||||
Use correct mips-style address.
|
||||
* include/grub/mips/qemu-mips/time.h: Include cpu/time.h.
|
||||
(GRUB_TICKS_PER_SECOND): Removed.
|
||||
(grub_get_rtc): Likewise.
|
||||
(grub_cpu_idle): Likewise.
|
||||
* include/grub/offsets.h (GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR):
|
||||
New definition.
|
||||
(GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN): Likewise.
|
||||
(GRUB_KERNEL_MIPS_QEMU_MIPS_COMPRESSED_SIZE): Likewise.
|
||||
(GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE): Likewise.
|
||||
(GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE): Likewise.
|
||||
(GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_MIPS_QEMU_MIPS_MOD_ALIGN): Likewise.
|
||||
* util/grub-mkimage.c (image_targets): Add mipsel-qemu_mips-elf.
|
||||
|
||||
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
SGI ARCS port.
|
||||
|
||||
* Makefile.util.def (libgrubmods.a): Add dvh.c.
|
||||
* conf/Makefile.common (CCASFLAGS_PLATFORM): Add -mips3 on all mips
|
||||
platforms.
|
||||
* configure.ac: New target mips-arc.
|
||||
* gentpl.py: Likewise.
|
||||
* grub-core/Makefile.am: Likewise.
|
||||
* grub-core/Makefile.core.def: Likewise.
|
||||
(xz_decompress): Remove -D GRUB_MACHINE_LINK_ADDR.
|
||||
(none_decompress): Likewise.
|
||||
(lsdev): New module.
|
||||
(datetime): Use lib/arc/datetime.c on ARC.
|
||||
(part_dvh): New module.
|
||||
* grub-core/commands/arc/lsdev.c: New file.
|
||||
* grub-core/disk/arc/arcdisk.c: Likewise.
|
||||
* grub-core/kern/mips/arc/init.c: Likewise.
|
||||
* grub-core/kern/mips/cache_flush.S: Don't flush non 4-byte
|
||||
aligned addresses.
|
||||
* grub-core/kern/mips/dl.c (grub_arch_dl_check_header): Fix bigendian
|
||||
support.
|
||||
(grub_arch_dl_relocate_symbols): Likewise.
|
||||
* grub-core/kern/mips/loongson/init.c (grub_get_rtc): Moved from here...
|
||||
* grub-core/kern/mips/init.c (grub_get_rtc): ... here.
|
||||
* grub-core/kern/mips/startup.S (grub_arch_cpuclock): Have on all
|
||||
platforms.
|
||||
* grub-core/lib/arc/datetime.c: New file.
|
||||
* grub-core/loader/mips/linux.c: Always include time.h. Don't include
|
||||
pci.h on non-loongson.
|
||||
(envp_off) [!GRUB_MACHINE_MIPS_LOONGSON]: Remove.
|
||||
(grub_linux_boot): Set unused registers to 0.
|
||||
(grub_cmd_linux) [!GRUB_MACHINE_MIPS_LOONGSON]: Remove envp.
|
||||
* grub-core/mmap/mips/loongson/uppermem.c: Moved from here ...
|
||||
* grub-core/mmap/mips/uppermem.c: ...here.
|
||||
* grub-core/partmap/dvh.c: New file.
|
||||
* grub-core/term/arc/console.c: Likewise.
|
||||
* grub-core/term/terminfo.c (ANSI_C0_STR): New const.
|
||||
(grub_terminfo_set_current): Add terminal "arc".
|
||||
(grub_terminfo_readkey): Support ARC sequences.
|
||||
* include/grub/arc/arc.h: New file.
|
||||
* include/grub/arc/console.h: Likewise.
|
||||
* include/grub/disk.h (grub_disk_dev_id): Add
|
||||
GRUB_DISK_DEVICE_ARCDISK_ID.
|
||||
* include/grub/mips/arc/kernel.h: New file.
|
||||
* include/grub/mips/arc/memory.h: Likewise.
|
||||
* include/grub/mips/arc/time.h: Likewise.
|
||||
* include/grub/mips/loongson/kernel.h (grub_halt): Moved from here ...
|
||||
* include/grub/mips/kernel.h (grub_halt): ... here.
|
||||
* include/grub/mips/loongson.h (GRUB_CPU_REGISTER_WRAP): Moved from
|
||||
here...
|
||||
* include/grub/mips/mips.h (GRUB_CPU_REGISTER_WRAP): ... here.
|
||||
(GRUB_CPU_LOONGSON_COP0_TIMER_COUNT): Moved from here ...
|
||||
* include/grub/mips/mips.h (GRUB_CPU_LOONGSON_COP0_TIMER_COUNT): .. here
|
||||
* include/grub/mips/loongson/kernel.h (grub_reboot): Removed redundant
|
||||
proto.
|
||||
* include/grub/mips/loongson/memory.h (GRUB_ARCH_LOWMEMVSTART): Moved
|
||||
from here ...
|
||||
* include/grub/mips/memory.h (GRUB_ARCH_LOWMEMVSTART): ... here.
|
||||
(GRUB_ARCH_LOWMEMPSTART): Moved from here ...
|
||||
* include/grub/mips/memory.h (GRUB_ARCH_LOWMEMPSTART): ... here.
|
||||
(GRUB_ARCH_LOWMEMMAXSIZE): Moved from here ...
|
||||
* include/grub/mips/memory.h (GRUB_ARCH_LOWMEMMAXSIZE): ... here.
|
||||
(GRUB_ARCH_HIGHMEMPSTART): Moved from here ...
|
||||
* include/grub/mips/memory.h (GRUB_ARCH_HIGHMEMPSTART): ... here.
|
||||
(grub_phys_addr_t): Moved from here ...
|
||||
* include/grub/mips/memory.h (grub_phys_addr_t): ... here.
|
||||
(grub_vtop): Moved from here ...
|
||||
* include/grub/mips/memory.h (grub_vtop): ... here.
|
||||
(grub_map_memory): Moved from here ...
|
||||
* include/grub/mips/memory.h (grub_map_memory): ... here.
|
||||
(grub_unmap_memory): Moved from here ...
|
||||
* include/grub/mips/memory.h (grub_unmap_memory): ... here.
|
||||
(grub_machine_mmap_iterate): Moved from here ...
|
||||
* include/grub/mips/memory.h (grub_machine_mmap_iterate): ... here.
|
||||
(grub_mmap_get_lower): Moved from here ...
|
||||
* include/grub/mips/memory.h (grub_mmap_get_lower): ... here.
|
||||
(grub_mmap_get_upper): Moved from here ...
|
||||
* include/grub/mips/memory.h (grub_mmap_get_upper): ... here.
|
||||
* include/grub/mips/loongson/time.h (grub_arch_cpuclock): Moved from
|
||||
here ...
|
||||
* include/grub/mips/time.h (grub_arch_cpuclock): ... here.
|
||||
* include/grub/mips/loongson/time.h (grub_get_rtc): Moved from
|
||||
here ...
|
||||
* include/grub/mips/time.h (grub_get_rtc): ... here.
|
||||
* include/grub/mips/loongson/time.h (grub_arch_cpuclock): Moved from
|
||||
here ...
|
||||
* include/grub/mips/time.h (grub_arch_cpuclock): ... here.
|
||||
* include/grub/mips/loongson/time.h (grub_cpu_idle): Moved from
|
||||
here ...
|
||||
* include/grub/mips/time.h (grub_cpu_idle): ... here.
|
||||
* include/grub/offsets.h (GRUB_KERNEL_MIPS_ARC_LINK_ADDR): New
|
||||
definition.
|
||||
(GRUB_KERNEL_MIPS_ARC_LINK_ALIGN): Likewise.
|
||||
(GRUB_KERNEL_MIPS_ARC_COMPRESSED_SIZE): Likewise.
|
||||
(GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_SIZE): Likewise.
|
||||
(GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE): Likewise.
|
||||
(GRUB_KERNEL_MIPS_ARC_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_MIPS_ARC_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_MIPS_ARC_MOD_ALIGN): Likewise.
|
||||
(GRUB_MACHINE_LINK_ADDR): Likewise.
|
||||
* include/grub/terminfo.h (GRUB_TERMINFO_READKEY_MAX_LEN): Increased
|
||||
to 6.
|
||||
* util/grub-install.in: Run dvhtool on ARC.
|
||||
* util/grub-mkimage.c (image_targets): Add mips-arc.
|
||||
(generate_image): Handle ECOFF output for mips-arc.
|
||||
|
||||
2011-05-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/bus/pci.c (grub_memalign_dma32): Always allocate in 64-byte
|
||||
|
|
|
@ -95,6 +95,7 @@ library = {
|
|||
common = grub-core/partmap/gpt.c;
|
||||
common = grub-core/partmap/msdos.c;
|
||||
common = grub-core/partmap/sun.c;
|
||||
common = grub-core/partmap/dvh.c;
|
||||
common = grub-core/partmap/sunpc.c;
|
||||
common = grub-core/partmap/bsdlabel.c;
|
||||
common = grub-core/script/function.c;
|
||||
|
@ -113,7 +114,7 @@ program = {
|
|||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
mansection = 1;
|
||||
installdir = noinst;
|
||||
};
|
||||
|
||||
program = {
|
||||
|
|
|
@ -28,10 +28,10 @@ endif
|
|||
if COND_mips_loongson
|
||||
CFLAGS_PLATFORM += -mexplicit-relocs
|
||||
CPPFLAGS_PLATFORM = -DUSE_ASCII_FAILBACK
|
||||
CCASFLAGS_PLATFORM = -march=mips3
|
||||
endif
|
||||
if COND_mips
|
||||
CFLAGS_PLATFORM += -mflush-func=grub_cpu_flush_cache
|
||||
CCASFLAGS_PLATFORM = -march=mips3
|
||||
endif
|
||||
if COND_sparc64_ieee1275
|
||||
CFLAGS_PLATFORM += -mno-app-regs
|
||||
|
|
49
configure.ac
49
configure.ac
|
@ -72,7 +72,7 @@ case "$target_cpu" in
|
|||
amd64) target_cpu=x86_64 ;;
|
||||
sparc) target_cpu=sparc64 ;;
|
||||
mipsel|mips64el)
|
||||
target_cpu=mips;
|
||||
target_cpu=mipsel;
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
|
||||
;;
|
||||
mips|mips64)
|
||||
|
@ -96,7 +96,8 @@ if test "x$with_platform" = x; then
|
|||
powerpc-*) platform=ieee1275 ;;
|
||||
powerpc64-*) platform=ieee1275 ;;
|
||||
sparc64-*) platform=ieee1275 ;;
|
||||
mips-*) platform=loongson ;;
|
||||
mipsel-*) platform=loongson ;;
|
||||
mips-*) platform=arc ;;
|
||||
ia64-*) platform=efi ;;
|
||||
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
||||
esac
|
||||
|
@ -124,10 +125,14 @@ case "$target_cpu"-"$platform" in
|
|||
powerpc-ieee1275) ;;
|
||||
sparc64-ieee1275) ;;
|
||||
ia64-efi) ;;
|
||||
mips-qemu-mips) ;;
|
||||
mips-yeeloong) platform=loongson ;;
|
||||
mips-fuloong) platform=loongson ;;
|
||||
mips-loongson) ;;
|
||||
mips-qemu_mips) ;;
|
||||
mips-qemu-mips) platform=qemu_mips;;
|
||||
mips-arc) ;;
|
||||
mipsel-qemu_mips) ;;
|
||||
mipsel-qemu-mips) platform=qemu_mips;;
|
||||
mipsel-yeeloong) platform=loongson ;;
|
||||
mipsel-fuloong) platform=loongson ;;
|
||||
mipsel-loongson) ;;
|
||||
*-emu) ;;
|
||||
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
||||
esac
|
||||
|
@ -161,13 +166,18 @@ case "$platform" in
|
|||
pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
|
||||
emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
|
||||
loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
qemu-mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
|
||||
esac
|
||||
case "$target_cpu" in
|
||||
mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
||||
mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
||||
sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
||||
esac
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||
if test x${target_cpu} = xmipsel ; then
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||
else
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||
fi
|
||||
|
||||
HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
|
||||
|
@ -402,7 +412,7 @@ if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
|
|||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
||||
fi
|
||||
|
||||
if test "${target_cpu}-${platform}" = mips-loongson; then
|
||||
if test "${target_cpu}-${platform}" = mipsel-loongson; then
|
||||
AC_CACHE_CHECK([whether -march=loongson2f works], [grub_cv_cc_march_loongson2f], [
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -march=loongson2f"
|
||||
|
@ -955,11 +965,12 @@ AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform =
|
|||
AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
|
||||
AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
|
||||
AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
|
||||
AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmips -a x$platform = xloongson])
|
||||
AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips])
|
||||
AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
|
||||
AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
|
||||
AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc])
|
||||
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
|
||||
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
|
||||
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips])
|
||||
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
|
||||
|
||||
AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
|
||||
AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
|
||||
|
@ -981,19 +992,23 @@ AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
|
|||
AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin])
|
||||
|
||||
# Output files.
|
||||
cpudir="${target_cpu}"
|
||||
if test x${cpudir} = xmipsel; then
|
||||
cpudir=mips;
|
||||
fi
|
||||
grub_CHECK_LINK_DIR
|
||||
if test x"$link_dir" = xyes ; then
|
||||
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
|
||||
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
|
||||
if test "$platform" != emu ; then
|
||||
AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
|
||||
AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
|
||||
fi
|
||||
else
|
||||
mkdir -p include/grub 2>/dev/null
|
||||
rm -rf include/grub/cpu
|
||||
cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
|
||||
cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
|
||||
if test "$platform" != emu ; then
|
||||
rm -rf include/grub/machine
|
||||
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
|
||||
cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -1169,8 +1169,14 @@ NetBSD.
|
|||
|
||||
@item GRUB_CMDLINE_XEN
|
||||
@itemx GRUB_CMDLINE_XEN_DEFAULT
|
||||
As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
|
||||
Linux and Xen.
|
||||
The values of these options are appended to the values of
|
||||
@samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux
|
||||
and Xen menu entries.
|
||||
|
||||
@item GRUB_CMDLINE_LINUX_XEN_REPLACE
|
||||
@item GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT
|
||||
The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX}
|
||||
and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries.
|
||||
|
||||
@item GRUB_DISABLE_LINUX_UUID
|
||||
Normally, @command{grub-mkconfig} will generate menu entries that use
|
||||
|
@ -3936,6 +3942,7 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
|
|||
@item @tab BIOS @tab Coreboot
|
||||
@item BIOS chainloading @tab yes @tab no (1)
|
||||
@item NTLDR @tab yes @tab no (1)
|
||||
@item Freedos @tab yes @tab no (1)
|
||||
@item FreeBSD bootloader @tab yes @tab crashes (1)
|
||||
@item 32-bit kFreeBSD @tab yes @tab crashes (2,6)
|
||||
@item 64-bit kFreeBSD @tab yes @tab crashes (2,6)
|
||||
|
@ -3960,6 +3967,7 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
|
|||
@item @tab Multiboot @tab Qemu
|
||||
@item BIOS chainloading @tab no (1) @tab no (1)
|
||||
@item NTLDR @tab no (1) @tab no (1)
|
||||
@item FreeDOS @tab no (1) @tab no (1)
|
||||
@item FreeBSD bootloader @tab crashes (1) @tab crashes (1)
|
||||
@item 32-bit kFreeBSD @tab crashes (6) @tab crashes (6)
|
||||
@item 64-bit kFreeBSD @tab crashes (6) @tab crashes (6)
|
||||
|
@ -3984,6 +3992,7 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
|
|||
@item @tab 32-bit EFI @tab 64-bit EFI
|
||||
@item BIOS chainloading @tab no (1) @tab no (1)
|
||||
@item NTLDR @tab no (1) @tab no (1)
|
||||
@item FreeDOS @tab no (1) @tab no (1)
|
||||
@item FreeBSD bootloader @tab crashes (1) @tab crashes (1)
|
||||
@item 32-bit kFreeBSD @tab headless @tab headless
|
||||
@item 64-bit kFreeBSD @tab headless @tab headless
|
||||
|
@ -4008,6 +4017,7 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
|
|||
@item @tab IEEE1275
|
||||
@item BIOS chainloading @tab no (1)
|
||||
@item NTLDR @tab no (1)
|
||||
@item FreeDOS @tab no (1)
|
||||
@item FreeBSD bootloader @tab crashes (1)
|
||||
@item 32-bit kFreeBSD @tab crashes (6)
|
||||
@item 64-bit kFreeBSD @tab crashes (6)
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[NAME]
|
||||
grub-bin2h \- convert a binary file to a C header
|
11
gentpl.py
11
gentpl.py
|
@ -7,7 +7,8 @@
|
|||
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
|
||||
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
|
||||
"mips_loongson", "sparc64_ieee1275",
|
||||
"powerpc_ieee1275", "ia64_efi" ]
|
||||
"powerpc_ieee1275", "mips_arc", "ia64_efi",
|
||||
"mips_qemu_mips" ]
|
||||
|
||||
GROUPS = {}
|
||||
|
||||
|
@ -17,7 +18,7 @@ GROUPS["common"] = GRUB_PLATFORMS[:]
|
|||
GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ]
|
||||
GROUPS["x86_64"] = [ "x86_64_efi" ]
|
||||
GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"]
|
||||
GROUPS["mips"] = [ "mips_loongson" ]
|
||||
GROUPS["mips"] = [ "mips_loongson", "mips_qemu_mips", "mips_arc" ]
|
||||
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
|
||||
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
|
||||
|
||||
|
@ -29,8 +30,8 @@ GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275"
|
|||
GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
|
||||
|
||||
# Groups based on hardware features
|
||||
GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_loongson"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
|
||||
GROUPS["pci"] = GROUPS["x86"] + GROUPS["mips"]
|
||||
GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_loongson", "mips_qemu_mips"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
|
||||
GROUPS["pci"] = GROUPS["x86"] + ["mips_loongson"]
|
||||
GROUPS["usb"] = GROUPS["pci"]
|
||||
|
||||
# If gfxterm is main output console integrate it into kernel
|
||||
|
@ -39,7 +40,7 @@ GROUPS["videomodules"] = GRUB_PLATFORMS[:];
|
|||
for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
|
||||
|
||||
# Similar for terminfo
|
||||
GROUPS["terminfoinkernel"] = ["mips_loongson"] + GROUPS["ieee1275"];
|
||||
GROUPS["terminfoinkernel"] = ["mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"];
|
||||
GROUPS["terminfomodule"] = GRUB_PLATFORMS[:];
|
||||
for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
|
||||
|
||||
|
|
|
@ -131,6 +131,19 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
|
|||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||
endif
|
||||
|
||||
if COND_mips
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
|
||||
endif
|
||||
|
||||
if COND_mips_arc
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arc/arc.h
|
||||
endif
|
||||
|
||||
if COND_mips_qemu_mips
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
endif
|
||||
|
||||
if COND_mips_loongson
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||
|
@ -151,6 +164,11 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
|||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
endif
|
||||
|
||||
if COND_mips_qemu_mips
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||
endif
|
||||
|
||||
if COND_powerpc_ieee1275
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
|
@ -311,6 +329,7 @@ CLEANFILES += config.log syminfo.lst moddep.lst
|
|||
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT)
|
||||
TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
|
||||
platform_DATA += $(MOD_FILES)
|
||||
platform_DATA += modinfo.sh
|
||||
CLEANFILES += $(MOD_FILES)
|
||||
|
||||
if COND_ENABLE_EFIEMU
|
||||
|
|
|
@ -12,6 +12,12 @@ script = {
|
|||
common = genmod.sh.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
installdir = noinst;
|
||||
name = modinfo.sh;
|
||||
common = modinfo.sh.in;
|
||||
};
|
||||
|
||||
kernel = {
|
||||
name = kernel;
|
||||
|
||||
|
@ -41,6 +47,8 @@ kernel = {
|
|||
mips_loongson_ldflags = '-Wl,-Ttext,0x80200000';
|
||||
powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';
|
||||
sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400';
|
||||
mips_arc_ldflags = '-Wl,-Ttext,0x8bd00000';
|
||||
mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
|
||||
|
||||
mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK';
|
||||
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
||||
|
@ -54,7 +62,7 @@ kernel = {
|
|||
i386_ieee1275_startup = kern/i386/ieee1275/startup.S;
|
||||
i386_coreboot_startup = kern/i386/coreboot/startup.S;
|
||||
i386_multiboot_startup = kern/i386/coreboot/startup.S;
|
||||
mips_loongson_startup = kern/mips/startup.S;
|
||||
mips_startup = kern/mips/startup.S;
|
||||
sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S;
|
||||
powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S;
|
||||
|
||||
|
@ -86,7 +94,7 @@ kernel = {
|
|||
i386_qemu = kern/generic/rtc_get_time_ms.c;
|
||||
i386_coreboot = kern/generic/rtc_get_time_ms.c;
|
||||
i386_multiboot = kern/generic/rtc_get_time_ms.c;
|
||||
mips_loongson = kern/generic/rtc_get_time_ms.c;
|
||||
mips = kern/generic/rtc_get_time_ms.c;
|
||||
|
||||
ieee1275 = disk/ieee1275/ofdisk.c;
|
||||
ieee1275 = kern/ieee1275/cmain.c;
|
||||
|
@ -147,13 +155,22 @@ kernel = {
|
|||
|
||||
i386_ieee1275 = kern/ieee1275/init.c;
|
||||
|
||||
mips = kern/mips/cache.S;
|
||||
mips = kern/mips/dl.c;
|
||||
mips = kern/mips/init.c;
|
||||
|
||||
mips_qemu_mips = kern/mips/qemu_mips/init.c;
|
||||
mips_qemu_mips = term/ns8250.c;
|
||||
mips_qemu_mips = term/serial.c;
|
||||
|
||||
mips_arc = kern/mips/arc/init.c;
|
||||
mips_arc = term/arc/console.c;
|
||||
mips_arc = disk/arc/arcdisk.c;
|
||||
|
||||
mips_loongson = term/ns8250.c;
|
||||
mips_loongson = bus/bonito.c;
|
||||
mips_loongson = bus/cs5536.c;
|
||||
mips_loongson = bus/pci.c;
|
||||
mips_loongson = kern/mips/cache.S;
|
||||
mips_loongson = kern/mips/dl.c;
|
||||
mips_loongson = kern/mips/init.c;
|
||||
mips_loongson = kern/mips/loongson/init.c;
|
||||
mips_loongson = term/at_keyboard.c;
|
||||
mips_loongson = term/serial.c;
|
||||
|
@ -308,12 +325,12 @@ image = {
|
|||
common = lib/xzembed/xz_dec_lzma2.c;
|
||||
common = lib/xzembed/xz_dec_stream.c;
|
||||
|
||||
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed';
|
||||
|
||||
mips_cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1 -DGRUB_MACHINE_LINK_ADDR=0x80200000';
|
||||
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1';
|
||||
|
||||
objcopyflags = '-O binary';
|
||||
ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x8bc00000';
|
||||
ldadd = '-lgcc';
|
||||
cflags = '-static-libgcc';
|
||||
enable = mips;
|
||||
|
@ -324,10 +341,12 @@ image = {
|
|||
mips = boot/mips/startup_raw.S;
|
||||
common = boot/decompressor/none.c;
|
||||
|
||||
mips_cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1 -DGRUB_MACHINE_LINK_ADDR=0x80200000';
|
||||
cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1';
|
||||
|
||||
objcopyflags = '-O binary';
|
||||
ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x8bc00000';
|
||||
ldadd = '-lgcc';
|
||||
cflags = '-static-libgcc';
|
||||
enable = mips;
|
||||
|
@ -430,6 +449,13 @@ module = {
|
|||
emu_condition = COND_GRUB_EMU_PCI;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = lsdev;
|
||||
common = commands/arc/lsdev.c;
|
||||
|
||||
enable = mips_arc;
|
||||
};
|
||||
|
||||
library = {
|
||||
name = libgnulib.a;
|
||||
common = gnulib/regex.c;
|
||||
|
@ -836,6 +862,7 @@ module = {
|
|||
name = ata;
|
||||
common = disk/ata.c;
|
||||
enable = pci;
|
||||
enable = mips_qemu_mips;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -848,6 +875,7 @@ module = {
|
|||
name = pata;
|
||||
common = disk/pata.c;
|
||||
enable = pci;
|
||||
enable = mips_qemu_mips;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -1163,6 +1191,7 @@ module = {
|
|||
efi = lib/efi/datetime.c;
|
||||
sparc64_ieee1275 = lib/ieee1275/datetime.c;
|
||||
powerpc_ieee1275 = lib/ieee1275/datetime.c;
|
||||
mips_arc = lib/arc/datetime.c;
|
||||
enable = noemu;
|
||||
};
|
||||
|
||||
|
@ -1207,6 +1236,12 @@ module = {
|
|||
enable = i386_pc;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = freedos;
|
||||
i386_pc = loader/i386/pc/freedos.c;
|
||||
enable = i386_pc;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = multiboot2;
|
||||
cppflags = "-DGRUB_USE_MULTIBOOT2";
|
||||
|
@ -1276,11 +1311,11 @@ module = {
|
|||
|
||||
efi = mmap/efi/mmap.c;
|
||||
|
||||
mips_loongson = mmap/mips/loongson/uppermem.c;
|
||||
mips = mmap/mips/uppermem.c;
|
||||
|
||||
enable = x86;
|
||||
enable = ia64_efi;
|
||||
enable = mips_loongson;
|
||||
enable = mips;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -1354,6 +1389,11 @@ module = {
|
|||
common = partmap/sun.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = part_dvh;
|
||||
common = partmap/dvh.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = part_bsd;
|
||||
common = partmap/bsdlabel.c;
|
||||
|
|
|
@ -25,6 +25,9 @@ grub_decompress_core (void *src, void *dest, unsigned long n,
|
|||
char *d = (char *) dest;
|
||||
const char *s = (const char *) src;
|
||||
|
||||
if (d == s)
|
||||
return;
|
||||
|
||||
if (d < s)
|
||||
while (n--)
|
||||
*d++ = *s++;
|
||||
|
|
|
@ -44,12 +44,20 @@ compressed_size:
|
|||
. = _start + GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE
|
||||
uncompressed_size:
|
||||
.long 0
|
||||
. = _start + GRUB_KERNEL_MACHINE_UNCOMPRESSED_ADDR
|
||||
uncompressed_addr:
|
||||
.long 0
|
||||
codestart:
|
||||
/* Save our base. */
|
||||
move $s0, $ra
|
||||
|
||||
/* Parse arguments. Has to be done before relocation.
|
||||
So need to do it in asm. */
|
||||
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
lui $t0, %hi (((16 << 20) - 264) | 0x80000000)
|
||||
lw $s4, %lo (((16 << 20) - 264) | 0x80000000) ($t0)
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
move $s2, $zero
|
||||
move $s3, $zero
|
||||
|
@ -216,8 +224,7 @@ cmdlinedone:
|
|||
subu $a0, $a0, $t0
|
||||
addu $a0, $a0, $s0
|
||||
|
||||
lui $a1, %hi(GRUB_MACHINE_LINK_ADDR)
|
||||
addiu $a1, %lo(GRUB_MACHINE_LINK_ADDR)
|
||||
lw $a1, (GRUB_KERNEL_MACHINE_UNCOMPRESSED_ADDR - BASE_ADDR)($s0)
|
||||
lw $a2, (GRUB_KERNEL_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
lw $a3, (GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
move $s1, $a1
|
||||
|
|
53
grub-core/commands/arc/lsdev.c
Normal file
53
grub-core/commands/arc/lsdev.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/arc/arc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_lsdev (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
auto int hook (const char *name, const struct grub_arc_component *comp);
|
||||
int hook (const char *name, const struct grub_arc_component *comp __attribute__ ((unused)))
|
||||
{
|
||||
grub_printf ("%s\n", name);
|
||||
return 0;
|
||||
}
|
||||
grub_arc_iterate_devs (hook, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_command_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(lsdev)
|
||||
{
|
||||
cmd = grub_register_command ("lsdev", grub_cmd_lsdev, "",
|
||||
N_("List devices."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(lsdev)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
}
|
295
grub-core/disk/arc/arcdisk.c
Normal file
295
grub-core/disk/arc/arcdisk.c
Normal file
|
@ -0,0 +1,295 @@
|
|||
/* ofdisk.c - Open Firmware disk access. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/misc.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/arc/arc.h>
|
||||
|
||||
static grub_arc_fileno_t last_handle = 0;
|
||||
static char *last_path = NULL;
|
||||
|
||||
static int lnum = 0;
|
||||
|
||||
struct arcdisk_hash_ent
|
||||
{
|
||||
char *devpath;
|
||||
int num;
|
||||
struct arcdisk_hash_ent *next;
|
||||
};
|
||||
|
||||
#define ARCDISK_HASH_SZ 8
|
||||
static struct arcdisk_hash_ent *arcdisk_hash[ARCDISK_HASH_SZ];
|
||||
|
||||
static int
|
||||
arcdisk_hash_fn (const char *devpath)
|
||||
{
|
||||
int hash = 0;
|
||||
while (*devpath)
|
||||
hash ^= *devpath++;
|
||||
return (hash & (ARCDISK_HASH_SZ - 1));
|
||||
}
|
||||
|
||||
static struct arcdisk_hash_ent *
|
||||
arcdisk_hash_find (const char *devpath)
|
||||
{
|
||||
struct arcdisk_hash_ent *p = arcdisk_hash[arcdisk_hash_fn (devpath)];
|
||||
|
||||
while (p)
|
||||
{
|
||||
if (!grub_strcmp (p->devpath, devpath))
|
||||
break;
|
||||
p = p->next;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
static struct arcdisk_hash_ent *
|
||||
arcdisk_hash_add (char *devpath)
|
||||
{
|
||||
struct arcdisk_hash_ent *p;
|
||||
struct arcdisk_hash_ent **head = &arcdisk_hash[arcdisk_hash_fn(devpath)];
|
||||
|
||||
p = grub_malloc (sizeof (*p));
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
p->devpath = devpath;
|
||||
p->next = *head;
|
||||
p->num = lnum++;
|
||||
*head = p;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
grub_arcdisk_iterate (int (*hook_in) (const char *name))
|
||||
{
|
||||
auto int hook (const char *name, const struct grub_arc_component *comp);
|
||||
int hook (const char *name, const struct grub_arc_component *comp)
|
||||
{
|
||||
if (!(comp->type == GRUB_ARC_COMPONENT_TYPE_DISK
|
||||
|| comp->type == GRUB_ARC_COMPONENT_TYPE_DISK
|
||||
|| comp->type == GRUB_ARC_COMPONENT_TYPE_TAPE))
|
||||
return 0;
|
||||
return hook_in (name);
|
||||
}
|
||||
return grub_arc_iterate_devs (hook, 1);
|
||||
}
|
||||
|
||||
#define RAW_SUFFIX "partition(10)"
|
||||
|
||||
static grub_err_t
|
||||
reopen (const char *name)
|
||||
{
|
||||
grub_arc_fileno_t handle;
|
||||
|
||||
if (last_path && grub_strcmp (last_path, name) == 0)
|
||||
{
|
||||
grub_dprintf ("arcdisk", "using already opened %s\n", name);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->open (name, 0, &handle))
|
||||
{
|
||||
grub_dprintf ("arcdisk", "couldn't open %s\n", name);
|
||||
return grub_error (GRUB_ERR_IO, "couldn't open %s", name);
|
||||
}
|
||||
if (last_path)
|
||||
{
|
||||
GRUB_ARC_FIRMWARE_VECTOR->close (last_handle);
|
||||
grub_free (last_path);
|
||||
last_path = NULL;
|
||||
last_handle = 0;
|
||||
}
|
||||
last_path = grub_strdup (name);
|
||||
if (!last_path)
|
||||
return grub_errno;
|
||||
last_handle = handle;
|
||||
grub_dprintf ("arcdisk", "opened %s\n", name);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_arcdisk_open (const char *name, grub_disk_t disk)
|
||||
{
|
||||
char *fullname, *optr;
|
||||
const char *iptr;
|
||||
int state = 0;
|
||||
grub_err_t err;
|
||||
grub_arc_err_t r;
|
||||
struct grub_arc_fileinfo info;
|
||||
struct arcdisk_hash_ent *hash;
|
||||
|
||||
if (grub_memcmp (name, "arc/", 4) != 0)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not arc device");
|
||||
fullname = grub_malloc (2 * grub_strlen (name) + sizeof (RAW_SUFFIX));
|
||||
if (!fullname)
|
||||
return grub_errno;
|
||||
optr = fullname;
|
||||
for (iptr = name + 4; *iptr; iptr++)
|
||||
if (state == 0)
|
||||
{
|
||||
if (!grub_isdigit (*iptr))
|
||||
*optr++ = *iptr;
|
||||
else
|
||||
{
|
||||
*optr++ = '(';
|
||||
*optr++ = *iptr;
|
||||
state = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (grub_isdigit (*iptr))
|
||||
*optr++ = *iptr;
|
||||
else
|
||||
{
|
||||
*optr++ = ')';
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
if (state)
|
||||
*optr++ = ')';
|
||||
grub_memcpy (optr, RAW_SUFFIX, sizeof (RAW_SUFFIX));
|
||||
disk->data = fullname;
|
||||
grub_dprintf ("arcdisk", "opening %s\n", fullname);
|
||||
|
||||
hash = arcdisk_hash_find (fullname);
|
||||
if (!hash)
|
||||
hash = arcdisk_hash_add (fullname);
|
||||
if (!hash)
|
||||
return grub_errno;
|
||||
|
||||
err = reopen (fullname);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
r = GRUB_ARC_FIRMWARE_VECTOR->getfileinformation (last_handle, &info);
|
||||
if (r)
|
||||
{
|
||||
grub_uint64_t res = 0;
|
||||
int i;
|
||||
|
||||
grub_dprintf ("arcdisk", "couldn't retrieve size: %ld\n", r);
|
||||
for (i = 40; i >= 9; i--)
|
||||
{
|
||||
grub_uint64_t pos = res | (1ULL << i);
|
||||
char buf[512];
|
||||
long unsigned count = 0;
|
||||
grub_dprintf ("arcdisk",
|
||||
"seek to 0x%" PRIxGRUB_UINT64_T "\n", pos);
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->seek (last_handle, &pos, 0))
|
||||
continue;
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->read (last_handle, buf,
|
||||
0x200, &count))
|
||||
continue;
|
||||
if (count == 0)
|
||||
continue;
|
||||
res |= (1ULL << i);
|
||||
}
|
||||
grub_dprintf ("arcdisk",
|
||||
"determined disk size 0x%" PRIxGRUB_UINT64_T "\n", res);
|
||||
disk->total_sectors = (res + 0x200) >> 9;
|
||||
}
|
||||
else
|
||||
disk->total_sectors = (info.end >> 9);
|
||||
|
||||
disk->id = hash->num;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_arcdisk_close (grub_disk_t disk)
|
||||
{
|
||||
grub_free (disk->data);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_arcdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf)
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_uint64_t pos = sector << 9;
|
||||
unsigned long count;
|
||||
grub_uint64_t totl = size << 9;
|
||||
grub_arc_err_t r;
|
||||
|
||||
err = reopen (disk->data);
|
||||
if (err)
|
||||
return err;
|
||||
r = GRUB_ARC_FIRMWARE_VECTOR->seek (last_handle, &pos, 0);
|
||||
if (r)
|
||||
{
|
||||
grub_dprintf ("arcdisk", "seek to 0x%" PRIxGRUB_UINT64_T " failed: %ld\n",
|
||||
pos, r);
|
||||
return grub_error (GRUB_ERR_IO, "couldn't seek");
|
||||
}
|
||||
|
||||
while (totl)
|
||||
{
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->read (last_handle, buf,
|
||||
totl, &count))
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "read failed");
|
||||
totl -= count;
|
||||
buf += count;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_arcdisk_write (grub_disk_t disk __attribute ((unused)),
|
||||
grub_disk_addr_t sector __attribute ((unused)),
|
||||
grub_size_t size __attribute ((unused)),
|
||||
const char *buf __attribute ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NOT_IMPLEMENTED_YET;
|
||||
}
|
||||
|
||||
static struct grub_disk_dev grub_arcdisk_dev =
|
||||
{
|
||||
.name = "arcdisk",
|
||||
.id = GRUB_DISK_DEVICE_ARCDISK_ID,
|
||||
.iterate = grub_arcdisk_iterate,
|
||||
.open = grub_arcdisk_open,
|
||||
.close = grub_arcdisk_close,
|
||||
.read = grub_arcdisk_read,
|
||||
.write = grub_arcdisk_write,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
void
|
||||
grub_arcdisk_init (void)
|
||||
{
|
||||
grub_disk_dev_register (&grub_arcdisk_dev);
|
||||
}
|
||||
|
||||
void
|
||||
grub_arcdisk_fini (void)
|
||||
{
|
||||
if (last_path)
|
||||
{
|
||||
GRUB_ARC_FIRMWARE_VECTOR->close (last_handle);
|
||||
grub_free (last_path);
|
||||
last_path = NULL;
|
||||
last_handle = 0;
|
||||
}
|
||||
|
||||
grub_disk_dev_unregister (&grub_arcdisk_dev);
|
||||
}
|
|
@ -22,8 +22,12 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/mm.h>
|
||||
#ifndef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
#include <grub/pci.h>
|
||||
#include <grub/cs5536.h>
|
||||
#else
|
||||
#define GRUB_MACHINE_PCI_IO_BASE 0xb4000000
|
||||
#endif
|
||||
#include <grub/time.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
@ -319,6 +323,7 @@ grub_pata_device_initialize (int port, int device, int addr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
static int NESTED_FUNC_ATTR
|
||||
grub_pata_pciinit (grub_pci_device_t dev,
|
||||
grub_pci_id_t pciid)
|
||||
|
@ -430,6 +435,21 @@ grub_pata_initialize (void)
|
|||
grub_pci_iterate (grub_pata_pciinit);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static grub_err_t
|
||||
grub_ata_initialize (void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
grub_ata_device_initialize (i, 0, grub_ata_ioaddress[i],
|
||||
grub_ata_ioaddress2[i]);
|
||||
grub_ata_device_initialize (i, 1, grub_ata_ioaddress[i],
|
||||
grub_ata_ioaddress2[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static grub_err_t
|
||||
grub_pata_open (int id, int devnum, struct grub_ata *ata)
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
#include <stdint.h>
|
||||
#include <grub/util/misc.h>
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
# include <libdevmapper.h>
|
||||
#endif
|
||||
|
||||
#ifdef __GNU__
|
||||
#include <hurd.h>
|
||||
#include <hurd/lookup.h>
|
||||
|
@ -634,32 +638,65 @@ grub_guess_root_device (const char *dir)
|
|||
}
|
||||
|
||||
static int
|
||||
grub_util_is_dmraid (const char *os_dev)
|
||||
grub_util_is_lvm (const char *os_dev)
|
||||
{
|
||||
if (! strncmp (os_dev, "/dev/mapper/nvidia_", 19))
|
||||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/isw_", 16))
|
||||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/hpt37x_", 19))
|
||||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/hpt45x_", 19))
|
||||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/via_", 16))
|
||||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/lsi_", 16))
|
||||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/pdc_", 16))
|
||||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/jmicron_", 20))
|
||||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/asr_", 16))
|
||||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
|
||||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/ddf1_", 17))
|
||||
return 1;
|
||||
if ((strncmp ("/dev/mapper/", os_dev, 12) != 0))
|
||||
return 0;
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
{
|
||||
struct dm_tree *tree;
|
||||
uint32_t maj, min;
|
||||
struct dm_tree_node *node = NULL;
|
||||
const char *node_uuid;
|
||||
struct stat st;
|
||||
|
||||
return 0;
|
||||
if (stat (os_dev, &st) < 0)
|
||||
return 0;
|
||||
|
||||
tree = dm_tree_create ();
|
||||
if (! tree)
|
||||
{
|
||||
grub_printf ("Failed to create tree\n");
|
||||
grub_dprintf ("hostdisk", "dm_tree_create failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
maj = major (st.st_rdev);
|
||||
min = minor (st.st_rdev);
|
||||
|
||||
if (! dm_tree_add_dev (tree, maj, min))
|
||||
{
|
||||
grub_dprintf ("hostdisk", "dm_tree_add_dev failed\n");
|
||||
dm_tree_free (tree);
|
||||
return 0;
|
||||
}
|
||||
|
||||
node = dm_tree_find_node (tree, maj, min);
|
||||
if (! node)
|
||||
{
|
||||
grub_dprintf ("hostdisk", "dm_tree_find_node failed\n");
|
||||
dm_tree_free (tree);
|
||||
return 0;
|
||||
}
|
||||
node_uuid = dm_tree_node_get_uuid (node);
|
||||
if (! node_uuid)
|
||||
{
|
||||
grub_dprintf ("hostdisk", "%s has no DM uuid\n", os_dev);
|
||||
dm_tree_free (tree);
|
||||
return 0;
|
||||
}
|
||||
if (strncmp (node_uuid, "LVM-", 4) != 0)
|
||||
{
|
||||
dm_tree_free (tree);
|
||||
return 0;
|
||||
}
|
||||
dm_tree_free (tree);
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
return 1;
|
||||
#endif /* HAVE_DEVICE_MAPPER */
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -671,13 +708,11 @@ grub_util_get_dev_abstraction (const char *os_dev __attribute__((unused)))
|
|||
return GRUB_DEV_ABSTRACTION_NONE;
|
||||
|
||||
/* Check for LVM. */
|
||||
if (!strncmp (os_dev, "/dev/mapper/", 12)
|
||||
&& ! grub_util_is_dmraid (os_dev)
|
||||
&& strncmp (os_dev, "/dev/mapper/mpath", 17) != 0)
|
||||
if (grub_util_is_lvm (os_dev))
|
||||
return GRUB_DEV_ABSTRACTION_LVM;
|
||||
|
||||
/* Check for RAID. */
|
||||
if (!strncmp (os_dev, "/dev/md", 7))
|
||||
if (!strncmp (os_dev, "/dev/md", 7) && ! grub_util_device_is_mapped (os_dev))
|
||||
return GRUB_DEV_ABSTRACTION_RAID;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/emu/misc.h>
|
||||
#include <grub/emu/hostdisk.h>
|
||||
#include <grub/emu/getroot.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/list.h>
|
||||
|
@ -331,18 +332,23 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
static int
|
||||
device_is_mapped (const char *dev)
|
||||
int
|
||||
grub_util_device_is_mapped (const char *dev)
|
||||
{
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
struct stat st;
|
||||
|
||||
if (!grub_device_mapper_supported ())
|
||||
return 0;
|
||||
|
||||
if (stat (dev, &st) < 0)
|
||||
return 0;
|
||||
|
||||
return dm_is_dm_major (major (st.st_rdev));
|
||||
}
|
||||
#else
|
||||
return 0;
|
||||
#endif /* HAVE_DEVICE_MAPPER */
|
||||
}
|
||||
|
||||
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
/* FIXME: geom actually gives us the whole container hierarchy.
|
||||
|
@ -418,7 +424,7 @@ find_partition_start (const char *dev)
|
|||
# endif /* !defined(HAVE_DIOCGDINFO) */
|
||||
|
||||
# ifdef HAVE_DEVICE_MAPPER
|
||||
if (grub_device_mapper_supported () && device_is_mapped (dev)) {
|
||||
if (grub_util_device_is_mapped (dev)) {
|
||||
struct dm_task *task = NULL;
|
||||
grub_uint64_t start, length;
|
||||
char *target_type, *params, *space;
|
||||
|
@ -1149,6 +1155,54 @@ make_device_name (int drive, int dos_part, int bsd_part)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
static int
|
||||
grub_util_get_dm_node_linear_info (const char *dev,
|
||||
int *maj, int *min)
|
||||
{
|
||||
struct dm_task *dmt;
|
||||
void *next = NULL;
|
||||
uint64_t length, start;
|
||||
char *target, *params;
|
||||
char *ptr;
|
||||
int major, minor;
|
||||
|
||||
dmt = dm_task_create(DM_DEVICE_TABLE);
|
||||
if (!dmt)
|
||||
return 0;
|
||||
|
||||
if (!dm_task_set_name(dmt, dev))
|
||||
return 0;
|
||||
dm_task_no_open_count(dmt);
|
||||
if (!dm_task_run(dmt))
|
||||
return 0;
|
||||
next = dm_get_next_target(dmt, next, &start, &length,
|
||||
&target, ¶ms);
|
||||
if (grub_strcmp (target, "linear") != 0)
|
||||
return 0;
|
||||
major = grub_strtoul (params, &ptr, 10);
|
||||
if (grub_errno)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return 0;
|
||||
}
|
||||
if (*ptr != ':')
|
||||
return 0;
|
||||
ptr++;
|
||||
minor = grub_strtoul (ptr, 0, 10);
|
||||
if (grub_errno)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return 0;
|
||||
}
|
||||
if (maj)
|
||||
*maj = major;
|
||||
if (min)
|
||||
*min = minor;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *
|
||||
convert_system_partition_to_system_disk (const char *os_dev, struct stat *st)
|
||||
{
|
||||
|
@ -1325,9 +1379,39 @@ convert_system_partition_to_system_disk (const char *os_dev, struct stat *st)
|
|||
node = NULL;
|
||||
goto devmapper_out;
|
||||
}
|
||||
else if (strncmp (node_uuid, "DMRAID-", 7) != 0)
|
||||
if (strncmp (node_uuid, "LVM-", 4) == 0)
|
||||
{
|
||||
grub_dprintf ("hostdisk", "%s is an LVM\n", path);
|
||||
node = NULL;
|
||||
goto devmapper_out;
|
||||
}
|
||||
if (strncmp (node_uuid, "mpath-", 6) == 0)
|
||||
{
|
||||
/* Multipath partitions have partN-mpath-* UUIDs, and are
|
||||
linear mappings so are handled by
|
||||
grub_util_get_dm_node_linear_info. Multipath disks are not
|
||||
linear mappings and must be handled specially. */
|
||||
grub_dprintf ("hostdisk", "%s is a multipath disk\n", path);
|
||||
mapper_name = dm_tree_node_get_name (node);
|
||||
goto devmapper_out;
|
||||
}
|
||||
if (strncmp (node_uuid, "DMRAID-", 7) != 0)
|
||||
{
|
||||
int major, minor;
|
||||
const char *node_name;
|
||||
grub_dprintf ("hostdisk", "%s is not DM-RAID\n", path);
|
||||
|
||||
if ((node_name = dm_tree_node_get_name (node))
|
||||
&& grub_util_get_dm_node_linear_info (node_name,
|
||||
&major, &minor))
|
||||
{
|
||||
if (tree)
|
||||
dm_tree_free (tree);
|
||||
free (path);
|
||||
char *ret = grub_find_device (NULL, (major << 8) | minor);
|
||||
return ret;
|
||||
}
|
||||
|
||||
node = NULL;
|
||||
goto devmapper_out;
|
||||
}
|
||||
|
|
|
@ -27,35 +27,35 @@ void
|
|||
grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||
grub_size_t *got)
|
||||
{
|
||||
const Elf_Ehdr *e = ehdr;
|
||||
const Elf64_Ehdr *e = ehdr;
|
||||
grub_size_t cntt = 0, cntg = 0;;
|
||||
const Elf_Shdr *s;
|
||||
Elf_Word entsize;
|
||||
const Elf64_Shdr *s;
|
||||
Elf64_Word entsize;
|
||||
unsigned i;
|
||||
|
||||
/* Find a symbol table. */
|
||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||
i < e->e_shnum;
|
||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||
if (s->sh_type == SHT_SYMTAB)
|
||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu32 (e->e_shoff));
|
||||
i < grub_le_to_cpu16 (e->e_shnum);
|
||||
i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize)))
|
||||
if (grub_le_to_cpu32 (s->sh_type) == SHT_SYMTAB)
|
||||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
if (i == grub_le_to_cpu16 (e->e_shnum))
|
||||
return;
|
||||
|
||||
entsize = s->sh_entsize;
|
||||
|
||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||
i < e->e_shnum;
|
||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||
if (s->sh_type == SHT_RELA)
|
||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu32 (e->e_shoff));
|
||||
i < grub_le_to_cpu16 (e->e_shnum);
|
||||
i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize)))
|
||||
if (grub_le_to_cpu32 (s->sh_type) == SHT_RELA)
|
||||
{
|
||||
Elf_Rela *rel, *max;
|
||||
Elf64_Rela *rel, *max;
|
||||
|
||||
for (rel = (Elf_Rela *) ((char *) e + s->sh_offset),
|
||||
max = rel + s->sh_size / s->sh_entsize;
|
||||
for (rel = (Elf64_Rela *) ((char *) e + grub_le_to_cpu32 (s->sh_offset)),
|
||||
max = rel + grub_le_to_cpu32 (s->sh_size) / grub_le_to_cpu16 (s->sh_entsize);
|
||||
rel < max; rel++)
|
||||
switch (ELF_R_TYPE (rel->r_info))
|
||||
switch (ELF64_R_TYPE (grub_le_to_cpu32 (rel->r_info)))
|
||||
{
|
||||
case R_IA64_PCREL21B:
|
||||
cntt++;
|
||||
|
|
|
@ -54,7 +54,7 @@ grub_module_iterate (int (*hook) (struct grub_module_header *header))
|
|||
}
|
||||
|
||||
/* This is actualy platform-independant but used only on loongson and sparc. */
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_SPARC64)
|
||||
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_SPARC64)
|
||||
grub_addr_t
|
||||
grub_modules_get_end (void)
|
||||
{
|
||||
|
|
213
grub-core/kern/mips/arc/init.c
Normal file
213
grub-core/kern/mips/arc/init.c
Normal file
|
@ -0,0 +1,213 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/kernel.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/arc/console.h>
|
||||
#include <grub/cpu/memory.h>
|
||||
#include <grub/cpu/time.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/arc/arc.h>
|
||||
#include <grub/offsets.h>
|
||||
|
||||
const char *type_names[] = {
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
NULL,
|
||||
#endif
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
"eisa", "tc", "scsi", "dti", "multi", "disk", "tape", "cdrom", "worm",
|
||||
"serial", "net", "video", "par", "point", "key", "audio", "other",
|
||||
"rdisk", "fdisk", "tape", "modem", "monitor", "print", "pointer",
|
||||
"keyboard", "term", "other", "line", "network", NULL
|
||||
};
|
||||
|
||||
static int
|
||||
iterate_rec (const char *prefix, const struct grub_arc_component *parent,
|
||||
int (*hook) (const char *name,
|
||||
const struct grub_arc_component *comp),
|
||||
int alt_names)
|
||||
{
|
||||
const struct grub_arc_component *comp;
|
||||
FOR_ARC_CHILDREN(comp, parent)
|
||||
{
|
||||
char *name;
|
||||
const char *cname = NULL;
|
||||
if (comp->type < ARRAY_SIZE (type_names))
|
||||
cname = type_names[comp->type];
|
||||
if (!cname)
|
||||
cname = "unknown";
|
||||
if (alt_names)
|
||||
name = grub_xasprintf ("%s/%s%lu", prefix, cname, comp->key);
|
||||
else
|
||||
name = grub_xasprintf ("%s%s(%lu)", prefix, cname, comp->key);
|
||||
if (!name)
|
||||
return 1;
|
||||
if (hook (name, comp))
|
||||
{
|
||||
grub_free (name);
|
||||
return 1;
|
||||
}
|
||||
if (iterate_rec ((parent ? name : prefix), comp, hook, alt_names))
|
||||
{
|
||||
grub_free (name);
|
||||
return 1;
|
||||
}
|
||||
grub_free (name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
grub_arc_iterate_devs (int (*hook) (const char *name,
|
||||
const struct grub_arc_component *comp),
|
||||
int alt_names)
|
||||
{
|
||||
return iterate_rec ((alt_names ? "arc" : ""), NULL, hook, alt_names);
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_machine_mmap_iterate (grub_memory_hook_t hook)
|
||||
{
|
||||
struct grub_arc_memory_descriptor *cur = NULL;
|
||||
while (1)
|
||||
{
|
||||
grub_memory_type_t type;
|
||||
cur = GRUB_ARC_FIRMWARE_VECTOR->getmemorydescriptor (cur);
|
||||
if (!cur)
|
||||
return GRUB_ERR_NONE;
|
||||
switch (cur->type)
|
||||
{
|
||||
case GRUB_ARC_MEMORY_EXCEPTION_BLOCK:
|
||||
case GRUB_ARC_MEMORY_SYSTEM_PARAMETER_BLOCK:
|
||||
case GRUB_ARC_MEMORY_FW_PERMANENT:
|
||||
default:
|
||||
type = GRUB_MEMORY_RESERVED;
|
||||
break;
|
||||
|
||||
case GRUB_ARC_MEMORY_FW_TEMPORARY:
|
||||
case GRUB_ARC_MEMORY_FREE:
|
||||
case GRUB_ARC_MEMORY_LOADED:
|
||||
case GRUB_ARC_MEMORY_FREE_CONTIGUOUS:
|
||||
type = GRUB_MEMORY_AVAILABLE;
|
||||
break;
|
||||
case GRUB_ARC_MEMORY_BADRAM:
|
||||
type = GRUB_MEMORY_BADRAM;
|
||||
break;
|
||||
}
|
||||
if (hook (((grub_uint64_t) cur->start_page) << 12,
|
||||
((grub_uint64_t) cur->num_pages) << 12, type))
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
extern grub_uint32_t grub_total_modules_size;
|
||||
|
||||
void
|
||||
grub_machine_init (void)
|
||||
{
|
||||
struct grub_arc_memory_descriptor *cur = NULL;
|
||||
|
||||
grub_console_init_early ();
|
||||
|
||||
/* FIXME: measure this. */
|
||||
grub_arch_cpuclock = 64000000;
|
||||
grub_install_get_time_ms (grub_rtc_get_time_ms);
|
||||
|
||||
while (1)
|
||||
{
|
||||
grub_uint64_t start, end;
|
||||
cur = GRUB_ARC_FIRMWARE_VECTOR->getmemorydescriptor (cur);
|
||||
if (!cur)
|
||||
break;
|
||||
if (cur->type != GRUB_ARC_MEMORY_FREE
|
||||
&& cur->type != GRUB_ARC_MEMORY_LOADED
|
||||
&& cur->type != GRUB_ARC_MEMORY_FREE_CONTIGUOUS)
|
||||
continue;
|
||||
start = ((grub_uint64_t) cur->start_page) << 12;
|
||||
end = ((grub_uint64_t) cur->num_pages) << 12;
|
||||
end += start;
|
||||
if ((grub_uint64_t) end > ((GRUB_KERNEL_MIPS_ARC_LINK_ADDR
|
||||
- grub_total_modules_size) & 0x1fffffff))
|
||||
end = ((GRUB_KERNEL_MIPS_ARC_LINK_ADDR - grub_total_modules_size)
|
||||
& 0x1fffffff);
|
||||
if (end > start)
|
||||
grub_mm_init_region ((void *) (grub_addr_t) (start | 0x80000000),
|
||||
end - start);
|
||||
}
|
||||
|
||||
grub_console_init_lately ();
|
||||
|
||||
grub_arcdisk_init ();
|
||||
}
|
||||
|
||||
grub_addr_t
|
||||
grub_arch_modules_addr (void)
|
||||
{
|
||||
return GRUB_KERNEL_MIPS_ARC_LINK_ADDR - grub_total_modules_size;
|
||||
}
|
||||
|
||||
void
|
||||
grub_machine_fini (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
grub_halt (void)
|
||||
{
|
||||
GRUB_ARC_FIRMWARE_VECTOR->powerdown ();
|
||||
|
||||
grub_millisleep (1500);
|
||||
|
||||
grub_printf ("Shutdown failed\n");
|
||||
grub_refresh ();
|
||||
while (1);
|
||||
}
|
||||
|
||||
void
|
||||
grub_exit (void)
|
||||
{
|
||||
GRUB_ARC_FIRMWARE_VECTOR->exit ();
|
||||
|
||||
grub_millisleep (1500);
|
||||
|
||||
grub_printf ("Exit failed\n");
|
||||
grub_refresh ();
|
||||
while (1);
|
||||
}
|
||||
|
||||
void
|
||||
grub_reboot (void)
|
||||
{
|
||||
GRUB_ARC_FIRMWARE_VECTOR->restart ();
|
||||
|
||||
grub_millisleep (1500);
|
||||
|
||||
grub_printf ("Reboot failed\n");
|
||||
grub_refresh ();
|
||||
while (1);
|
||||
}
|
||||
|
|
@ -9,15 +9,15 @@
|
|||
subu $t1, $t3, $t2
|
||||
1:
|
||||
cache 1, 0($t0)
|
||||
addiu $t1, $t1, 0xffff
|
||||
addiu $t1, $t1, -0x4
|
||||
bne $t1, $zero, 1b
|
||||
addiu $t0, $t0, 0x1
|
||||
addiu $t0, $t0, 0x4
|
||||
sync
|
||||
move $t0, $t2
|
||||
subu $t1, $t3, $t2
|
||||
2:
|
||||
cache 0, 0($t0)
|
||||
addiu $t1, $t1, 0xffff
|
||||
addiu $t1, $t1, -0x4
|
||||
bne $t1, $zero, 2b
|
||||
addiu $t0, $t0, 0x1
|
||||
addiu $t0, $t0, 0x4
|
||||
sync
|
||||
|
|
|
@ -34,7 +34,7 @@ grub_arch_dl_check_header (void *ehdr)
|
|||
Elf_Ehdr *e = ehdr;
|
||||
|
||||
/* Check the magic numbers. */
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
if (e->e_ident[EI_CLASS] != ELFCLASS32
|
||||
|| e->e_ident[EI_DATA] != ELFDATA2MSB
|
||||
|| e->e_machine != EM_MIPS)
|
||||
|
@ -144,14 +144,14 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
rel < max;
|
||||
rel++)
|
||||
{
|
||||
Elf_Word *addr;
|
||||
grub_uint8_t *addr;
|
||||
Elf_Sym *sym;
|
||||
|
||||
if (seg->size < rel->r_offset)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||
"reloc offset is out of the segment");
|
||||
|
||||
addr = (Elf_Word *) ((char *) seg->addr + rel->r_offset);
|
||||
addr = (grub_uint8_t *) ((char *) seg->addr + rel->r_offset);
|
||||
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||
+ entsize * ELF_R_SYM (rel->r_info));
|
||||
if (sym->st_value == (grub_addr_t) &__gnu_local_gp_dummy)
|
||||
|
@ -163,7 +163,11 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
{
|
||||
grub_uint32_t value;
|
||||
Elf_Rel *rel2;
|
||||
|
||||
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
addr += 2;
|
||||
#endif
|
||||
|
||||
/* Handle partner lo16 relocation. Lower part is
|
||||
treated as signed. Hence add 0x8000 to compensate.
|
||||
*/
|
||||
|
@ -175,13 +179,20 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
&& ELF_R_TYPE (rel2->r_info) == R_MIPS_LO16)
|
||||
{
|
||||
value += *(grub_int16_t *)
|
||||
((char *) seg->addr + rel2->r_offset);
|
||||
((char *) seg->addr + rel2->r_offset
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
+ 2
|
||||
#endif
|
||||
);
|
||||
break;
|
||||
}
|
||||
*(grub_uint16_t *) addr = (value >> 16) & 0xffff;
|
||||
}
|
||||
break;
|
||||
case R_MIPS_LO16:
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
addr += 2;
|
||||
#endif
|
||||
*(grub_uint16_t *) addr += (sym->st_value) & 0xffff;
|
||||
break;
|
||||
case R_MIPS_32:
|
||||
|
@ -208,6 +219,9 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
case R_MIPS_GOT16:
|
||||
case R_MIPS_CALL16:
|
||||
/* FIXME: reuse*/
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
addr += 2;
|
||||
#endif
|
||||
*gpptr = sym->st_value + *(grub_uint16_t *) addr;
|
||||
*(grub_uint16_t *) addr
|
||||
= sizeof (grub_uint32_t) * (gpptr - gp);
|
||||
|
|
|
@ -18,17 +18,27 @@
|
|||
|
||||
#include <grub/kernel.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/cpu/time.h>
|
||||
#include <grub/cpu/mips.h>
|
||||
|
||||
/* FIXME: use interrupt to count high. */
|
||||
grub_uint64_t
|
||||
grub_get_rtc (void)
|
||||
{
|
||||
static grub_uint32_t high = 0;
|
||||
static grub_uint32_t last = 0;
|
||||
grub_uint32_t low;
|
||||
|
||||
asm volatile ("mfc0 %0, " GRUB_CPU_MIPS_COP0_TIMER_COUNT : "=r" (low));
|
||||
if (low < last)
|
||||
high++;
|
||||
last = low;
|
||||
|
||||
return (((grub_uint64_t) high) << 32) | low;
|
||||
}
|
||||
|
||||
void
|
||||
grub_machine_set_prefix (void)
|
||||
{
|
||||
grub_env_set ("prefix", grub_prefix);
|
||||
}
|
||||
|
||||
extern char _end[];
|
||||
|
||||
grub_addr_t
|
||||
grub_arch_modules_addr (void)
|
||||
{
|
||||
return (grub_addr_t) _end;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <grub/cs5536.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/machine/ec.h>
|
||||
#include <grub/cpu/memory.h>
|
||||
|
||||
extern void grub_video_sm712_init (void);
|
||||
extern void grub_video_sis315pro_init (void);
|
||||
|
@ -44,22 +45,6 @@ extern void grub_terminfo_init (void);
|
|||
extern void grub_keylayouts_init (void);
|
||||
extern void grub_boot_init (void);
|
||||
|
||||
/* FIXME: use interrupt to count high. */
|
||||
grub_uint64_t
|
||||
grub_get_rtc (void)
|
||||
{
|
||||
static grub_uint32_t high = 0;
|
||||
static grub_uint32_t last = 0;
|
||||
grub_uint32_t low;
|
||||
|
||||
asm volatile ("mfc0 %0, " GRUB_CPU_LOONGSON_COP0_TIMER_COUNT : "=r" (low));
|
||||
if (low < last)
|
||||
high++;
|
||||
last = low;
|
||||
|
||||
return (((grub_uint64_t) high) << 32) | low;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_machine_mmap_iterate (grub_memory_hook_t hook)
|
||||
{
|
||||
|
@ -272,3 +257,10 @@ grub_reboot (void)
|
|||
while (1);
|
||||
}
|
||||
|
||||
extern char _end[];
|
||||
|
||||
grub_addr_t
|
||||
grub_arch_modules_addr (void)
|
||||
{
|
||||
return (grub_addr_t) _end;
|
||||
}
|
||||
|
|
|
@ -6,25 +6,29 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/cpu/kernel.h>
|
||||
#include <grub/cpu/memory.h>
|
||||
#include <grub/memory.h>
|
||||
|
||||
#define RAMSIZE (*(grub_uint32_t *) ((16 << 20) - 264))
|
||||
|
||||
grub_uint32_t
|
||||
grub_get_rtc (void)
|
||||
{
|
||||
static int calln = 0;
|
||||
return calln++;
|
||||
}
|
||||
extern void grub_serial_init (void);
|
||||
extern void grub_terminfo_init (void);
|
||||
|
||||
void
|
||||
grub_machine_init (void)
|
||||
{
|
||||
grub_mm_init_region ((void *) GRUB_MACHINE_MEMORY_USABLE,
|
||||
RAMSIZE - (GRUB_MACHINE_MEMORY_USABLE & 0x7fffffff));
|
||||
grub_addr_t modend;
|
||||
|
||||
/* FIXME: measure this. */
|
||||
grub_arch_cpuclock = 64000000;
|
||||
|
||||
modend = grub_modules_get_end ();
|
||||
grub_mm_init_region ((void *) modend, grub_arch_memsize
|
||||
- (modend - GRUB_ARCH_LOWMEMVSTART));
|
||||
|
||||
grub_install_get_time_ms (grub_rtc_get_time_ms);
|
||||
|
||||
grub_terminfo_init ();
|
||||
grub_serial_init ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -53,6 +57,14 @@ grub_reboot (void)
|
|||
grub_err_t
|
||||
grub_machine_mmap_iterate (grub_memory_hook_t hook)
|
||||
{
|
||||
hook (0, RAMSIZE, GRUB_MEMORY_AVAILABLE);
|
||||
hook (0, grub_arch_memsize, GRUB_MEMORY_AVAILABLE);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
extern char _end[];
|
||||
|
||||
grub_addr_t
|
||||
grub_arch_modules_addr (void)
|
||||
{
|
||||
return (grub_addr_t) _end;
|
||||
}
|
|
@ -36,8 +36,8 @@ start:
|
|||
bal cont
|
||||
nop
|
||||
|
||||
. = _start + GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE
|
||||
total_module_size:
|
||||
. = _start + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
|
||||
VARIABLE(grub_total_modules_size)
|
||||
.long 0
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX
|
||||
|
@ -51,7 +51,6 @@ VARIABLE(grub_prefix)
|
|||
*/
|
||||
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
VARIABLE (grub_arch_busclock)
|
||||
.long 0
|
||||
VARIABLE (grub_arch_cpuclock)
|
||||
|
@ -60,6 +59,7 @@ VARIABLE (grub_arch_memsize)
|
|||
.long 0
|
||||
VARIABLE (grub_arch_highmemsize)
|
||||
.long 0
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
VARIABLE (grub_arch_machine)
|
||||
.long GRUB_ARCH_MACHINE_FULOONG
|
||||
#endif
|
||||
|
@ -67,6 +67,12 @@ cont:
|
|||
/* Save our base. */
|
||||
move $s0, $ra
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
lui $t1, %hi(grub_arch_busclock)
|
||||
addiu $t1, %lo(grub_arch_busclock)
|
||||
sw $s4, 8($t1)
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
lui $t1, %hi(grub_arch_busclock)
|
||||
addiu $t1, %lo(grub_arch_busclock)
|
||||
|
@ -78,6 +84,7 @@ cont:
|
|||
#endif
|
||||
|
||||
/* Move the modules out of BSS. */
|
||||
#ifndef GRUB_MACHINE_ARC
|
||||
lui $t2, %hi(__bss_start)
|
||||
addiu $t2, %lo(__bss_start)
|
||||
|
||||
|
@ -107,6 +114,7 @@ modulesmovcont:
|
|||
b modulesmovcont
|
||||
addiu $t3, $t3, -1
|
||||
modulesmovdone:
|
||||
#endif
|
||||
|
||||
/* Clean BSS. */
|
||||
|
||||
|
|
48
grub-core/lib/arc/datetime.c
Normal file
48
grub-core/lib/arc/datetime.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/datetime.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/arc/arc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
grub_err_t
|
||||
grub_get_datetime (struct grub_datetime *datetime)
|
||||
{
|
||||
struct grub_arc_timeinfo *dt;
|
||||
grub_memset (datetime, 0, sizeof (*datetime));
|
||||
|
||||
dt = GRUB_ARC_FIRMWARE_VECTOR->gettime ();
|
||||
|
||||
datetime->year = dt->y;
|
||||
datetime->month = dt->m;
|
||||
datetime->day = dt->d;
|
||||
datetime->hour = dt->h;
|
||||
datetime->minute = dt->min;
|
||||
datetime->second = dt->s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_set_datetime (struct grub_datetime *datetime __attribute__ ((unused)))
|
||||
{
|
||||
return grub_error (GRUB_ERR_IO, "setting time isn't supported");
|
||||
}
|
|
@ -50,6 +50,7 @@ extern grub_uint16_t grub_relocator16_gs;
|
|||
extern grub_uint16_t grub_relocator16_ss;
|
||||
extern grub_uint16_t grub_relocator16_sp;
|
||||
extern grub_uint32_t grub_relocator16_edx;
|
||||
extern grub_uint32_t grub_relocator16_ebx;
|
||||
|
||||
extern grub_uint8_t grub_relocator32_start;
|
||||
extern grub_uint8_t grub_relocator32_end;
|
||||
|
@ -212,6 +213,7 @@ grub_relocator16_boot (struct grub_relocator *rel,
|
|||
grub_relocator16_ss = state.ss;
|
||||
grub_relocator16_sp = state.sp;
|
||||
|
||||
grub_relocator16_ebx = state.ebx;
|
||||
grub_relocator16_edx = state.edx;
|
||||
|
||||
grub_memmove (get_virtual_current_address (ch), &grub_relocator16_start,
|
||||
|
|
|
@ -136,7 +136,12 @@ VARIABLE(grub_relocator16_sp)
|
|||
.byte 0x66, 0xba
|
||||
VARIABLE(grub_relocator16_edx)
|
||||
.long 0
|
||||
|
||||
|
||||
/* movw imm32, %ebx. */
|
||||
.byte 0x66, 0xbb
|
||||
VARIABLE(grub_relocator16_ebx)
|
||||
.long 0
|
||||
|
||||
/* Cleared direction flag is of no problem with any current
|
||||
payload and makes this implementation easier. */
|
||||
cld
|
||||
|
|
|
@ -57,7 +57,6 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
#endif
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x1000
|
||||
#define GRUB_LINUX_CL_END_OFFSET 0x2000
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
|
@ -74,6 +73,7 @@ static grub_uint32_t prot_mode_pages;
|
|||
static grub_uint32_t initrd_pages;
|
||||
static struct grub_relocator *relocator = NULL;
|
||||
static void *efi_mmap_buf;
|
||||
static grub_size_t maximal_cmdline_size;
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
static grub_efi_uintn_t efi_mmap_size;
|
||||
#else
|
||||
|
@ -189,7 +189,7 @@ allocate_pages (grub_size_t prot_size)
|
|||
grub_err_t err;
|
||||
|
||||
/* Make sure that each size is aligned to a page boundary. */
|
||||
real_size = GRUB_LINUX_CL_END_OFFSET;
|
||||
real_size = GRUB_LINUX_CL_OFFSET + maximal_cmdline_size;
|
||||
prot_size = page_align (prot_size);
|
||||
mmap_size = find_mmap_size ();
|
||||
|
||||
|
@ -663,6 +663,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (grub_le_to_cpu16 (lh.version) >= 0x0206)
|
||||
maximal_cmdline_size = grub_le_to_cpu32 (lh.cmdline_size) + 1;
|
||||
else
|
||||
maximal_cmdline_size = 256;
|
||||
|
||||
if (maximal_cmdline_size < 128)
|
||||
maximal_cmdline_size = 128;
|
||||
|
||||
setup_sects = lh.setup_sects;
|
||||
|
||||
/* If SETUP_SECTS is not set, set it to the default (4). */
|
||||
|
@ -676,7 +684,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
|
||||
params = (struct linux_kernel_params *) real_mode_mem;
|
||||
grub_memset (params, 0, GRUB_LINUX_CL_END_OFFSET);
|
||||
grub_memset (params, 0, GRUB_LINUX_CL_OFFSET + maximal_cmdline_size);
|
||||
grub_memcpy (¶ms->setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1);
|
||||
|
||||
params->ps_mouse = params->padding10 = 0;
|
||||
|
@ -871,7 +879,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_create_loader_cmdline (argc, argv,
|
||||
(char *)real_mode_mem + GRUB_LINUX_CL_OFFSET
|
||||
+ sizeof (LINUX_IMAGE) - 1,
|
||||
GRUB_LINUX_CL_END_OFFSET - GRUB_LINUX_CL_OFFSET
|
||||
maximal_cmdline_size
|
||||
- (sizeof (LINUX_IMAGE) - 1));
|
||||
|
||||
len = prot_size;
|
||||
|
|
136
grub-core/loader/i386/pc/freedos.c
Normal file
136
grub-core/loader/i386/pc/freedos.c
Normal file
|
@ -0,0 +1,136 @@
|
|||
/* chainloader.c - boot another boot loader */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2004,2007,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/loader.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/machine/biosnum.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/cpu/relocator.h>
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
static struct grub_relocator *rel;
|
||||
static grub_uint32_t ebx = 0xffffffff;
|
||||
|
||||
#define GRUB_FREEDOS_SEGMENT 0x60
|
||||
#define GRUB_FREEDOS_STACK_SEGMENT 0x1fe0
|
||||
#define GRUB_FREEDOS_STACK_POINTER 0x8000
|
||||
|
||||
static grub_err_t
|
||||
grub_freedos_boot (void)
|
||||
{
|
||||
struct grub_relocator16_state state = {
|
||||
.cs = GRUB_FREEDOS_SEGMENT,
|
||||
.ip = 0,
|
||||
.ds = 0,
|
||||
.es = 0,
|
||||
.fs = 0,
|
||||
.gs = 0,
|
||||
.ss = GRUB_FREEDOS_STACK_SEGMENT,
|
||||
.sp = GRUB_FREEDOS_STACK_POINTER,
|
||||
.ebx = ebx,
|
||||
.edx = 0
|
||||
};
|
||||
grub_video_set_mode ("text", 0, 0);
|
||||
|
||||
return grub_relocator16_boot (rel, state);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_freedos_unload (void)
|
||||
{
|
||||
grub_relocator_unload (rel);
|
||||
rel = NULL;
|
||||
grub_dl_unref (my_mod);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_freedos (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
{
|
||||
grub_file_t file = 0;
|
||||
grub_err_t err;
|
||||
void *kernelsys;
|
||||
grub_size_t kernelsyssize;
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
|
||||
|
||||
grub_dl_ref (my_mod);
|
||||
|
||||
rel = grub_relocator_new ();
|
||||
if (!rel)
|
||||
goto fail;
|
||||
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
goto fail;
|
||||
|
||||
ebx = grub_get_root_biosnumber ();
|
||||
|
||||
kernelsyssize = grub_file_size (file);
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
err = grub_relocator_alloc_chunk_addr (rel, &ch, GRUB_FREEDOS_SEGMENT << 4,
|
||||
kernelsyssize);
|
||||
if (err)
|
||||
goto fail;
|
||||
kernelsys = get_virtual_current_address (ch);
|
||||
}
|
||||
|
||||
if (grub_file_read (file, kernelsys, kernelsyssize)
|
||||
!= (grub_ssize_t) kernelsyssize)
|
||||
goto fail;
|
||||
|
||||
grub_loader_set (grub_freedos_boot, grub_freedos_unload, 1);
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
fail:
|
||||
|
||||
if (file)
|
||||
grub_file_close (file);
|
||||
|
||||
grub_freedos_unload ();
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
static grub_command_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(freedos)
|
||||
{
|
||||
cmd = grub_register_command ("freedos", grub_cmd_freedos,
|
||||
0, N_("Load FreeDOS kernel.sys."));
|
||||
my_mod = mod;
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(freedos)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
}
|
|
@ -39,7 +39,6 @@
|
|||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x9000
|
||||
#define GRUB_LINUX_CL_END_OFFSET 0x90FF
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
|
@ -49,6 +48,7 @@ static struct grub_relocator *relocator = NULL;
|
|||
static grub_addr_t grub_linux_real_target;
|
||||
static char *grub_linux_real_chunk;
|
||||
static grub_size_t grub_linux16_prot_size;
|
||||
static grub_size_t maximal_cmdline_size;
|
||||
|
||||
static grub_err_t
|
||||
grub_linux16_boot (void)
|
||||
|
@ -128,15 +128,20 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
setup_sects = lh.setup_sects;
|
||||
linux_mem_size = 0;
|
||||
|
||||
maximal_cmdline_size = 256;
|
||||
|
||||
if (lh.header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE)
|
||||
&& grub_le_to_cpu16 (lh.version) >= 0x0200)
|
||||
{
|
||||
grub_linux_is_bzimage = (lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL);
|
||||
lh.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE;
|
||||
|
||||
if (grub_le_to_cpu16 (lh.version) >= 0x0206)
|
||||
maximal_cmdline_size = grub_le_to_cpu32 (lh.cmdline_size) + 1;
|
||||
|
||||
/* Put the real mode part at as a high location as possible. */
|
||||
grub_linux_real_target = grub_mmap_get_lower ()
|
||||
- GRUB_LINUX_SETUP_MOVE_SIZE;
|
||||
- (GRUB_LINUX_CL_OFFSET + maximal_cmdline_size);
|
||||
/* But it must not exceed the traditional area. */
|
||||
if (grub_linux_real_target > GRUB_LINUX_OLD_REAL_MODE_ADDR)
|
||||
grub_linux_real_target = GRUB_LINUX_OLD_REAL_MODE_ADDR;
|
||||
|
@ -153,7 +158,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
{
|
||||
lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC);
|
||||
lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET);
|
||||
lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_SETUP_MOVE_SIZE);
|
||||
lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET
|
||||
+ maximal_cmdline_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -185,12 +191,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (grub_linux_real_target + GRUB_LINUX_SETUP_MOVE_SIZE
|
||||
if (grub_linux_real_target + GRUB_LINUX_CL_OFFSET + maximal_cmdline_size
|
||||
> grub_mmap_get_lower ())
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"too small lower memory (0x%x > 0x%x)",
|
||||
grub_linux_real_target + GRUB_LINUX_SETUP_MOVE_SIZE,
|
||||
grub_linux_real_target + GRUB_LINUX_CL_OFFSET
|
||||
+ maximal_cmdline_size,
|
||||
(int) grub_mmap_get_lower ());
|
||||
goto fail;
|
||||
}
|
||||
|
@ -263,7 +270,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_relocator_chunk_t ch;
|
||||
err = grub_relocator_alloc_chunk_addr (relocator, &ch,
|
||||
grub_linux_real_target,
|
||||
GRUB_LINUX_SETUP_MOVE_SIZE);
|
||||
GRUB_LINUX_CL_OFFSET
|
||||
+ maximal_cmdline_size);
|
||||
if (err)
|
||||
return err;
|
||||
grub_linux_real_chunk = get_virtual_current_address (ch);
|
||||
|
@ -294,7 +302,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_create_loader_cmdline (argc, argv,
|
||||
(char *)grub_linux_real_chunk
|
||||
+ GRUB_LINUX_CL_OFFSET + sizeof (LINUX_IMAGE) - 1,
|
||||
GRUB_LINUX_CL_END_OFFSET - GRUB_LINUX_CL_OFFSET
|
||||
maximal_cmdline_size
|
||||
- (sizeof (LINUX_IMAGE) - 1));
|
||||
|
||||
if (grub_linux_is_bzimage)
|
||||
|
|
|
@ -27,14 +27,15 @@
|
|||
#include <grub/mips/relocator.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/lib/cmdline.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* For frequencies. */
|
||||
#include <grub/pci.h>
|
||||
#include <grub/machine/time.h>
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
#include <grub/pci.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
|
||||
const char loongson_machtypes[][60] =
|
||||
|
@ -53,9 +54,16 @@ static grub_size_t linux_size;
|
|||
static struct grub_relocator *relocator;
|
||||
static grub_uint8_t *playground;
|
||||
static grub_addr_t target_addr, entry_addr;
|
||||
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
static char *params;
|
||||
#else
|
||||
static int linux_argc;
|
||||
static grub_off_t argv_off, envp_off;
|
||||
static grub_off_t argv_off;
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
static grub_off_t envp_off;
|
||||
#endif
|
||||
static grub_off_t rd_addr_arg_off, rd_size_arg_off;
|
||||
#endif
|
||||
static int initrd_loaded = 0;
|
||||
|
||||
static grub_err_t
|
||||
|
@ -63,11 +71,43 @@ grub_linux_boot (void)
|
|||
{
|
||||
struct grub_relocator32_state state;
|
||||
|
||||
grub_memset (&state, 0, sizeof (state));
|
||||
|
||||
/* Boot the kernel. */
|
||||
state.gpr[1] = entry_addr;
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_relocator_chunk_t ch;
|
||||
grub_uint32_t *memsize;
|
||||
grub_uint32_t *magic;
|
||||
char *str;
|
||||
|
||||
err = grub_relocator_alloc_chunk_addr (relocator, &ch,
|
||||
((16 << 20) - 264),
|
||||
grub_strlen (params) + 1 + 8);
|
||||
if (err)
|
||||
return err;
|
||||
memsize = get_virtual_current_address (ch);
|
||||
magic = memsize + 1;
|
||||
*memsize = grub_mmap_get_lower ();
|
||||
*magic = 0x12345678;
|
||||
str = (char *) (magic + 1);
|
||||
grub_strcpy (str, params);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
state.gpr[4] = linux_argc;
|
||||
state.gpr[5] = target_addr + argv_off;
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
state.gpr[6] = target_addr + envp_off;
|
||||
#else
|
||||
state.gpr[6] = 0;
|
||||
#endif
|
||||
state.gpr[7] = 0;
|
||||
#endif
|
||||
state.jumpreg = 1;
|
||||
grub_relocator32_boot (relocator, state);
|
||||
|
||||
|
@ -80,6 +120,11 @@ grub_linux_unload (void)
|
|||
grub_relocator_unload (relocator);
|
||||
grub_dl_unref (my_mod);
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
grub_free (params);
|
||||
params = 0;
|
||||
#endif
|
||||
|
||||
loaded = 0;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
@ -199,12 +244,18 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
int argc, char *argv[])
|
||||
{
|
||||
grub_elf_t elf = 0;
|
||||
int i;
|
||||
int size;
|
||||
void *extra = NULL;
|
||||
grub_uint32_t *linux_argv, *linux_envp;
|
||||
char *linux_args, *linux_envs;
|
||||
#ifndef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
int i;
|
||||
grub_uint32_t *linux_argv;
|
||||
char *linux_args;
|
||||
#endif
|
||||
grub_err_t err;
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
char *linux_envs;
|
||||
grub_uint32_t *linux_envp;
|
||||
#endif
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
|
||||
|
@ -224,6 +275,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_loader_unset ();
|
||||
loaded = 0;
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
size = 0;
|
||||
#else
|
||||
/* For arguments. */
|
||||
linux_argc = argc;
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
|
@ -256,6 +310,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
+ ALIGN_UP (sizeof ("highmemsize=XXXXXXXXXXXXXXXXXXXX"), 4)
|
||||
+ ALIGN_UP (sizeof ("busclock=XXXXXXXXXX"), 4)
|
||||
+ ALIGN_UP (sizeof ("cpuclock=XXXXXXXXXX"), 4);
|
||||
#endif
|
||||
|
||||
if (grub_elf_is_elf32 (elf))
|
||||
err = grub_linux_load32 (elf, &extra, size);
|
||||
|
@ -270,6 +325,20 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
/* Create kernel command line. */
|
||||
size = grub_loader_cmdline_size(argc, argv);
|
||||
params = grub_malloc (size + sizeof (LINUX_IMAGE));
|
||||
if (! params)
|
||||
{
|
||||
grub_linux_unload ();
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_memcpy (params, LINUX_IMAGE, sizeof (LINUX_IMAGE));
|
||||
grub_create_loader_cmdline (argc, argv, params + sizeof (LINUX_IMAGE) - 1,
|
||||
size);
|
||||
#else
|
||||
linux_argv = extra;
|
||||
argv_off = (grub_uint8_t *) linux_argv - (grub_uint8_t *) playground;
|
||||
extra = linux_argv + (linux_argc + 1 + 2);
|
||||
|
@ -321,6 +390,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
extra = linux_args;
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
linux_envp = extra;
|
||||
envp_off = (grub_uint8_t *) linux_envp - (grub_uint8_t *) playground;
|
||||
linux_envs = (char *) (linux_envp + 5);
|
||||
|
@ -348,8 +418,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
+ target_addr;
|
||||
linux_envs += ALIGN_UP (grub_strlen (linux_envs) + 1, 4);
|
||||
|
||||
|
||||
linux_envp[4] = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
grub_loader_set (grub_linux_boot, grub_linux_unload, 1);
|
||||
initrd_loaded = 0;
|
||||
|
@ -412,6 +483,21 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
{
|
||||
char *tmp;
|
||||
tmp = grub_xasprintf ("%s rd_start=0x%" PRIxGRUB_ADDR
|
||||
" rd_size=0x%" PRIxGRUB_ADDR, params,
|
||||
initrd_dest, size);
|
||||
if (!tmp)
|
||||
{
|
||||
grub_file_close (file);
|
||||
return grub_errno;
|
||||
}
|
||||
grub_free (params);
|
||||
params = tmp;
|
||||
}
|
||||
#else
|
||||
grub_snprintf ((char *) playground + rd_addr_arg_off,
|
||||
sizeof ("rd_start=0xXXXXXXXXXXXXXXXX"), "rd_start=0x%llx",
|
||||
(unsigned long long) initrd_dest);
|
||||
|
@ -425,6 +511,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
((grub_uint32_t *) (playground + argv_off))[linux_argc]
|
||||
= target_addr + rd_size_arg_off;
|
||||
linux_argc++;
|
||||
#endif
|
||||
|
||||
initrd_loaded = 1;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <grub/memory.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/cpu/memory.h>
|
||||
|
||||
grub_uint64_t
|
||||
grub_mmap_get_lower (void)
|
4
grub-core/modinfo.sh.in
Normal file
4
grub-core/modinfo.sh.in
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
grub_modinfo_target_cpu=@target_cpu@
|
||||
grub_modinfo_platform=@platform@
|
124
grub-core/partmap/dvh.c
Normal file
124
grub-core/partmap/dvh.c
Normal file
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2005,2006,2007,2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/partition.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define DVH_MAGIC 0x0be5a941
|
||||
|
||||
struct grub_dvh_partition_descriptor
|
||||
{
|
||||
grub_uint32_t length;
|
||||
grub_uint32_t start;
|
||||
grub_uint32_t type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_dvh_block
|
||||
{
|
||||
grub_uint32_t magic;
|
||||
grub_uint8_t unused[308];
|
||||
struct grub_dvh_partition_descriptor parts[16];
|
||||
grub_uint32_t checksum;
|
||||
grub_uint32_t unused2;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static struct grub_partition_map grub_dvh_partition_map;
|
||||
|
||||
/* Verify checksum (true=ok). */
|
||||
static int
|
||||
grub_dvh_is_valid (struct grub_dvh_block *label)
|
||||
{
|
||||
grub_uint32_t *pos;
|
||||
grub_uint32_t sum = 0;
|
||||
|
||||
for (pos = (grub_uint32_t *) label;
|
||||
pos < (grub_uint32_t *) (label + 1);
|
||||
pos++)
|
||||
sum += *pos;
|
||||
|
||||
return ! sum;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
dvh_partition_map_iterate (grub_disk_t disk,
|
||||
int (*hook) (grub_disk_t disk,
|
||||
const grub_partition_t partition))
|
||||
{
|
||||
struct grub_partition p;
|
||||
struct grub_dvh_block block;
|
||||
unsigned partnum;
|
||||
grub_err_t err;
|
||||
|
||||
p.partmap = &grub_dvh_partition_map;
|
||||
err = grub_disk_read (disk, 0, 0, sizeof (struct grub_dvh_block),
|
||||
&block);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (DVH_MAGIC != grub_be_to_cpu32 (block.magic))
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "not a dvh partition table");
|
||||
|
||||
if (! grub_dvh_is_valid (&block))
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "invalid checksum");
|
||||
|
||||
/* Maybe another error value would be better, because partition
|
||||
table _is_ recognized but invalid. */
|
||||
for (partnum = 0; partnum < ARRAY_SIZE (block.parts); partnum++)
|
||||
{
|
||||
if (block.parts[partnum].length == 0)
|
||||
continue;
|
||||
|
||||
if (partnum == 10)
|
||||
continue;
|
||||
|
||||
p.start = grub_be_to_cpu32 (block.parts[partnum].start);
|
||||
p.len = grub_be_to_cpu32 (block.parts[partnum].length);
|
||||
p.number = p.index = partnum;
|
||||
if (hook (disk, &p))
|
||||
break;
|
||||
}
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_dvh_partition_map =
|
||||
{
|
||||
.name = "dvh",
|
||||
.iterate = dvh_partition_map_iterate,
|
||||
};
|
||||
|
||||
GRUB_MOD_INIT(part_dvh)
|
||||
{
|
||||
grub_partition_map_register (&grub_dvh_partition_map);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(part_dvh)
|
||||
{
|
||||
grub_partition_map_unregister (&grub_dvh_partition_map);
|
||||
}
|
||||
|
123
grub-core/term/arc/console.c
Normal file
123
grub-core/term/arc/console.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/arc/arc.h>
|
||||
#include <grub/arc/console.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/terminfo.h>
|
||||
|
||||
/* FIXME: use unicode. */
|
||||
|
||||
static int
|
||||
readkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
unsigned long count;
|
||||
char chr;
|
||||
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->get_read_status (GRUB_ARC_STDIN))
|
||||
return -1;
|
||||
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->read (GRUB_ARC_STDIN, &chr, 1, &count))
|
||||
return -1;
|
||||
if (!count)
|
||||
return -1;
|
||||
return chr;
|
||||
}
|
||||
|
||||
static void
|
||||
put (struct grub_term_output *term __attribute__ ((unused)), const int c)
|
||||
{
|
||||
unsigned long count;
|
||||
char chr = c;
|
||||
|
||||
GRUB_ARC_FIRMWARE_VECTOR->write (GRUB_ARC_STDOUT, &chr, 1, &count);
|
||||
}
|
||||
|
||||
static struct grub_terminfo_output_state grub_console_terminfo_output;
|
||||
|
||||
static grub_err_t
|
||||
grub_console_init_output (struct grub_term_output *term)
|
||||
{
|
||||
struct grub_arc_display_status *info = NULL;
|
||||
if (GRUB_ARC_SYSTEM_PARAMETER_BLOCK->firmware_vector_length
|
||||
>= ((char *) (&GRUB_ARC_FIRMWARE_VECTOR->getdisplaystatus + 1)
|
||||
- (char *) GRUB_ARC_FIRMWARE_VECTOR)
|
||||
&& GRUB_ARC_FIRMWARE_VECTOR->getdisplaystatus)
|
||||
info = GRUB_ARC_FIRMWARE_VECTOR->getdisplaystatus (GRUB_ARC_STDOUT);
|
||||
if (info)
|
||||
{
|
||||
grub_console_terminfo_output.width = info->w;
|
||||
grub_console_terminfo_output.height = info->h;
|
||||
}
|
||||
grub_terminfo_output_init (term);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct grub_terminfo_input_state grub_console_terminfo_input =
|
||||
{
|
||||
.readkey = readkey
|
||||
};
|
||||
|
||||
static struct grub_terminfo_output_state grub_console_terminfo_output =
|
||||
{
|
||||
.put = put,
|
||||
.width = 80,
|
||||
.height = 36
|
||||
};
|
||||
|
||||
static struct grub_term_input grub_console_term_input =
|
||||
{
|
||||
.name = "console",
|
||||
.init = grub_terminfo_input_init,
|
||||
.getkey = grub_terminfo_getkey,
|
||||
.data = &grub_console_terminfo_input
|
||||
};
|
||||
|
||||
static struct grub_term_output grub_console_term_output =
|
||||
{
|
||||
.name = "console",
|
||||
.init = grub_console_init_output,
|
||||
.putchar = grub_terminfo_putchar,
|
||||
.getxy = grub_terminfo_getxy,
|
||||
.getwh = grub_terminfo_getwh,
|
||||
.gotoxy = grub_terminfo_gotoxy,
|
||||
.cls = grub_terminfo_cls,
|
||||
.setcolorstate = grub_terminfo_setcolorstate,
|
||||
.setcursor = grub_terminfo_setcursor,
|
||||
.flags = GRUB_TERM_CODE_TYPE_ASCII,
|
||||
.data = &grub_console_terminfo_output,
|
||||
.normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
|
||||
.highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
|
||||
};
|
||||
|
||||
void
|
||||
grub_console_init_early (void)
|
||||
{
|
||||
grub_term_register_input ("console", &grub_console_term_input);
|
||||
grub_term_register_output ("console", &grub_console_term_output);
|
||||
}
|
||||
|
||||
void grub_terminfo_init (void);
|
||||
|
||||
void
|
||||
grub_console_init_lately (void)
|
||||
{
|
||||
grub_terminfo_init ();
|
||||
grub_terminfo_output_register (&grub_console_term_output, "arc");
|
||||
}
|
|
@ -36,6 +36,9 @@
|
|||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define ANSI_C0 0x9b
|
||||
#define ANSI_C0_STR "\x9b"
|
||||
|
||||
static struct grub_term_output *terminfo_outputs;
|
||||
|
||||
/* Get current terminfo name. */
|
||||
|
@ -123,6 +126,20 @@ grub_terminfo_set_current (struct grub_term_output *term,
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
if (grub_strcmp ("arc", str) == 0)
|
||||
{
|
||||
data->name = grub_strdup ("arc");
|
||||
data->gotoxy = grub_strdup (ANSI_C0_STR "%i%p1%d;%p2%dH");
|
||||
data->cls = grub_strdup (ANSI_C0_STR "2J");
|
||||
data->reverse_video_on = grub_strdup (ANSI_C0_STR "7m");
|
||||
data->reverse_video_off = grub_strdup (ANSI_C0_STR "0m");
|
||||
data->cursor_on = 0;
|
||||
data->cursor_off = 0;
|
||||
data->setcolor = grub_strdup (ANSI_C0_STR "3%p1%dm"
|
||||
ANSI_C0_STR "4%p2%dm");
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
if (grub_strcmp ("ieee1275", str) == 0)
|
||||
{
|
||||
data->name = grub_strdup ("ieee1275");
|
||||
|
@ -369,8 +386,6 @@ grub_terminfo_getwh (struct grub_term_output *term)
|
|||
return (data->width << 8) | data->height;
|
||||
}
|
||||
|
||||
#define ANSI_C0 0x9b
|
||||
|
||||
static void
|
||||
grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
|
||||
int (*readkey) (struct grub_term_input *term))
|
||||
|
@ -430,7 +445,8 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
|
|||
{'K', GRUB_TERM_KEY_END},
|
||||
{'P', GRUB_TERM_KEY_DC},
|
||||
{'?', GRUB_TERM_KEY_PPAGE},
|
||||
{'/', GRUB_TERM_KEY_NPAGE}
|
||||
{'/', GRUB_TERM_KEY_NPAGE},
|
||||
{'@', GRUB_TERM_KEY_INSERT},
|
||||
};
|
||||
|
||||
static struct
|
||||
|
@ -445,6 +461,14 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
|
|||
{'5', GRUB_TERM_KEY_PPAGE},
|
||||
{'6', GRUB_TERM_KEY_NPAGE}
|
||||
};
|
||||
char fx_key[] =
|
||||
{ 'P', 'Q', 'w', 'x', 't', 'u',
|
||||
'q', 'r', 'p', 'M', 'A', 'B' };
|
||||
unsigned fx_code[] =
|
||||
{ GRUB_TERM_KEY_F1, GRUB_TERM_KEY_F2, GRUB_TERM_KEY_F3,
|
||||
GRUB_TERM_KEY_F4, GRUB_TERM_KEY_F5, GRUB_TERM_KEY_F6,
|
||||
GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, GRUB_TERM_KEY_F9,
|
||||
GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12 };
|
||||
unsigned i;
|
||||
|
||||
if (c == '\e')
|
||||
|
@ -465,17 +489,53 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
|
|||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE (four_code_table); i++)
|
||||
if (four_code_table[i].key == c)
|
||||
switch (c)
|
||||
{
|
||||
case 'O':
|
||||
CONTINUE_READ;
|
||||
for (i = 0; i < ARRAY_SIZE (fx_key); i++)
|
||||
if (fx_key[i] == c)
|
||||
{
|
||||
keys[0] = fx_code[i];
|
||||
*len = 1;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
case '0':
|
||||
{
|
||||
int num = 0;
|
||||
CONTINUE_READ;
|
||||
if (c != '~')
|
||||
if (c != '0' && c != '1')
|
||||
return;
|
||||
keys[0] = three_code_table[i].ascii;
|
||||
num = (c - '0') * 10;
|
||||
CONTINUE_READ;
|
||||
if (c < '0' || c > '9')
|
||||
return;
|
||||
num += (c - '0');
|
||||
if (num == 0 || num > 12)
|
||||
return;
|
||||
CONTINUE_READ;
|
||||
if (c != 'q')
|
||||
return;
|
||||
keys[0] = fx_code[num - 1];
|
||||
*len = 1;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
for (i = 0; i < ARRAY_SIZE (four_code_table); i++)
|
||||
if (four_code_table[i].key == c)
|
||||
{
|
||||
CONTINUE_READ;
|
||||
if (c != '~')
|
||||
return;
|
||||
keys[0] = three_code_table[i].ascii;
|
||||
*len = 1;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
#undef CONTINUE_READ
|
||||
}
|
||||
|
|
259
include/grub/arc/arc.h
Normal file
259
include/grub/arc/arc.h
Normal file
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_ARC_HEADER
|
||||
#define GRUB_ARC_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
typedef unsigned grub_arc_enum_t;
|
||||
typedef grub_uint64_t grub_arc_ularge_t;
|
||||
typedef unsigned long grub_arc_ulong_t;
|
||||
typedef long grub_arc_long_t;
|
||||
typedef unsigned short grub_arc_ushort_t;
|
||||
typedef unsigned char grub_arc_uchar_t;
|
||||
|
||||
typedef grub_arc_long_t grub_arc_err_t;
|
||||
typedef grub_arc_ulong_t grub_arc_fileno_t;
|
||||
|
||||
struct grub_arc_memory_descriptor
|
||||
{
|
||||
grub_arc_enum_t type;
|
||||
grub_arc_ulong_t start_page;
|
||||
grub_arc_ulong_t num_pages;
|
||||
};
|
||||
|
||||
enum grub_arc_memory_type
|
||||
{
|
||||
GRUB_ARC_MEMORY_EXCEPTION_BLOCK,
|
||||
GRUB_ARC_MEMORY_SYSTEM_PARAMETER_BLOCK,
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
GRUB_ARC_MEMORY_FREE_CONTIGUOUS,
|
||||
#endif
|
||||
GRUB_ARC_MEMORY_FREE,
|
||||
GRUB_ARC_MEMORY_BADRAM,
|
||||
GRUB_ARC_MEMORY_LOADED, GRUB_ARC_MEMORY_FW_TEMPORARY,
|
||||
GRUB_ARC_MEMORY_FW_PERMANENT,
|
||||
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
||||
GRUB_ARC_MEMORY_FREE_CONTIGUOUS,
|
||||
#endif
|
||||
} grub_arc_memory_type_t;
|
||||
|
||||
struct grub_arc_timeinfo
|
||||
{
|
||||
grub_arc_ushort_t y;
|
||||
grub_arc_ushort_t m;
|
||||
grub_arc_ushort_t d;
|
||||
grub_arc_ushort_t h;
|
||||
grub_arc_ushort_t min;
|
||||
grub_arc_ushort_t s;
|
||||
grub_arc_ushort_t ms;
|
||||
};
|
||||
|
||||
struct grub_arc_display_status
|
||||
{
|
||||
grub_arc_ushort_t x;
|
||||
grub_arc_ushort_t y;
|
||||
grub_arc_ushort_t w;
|
||||
grub_arc_ushort_t h;
|
||||
grub_arc_uchar_t fgcolor;
|
||||
grub_arc_uchar_t bgcolor;
|
||||
grub_arc_uchar_t high_intensity;
|
||||
grub_arc_uchar_t underscored;
|
||||
grub_arc_uchar_t reverse_video;
|
||||
};
|
||||
|
||||
struct grub_arc_component
|
||||
{
|
||||
grub_arc_enum_t class;
|
||||
grub_arc_enum_t type;
|
||||
grub_arc_enum_t flags;
|
||||
grub_arc_ushort_t version;
|
||||
grub_arc_ushort_t rev;
|
||||
grub_arc_ulong_t key;
|
||||
grub_arc_ulong_t affinity;
|
||||
grub_arc_ulong_t configdatasize;
|
||||
grub_arc_ulong_t idlen;
|
||||
const char *idstr;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
GRUB_ARC_COMPONENT_TYPE_ARC = 1,
|
||||
#else
|
||||
GRUB_ARC_COMPONENT_TYPE_ARC,
|
||||
#endif
|
||||
GRUB_ARC_COMPONENT_TYPE_CPU,
|
||||
GRUB_ARC_COMPONENT_TYPE_FPU,
|
||||
GRUB_ARC_COMPONENT_TYPE_PRI_I_CACHE,
|
||||
GRUB_ARC_COMPONENT_TYPE_PRI_D_CACHE,
|
||||
GRUB_ARC_COMPONENT_TYPE_SEC_I_CACHE,
|
||||
GRUB_ARC_COMPONENT_TYPE_SEC_D_CACHE,
|
||||
GRUB_ARC_COMPONENT_TYPE_SEC_CACHE,
|
||||
GRUB_ARC_COMPONENT_TYPE_EISA,
|
||||
GRUB_ARC_COMPONENT_TYPE_TCA,
|
||||
GRUB_ARC_COMPONENT_TYPE_SCSI,
|
||||
GRUB_ARC_COMPONENT_TYPE_DTIA,
|
||||
GRUB_ARC_COMPONENT_TYPE_MULTIFUNC,
|
||||
GRUB_ARC_COMPONENT_TYPE_DISK_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_TAPE_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_CDROM_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_WORM_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_SERIAL_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_NET_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_DISPLAY_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_PARALLEL_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_POINTER_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_KBD_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_AUDIO_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_OTHER_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_DISK,
|
||||
GRUB_ARC_COMPONENT_TYPE_FLOPPY,
|
||||
GRUB_ARC_COMPONENT_TYPE_TAPE,
|
||||
GRUB_ARC_COMPONENT_TYPE_MODEM,
|
||||
GRUB_ARC_COMPONENT_TYPE_MONITOR,
|
||||
GRUB_ARC_COMPONENT_TYPE_PRINTER,
|
||||
GRUB_ARC_COMPONENT_TYPE_POINTER,
|
||||
GRUB_ARC_COMPONENT_TYPE_KBD,
|
||||
GRUB_ARC_COMPONENT_TYPE_TERMINAL,
|
||||
GRUB_ARC_COMPONENT_TYPE_OTHER_PERIPHERAL,
|
||||
GRUB_ARC_COMPONENT_TYPE_LINE,
|
||||
GRUB_ARC_COMPONENT_TYPE_NET,
|
||||
GRUB_ARC_COMPONENT_TYPE_MEMORY_UNIT,
|
||||
};
|
||||
|
||||
struct grub_arc_fileinfo
|
||||
{
|
||||
grub_arc_ularge_t start;
|
||||
grub_arc_ularge_t end;
|
||||
grub_arc_ularge_t current;
|
||||
grub_arc_enum_t type;
|
||||
grub_arc_ulong_t fnamelength;
|
||||
grub_arc_uchar_t attr;
|
||||
char filename[32];
|
||||
};
|
||||
|
||||
struct grub_arc_firmware_vector
|
||||
{
|
||||
/* 0x00. */
|
||||
void *load;
|
||||
void *invoke;
|
||||
void *execute;
|
||||
void *halt;
|
||||
|
||||
/* 0x10. */
|
||||
void (*powerdown) (void);
|
||||
void (*restart) (void);
|
||||
void (*reboot) (void);
|
||||
void (*exit) (void);
|
||||
|
||||
/* 0x20. */
|
||||
void *reserved1;
|
||||
const struct grub_arc_component * (*getpeer) (const struct grub_arc_component *comp);
|
||||
const struct grub_arc_component * (*getchild) (const struct grub_arc_component *comp);
|
||||
void *getparent;
|
||||
|
||||
/* 0x30. */
|
||||
void *getconfigurationdata;
|
||||
void *addchild;
|
||||
void *deletecomponent;
|
||||
void *getcomponent;
|
||||
|
||||
/* 0x40. */
|
||||
void *saveconfiguration;
|
||||
void *getsystemid;
|
||||
struct grub_arc_memory_descriptor *(*getmemorydescriptor) (struct grub_arc_memory_descriptor *current);
|
||||
void *reserved2;
|
||||
|
||||
/* 0x50. */
|
||||
struct grub_arc_timeinfo *(*gettime) (void);
|
||||
void *getrelativetime;
|
||||
void *getdirectoryentry;
|
||||
grub_arc_err_t (*open) (const char *path, grub_arc_enum_t mode,
|
||||
grub_arc_fileno_t *fileno);
|
||||
|
||||
/* 0x60. */
|
||||
grub_arc_err_t (*close) (grub_arc_fileno_t fileno);
|
||||
grub_arc_err_t (*read) (grub_arc_fileno_t fileno, void *buf,
|
||||
grub_arc_ulong_t n,
|
||||
grub_arc_ulong_t *count);
|
||||
grub_arc_err_t (*get_read_status) (grub_arc_fileno_t fileno);
|
||||
grub_arc_err_t (*write) (grub_arc_fileno_t fileno, void *buf,
|
||||
grub_arc_ulong_t n,
|
||||
grub_arc_ulong_t *count);
|
||||
|
||||
/* 0x70. */
|
||||
grub_arc_err_t (*seek) (grub_arc_fileno_t fileno,
|
||||
grub_arc_ularge_t *pos, grub_arc_enum_t mode);
|
||||
void *mount;
|
||||
void *getenvironmentvariable;
|
||||
void *setenvironmentvariable;
|
||||
|
||||
/* 0x80. */
|
||||
grub_arc_err_t (*getfileinformation) (grub_arc_fileno_t fileno,
|
||||
struct grub_arc_fileinfo *info);
|
||||
void *setfileinformation;
|
||||
void *flushallcaches;
|
||||
void *testunicodecharacter;
|
||||
|
||||
/* 0x90. */
|
||||
struct grub_arc_display_status * (*getdisplaystatus) (grub_arc_fileno_t fileno);
|
||||
};
|
||||
|
||||
struct grub_arc_adapter
|
||||
{
|
||||
grub_arc_ulong_t adapter_type;
|
||||
grub_arc_ulong_t adapter_vector_length;
|
||||
void *adapter_vector;
|
||||
};
|
||||
|
||||
struct grub_arc_system_parameter_block
|
||||
{
|
||||
grub_arc_ulong_t signature;
|
||||
grub_arc_ulong_t length;
|
||||
grub_arc_ushort_t version;
|
||||
grub_arc_ushort_t revision;
|
||||
void *restartblock;
|
||||
void *debugblock;
|
||||
void *gevector;
|
||||
void *utlbmissvector;
|
||||
grub_arc_ulong_t firmware_vector_length;
|
||||
struct grub_arc_firmware_vector *firmwarevector;
|
||||
grub_arc_ulong_t private_vector_length;
|
||||
void *private_vector;
|
||||
grub_arc_ulong_t adapter_count;
|
||||
struct grub_arc_adapter adapters[0];
|
||||
};
|
||||
|
||||
|
||||
#define GRUB_ARC_SYSTEM_PARAMETER_BLOCK ((struct grub_arc_system_parameter_block *) 0xa0001000)
|
||||
#define GRUB_ARC_FIRMWARE_VECTOR (GRUB_ARC_SYSTEM_PARAMETER_BLOCK->firmwarevector)
|
||||
#define GRUB_ARC_STDIN 0
|
||||
#define GRUB_ARC_STDOUT 1
|
||||
|
||||
int EXPORT_FUNC (grub_arc_iterate_devs) (int (*hook) (const char *name, const struct grub_arc_component *comp), int alt_names);
|
||||
|
||||
#define FOR_ARC_CHILDREN(comp, parent) for (comp = GRUB_ARC_FIRMWARE_VECTOR->getchild (parent); comp; comp = GRUB_ARC_FIRMWARE_VECTOR->getpeer (comp))
|
||||
|
||||
extern void grub_arcdisk_init (void);
|
||||
extern void grub_arcdisk_fini (void);
|
||||
|
||||
|
||||
#endif
|
31
include/grub/arc/console.h
Normal file
31
include/grub/arc/console.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CONSOLE_MACHINE_HEADER
|
||||
#define GRUB_CONSOLE_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init_early (void);
|
||||
void grub_console_init_lately (void);
|
||||
|
||||
/* Finish the console system. */
|
||||
void grub_console_fini (void);
|
||||
|
||||
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
|
|
@ -42,7 +42,8 @@ enum grub_disk_dev_id
|
|||
GRUB_DISK_DEVICE_PXE_ID,
|
||||
GRUB_DISK_DEVICE_SCSI_ID,
|
||||
GRUB_DISK_DEVICE_FILE_ID,
|
||||
GRUB_DISK_DEVICE_LUKS_ID
|
||||
GRUB_DISK_DEVICE_LUKS_ID,
|
||||
GRUB_DISK_DEVICE_ARCDISK_ID,
|
||||
};
|
||||
|
||||
struct grub_disk;
|
||||
|
|
|
@ -54,6 +54,8 @@ void grub_find_zpool_from_dir (const char *dir,
|
|||
|
||||
char *grub_make_system_path_relative_to_its_root (const char *path)
|
||||
__attribute__ ((warn_unused_result));
|
||||
int
|
||||
grub_util_device_is_mapped (const char *dev);
|
||||
|
||||
void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#define GRUB_LINUX_VID_MODE_ASK 0xFFFD
|
||||
#define GRUB_LINUX_VID_MODE_VESA_START 0x0300
|
||||
|
||||
#define GRUB_LINUX_SETUP_MOVE_SIZE 0x9100
|
||||
#define GRUB_LINUX_CL_MAGIC 0xA33F
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
@ -130,6 +129,10 @@ struct linux_kernel_header
|
|||
grub_uint16_t pad1; /* Unused */
|
||||
grub_uint32_t cmd_line_ptr; /* Points to the kernel command line */
|
||||
grub_uint32_t initrd_addr_max; /* Highest address for initrd */
|
||||
grub_uint32_t kernel_alignment;
|
||||
grub_uint8_t relocatable;
|
||||
grub_uint8_t pad[3];
|
||||
grub_uint32_t cmdline_size;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Boot parameters for Linux based on 2.6.12. This is used by the setup
|
||||
|
|
|
@ -46,6 +46,7 @@ struct grub_relocator16_state
|
|||
grub_uint16_t ss;
|
||||
grub_uint16_t sp;
|
||||
grub_uint16_t ip;
|
||||
grub_uint32_t ebx;
|
||||
grub_uint32_t edx;
|
||||
};
|
||||
|
||||
|
|
2
include/grub/mips/arc/kernel.h
Normal file
2
include/grub/mips/arc/kernel.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include <grub/cpu/kernel.h>
|
||||
|
42
include/grub/mips/arc/memory.h
Normal file
42
include/grub/mips/arc/memory.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MEMORY_MACHINE_HEADER
|
||||
#define GRUB_MEMORY_MACHINE_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x8bfffff0
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
|
||||
grub_uint64_t size __attribute__ ((unused)),
|
||||
int type __attribute__ ((unused)),
|
||||
int handle __attribute__ ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
30
include/grub/mips/kernel.h
Normal file
30
include/grub/mips/kernel.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
|
@ -19,11 +19,7 @@
|
|||
#ifndef GRUB_LOONGSON_CPU_HEADER
|
||||
#define GRUB_LOONGSON_CPU_HEADER 1
|
||||
|
||||
#ifdef ASM_FILE
|
||||
#define GRUB_CPU_REGISTER_WRAP(x) x
|
||||
#else
|
||||
#define GRUB_CPU_REGISTER_WRAP(x) #x
|
||||
#endif
|
||||
#include <grub/cpu/mips.h>
|
||||
|
||||
#define GRUB_CPU_LOONGSON_FLASH_START 0xbfc00000
|
||||
#define GRUB_CPU_LOONGSON_FLASH_TLB_REFILL 0xbfc00200
|
||||
|
@ -68,7 +64,6 @@
|
|||
#define GRUB_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE 19
|
||||
|
||||
#define GRUB_CPU_LOONGSON_COP0_BADVADDR GRUB_CPU_REGISTER_WRAP($8)
|
||||
#define GRUB_CPU_LOONGSON_COP0_TIMER_COUNT GRUB_CPU_REGISTER_WRAP($9)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CAUSE GRUB_CPU_REGISTER_WRAP($13)
|
||||
#define GRUB_CPU_LOONGSON_COP0_EPC GRUB_CPU_REGISTER_WRAP($14)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28)
|
||||
|
|
|
@ -20,15 +20,13 @@
|
|||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/cpu/kernel.h>
|
||||
|
||||
#define GRUB_ARCH_MACHINE_YEELOONG 0
|
||||
#define GRUB_ARCH_MACHINE_FULOONG 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_machine);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,36 +26,9 @@
|
|||
#endif
|
||||
|
||||
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x801ffff0
|
||||
#define GRUB_ARCH_LOWMEMVSTART 0x80000000
|
||||
#define GRUB_ARCH_LOWMEMPSTART 0x00000000
|
||||
#define GRUB_ARCH_LOWMEMMAXSIZE 0x10000000
|
||||
#define GRUB_ARCH_HIGHMEMPSTART 0x10000000
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
typedef grub_addr_t grub_phys_addr_t;
|
||||
|
||||
static inline grub_phys_addr_t
|
||||
grub_vtop (void *a)
|
||||
{
|
||||
return ((grub_phys_addr_t) a) & 0x1fffffff;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
grub_map_memory (grub_phys_addr_t a, grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
return (void *) (a | 0x80000000);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_unmap_memory (void *a __attribute__ ((unused)),
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
|
||||
grub_uint64_t size __attribute__ ((unused)),
|
||||
|
@ -70,9 +43,6 @@ grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_uint64_t grub_mmap_get_lower (void);
|
||||
grub_uint64_t grub_mmap_get_upper (void);
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_memsize);
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_highmemsize);
|
||||
|
||||
|
|
|
@ -20,18 +20,8 @@
|
|||
#define KERNEL_MACHINE_TIME_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define GRUB_TICKS_PER_SECOND (grub_arch_cpuclock / 2)
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint64_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
#include <grub/cpu/time.h>
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_busclock);
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_cpuclock);
|
||||
|
||||
static inline void
|
||||
grub_cpu_idle(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* ! KERNEL_MACHINE_TIME_HEADER */
|
||||
|
|
|
@ -1 +1,60 @@
|
|||
#include <grub/machine/memory.h>
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MEMORY_CPU_HEADER
|
||||
#define GRUB_MEMORY_CPU_HEADER 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_ARCH_LOWMEMVSTART 0x80000000
|
||||
#define GRUB_ARCH_LOWMEMPSTART 0x00000000
|
||||
#define GRUB_ARCH_LOWMEMMAXSIZE 0x10000000
|
||||
#define GRUB_ARCH_HIGHMEMPSTART 0x10000000
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
typedef grub_addr_t grub_phys_addr_t;
|
||||
|
||||
static inline grub_phys_addr_t
|
||||
grub_vtop (void *a)
|
||||
{
|
||||
return ((grub_phys_addr_t) a) & 0x1fffffff;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
grub_map_memory (grub_phys_addr_t a, grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
return (void *) (a | 0x80000000);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_unmap_memory (void *a __attribute__ ((unused)),
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
grub_uint64_t grub_mmap_get_lower (void);
|
||||
grub_uint64_t grub_mmap_get_upper (void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
30
include/grub/mips/mips.h
Normal file
30
include/grub/mips/mips.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_REGISTERS_CPU_HEADER
|
||||
#define GRUB_REGISTERS_CPU_HEADER 1
|
||||
|
||||
#ifdef ASM_FILE
|
||||
#define GRUB_CPU_REGISTER_WRAP(x) x
|
||||
#else
|
||||
#define GRUB_CPU_REGISTER_WRAP(x) #x
|
||||
#endif
|
||||
|
||||
#define GRUB_CPU_MIPS_COP0_TIMER_COUNT GRUB_CPU_REGISTER_WRAP($9)
|
||||
|
||||
#endif
|
28
include/grub/mips/qemu_mips/cmos.h
Normal file
28
include/grub/mips/qemu_mips/cmos.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CPU_CMOS_H
|
||||
#define GRUB_CPU_CMOS_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/cpu/io.h>
|
||||
|
||||
#define GRUB_CMOS_ADDR_REG 0xb4000070
|
||||
#define GRUB_CMOS_DATA_REG 0xb4000071
|
||||
|
||||
#endif /* GRUB_CPU_CMOS_H */
|
|
@ -20,7 +20,6 @@
|
|||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/cpu/kernel.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
0
include/grub/mips/qemu_mips/loader.h
Normal file
0
include/grub/mips/qemu_mips/loader.h
Normal file
|
@ -29,10 +29,8 @@
|
|||
#define GRUB_MACHINE_MEMORY_USABLE 0x81000000
|
||||
|
||||
#ifndef ASM_FILE
|
||||
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
|
||||
extern grub_uint32_t grub_arch_memsize;
|
||||
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
|
|
@ -19,6 +19,6 @@
|
|||
#ifndef GRUB_MACHINE_SERIAL_HEADER
|
||||
#define GRUB_MACHINE_SERIAL_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { 0x140003f8 }
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { 0xb40003f8 }
|
||||
|
||||
#endif
|
|
@ -20,15 +20,6 @@
|
|||
#define KERNEL_MACHINE_TIME_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define GRUB_TICKS_PER_SECOND 1000
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
||||
static inline void
|
||||
grub_cpu_idle(void)
|
||||
{
|
||||
}
|
||||
#include <grub/cpu/time.h>
|
||||
|
||||
#endif /* ! KERNEL_MACHINE_TIME_HEADER */
|
|
@ -1,6 +1,37 @@
|
|||
#ifdef GRUB_MACHINE_EMU
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2004,2005,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_CPU_TIME_HEADER
|
||||
#define KERNEL_CPU_TIME_HEADER 1
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
|
||||
#define GRUB_TICKS_PER_SECOND (grub_arch_cpuclock / 2)
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint64_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_cpuclock);
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
grub_cpu_idle(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -106,11 +106,33 @@
|
|||
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR 0x10
|
||||
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END 0x54
|
||||
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR 0x80200000
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN 32
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END 0x54
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x8bd00000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_ADDR 0x10
|
||||
|
||||
#define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_ARC_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_ARC_PREFIX_END 0x54
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
|
||||
|
||||
|
@ -151,6 +173,8 @@
|
|||
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x1
|
||||
#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_MOD_ALIGN 0x1
|
||||
|
||||
/* Minimal gap between _end and the start of the modules. It's a hack
|
||||
for PowerMac to prevent "CLAIM failed" error. The real fix is to
|
||||
|
@ -166,6 +190,7 @@
|
|||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _KERNEL_IMAGE_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _COMPRESSED_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_UNCOMPRESSED_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_ADDR)
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX)
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX_END)
|
||||
|
@ -174,6 +199,7 @@
|
|||
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _RAW_SIZE)
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_BSD_PART)
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_DOS_PART)
|
||||
#define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR)
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
|
|
@ -27,7 +27,7 @@ char *EXPORT_FUNC(grub_terminfo_get_current) (struct grub_term_output *term);
|
|||
grub_err_t EXPORT_FUNC(grub_terminfo_set_current) (struct grub_term_output *term,
|
||||
const char *);
|
||||
|
||||
#define GRUB_TERMINFO_READKEY_MAX_LEN 4
|
||||
#define GRUB_TERMINFO_READKEY_MAX_LEN 6
|
||||
struct grub_terminfo_input_state
|
||||
{
|
||||
int input_buf[GRUB_TERMINFO_READKEY_MAX_LEN];
|
||||
|
|
|
@ -27,7 +27,6 @@ builddir=@builddir@
|
|||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
|
||||
# Force build directory components
|
||||
PATH=${builddir}:$PATH
|
||||
|
|
|
@ -54,12 +54,15 @@ execute_command (char *name, int n, char **args)
|
|||
return (cmd->func) (cmd, n, args);
|
||||
}
|
||||
|
||||
#define CMD_LS 1
|
||||
#define CMD_CP 2
|
||||
#define CMD_CMP 3
|
||||
#define CMD_HEX 4
|
||||
#define CMD_CRC 6
|
||||
#define CMD_BLOCKLIST 7
|
||||
enum {
|
||||
CMD_LS = 1,
|
||||
CMD_CP,
|
||||
CMD_CAT,
|
||||
CMD_CMP,
|
||||
CMD_HEX,
|
||||
CMD_CRC,
|
||||
CMD_BLOCKLIST
|
||||
};
|
||||
|
||||
#define BUF_SIZE 32256
|
||||
|
||||
|
@ -182,6 +185,26 @@ cmd_cp (char *src, char *dest)
|
|||
fclose (ff);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_cat (char *src)
|
||||
{
|
||||
auto int cat_hook (grub_off_t ofs, char *buf, int len);
|
||||
int cat_hook (grub_off_t ofs, char *buf, int len)
|
||||
{
|
||||
(void) ofs;
|
||||
|
||||
if ((int) fwrite (buf, 1, len, stdout) != len)
|
||||
{
|
||||
grub_util_error (_("write error"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
read_file (src, cat_hook);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_cmp (char *src, char *dest)
|
||||
{
|
||||
|
@ -321,6 +344,9 @@ fstest (int n, char **args)
|
|||
case CMD_CP:
|
||||
cmd_cp (args[0], args[1]);
|
||||
break;
|
||||
case CMD_CAT:
|
||||
cmd_cat (args[0]);
|
||||
break;
|
||||
case CMD_CMP:
|
||||
cmd_cmp (args[0], args[1]);
|
||||
break;
|
||||
|
@ -356,6 +382,7 @@ static struct argp_option options[] = {
|
|||
{0, 0, 0 , OPTION_DOC, N_("Commands:"), 1},
|
||||
{N_("ls PATH"), 0, 0 , OPTION_DOC, N_("List files in PATH."), 1},
|
||||
{N_("cp FILE LOCAL"), 0, 0, OPTION_DOC, N_("Copy FILE to local file LOCAL."), 1},
|
||||
{N_("cat FILE"), 0, 0 , OPTION_DOC, N_("Copy FILE to standard output."), 1},
|
||||
{N_("cmp FILE LOCAL"), 0, 0, OPTION_DOC, N_("Compare FILE with local file LOCAL."), 1},
|
||||
{N_("hex FILE"), 0, 0 , OPTION_DOC, N_("Hex dump FILE."), 1},
|
||||
{N_("crc FILE"), 0, 0 , OPTION_DOC, N_("Get crc32 checksum of FILE."), 1},
|
||||
|
@ -468,6 +495,11 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
|||
cmd = CMD_CP;
|
||||
nparm = 2;
|
||||
}
|
||||
else if (!grub_strcmp (arg, "cat"))
|
||||
{
|
||||
cmd = CMD_CAT;
|
||||
nparm = 1;
|
||||
}
|
||||
else if (!grub_strcmp (arg, "cmp"))
|
||||
{
|
||||
cmd = CMD_CMP;
|
||||
|
|
|
@ -562,13 +562,13 @@ fi
|
|||
|
||||
case "${target_cpu}-${platform}" in
|
||||
sparc64-ieee1275) mkimage_target=sparc64-ieee1275-raw ;;
|
||||
mips-loongson) mkimage_target=mipsel-loongson-elf ;;
|
||||
mipsel-loongson) mkimage_target=mipsel-loongson-elf ;;
|
||||
*) mkimage_target="${target_cpu}-${platform}" ;;
|
||||
esac
|
||||
|
||||
case "${target_cpu}-${platform}" in
|
||||
i386-efi | x86_64-efi) imgext=efi ;;
|
||||
mips-loongson | i386-coreboot | i386-multiboot | i386-ieee1275 \
|
||||
mipsel-loongson | i386-coreboot | i386-multiboot | i386-ieee1275 \
|
||||
| powerpc-ieee1275) imgext=elf ;;
|
||||
*) imgext=img ;;
|
||||
esac
|
||||
|
@ -577,7 +577,7 @@ esac
|
|||
"$grub_mkimage" ${config_opt} -d "${pkglibdir}" -O ${mkimage_target} --output="${grubdir}/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $modules || exit 1
|
||||
|
||||
# Backward-compatibility kludges
|
||||
if [ "${target_cpu}-${platform}" = "mips-loongson" ]; then
|
||||
if [ "${target_cpu}-${platform}" = "mipsel-loongson" ]; then
|
||||
cp "${grubdir}/core.${imgext}" "${bootdir}"/grub.elf
|
||||
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
|
||||
cp "${grubdir}/core.${imgext}" "${grubdir}/grub"
|
||||
|
@ -627,6 +627,9 @@ elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${pla
|
|||
exit 1
|
||||
}
|
||||
fi
|
||||
elif [ x"${target_cpu}-${platform}" = xmips-arc ]; then
|
||||
dvhtool -d "${install_device}" --unix-to-vh "{grubdir}/core.${imgext}" grub
|
||||
echo "You will have to set SystemPartition and OSLoader manually."
|
||||
elif [ x"$platform" = xefi ]; then
|
||||
cp "${grubdir}/core.${imgext}" "${efidir}/${efi_file}"
|
||||
# For old macs. Suggested by Peter Jones.
|
||||
|
|
|
@ -67,13 +67,14 @@ struct image_target_desc
|
|||
IMAGE_I386_PC, IMAGE_EFI, IMAGE_COREBOOT,
|
||||
IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_I386_IEEE1275,
|
||||
IMAGE_LOONGSON_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
|
||||
IMAGE_FULOONG_FLASH, IMAGE_I386_PC_PXE
|
||||
IMAGE_FULOONG_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC
|
||||
} id;
|
||||
enum
|
||||
{
|
||||
PLATFORM_FLAGS_NONE = 0,
|
||||
PLATFORM_FLAGS_LZMA = 1,
|
||||
PLATFORM_FLAGS_DECOMPRESSORS = 2
|
||||
PLATFORM_FLAGS_DECOMPRESSORS = 2,
|
||||
PLATFORM_FLAGS_MODULES_BEFORE_KERNEL = 4,
|
||||
} flags;
|
||||
unsigned prefix;
|
||||
unsigned prefix_end;
|
||||
|
@ -273,7 +274,7 @@ struct image_target_desc image_targets[] =
|
|||
.elf_target = EM_X86_64,
|
||||
},
|
||||
{
|
||||
.dirname = "mips-loongson",
|
||||
.dirname = "mipsel-loongson",
|
||||
.names = { "mipsel-yeeloong-flash", NULL },
|
||||
.voidp_sizeof = 4,
|
||||
.bigendian = 0,
|
||||
|
@ -295,7 +296,7 @@ struct image_target_desc image_targets[] =
|
|||
.default_compression = COMPRESSION_NONE
|
||||
},
|
||||
{
|
||||
.dirname = "mips-loongson",
|
||||
.dirname = "mipsel-loongson",
|
||||
.names = { "mipsel-fuloong-flash", NULL },
|
||||
.voidp_sizeof = 4,
|
||||
.bigendian = 0,
|
||||
|
@ -317,7 +318,7 @@ struct image_target_desc image_targets[] =
|
|||
.default_compression = COMPRESSION_NONE
|
||||
},
|
||||
{
|
||||
.dirname = "mips-loongson",
|
||||
.dirname = "mipsel-loongson",
|
||||
.names = { "mipsel-loongson-elf", "mipsel-yeeloong-elf",
|
||||
"mipsel-fuloong-elf", NULL },
|
||||
.voidp_sizeof = 4,
|
||||
|
@ -420,6 +421,73 @@ struct image_target_desc image_targets[] =
|
|||
.pe_target = GRUB_PE32_MACHINE_IA64,
|
||||
.elf_target = EM_IA_64,
|
||||
},
|
||||
{
|
||||
.dirname = "mips-arc",
|
||||
.names = {"mips-arc", NULL},
|
||||
.voidp_sizeof = 4,
|
||||
.bigendian = 1,
|
||||
.id = IMAGE_MIPS_ARC,
|
||||
.flags = (PLATFORM_FLAGS_DECOMPRESSORS
|
||||
| PLATFORM_FLAGS_MODULES_BEFORE_KERNEL),
|
||||
.prefix = GRUB_KERNEL_MIPS_ARC_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_ARC_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
.kernel_image_size = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_ARC_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_ARC_LINK_ALIGN,
|
||||
.default_compression = COMPRESSION_NONE
|
||||
},
|
||||
{
|
||||
.dirname = "mipsel-qemu_mips",
|
||||
.names = { "mipsel-qemu_mips-elf", NULL },
|
||||
.voidp_sizeof = 4,
|
||||
.bigendian = 0,
|
||||
.id = IMAGE_LOONGSON_ELF,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
.kernel_image_size = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN,
|
||||
.default_compression = COMPRESSION_NONE
|
||||
},
|
||||
{
|
||||
.dirname = "mips-qemu_mips",
|
||||
.names = { "mips-qemu_mips-elf", NULL },
|
||||
.voidp_sizeof = 4,
|
||||
.bigendian = 1,
|
||||
.id = IMAGE_LOONGSON_ELF,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = TARGET_NO_FIELD,
|
||||
.kernel_image_size = TARGET_NO_FIELD,
|
||||
.section_align = 1,
|
||||
.vaddr_offset = 0,
|
||||
.install_dos_part = TARGET_NO_FIELD,
|
||||
.install_bsd_part = TARGET_NO_FIELD,
|
||||
.link_addr = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN,
|
||||
.default_compression = COMPRESSION_NONE
|
||||
},
|
||||
};
|
||||
|
||||
#define grub_target_to_host32(x) (grub_target_to_host32_real (image_target, (x)))
|
||||
|
@ -690,6 +758,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
grub_uint64_t start_address;
|
||||
void *rel_section;
|
||||
grub_size_t reloc_size, align;
|
||||
size_t decompress_size;
|
||||
|
||||
if (comp == COMPRESSION_AUTO)
|
||||
comp = image_target->default_compression;
|
||||
|
@ -737,27 +806,47 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
grub_util_error (_("prefix is too long"));
|
||||
strcpy (kernel_img + image_target->prefix, prefix);
|
||||
|
||||
if ((image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS)
|
||||
&& (image_target->total_module_size != TARGET_NO_FIELD))
|
||||
*((grub_uint32_t *) (kernel_img + image_target->total_module_size))
|
||||
= grub_host_to_target32 (total_module_size);
|
||||
|
||||
if (image_target->flags & PLATFORM_FLAGS_MODULES_BEFORE_KERNEL)
|
||||
memmove (kernel_img + total_module_size, kernel_img, kernel_size);
|
||||
|
||||
if (image_target->voidp_sizeof == 8)
|
||||
{
|
||||
/* Fill in the grub_module_info structure. */
|
||||
struct grub_module_info64 *modinfo;
|
||||
modinfo = (struct grub_module_info64 *) (kernel_img + kernel_size);
|
||||
if (image_target->flags & PLATFORM_FLAGS_MODULES_BEFORE_KERNEL)
|
||||
modinfo = (struct grub_module_info64 *) kernel_img;
|
||||
else
|
||||
modinfo = (struct grub_module_info64 *) (kernel_img + kernel_size);
|
||||
memset (modinfo, 0, sizeof (struct grub_module_info64));
|
||||
modinfo->magic = grub_host_to_target32 (GRUB_MODULE_MAGIC);
|
||||
modinfo->offset = grub_host_to_target_addr (sizeof (struct grub_module_info64));
|
||||
modinfo->size = grub_host_to_target_addr (total_module_size);
|
||||
offset = kernel_size + sizeof (struct grub_module_info64);
|
||||
if (image_target->flags & PLATFORM_FLAGS_MODULES_BEFORE_KERNEL)
|
||||
offset = sizeof (struct grub_module_info64);
|
||||
else
|
||||
offset = kernel_size + sizeof (struct grub_module_info64);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fill in the grub_module_info structure. */
|
||||
struct grub_module_info32 *modinfo;
|
||||
modinfo = (struct grub_module_info32 *) (kernel_img + kernel_size);
|
||||
if (image_target->flags & PLATFORM_FLAGS_MODULES_BEFORE_KERNEL)
|
||||
modinfo = (struct grub_module_info32 *) kernel_img;
|
||||
else
|
||||
modinfo = (struct grub_module_info32 *) (kernel_img + kernel_size);
|
||||
memset (modinfo, 0, sizeof (struct grub_module_info32));
|
||||
modinfo->magic = grub_host_to_target32 (GRUB_MODULE_MAGIC);
|
||||
modinfo->offset = grub_host_to_target_addr (sizeof (struct grub_module_info32));
|
||||
modinfo->size = grub_host_to_target_addr (total_module_size);
|
||||
offset = kernel_size + sizeof (struct grub_module_info32);
|
||||
if (image_target->flags & PLATFORM_FLAGS_MODULES_BEFORE_KERNEL)
|
||||
offset = sizeof (struct grub_module_info32);
|
||||
else
|
||||
offset = kernel_size + sizeof (struct grub_module_info32);
|
||||
}
|
||||
|
||||
for (p = path_list; p; p = p->next)
|
||||
|
@ -808,26 +897,27 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
offset += config_size;
|
||||
}
|
||||
|
||||
if ((image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS)
|
||||
&& (image_target->total_module_size != TARGET_NO_FIELD))
|
||||
*((grub_uint32_t *) (kernel_img + image_target->total_module_size))
|
||||
= grub_host_to_target32 (total_module_size);
|
||||
|
||||
grub_util_info ("kernel_img=%p, kernel_size=0x%x", kernel_img, kernel_size);
|
||||
compress_kernel (image_target, kernel_img, kernel_size + total_module_size,
|
||||
&core_img, &core_size, comp);
|
||||
free (kernel_img);
|
||||
|
||||
if (image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS)
|
||||
kernel_img = core_img + total_module_size;
|
||||
else
|
||||
kernel_img = core_img;
|
||||
|
||||
grub_util_info ("the core size is 0x%x", core_size);
|
||||
|
||||
if (!(image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS)
|
||||
&& image_target->total_module_size != TARGET_NO_FIELD)
|
||||
*((grub_uint32_t *) (core_img + image_target->total_module_size))
|
||||
*((grub_uint32_t *) (kernel_img + image_target->total_module_size))
|
||||
= grub_host_to_target32 (total_module_size);
|
||||
if (image_target->kernel_image_size != TARGET_NO_FIELD)
|
||||
*((grub_uint32_t *) (core_img + image_target->kernel_image_size))
|
||||
*((grub_uint32_t *) (kernel_img + image_target->kernel_image_size))
|
||||
= grub_host_to_target32 (kernel_size);
|
||||
if (image_target->compressed_size != TARGET_NO_FIELD)
|
||||
*((grub_uint32_t *) (core_img + image_target->compressed_size))
|
||||
*((grub_uint32_t *) (kernel_img + image_target->compressed_size))
|
||||
= grub_host_to_target32 (core_size - image_target->raw_size);
|
||||
|
||||
/* If we included a drive in our prefix, let GRUB know it doesn't have to
|
||||
|
@ -835,9 +925,9 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
if (image_target->install_dos_part != TARGET_NO_FIELD
|
||||
&& image_target->install_bsd_part != TARGET_NO_FIELD && prefix[0] == '(')
|
||||
{
|
||||
*((grub_int32_t *) (core_img + image_target->install_dos_part))
|
||||
*((grub_int32_t *) (kernel_img + image_target->install_dos_part))
|
||||
= grub_host_to_target32 (-2);
|
||||
*((grub_int32_t *) (core_img + image_target->install_bsd_part))
|
||||
*((grub_int32_t *) (kernel_img + image_target->install_bsd_part))
|
||||
= grub_host_to_target32 (-2);
|
||||
}
|
||||
|
||||
|
@ -846,7 +936,6 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
char *full_img;
|
||||
size_t full_size;
|
||||
char *decompress_path, *decompress_img;
|
||||
size_t decompress_size;
|
||||
const char *name;
|
||||
|
||||
switch (comp)
|
||||
|
@ -871,6 +960,13 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
*((grub_uint32_t *) (decompress_img + GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_SIZE))
|
||||
= grub_host_to_target32 (kernel_size + total_module_size);
|
||||
|
||||
if (image_target->flags & PLATFORM_FLAGS_MODULES_BEFORE_KERNEL)
|
||||
*((grub_uint32_t *) (decompress_img + GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR))
|
||||
= grub_host_to_target_addr (image_target->link_addr - total_module_size);
|
||||
else
|
||||
*((grub_uint32_t *) (decompress_img + GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR))
|
||||
= grub_host_to_target_addr (image_target->link_addr);
|
||||
|
||||
full_size = core_size + decompress_size;
|
||||
|
||||
full_img = xmalloc (full_size);
|
||||
|
@ -1155,7 +1251,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
rom_img = xmalloc (rom_size);
|
||||
memset (rom_img, 0, rom_size);
|
||||
|
||||
*((grub_int32_t *) (core_img + GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR))
|
||||
*((grub_int32_t *) (kernel_img + GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR))
|
||||
= grub_host_to_target32 ((grub_uint32_t) -rom_size);
|
||||
|
||||
memcpy (rom_img, core_img, core_size);
|
||||
|
@ -1293,6 +1389,81 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
core_size = rom_size;
|
||||
}
|
||||
break;
|
||||
case IMAGE_MIPS_ARC:
|
||||
{
|
||||
char *ecoff_img;
|
||||
struct ecoff_header {
|
||||
grub_uint16_t magic;
|
||||
grub_uint16_t nsec;
|
||||
grub_uint32_t time;
|
||||
grub_uint32_t syms;
|
||||
grub_uint32_t nsyms;
|
||||
grub_uint16_t opt;
|
||||
grub_uint16_t flags;
|
||||
grub_uint16_t magic2;
|
||||
grub_uint16_t version;
|
||||
grub_uint32_t textsize;
|
||||
grub_uint32_t datasize;
|
||||
grub_uint32_t bsssize;
|
||||
grub_uint32_t entry;
|
||||
grub_uint32_t text_start;
|
||||
grub_uint32_t data_start;
|
||||
grub_uint32_t bss_start;
|
||||
grub_uint32_t gprmask;
|
||||
grub_uint32_t cprmask[4];
|
||||
grub_uint32_t gp_value;
|
||||
};
|
||||
struct ecoff_section
|
||||
{
|
||||
char name[8];
|
||||
grub_uint32_t paddr;
|
||||
grub_uint32_t vaddr;
|
||||
grub_uint32_t size;
|
||||
grub_uint32_t file_offset;
|
||||
grub_uint32_t reloc;
|
||||
grub_uint32_t gp;
|
||||
grub_uint16_t nreloc;
|
||||
grub_uint16_t ngp;
|
||||
grub_uint32_t flags;
|
||||
};
|
||||
struct ecoff_header *head;
|
||||
struct ecoff_section *section;
|
||||
grub_uint32_t target_addr;
|
||||
size_t program_size;
|
||||
|
||||
program_size = ALIGN_ADDR (core_size);
|
||||
if (comp == COMPRESSION_NONE)
|
||||
target_addr = (image_target->link_addr
|
||||
- total_module_size - decompress_size);
|
||||
else
|
||||
target_addr = (image_target->link_addr
|
||||
- ALIGN_UP(total_module_size + core_size, 1048576)
|
||||
- (1 << 20));
|
||||
|
||||
ecoff_img = xmalloc (program_size + sizeof (*head) + sizeof (*section));
|
||||
grub_memset (ecoff_img, 0, program_size + sizeof (*head) + sizeof (*section));
|
||||
head = (void *) ecoff_img;
|
||||
section = (void *) (head + 1);
|
||||
head->magic = grub_host_to_target16 (0x160);
|
||||
head->nsec = grub_host_to_target16 (1);
|
||||
head->time = grub_host_to_target32 (0);
|
||||
head->opt = grub_host_to_target16 (0x38);
|
||||
head->flags = grub_host_to_target16 (0x207);
|
||||
head->magic2 = grub_host_to_target16 (0x107);
|
||||
head->textsize = grub_host_to_target32 (program_size);
|
||||
head->entry = grub_host_to_target32 (target_addr);
|
||||
head->text_start = grub_host_to_target32 (target_addr);
|
||||
head->data_start = grub_host_to_target32 (target_addr + program_size);
|
||||
grub_memcpy (section->name, ".text", sizeof (".text") - 1);
|
||||
section->vaddr = grub_host_to_target32 (target_addr);
|
||||
section->size = grub_host_to_target32 (program_size);
|
||||
section->file_offset = grub_host_to_target32 (sizeof (*head) + sizeof (*section));
|
||||
memcpy (section + 1, core_img, core_size);
|
||||
free (core_img);
|
||||
core_img = ecoff_img;
|
||||
core_size = program_size + sizeof (*head) + sizeof (*section);
|
||||
}
|
||||
break;
|
||||
case IMAGE_LOONGSON_ELF:
|
||||
case IMAGE_PPC:
|
||||
case IMAGE_COREBOOT:
|
||||
|
@ -1355,8 +1526,13 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
phdr->p_flags = grub_host_to_target32 (PF_R | PF_W | PF_X);
|
||||
|
||||
if (image_target->id == IMAGE_LOONGSON_ELF)
|
||||
target_addr = ALIGN_UP (image_target->link_addr
|
||||
+ kernel_size + total_module_size, 32);
|
||||
{
|
||||
if (comp == COMPRESSION_NONE)
|
||||
target_addr = (image_target->link_addr - decompress_size);
|
||||
else
|
||||
target_addr = ALIGN_UP (image_target->link_addr
|
||||
+ kernel_size + total_module_size, 32);
|
||||
}
|
||||
else
|
||||
target_addr = image_target->link_addr;
|
||||
ehdr->e_entry = grub_host_to_target32 (target_addr);
|
||||
|
@ -1439,7 +1615,6 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
}
|
||||
|
||||
grub_util_write_image (core_img, core_size, out);
|
||||
free (kernel_img);
|
||||
free (core_img);
|
||||
free (kernel_path);
|
||||
|
||||
|
|
|
@ -27,12 +27,8 @@ libdir=@libdir@
|
|||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
platform=@platform@
|
||||
host_os=@host_os@
|
||||
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||
localedir=@datadir@/locale
|
||||
native_platform=@platform@
|
||||
pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
|
||||
|
||||
self=`basename $0`
|
||||
|
@ -64,7 +60,7 @@ Install GRUB on your drive.
|
|||
--subdir=DIR relative subdirectory on network server
|
||||
--grub-mkimage=FILE use FILE as grub-mkimage
|
||||
|
||||
$self copies GRUB images into net_directory/subdir/${target_cpu}-${platform}
|
||||
$self copies GRUB images into net_directory/subdir/target_cpu-platform
|
||||
|
||||
Report bugs to <bug-grub@gnu.org>.
|
||||
EOF
|
||||
|
@ -222,7 +218,8 @@ if [ "${override_dir}" = "" ] ; then
|
|||
process_input_dir ${pc_dir} i386-pc
|
||||
fi
|
||||
else
|
||||
process_input_dir ${override_dir} ${target_cpu}-${native_platform}
|
||||
source "${override_dir}"/modinfo.sh
|
||||
process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform}
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@ libdir=@libdir@
|
|||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
native_platform=@platform@
|
||||
pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
|
||||
|
||||
self=`basename $0`
|
||||
|
@ -231,14 +229,15 @@ if [ "${override_dir}" = "" ] ; then
|
|||
process_input_dir ${efi64_dir} x86_64-efi
|
||||
fi
|
||||
else
|
||||
process_input_dir ${override_dir} ${target_cpu}-${native_platform}
|
||||
source "${override_dir}"/modinfo.sh
|
||||
process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform}
|
||||
multiboot_dir=
|
||||
pc_dir=
|
||||
efi32_dir=
|
||||
efi64_dir=
|
||||
coreboot_dir=
|
||||
qemu_dir=
|
||||
case "${target_cpu}-${native_platform}" in
|
||||
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
||||
i386-multiboot) multiboot_dir=${override_dir} ;;
|
||||
i386-coreboot) coreboot_dir=${override_dir} ;;
|
||||
i386-qemu) qemu_dir=${override_dir} ;;
|
||||
|
|
|
@ -51,6 +51,14 @@ else
|
|||
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
||||
fi
|
||||
|
||||
# Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
|
||||
if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE}" ]; then
|
||||
GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_XEN_REPLACE}"
|
||||
fi
|
||||
if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
|
||||
fi
|
||||
|
||||
if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
|
||||
rootsubvol="`make_system_path_relative_to_its_root /`"
|
||||
rootsubvol="${rootsubvol#/}"
|
||||
|
|
Loading…
Reference in a new issue