merge mainline into net
This commit is contained in:
commit
dc5aeea5b9
103 changed files with 2530 additions and 690 deletions
|
@ -104,9 +104,10 @@ grub-core/lib/libgcrypt-grub
|
|||
**/.deps-core
|
||||
**/.dirstamp
|
||||
Makefile.util.am
|
||||
contrib
|
||||
grub-core/Makefile.core.am
|
||||
grub-core/Makefile.gcry.am
|
||||
grub-core/Makefile.gcry.def
|
||||
grub-core/contrib
|
||||
grub-core/genmod.sh
|
||||
grub-core/gensyminfo.sh
|
||||
grub-core/*.module
|
||||
|
|
496
ChangeLog
496
ChangeLog
|
@ -1,3 +1,495 @@
|
|||
2010-10-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/emu/misc.c
|
||||
(grub_make_system_path_relative_to_its_root)
|
||||
[HAVE_LIBZFS && HAVE_LIBNVPAIR]: Fix mountpoint return on ZFS.
|
||||
|
||||
2010-10-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/emu/misc.c
|
||||
(grub_make_system_path_relative_to_its_root): Revert r2882.
|
||||
|
||||
2010-10-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/lib/relocator.c (grub_relocator_subchunk): Remove now
|
||||
useless field head. All users updated.
|
||||
(free_subchunk): Correct handling of IN_REGION subchunk.
|
||||
|
||||
2010-10-22 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Installing GRUB using grub-install): Proofread.
|
||||
(Supported kernels): Likewise.
|
||||
|
||||
2010-10-18 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
Make mktemp invocations portable.
|
||||
|
||||
* grub-core/genmod.sh.in: Use mktemp with an explicit template, and
|
||||
exit if mktemp fails.
|
||||
* tests/grub_script_blockarg.in: Likewise.
|
||||
* tests/partmap_test.in: Likewise.
|
||||
* tests/util/grub-shell-tester.in: Likewise.
|
||||
* tests/util/grub-shell.in: Likewise.
|
||||
* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
|
||||
* Makefile.am: Likewise, and chain shell commands with `&&'
|
||||
instead of ';'.
|
||||
* util/grub-mkrescue.in: Use the same explicit template as above, and
|
||||
exit if mktemp fails.
|
||||
|
||||
2010-10-18 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
* util/grub.d/10_linux.in: Fix built-in initramfs image mode for
|
||||
Linux kernel, reported by Dennis Schridde.
|
||||
|
||||
2010-10-17 Szymon Janc <szymon@janc.net.pl>
|
||||
|
||||
* grub-core/normal/auth.c (grub_auth_check_authentication):
|
||||
Set-but-not-used variable removed.
|
||||
|
||||
2010-10-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* docs/grub.texi (GNU/Linux): Document APM unavailability with
|
||||
32-bit linux protocol.
|
||||
|
||||
2010-10-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/i386/pc/startup.S (grub_console_setcursor): Check
|
||||
cursor shape for sanity.
|
||||
|
||||
2010-10-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* docs/grub.texi (Installation): Document buggy BIOS install.
|
||||
|
||||
2010-10-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* docs/grub.texi (Installation): Indent.
|
||||
|
||||
2010-10-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-setup.c (setup): New parameter allow_floppy.
|
||||
(arguments): New member allow_floppy.
|
||||
(argp_parser): Handle --allow-floppy.
|
||||
(main): Pass allow_floppy.
|
||||
* util/grub-install.in: New option --allow-floppy passed though to
|
||||
grub-setup.
|
||||
|
||||
2010-10-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-install.in: Handle partitionless disks.
|
||||
|
||||
2010-10-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-setup.c (setup): Don't clean blocklists before readability
|
||||
verfification.
|
||||
|
||||
2010-10-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* docs/grub.texi (Installation): Document embedding zone. Remove
|
||||
obsolete grub-install example.
|
||||
|
||||
2010-10-16 Szymon Janc <szymon@janc.net.pl>
|
||||
|
||||
* grub-core/commands/legacycfg.c (grub_cmd_legacy_kernel):
|
||||
Set-but-not-used variable ifdef'ed.
|
||||
* grub-core/lib/legacy_parse.c (grub_legacy_parse): Likewise.
|
||||
* grub-core/bus/usb/ohci.c (grub_ohci_pci_iter): Set-but-not-used
|
||||
variable removed.
|
||||
* grub-core/disk/lvm.c (grub_lvm_scan_device): Likewise.
|
||||
* grub-core/fs/jfs.c (grub_jfs_find_file): Likewise.
|
||||
* grub-core/fs/minix.c (grub_minix_dir): Likewise.
|
||||
* grub-core/fs/sfs.c (grub_sfs_read_extent): Likewise.
|
||||
* grub-core/fs/ufs.c (grub_ufs_dir): Likewise.
|
||||
* grub-core/gfxmenu/gui_list.c (grub_gui_list_new): Likewise.
|
||||
* grub-core/gfxmenu/view.c (redraw_menu_visit): Likewise.
|
||||
* grub-core/gfxmenu/widget-box.c (draw): Likewise.
|
||||
* grub-core/lib/relocator.c (malloc_in_range): Likewise.
|
||||
* grub-core/loader/i386/bsdXX.c (grub_netbsd_load_elf_meta): Likewise.
|
||||
* grub-core/loader/i386/bsd_pagetable.c (fill_bsd64_pagetable):
|
||||
Likewise.
|
||||
|
||||
2010-10-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/commands/acpihalt.c (skip_ext_op): Skip index field op.
|
||||
* include/grub/acpi.h (GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP): New
|
||||
enum value.
|
||||
|
||||
2010-10-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/commands/acpihalt.c (get_sleep_type): Accept \_S5_ as
|
||||
synonym to _S5_. Needed for some DSDTs.
|
||||
|
||||
2010-10-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Userspace ACPI parser debugging.
|
||||
|
||||
* grub-core/commands/acpihalt.c [GRUB_DSDT_TEST]: Include userspace
|
||||
headers and add relevant defines. Don't include standard headers.
|
||||
(main) [GRUB_DSDT_TEST]: New function.
|
||||
* include/grub/acpi.h [GRUB_DSDT_TEST]: Don't include standard headers.
|
||||
Don't declare functions.
|
||||
|
||||
2010-10-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Remove dead grub_efi_mm_fini.
|
||||
|
||||
* grub-core/kern/efi/mm.c (allocated_page): Removed.
|
||||
(ALLOCATED_PAGES_SIZE): Likewise.
|
||||
(MAX_ALLOCATED_PAGES): Likewise.
|
||||
(allocated_pages): Likewise.
|
||||
(grub_efi_allocate_pages): Don't record allocated pages.
|
||||
(grub_efi_free_pages): Likewise.
|
||||
(grub_efi_mm_init): Likewise.
|
||||
(grub_efi_mm_fini): Removed.
|
||||
|
||||
2010-10-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/efi/mm.c (BYTES_TO_PAGES): Round up instead of down.
|
||||
(grub_efi_mm_init): Take into account the memory map size increase.
|
||||
|
||||
2010-10-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/term/ns8250.c (do_real_config): Set port->broken to 0.
|
||||
(serial_hw_put): Wait based on real time rather than port reads. Don't
|
||||
roken ports.
|
||||
* include/grub/serial.h (grub_serial_port): New field broken.
|
||||
|
||||
2010-10-16 Robert Millan <rmh@gnu.org>
|
||||
|
||||
* grub-core/kern/emu/misc.c
|
||||
(grub_make_system_path_relative_to_its_root): Fix premature return
|
||||
when processing non-root ZFS filesystems.
|
||||
Reported by Sergio Talens-Oliag.
|
||||
|
||||
2010-10-15 Robert Millan <rmh@gnu.org>
|
||||
|
||||
* util/grub.d/10_linux.in (list): Expand "vmlinu[zx]" instances to
|
||||
guarantee compressed ones are processed first.
|
||||
|
||||
2010-10-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/efiemu/main.c (grub_efiemu_prepare): Handle errors from
|
||||
grub_efiemu_autocore.
|
||||
|
||||
2010-10-14 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/i386/pc/startup.S (bypass_table): Use 0x1b explicitly
|
||||
rather than 0x1b.
|
||||
(grub_console_getkey): Use correct jae opcode rather than ja.
|
||||
|
||||
2010-10-12 Robert Millan <rmh@gnu.org>
|
||||
|
||||
* util/grub-mkconfig.in: Merge `GRUB_DISABLE_LINUX_RECOVERY' and
|
||||
`GRUB_DISABLE_NETBSD_RECOVERY' into a single `GRUB_DISABLE_RECOVERY'
|
||||
variable. All references updated.
|
||||
|
||||
* util/grub.d/10_kfreebsd.in: Support recovery boot entries.
|
||||
|
||||
2010-10-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Correctly distinguish mdraid flavours.
|
||||
|
||||
* grub-core/disk/raid.c (grub_raid_getname) [GRUB_UTIL]: New function.
|
||||
(insert_array): New argument raid.
|
||||
* include/grub/disk.h (grub_disk_dev) [GRUB_UTIL]: New member raidname.
|
||||
* include/grub/raid.h (grub_raid_array) [GRUB_UTIL]: New member driver.
|
||||
* util/grub-probe.c (probe): PRint raidname instead of plainly "mdraid".
|
||||
|
||||
2010-10-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/i386/pc/startup.S (grub_console_getkey): Fix incorrect
|
||||
handling of special keys.
|
||||
|
||||
2010-10-02 Aleš Nesrsta <starous@volny.cz>
|
||||
|
||||
* include/grub/scsi.h (grub_make_scsi_id): Fix incorrect usgae of
|
||||
GRUB_SCSI_ID_BUS_SHIFT instead of GRUB_SCSI_ID_LUN_SHIFT.
|
||||
|
||||
2010-10-02 Aleš Nesrsta <starous@volny.cz>
|
||||
|
||||
* grub-core/bus/usb/ohci.c (GRUB_OHCI_TDS): Increase.
|
||||
* grub-core/bus/usb/uhci.c (N_TD): New definition. All previous implicit
|
||||
users updated.
|
||||
* grub-core/bus/usb/usbtrans.c (grub_usb_bulk_setup_readwrite):
|
||||
Use right endpoint when querying descriptor.
|
||||
|
||||
2010-10-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Clear out 0x80 color bit on EFI.
|
||||
Tested by: decoder
|
||||
Reported by: decoder and meta tech.
|
||||
|
||||
* grub-core/term/efi/console.c (grub_console_standard_color): Removed.
|
||||
(grub_console_setcolorstate): Clear out 0x80 bit.
|
||||
Use GRUB_TERM_DEFAULT_STANDARD_COLOR.
|
||||
(grub_console_output): Use GRUB_TERM_DEFAULT_NORMAL_COLOR.
|
||||
Use GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR.
|
||||
|
||||
2010-10-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/loader/i386/linux.c (DEFAULT_VIDEO_MODE) [GRUB_MACHINE_EFI]:
|
||||
Set to "auto".
|
||||
|
||||
2010-09-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/gettext/gettext.c (grub_gettext_init_ext): Avoid using
|
||||
mo_file after freeing.
|
||||
|
||||
2010-09-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/normal/term.c (read_terminal_list): Free in a right order.
|
||||
|
||||
2010-09-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/script/execute.c (grub_script_execute_sourcecode): Set
|
||||
flags.
|
||||
|
||||
2010-09-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-setup.c (main) [GRUB_MACHINE_IEEE1275]: Propagate argp
|
||||
usage.
|
||||
|
||||
2010-09-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Put terminfo into core on ieee1275 and yeeloong (needed for console).
|
||||
|
||||
* gentpl.py: New groups terminfoinkernel and terminfomodule.
|
||||
* grub-core/Makefile.am (KERNEL_HEADER_FILES): Include extcmd.h, arg.h
|
||||
and terminfo.h when needed.
|
||||
* grub-core/Makefile.core.def (kernel): Include term/terminfo.c,
|
||||
term/tparm.c, commands/extcmd.c, lib/arg.c on terminfokernel.
|
||||
(terminfo): Enable only on terminfokernel.
|
||||
(extcmd): Likewise.
|
||||
* include/grub/extcmd.h: Add missing EXPORT_FUNC.
|
||||
* include/grub/lib/arg.h: Likewise.
|
||||
* grub-core/term/ieee1275/ofconsole.c (grub_ofconsole_dimensions): Fix
|
||||
incorrect usage of ->.
|
||||
|
||||
2010-09-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/loader/multiboot_mbi2.c (grub_multiboot_make_mbi]
|
||||
[GRUB_MACHINE_EFI && __i386__]: Fix typo.
|
||||
|
||||
2010-09-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix coreboot compilation.
|
||||
|
||||
* grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_get_mbi_size):
|
||||
Take VBE info into account even if only text is supported.
|
||||
(fill_vbe_info): Take into account the case when only VGA text
|
||||
is supported.
|
||||
* include/grub/multiboot.h (GRUB_MACHINE_HAS_VBE): Set to zero
|
||||
on coreboot, multiboot and qemu.
|
||||
|
||||
2010-09-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/lib/relocator.c (malloc_in_range): Trim too verbose
|
||||
debug messages.
|
||||
(grub_relocator_prepare_relocs): Set movers_chunk.srcv.
|
||||
|
||||
2010-09-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/loader/i386/bsd.c (grub_cmd_netbsd): Provide default serial
|
||||
parameters.
|
||||
|
||||
2010-09-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/lib/arg.c (grub_arg_parse): Fix treating of all commands as
|
||||
if they were BSD-style.
|
||||
|
||||
2010-09-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/boot/i386/pc/lnxboot.S: Replace
|
||||
GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE with
|
||||
GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART.
|
||||
|
||||
2010-09-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Write embedding zone using Reed-Solomon.
|
||||
|
||||
* Makefile.util.def (grub-setup): Add grub-core/lib/reed_solomon.c.
|
||||
* grub-core/Makefile.am (rs_decoder.S): New target.
|
||||
(kern/i386/pc/startup.S): Depend on rs_decoder.S.
|
||||
* grub-core/kern/i386/pc/startup.S (reed_solomon_redundancy): New field.
|
||||
(multiboot): Move to RS part.
|
||||
(post_reed_solomon): New label.
|
||||
(grub_boot_drive): Move to non-RS part since it's modified in memory
|
||||
on boot.
|
||||
Include rs_decoder.S.
|
||||
* grub-core/lib/reed_solomon.c: New file.
|
||||
* include/grub/offsets.h (GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY):
|
||||
New definition.
|
||||
(GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE): Removed.
|
||||
(GRUB_KERNEL_I386_PC_RAW_SIZE): Updated.
|
||||
(GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART): New definition.
|
||||
* include/grub/partition.h (grub_partition_map): Change prototype of
|
||||
embed to allow returning additional sectors.
|
||||
* include/grub/reed_solomon.h: New file.
|
||||
* util/grub-setup.c (setup): Handle Reed-Solomon.
|
||||
|
||||
2010-09-28 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* grub-core/loader/multiboot_mbi2.c (grub_multiboot_make_mbi): Fix
|
||||
i386 and x86-64 definedness tests.
|
||||
|
||||
2010-09-27 Yves Blusseau <blusseau@zetam.org>
|
||||
|
||||
Fix generation of kernel_syms.lst
|
||||
|
||||
* grub-core/Makefile.am (kernel_syms.lst): Fix value and position of
|
||||
ASM_PREFIX
|
||||
|
||||
2010-09-26 Robert Millan <rmh@gnu.org>
|
||||
|
||||
Support degraded ZFS arrays in "grub-probe -t device" resolution.
|
||||
|
||||
* grub-core/kern/emu/getroot.c (find_root_device_from_libzfs): When
|
||||
the pool is an array of devices, iterate through it and return the
|
||||
first device that passes a stat() test (instead of blindly returning
|
||||
the first one).
|
||||
|
||||
2010-09-26 Robert Millan <rmh@gnu.org>
|
||||
|
||||
Build fixes for GNU/kFreeBSD.
|
||||
|
||||
* Makefile.util.def: Add `$(LIBZFS) $(LIBNVPAIR)' library dependencies
|
||||
to programs that require ZFS conversion.
|
||||
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy): Support
|
||||
kernels that don't have FLOPPY_MAJOR.
|
||||
|
||||
2010-09-25 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
* grub-core/kern/emu/full.c (grub_emu_post_init): Fix typo.
|
||||
|
||||
2010-09-25 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
Fix grub-emu build.
|
||||
|
||||
* grub-core/kern/emu/main.c: Remove #include <getopt.h>.
|
||||
* grub-core/kern/emu/full.c: Split grub_mdraid_{init,fini} into
|
||||
mdraid09 and mdraid1x.
|
||||
|
||||
2010-09-24 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
Re-enable grub-extras.
|
||||
|
||||
* autogen.sh: Create symlinks to ${GRUB_CONTRIB} if necessary to
|
||||
avoid confusing Automake. Run autogen only twice, once for the top
|
||||
level and once for grub-core. Add Makefile.util.def and
|
||||
Makefile.core.def from extra modules to the appropriate autogen
|
||||
invocations. If Makefile.common exists in an extra module, include
|
||||
it in both Makefile.util.am and grub-core/Makefile.core.am;
|
||||
similarly, include any Makefile.util.common file in Makefile.util.am
|
||||
and any Makefile.core.common file in grub-core/Makefile.core.am.
|
||||
* conf/Makefile.common ($(top_srcdir)/grub-core/Makefile.core.am):
|
||||
Depend on $(top_srcdir)/grub-core/Makefile.gcry.def.
|
||||
($(top_srcdir)/grub-core/Makefile.gcry.def): Remove.
|
||||
* grub-core/Makefile.am: Remove inclusion of Makefile.gcry.am.
|
||||
|
||||
* gentpl.py (gvar_add): Turn GVARS into a set.
|
||||
(global_variable_initializers): Sort global variables on output.
|
||||
(vars_init): New function.
|
||||
(first_time): Likewise.
|
||||
(library): Ensure that non-global variable initialisations are
|
||||
emitted before the first time we emit code for a library block.
|
||||
Append to variables rather than setting them. Only emit
|
||||
noinst_LIBRARIES, BUILT_SOURCES, and CLEANFILES the first time for
|
||||
each conditional path.
|
||||
(program): installdir() emits an Autogen macro, so must be passed to
|
||||
var_add rather than gvar_add.
|
||||
(data): Likewise.
|
||||
(script): Likewise.
|
||||
(rules): New function, centralising handling for different target
|
||||
types. Set up Guile association lists for first_time and vars_init,
|
||||
and send most output to a diversion so that variable initialisations
|
||||
can be emitted first.
|
||||
(module_rules): Use new rules function.
|
||||
(kernel_rules): Likewise.
|
||||
(image_rules): Likewise.
|
||||
(library_rules): Likewise.
|
||||
(program_rules): Likewise.
|
||||
(script_rules): Likewise.
|
||||
(data_rules): Likewise.
|
||||
|
||||
* configure.ac: Add AC_PROG_LN_S, for the benefit of ntldr-img.
|
||||
|
||||
* .bzrignore: Add contrib and grub-core/contrib. Remove
|
||||
grub-core/Makefile.gcry.am.
|
||||
|
||||
2010-09-24 Yves Blusseau <blusseau@zetam.org>
|
||||
|
||||
* grub-core/lib/LzFind.c: Add missing include.
|
||||
* grub-core/lib/LzmaEnc.c: Likewise.
|
||||
* grub-core/script/lexer.c: Likewise.
|
||||
* grub-core/script/yylex.l: Likewise.
|
||||
* util/grub-macho2img.c: Likewise.
|
||||
* util/grub-menulst2cfg.c: Likewise.
|
||||
* util/grub-mklayout.c: Likewise.
|
||||
* util/grub-mkpasswd-pbkdf2.c
|
||||
* util/grub-mkrelpath.c: Likewise.
|
||||
* util/resolve.c: Likewise.
|
||||
|
||||
2010-09-24 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
* Makefile.util.def (example_unit_test): Add
|
||||
grub-core/gnulib/libgnu.a.
|
||||
|
||||
2010-09-23 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* grub-core/commands/acpihalt.c (get_sleep_type): Initialize prev.
|
||||
|
||||
2010-09-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Support xz compression on yeeloong.
|
||||
|
||||
* Makefile.util.def (grub-mkimage): Add $(LIBLZMA).
|
||||
* configure.ac: Check for LZMA.
|
||||
* grub-core/Makefile.core.def (xz_decompress): New target.
|
||||
(none_decompress): Likewise.
|
||||
* grub-core/boot/decompressor/minilib.c: New file.
|
||||
* grub-core/boot/decompressor/none.c: Likewise.
|
||||
* grub-core/boot/decompressor/xz.c: Likewise.
|
||||
* grub-core/kern/mips/cache.S: Change to noreorder nomacro.
|
||||
* grub-core/kern/mips/cache_flush.S: Likewise.
|
||||
* grub-core/kern/i386/pc/lzma_decode.S: Remove dead code.
|
||||
* grub-core/kern/mips/startup.S: Move first stage to ...
|
||||
* grub-core/boot/mips/startup_raw.S: ...here. Change to noreorder
|
||||
nomacro.
|
||||
* grub-core/kern/mips/startup.S: Change to noreorder nomacro.
|
||||
* grub-core/lib/mips/relocator_asm.S: Change to noreorder nomacro.
|
||||
* grub-core/lib/xzembed/xz_dec_bcj.c [GRUB_EMBED_DECOMPRESSOR]:
|
||||
Allocate statically.
|
||||
* grub-core/lib/xzembed/xz_dec_lzma2.c [GRUB_EMBED_DECOMPRESSOR]:
|
||||
Allocate statically or use scratch. Don't check CRC32.
|
||||
* grub-core/lib/xzembed/xz_dec_stream.c [GRUB_EMBED_DECOMPRESSOR]:
|
||||
Allocate statically. Don't check CRC32.
|
||||
* include/grub/decompressor.h: New file.
|
||||
* include/grub/offsets.h (GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE):
|
||||
Removed.
|
||||
(GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE): New field.
|
||||
(GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE): Adjusted.
|
||||
(GRUB_KERNEL_MIPS_YEELOONG_PREFIX): Likewise.
|
||||
(GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END): Likewise.
|
||||
(GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE): New define.
|
||||
* util/grub-mkimage.c (grub_compression_t): New type.
|
||||
(PLATFORM_FLAGS_DECOMPRESSORS): New flag.
|
||||
(image_target_desc): New field default_compression.
|
||||
(image_targets): Adjust yeeloong targets.
|
||||
(compress_kernel_xz) [HAVE_LIBLZMA]: New function.
|
||||
(compress_kernel): New parameter comp.
|
||||
(generate_image): Likewise. Handle new compression case.
|
||||
(options): New option --compression
|
||||
(help): Likewise.
|
||||
(main): Handle new option.
|
||||
|
||||
2010-09-22 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* grub-core/kern/emu/hostdisk.c [__NetBSD__]: Define FLOPPY_MAJOR.
|
||||
|
||||
2010-09-22 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* grub-core/loader/multiboot_mbi2.c (grub_multiboot_make_mbi): Fix
|
||||
typo in __i386__ conditional.
|
||||
|
||||
2010-09-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/loader/multiboot_mbi2.c (GRUB_MACHINE_EFI): Add missing
|
||||
|
@ -5,7 +497,7 @@
|
|||
|
||||
2010-09-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Implement EFI and ACPI multiboot2 extensions.
|
||||
Implement EFI and ACPI multiboot2 extensions.
|
||||
|
||||
* grub-core/loader/multiboot_mbi2.c (grub_multiboot_load): Declare
|
||||
new tags as supported.
|
||||
|
@ -13,7 +505,7 @@
|
|||
(grub_multiboot_get_mbi_size): Take new tags into account.
|
||||
(grub_multiboot_make_mbi): Add new tags.
|
||||
* include/grub/multiboot.h (GRUB_MACHINE_HAS_ACPI): New definition.
|
||||
|
||||
|
||||
2010-09-21 Aleš Nesrsta <starous@volny.cz>
|
||||
|
||||
* grub-core/bus/usb/serial/common.c (grub_usbserial_attach):
|
||||
|
|
16
Makefile.am
16
Makefile.am
|
@ -189,31 +189,31 @@ kopenbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S
|
|||
$(TARGET_CC) -o $@ $< -m64 -DTARGET_OPENBSD=1 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||
|
||||
linux-initramfs.i386: linux.init.i386 Makefile
|
||||
TDIR=`mktemp -d`; cp $< $$TDIR/init; (cd $$TDIR; echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@; rm -rf $$TDIR
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
|
||||
|
||||
linux-initramfs.x86_64: linux.init.x86_64 Makefile
|
||||
TDIR=`mktemp -d`; cp $< $$TDIR/init; (cd $$TDIR; echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@; rm -rf $$TDIR
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
|
||||
|
||||
kfreebsd-mfsroot.i386.img: kfreebsd.init.i386 Makefile
|
||||
TDIR=`mktemp -d`; mkdir $$TDIR/dev; mkdir $$TDIR/sbin; cp $< $$TDIR/sbin/init; makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR; rm -rf $$TDIR
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||
|
||||
knetbsd.image.i386: knetbsd.init.i386 $(srcdir)/grub-core/tests/boot/kbsd.spec.txt
|
||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||
|
||||
kopenbsd.image.i386: kopenbsd.init.i386 $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt
|
||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@
|
||||
|
||||
kopenbsd.image.x86_64: kopenbsd.init.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt
|
||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@
|
||||
|
||||
knetbsd.miniroot-image.i386.img: knetbsd.image.i386 $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.i386
|
||||
$(OBJCOPY) --add-section=miniroot=$< $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.i386 $@
|
||||
|
||||
kfreebsd-mfsroot.x86_64.img: kfreebsd.init.x86_64 Makefile
|
||||
TDIR=`mktemp -d`; mkdir $$TDIR/dev; mkdir $$TDIR/sbin; cp $< $$TDIR/sbin/init; makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR; rm -rf $$TDIR
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||
|
||||
knetbsd.image.x86_64: knetbsd.init.x86_64 $(srcdir)/grub-core/tests/boot/kbsd.spec.txt
|
||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||
|
||||
knetbsd.miniroot-image.x86_64.img: knetbsd.image.x86_64 $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.x86_64
|
||||
$(OBJCOPY) --add-section=miniroot=$< $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.x86_64 $@
|
||||
|
|
|
@ -109,7 +109,8 @@ program = {
|
|||
extra_dist = util/grub-mkimagexx.c;
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
ldadd = '$(LIBLZMA)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"';
|
||||
};
|
||||
|
@ -121,7 +122,7 @@ program = {
|
|||
common = util/grub-mkrelpath.c;
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
};
|
||||
|
||||
|
@ -132,7 +133,7 @@ program = {
|
|||
common = util/grub-script-check.c;
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
};
|
||||
|
||||
|
@ -143,7 +144,7 @@ program = {
|
|||
common = util/grub-editenv.c;
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
};
|
||||
|
||||
|
@ -154,7 +155,7 @@ program = {
|
|||
common = util/grub-mkpasswd-pbkdf2.c;
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
cflags = '$(CFLAGS_GCRY)';
|
||||
cppflags = '$(CPPFLAGS_GCRY)';
|
||||
|
@ -190,7 +191,7 @@ program = {
|
|||
cppflags = '$(CPPFLAGS_GCRY)';
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
};
|
||||
|
||||
|
@ -203,7 +204,7 @@ program = {
|
|||
cflags = '$(freetype_cflags)';
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(freetype_libs)';
|
||||
condition = COND_GRUB_MKFONT;
|
||||
|
@ -222,7 +223,7 @@ program = {
|
|||
sparc64_ieee1275 = util/ieee1275/devicemap.c;
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
};
|
||||
|
||||
|
@ -233,7 +234,7 @@ program = {
|
|||
common = util/grub-probe.c;
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
};
|
||||
|
||||
|
@ -244,11 +245,12 @@ program = {
|
|||
common = util/grub-setup.c;
|
||||
common = util/raid.c;
|
||||
common = util/lvm.c;
|
||||
common = grub-core/lib/reed_solomon.c;
|
||||
|
||||
sparc64_ieee1275 = util/ieee1275/ofpath.c;
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
|
||||
enable = i386_pc;
|
||||
|
@ -274,7 +276,7 @@ program = {
|
|||
common = util/grub-mklayout.c;
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
};
|
||||
|
||||
|
@ -583,6 +585,7 @@ program = {
|
|||
common = grub-core/tests/lib/test.c;
|
||||
cflags = -Wno-format;
|
||||
ldadd = libgrub.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBDEVMAPPER)';
|
||||
};
|
||||
|
||||
|
@ -594,6 +597,6 @@ program = {
|
|||
common = grub-core/lib/i386/pc/vesa_modes_table.c;
|
||||
|
||||
ldadd = libgrub.a;
|
||||
ldflags = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
ldflags = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
};
|
||||
|
|
47
autogen.sh
47
autogen.sh
|
@ -14,9 +14,50 @@ echo "Creating Makefile.tpl..."
|
|||
python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl
|
||||
|
||||
echo "Running autogen..."
|
||||
autogen -T Makefile.tpl Makefile.util.def | sed -e '/^$/{N;/^\n$/D;}' > Makefile.util.am
|
||||
autogen -T Makefile.tpl grub-core/Makefile.core.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am
|
||||
autogen -T Makefile.tpl grub-core/Makefile.gcry.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.gcry.am
|
||||
|
||||
# Automake doesn't like including files from a path outside the project.
|
||||
rm -f contrib grub-core/contrib
|
||||
if [ "x${GRUB_CONTRIB}" != x ]; then
|
||||
[ "${GRUB_CONTRIB}" = contrib ] || ln -s "${GRUB_CONTRIB}" contrib
|
||||
[ "${GRUB_CONTRIB}" = grub-core/contrib ] || ln -s ../contrib grub-core/contrib
|
||||
fi
|
||||
|
||||
UTIL_DEFS=Makefile.util.def
|
||||
CORE_DEFS='grub-core/Makefile.core.def grub-core/Makefile.gcry.def'
|
||||
|
||||
for extra in contrib/*/Makefile.util.def; do
|
||||
if test -e "$extra"; then
|
||||
UTIL_DEFS="$UTIL_DEFS $extra"
|
||||
fi
|
||||
done
|
||||
|
||||
for extra in contrib/*/Makefile.core.def; do
|
||||
if test -e "$extra"; then
|
||||
CORE_DEFS="$CORE_DEFS $extra"
|
||||
fi
|
||||
done
|
||||
|
||||
cat $UTIL_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > Makefile.util.am
|
||||
cat $CORE_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am
|
||||
|
||||
for extra in contrib/*/Makefile.common; do
|
||||
if test -e "$extra"; then
|
||||
echo "include $extra" >> Makefile.util.am
|
||||
echo "include $extra" >> grub-core/Makefile.core.am
|
||||
fi
|
||||
done
|
||||
|
||||
for extra in contrib/*/Makefile.util.common; do
|
||||
if test -e "$extra"; then
|
||||
echo "include $extra" >> Makefile.util.am
|
||||
fi
|
||||
done
|
||||
|
||||
for extra in contrib/*/Makefile.core.common; do
|
||||
if test -e "$extra"; then
|
||||
echo "include $extra" >> grub-core/Makefile.core.am
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Saving timestamps..."
|
||||
echo timestamp > stamp-h.in
|
||||
|
|
|
@ -146,11 +146,7 @@ $(top_srcdir)/Makefile.util.am: $(top_srcdir)/Makefile.util.def $(top_srcdir)/Ma
|
|||
mv $@.new $@
|
||||
|
||||
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
|
||||
$(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/Makefile.tpl
|
||||
autogen -T $(top_srcdir)/Makefile.tpl $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
|
||||
mv $@.new $@
|
||||
|
||||
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.gcry.am
|
||||
$(top_srcdir)/grub-core/Makefile.gcry.am: $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl
|
||||
autogen -T $(top_srcdir)/Makefile.tpl $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
|
||||
$(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl
|
||||
if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
|
||||
autogen -T $(top_srcdir)/Makefile.tpl $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
|
||||
mv $@.new $@
|
||||
|
|
|
@ -235,6 +235,7 @@ AC_PROG_LEX
|
|||
AC_PROG_YACC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_MKDIR_P
|
||||
AC_PROG_LN_S
|
||||
|
||||
if test "x$LEX" = "x:"; then
|
||||
AC_MSG_ERROR([flex is not found])
|
||||
|
@ -849,6 +850,12 @@ fi
|
|||
|
||||
AC_SUBST([LIBDEVMAPPER])
|
||||
|
||||
AC_CHECK_LIB([lzma], [lzma_code],
|
||||
[LIBLZMA="-llzma"
|
||||
AC_DEFINE([HAVE_LIBLZMA], [1],
|
||||
[Define to 1 if you have the LZMA library.])],)
|
||||
AC_SUBST([LIBLZMA])
|
||||
|
||||
AC_CHECK_LIB([zfs], [libzfs_init],
|
||||
[LIBZFS="-lzfs"
|
||||
AC_DEFINE([HAVE_LIBZFS], [1],
|
||||
|
|
|
@ -559,6 +559,14 @@ always. Therefore, GRUB provides you with a map file called the
|
|||
@dfn{device map}, which you must fix if it is wrong. @xref{Device
|
||||
map}, for more details.
|
||||
|
||||
On BIOS platforms GRUB has to use a so-called embedding zone. On msdos
|
||||
partition tables, this is the space between the MBR and the first partition
|
||||
(called the MBR gap or the boot track), while on GPT partition tables it
|
||||
uses a BIOS Boot Partition (a partition with GUID
|
||||
21686148-6449-6e6f-744e656564454649). If you use GRUB on a BIOS system, make
|
||||
sure that the embedding zone is at least 31 KiB (512KiB or more
|
||||
recommended).
|
||||
|
||||
If you still do want to install GRUB under a UNIX-like OS (such
|
||||
as @sc{gnu}), invoke the program @command{grub-install} (@pxref{Invoking
|
||||
grub-install}) as the superuser (@dfn{root}).
|
||||
|
@ -579,18 +587,6 @@ Likewise, under GNU/Hurd, this has the same effect:
|
|||
# @kbd{grub-install /dev/hd0}
|
||||
@end example
|
||||
|
||||
If it is the first BIOS drive, this is the same as well:
|
||||
|
||||
@example
|
||||
# @kbd{grub-install '(hd0)'}
|
||||
@end example
|
||||
|
||||
Or you can omit the parentheses:
|
||||
|
||||
@example
|
||||
# @kbd{grub-install hd0}
|
||||
@end example
|
||||
|
||||
But all the above examples assume that GRUB should use images under
|
||||
the root directory. If you want GRUB to use images under a directory
|
||||
other than the root directory, you need to specify the option
|
||||
|
@ -622,6 +618,19 @@ installation. The format is defined in @ref{Device map}. Please be
|
|||
quite careful. If the output is wrong, it is unlikely that your
|
||||
computer will be able to boot with no problem.
|
||||
|
||||
Some BIOSes have a bug of exposing the first partition of a USB drive as a
|
||||
floppy instead of exposing the USB drive as a hard disk (they call it
|
||||
``USB-FDD'' boot). In such cases, you need to install like this:
|
||||
|
||||
@example
|
||||
# @kbd{losetup /dev/loop0 /dev/sdb1}
|
||||
# @kbd{mount /dev/loop0 /mnt/usb}
|
||||
# @kbd{grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0}
|
||||
@end example
|
||||
|
||||
This install doesn't conflict with standard install as long as they are in
|
||||
separate directories.
|
||||
|
||||
Note that @command{grub-install} is actually just a shell script and the
|
||||
real task is done by @command{grub-mkimage} and @command{grub-setup}.
|
||||
Therefore, you may run those commands directly to install GRUB, without
|
||||
|
@ -629,7 +638,6 @@ using @command{grub-install}. Don't do that, however, unless you are very
|
|||
familiar with the internals of GRUB. Installing a boot loader on a running
|
||||
OS may be extremely dangerous.
|
||||
|
||||
|
||||
@node Making a GRUB bootable CD-ROM
|
||||
@section Making a GRUB bootable CD-ROM
|
||||
|
||||
|
@ -888,6 +896,14 @@ grub> @kbd{linux /vmlinuz root=/dev/sda1 acpi=off}
|
|||
See the documentation in the Linux source tree for complete information on
|
||||
the available options.
|
||||
|
||||
With @command{linux} GRUB uses 32-bit protocol. Some BIOS services like APM
|
||||
or EDD aren't available with this protocol. In this case you need to use
|
||||
@command{linux16}
|
||||
|
||||
@example
|
||||
grub> @kbd{linux16 /vmlinuz root=/dev/sda1 acpi=off}
|
||||
@end example
|
||||
|
||||
@item
|
||||
If you use an initrd, execute the command @command{initrd} (@pxref{initrd})
|
||||
after @command{linux}:
|
||||
|
@ -896,6 +912,12 @@ after @command{linux}:
|
|||
grub> @kbd{initrd /initrd}
|
||||
@end example
|
||||
|
||||
If you used @command{linux16} you need to use @command{initrd16}:
|
||||
|
||||
@example
|
||||
grub> @kbd{initrd16 /initrd}
|
||||
@end example
|
||||
|
||||
@item
|
||||
Finally, run the command @command{boot} (@pxref{boot}).
|
||||
@end enumerate
|
||||
|
@ -1073,7 +1095,7 @@ A command to configure the serial port when using the serial console.
|
|||
Command-line arguments to add to menu entries for the Linux kernel.
|
||||
|
||||
@item GRUB_CMDLINE_LINUX_DEFAULT
|
||||
Unless @samp{GRUB_DISABLE_LINUX_RECOVERY} is set to @samp{true}, two menu
|
||||
Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu
|
||||
entries will be generated for each Linux kernel: one default entry and one
|
||||
entry for recovery mode. This option lists command-line arguments to add
|
||||
only to the default menu entry, after those listed in
|
||||
|
@ -1096,13 +1118,9 @@ the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is
|
|||
usually more reliable, but in some cases it may not be appropriate. To
|
||||
disable the use of UUIDs, set this option to @samp{true}.
|
||||
|
||||
@item GRUB_DISABLE_LINUX_RECOVERY
|
||||
@item GRUB_DISABLE_RECOVERY
|
||||
If this option is set to @samp{true}, disable the generation of recovery
|
||||
mode menu entries for Linux.
|
||||
|
||||
@item GRUB_DISABLE_NETBSD_RECOVERY
|
||||
If this option is set to @samp{true}, disable the generation of recovery
|
||||
mode menu entries for NetBSD.
|
||||
mode menu entries.
|
||||
|
||||
@item GRUB_VIDEO_BACKEND
|
||||
If graphical video support is required, either because the @samp{gfxterm}
|
||||
|
@ -3278,7 +3296,7 @@ commands.
|
|||
@node Supported kernels
|
||||
@chapter Supported boot targets
|
||||
|
||||
X86 support is summarised in following table. ``Yes'' means that kernel works on the given platform, ``crashes'' means an early kernel crash which we hove will be fixed by concerned kernel developpers. ``no'' means GRUB doesn't load given kernel on a given platform. ``headless'' means that the kernel works but lacks console drivers (you can still use serial or network console). In case of ``no'' and ``crashes'' the reason is given in footnote.
|
||||
X86 support is summarised in the following table. ``Yes'' means that the kernel works on the given platform, ``crashes'' means an early kernel crash which we hope will be fixed by concerned kernel developers. ``no'' means GRUB doesn't load the given kernel on a given platform. ``headless'' means that the kernel works but lacks console drivers (you can still use serial or network console). In case of ``no'' and ``crashes'' the reason is given in footnote.
|
||||
@multitable @columnfractions .50 .22 .22
|
||||
@item @tab BIOS @tab Coreboot
|
||||
@item BIOS chainloading @tab yes @tab no (1)
|
||||
|
|
102
gentpl.py
102
gentpl.py
|
@ -38,6 +38,11 @@ GROUPS["videoinkernel"] = ["mips_yeeloong"]
|
|||
GROUPS["videomodules"] = GRUB_PLATFORMS[:];
|
||||
for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
|
||||
|
||||
# Similar for terminfo
|
||||
GROUPS["terminfoinkernel"] = ["mips_yeeloong"] + GROUPS["ieee1275"];
|
||||
GROUPS["terminfomodule"] = GRUB_PLATFORMS[:];
|
||||
for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
|
||||
|
||||
# Miscelaneous groups schedulded to disappear in future
|
||||
GROUPS["nosparc64"] = GRUB_PLATFORMS[:]; GROUPS["nosparc64"].remove("sparc64_ieee1275")
|
||||
GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
|
||||
|
@ -70,16 +75,15 @@ for platform in GRUB_PLATFORMS:
|
|||
#
|
||||
# Global variables
|
||||
#
|
||||
GVARS = []
|
||||
GVARS = set()
|
||||
|
||||
def gvar_add(var, value):
|
||||
if var not in GVARS:
|
||||
GVARS.append(var)
|
||||
GVARS.add(var)
|
||||
return var + " += " + value + "\n"
|
||||
|
||||
def global_variable_initializers():
|
||||
r = ""
|
||||
for var in GVARS:
|
||||
for var in sorted(GVARS):
|
||||
r += var + " ?= \n"
|
||||
return r
|
||||
|
||||
|
@ -87,6 +91,16 @@ def global_variable_initializers():
|
|||
# Per PROGRAM/SCRIPT variables
|
||||
#
|
||||
|
||||
def vars_init(*var_list):
|
||||
r = "[+ IF (if (not (assoc-ref seen-vars (get \".name\"))) \"seen\") +]"
|
||||
r += "[+ (out-suspend \"v\") +]"
|
||||
for var in var_list:
|
||||
r += var + " = \n"
|
||||
r += "[+ (out-resume \"v\") +]"
|
||||
r += "[+ (set! seen-vars (assoc-set! seen-vars (get \".name\") 0)) +]"
|
||||
r += "[+ ENDIF +]"
|
||||
return first_time(r)
|
||||
|
||||
def var_set(var, value):
|
||||
return var + " = " + value + "\n"
|
||||
|
||||
|
@ -257,6 +271,15 @@ def platform_ccasflags(p): return platform_specific_values(p, "_ccasflags", "cca
|
|||
def platform_stripflags(p): return platform_specific_values(p, "_stripflags", "stripflags")
|
||||
def platform_objcopyflags(p): return platform_specific_values(p, "_objcopyflags", "objcopyflags")
|
||||
|
||||
#
|
||||
# Emit snippet only the first time through for the current name.
|
||||
#
|
||||
def first_time(snippet):
|
||||
r = "[+ IF (if (not (assoc-ref seen-target (get \".name\"))) \"seen\") +]"
|
||||
r += snippet
|
||||
r += "[+ ENDIF +]"
|
||||
return r
|
||||
|
||||
def module(platform):
|
||||
r = set_canonical_name_suffix(".module")
|
||||
|
||||
|
@ -341,18 +364,25 @@ fi
|
|||
|
||||
def library(platform):
|
||||
r = set_canonical_name_suffix("")
|
||||
r += gvar_add("noinst_LIBRARIES", "[+ name +]")
|
||||
r += var_set(cname() + "_SOURCES", platform_sources(platform))
|
||||
r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform))
|
||||
r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_LIBRARY) " + platform_cflags(platform))
|
||||
r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) " + platform_cppflags(platform))
|
||||
r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) " + platform_ccasflags(platform))
|
||||
# r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
|
||||
|
||||
r += vars_init(cname() + "_SOURCES",
|
||||
"nodist_" + cname() + "_SOURCES",
|
||||
cname() + "_CFLAGS",
|
||||
cname() + "_CPPFLAGS",
|
||||
cname() + "_CCASFLAGS")
|
||||
# cname() + "_DEPENDENCIES")
|
||||
|
||||
r += first_time(gvar_add("noinst_LIBRARIES", "[+ name +]"))
|
||||
r += var_add(cname() + "_SOURCES", platform_sources(platform))
|
||||
r += var_add("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform))
|
||||
r += var_add(cname() + "_CFLAGS", first_time("$(AM_CFLAGS) $(CFLAGS_LIBRARY) ") + platform_cflags(platform))
|
||||
r += var_add(cname() + "_CPPFLAGS", first_time("$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) ") + platform_cppflags(platform))
|
||||
r += var_add(cname() + "_CCASFLAGS", first_time("$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) ") + platform_ccasflags(platform))
|
||||
# r += var_add(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
|
||||
|
||||
r += gvar_add("EXTRA_DIST", extra_dist())
|
||||
r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
|
||||
r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
|
||||
|
||||
r += first_time(gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)"))
|
||||
r += first_time(gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)"))
|
||||
return r
|
||||
|
||||
def installdir(default="bin"):
|
||||
|
@ -376,7 +406,7 @@ def program(platform, test=False):
|
|||
r += gvar_add("check_PROGRAMS", "[+ name +]")
|
||||
r += gvar_add("TESTS", "[+ name +]")
|
||||
r += "[+ ELSE +]"
|
||||
r += gvar_add(installdir() + "_PROGRAMS", "[+ name +]")
|
||||
r += var_add(installdir() + "_PROGRAMS", "[+ name +]")
|
||||
r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
|
||||
r += "[+ ENDIF +]"
|
||||
|
||||
|
@ -397,7 +427,7 @@ def program(platform, test=False):
|
|||
def data(platform):
|
||||
r = gvar_add("EXTRA_DIST", platform_sources(platform))
|
||||
r += gvar_add("EXTRA_DIST", extra_dist())
|
||||
r += gvar_add(installdir() + "_DATA", platform_sources(platform))
|
||||
r += var_add(installdir() + "_DATA", platform_sources(platform))
|
||||
return r
|
||||
|
||||
def script(platform):
|
||||
|
@ -405,7 +435,7 @@ def script(platform):
|
|||
r += gvar_add("check_SCRIPTS", "[+ name +]")
|
||||
r += gvar_add ("TESTS", "[+ name +]")
|
||||
r += "[+ ELSE +]"
|
||||
r += gvar_add(installdir() + "_SCRIPTS", "[+ name +]")
|
||||
r += var_add(installdir() + "_SCRIPTS", "[+ name +]")
|
||||
r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
|
||||
r += "[+ ENDIF +]"
|
||||
|
||||
|
@ -418,33 +448,43 @@ chmod a+x [+ name +]
|
|||
r += gvar_add("dist_noinst_DATA", platform_sources(platform))
|
||||
return r
|
||||
|
||||
def rules(target, closure):
|
||||
# Create association lists for the benefit of first_time and vars_init.
|
||||
r = "[+ (define seen-target '()) +]"
|
||||
r += "[+ (define seen-vars '()) +]"
|
||||
# Most output goes to a diversion. This allows us to emit variable
|
||||
# initializations before everything else.
|
||||
r += "[+ (out-push-new) +]"
|
||||
|
||||
r += "[+ FOR " + target + " +]"
|
||||
r += foreach_enabled_platform(
|
||||
lambda p: under_platform_specific_conditionals(p, closure(p)))
|
||||
# Remember that we've seen this target.
|
||||
r += "[+ (set! seen-target (assoc-set! seen-target (get \".name\") 0)) +]"
|
||||
r += "[+ ENDFOR +]"
|
||||
r += "[+ (out-pop #t) +]"
|
||||
return r
|
||||
|
||||
def module_rules():
|
||||
return "[+ FOR module +]" + foreach_enabled_platform(
|
||||
lambda p: under_platform_specific_conditionals(p, module(p))) + "[+ ENDFOR +]"
|
||||
return rules("module", module)
|
||||
|
||||
def kernel_rules():
|
||||
return "[+ FOR kernel +]" + foreach_enabled_platform(
|
||||
lambda p: under_platform_specific_conditionals(p, kernel(p))) + "[+ ENDFOR +]"
|
||||
return rules("kernel", kernel)
|
||||
|
||||
def image_rules():
|
||||
return "[+ FOR image +]" + foreach_enabled_platform(
|
||||
lambda p: under_platform_specific_conditionals(p, image(p))) + "[+ ENDFOR +]"
|
||||
return rules("image", image)
|
||||
|
||||
def library_rules():
|
||||
return "[+ FOR library +]" + foreach_enabled_platform(
|
||||
lambda p: under_platform_specific_conditionals(p, library(p))) + "[+ ENDFOR +]"
|
||||
return rules("library", library)
|
||||
|
||||
def program_rules():
|
||||
return "[+ FOR program +]" + foreach_enabled_platform(
|
||||
lambda p: under_platform_specific_conditionals(p, program(p))) + "[+ ENDFOR +]"
|
||||
return rules("program", program)
|
||||
|
||||
def script_rules():
|
||||
return "[+ FOR script +]" + foreach_enabled_platform(
|
||||
lambda p: under_platform_specific_conditionals(p, script(p))) + "[+ ENDFOR +]"
|
||||
return rules("script", script)
|
||||
|
||||
def data_rules():
|
||||
return "[+ FOR data +]" + foreach_enabled_platform(
|
||||
lambda p: under_platform_specific_conditionals(p, data(p))) + "[+ ENDFOR +]"
|
||||
return rules("data", data)
|
||||
|
||||
print "[+ AutoGen5 template +]\n"
|
||||
a = module_rules()
|
||||
|
|
|
@ -48,10 +48,15 @@ CLEANFILES += grub_script.tab.c grub_script.tab.h
|
|||
grub_script.yy.h: script/yylex.l
|
||||
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $<
|
||||
grub_script.yy.c: grub_script.yy.h
|
||||
|
||||
rs_decoder.S: $(srcdir)/lib/reed_solomon.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3
|
||||
|
||||
kern/i386/pc/startup.S: $(builddir)/rs_decoder.S
|
||||
|
||||
CLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||
|
||||
include $(srcdir)/Makefile.core.am
|
||||
include $(srcdir)/Makefile.gcry.am
|
||||
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h
|
||||
|
@ -109,6 +114,8 @@ endif
|
|||
if COND_i386_ieee1275
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||
endif
|
||||
|
||||
|
@ -134,15 +141,24 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
|
|||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.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
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
endif
|
||||
|
||||
if COND_sparc64_ieee1275
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
endif
|
||||
|
||||
if COND_emu
|
||||
|
@ -175,7 +191,7 @@ CLEANFILES += symlist.c
|
|||
BUILT_SOURCES += symlist.c
|
||||
|
||||
if COND_HAVE_ASM_USCORE
|
||||
ASM_PREFIX=1
|
||||
ASM_PREFIX=_
|
||||
else
|
||||
ASM_PREFIX=
|
||||
endif
|
||||
|
@ -185,8 +201,8 @@ noinst_DATA += kernel_syms.lst
|
|||
kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h
|
||||
$(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input
|
||||
cat kernel_syms.input | grep -v '^#' | sed -n \
|
||||
-e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/defined '"$(ASM_PREFIX)"'kernel \1/;p;}' \
|
||||
-e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/defined '"$(ASM_PREFIX)"' kernel \1/;p;}' \
|
||||
-e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \
|
||||
-e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \
|
||||
| sort -u >$@
|
||||
rm -f kernel_syms.input
|
||||
CLEANFILES += kernel_syms.lst
|
||||
|
|
|
@ -92,10 +92,10 @@ kernel = {
|
|||
ieee1275 = kern/ieee1275/openfw.c;
|
||||
ieee1275 = term/ieee1275/ofconsole.c;
|
||||
|
||||
ieee1275 = term/terminfo.c;
|
||||
ieee1275 = term/tparm.c;
|
||||
mips = term/terminfo.c;
|
||||
mips = term/tparm.c;
|
||||
terminfoinkernel = term/terminfo.c;
|
||||
terminfoinkernel = term/tparm.c;
|
||||
terminfoinkernel = commands/extcmd.c;
|
||||
terminfoinkernel = lib/arg.c;
|
||||
|
||||
i386 = kern/i386/dl.c;
|
||||
|
||||
|
@ -173,9 +173,7 @@ kernel = {
|
|||
emu = kern/emu/mm.c;
|
||||
emu = kern/emu/time.c;
|
||||
|
||||
videoinkernel = lib/arg.c;
|
||||
videoinkernel = term/gfxterm.c;
|
||||
videoinkernel = commands/extcmd.c;
|
||||
videoinkernel = font/font.c;
|
||||
videoinkernel = font/font_cmd.c;
|
||||
videoinkernel = io/bufio.c;
|
||||
|
@ -290,6 +288,38 @@ image = {
|
|||
enable = i386_pc;
|
||||
};
|
||||
|
||||
image = {
|
||||
name = xz_decompress;
|
||||
mips = boot/mips/startup_raw.S;
|
||||
common = boot/decompressor/minilib.c;
|
||||
common = boot/decompressor/xz.c;
|
||||
common = lib/xzembed/xz_dec_bcj.c;
|
||||
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';
|
||||
|
||||
objcopyflags = '-O binary';
|
||||
ldflags = '-lgcc -static-libgcc -Wl,-Ttext,0x80100000';
|
||||
cflags = '-static-libgcc';
|
||||
enable = mips;
|
||||
};
|
||||
|
||||
image = {
|
||||
name = none_decompress;
|
||||
mips = boot/mips/startup_raw.S;
|
||||
common = boot/decompressor/none.c;
|
||||
|
||||
mips_cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1 -DGRUB_MACHINE_LINK_ADDR=0x80200000';
|
||||
|
||||
objcopyflags = '-O binary';
|
||||
ldflags = '-lgcc -static-libgcc -Wl,-Ttext,0x80100000';
|
||||
cflags = '-static-libgcc';
|
||||
enable = mips;
|
||||
};
|
||||
|
||||
image = {
|
||||
name = fwstart;
|
||||
mips_yeeloong = boot/mips/yeeloong/fwstart.S;
|
||||
|
@ -510,6 +540,7 @@ module = {
|
|||
name = extcmd;
|
||||
common = commands/extcmd.c;
|
||||
common = lib/arg.c;
|
||||
enable = terminfomodule;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -1305,6 +1336,7 @@ module = {
|
|||
name = terminfo;
|
||||
common = term/terminfo.c;
|
||||
common = term/tparm.c;
|
||||
enable = terminfomodule;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
|
102
grub-core/boot/decompressor/minilib.c
Normal file
102
grub-core/boot/decompressor/minilib.c
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/decompressor.h>
|
||||
|
||||
void *
|
||||
memset (void *s, int c, grub_size_t len)
|
||||
{
|
||||
grub_uint8_t *ptr;
|
||||
for (ptr = s; len; ptr++, len--)
|
||||
*ptr = c;
|
||||
return s;
|
||||
}
|
||||
|
||||
void *
|
||||
grub_memmove (void *dest, const void *src, grub_size_t n)
|
||||
{
|
||||
char *d = (char *) dest;
|
||||
const char *s = (const char *) src;
|
||||
|
||||
if (d < s)
|
||||
while (n--)
|
||||
*d++ = *s++;
|
||||
else
|
||||
{
|
||||
d += n;
|
||||
s += n;
|
||||
|
||||
while (n--)
|
||||
*--d = *--s;
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
int
|
||||
grub_memcmp (const void *s1, const void *s2, grub_size_t n)
|
||||
{
|
||||
const char *t1 = s1;
|
||||
const char *t2 = s2;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
if (*t1 != *t2)
|
||||
return (int) *t1 - (int) *t2;
|
||||
|
||||
t1++;
|
||||
t2++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int memcmp (const void *s1, const void *s2, grub_size_t n)
|
||||
__attribute__ ((alias ("grub_memcmp")));
|
||||
|
||||
void *memmove (void *dest, const void *src, grub_size_t n)
|
||||
__attribute__ ((alias ("grub_memmove")));
|
||||
|
||||
void *memcpy (void *dest, const void *src, grub_size_t n)
|
||||
__attribute__ ((alias ("grub_memmove")));
|
||||
|
||||
void *grub_decompressor_scratch;
|
||||
|
||||
void
|
||||
find_scratch (void *src, void *dst, unsigned long srcsize,
|
||||
unsigned long dstsize)
|
||||
{
|
||||
#ifdef _mips
|
||||
/* Decoding from ROM. */
|
||||
if (((grub_addr_t) src & 0x10000000))
|
||||
{
|
||||
grub_decompressor_scratch = (void *) ALIGN_UP((grub_addr_t) dst + dstsize,
|
||||
256);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if ((char *) src + srcsize > (char *) dst + dstsize)
|
||||
grub_decompressor_scratch = (void *) ALIGN_UP ((grub_addr_t) src + srcsize,
|
||||
256);
|
||||
else
|
||||
grub_decompressor_scratch = (void *) ALIGN_UP ((grub_addr_t) dst + dstsize,
|
||||
256);
|
||||
return;
|
||||
}
|
39
grub-core/boot/decompressor/none.c
Normal file
39
grub-core/boot/decompressor/none.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/decompressor.h>
|
||||
|
||||
void
|
||||
grub_decompress_core (void *src, void *dest, unsigned long n,
|
||||
unsigned long dstsize __attribute__ ((unused)))
|
||||
{
|
||||
char *d = (char *) dest;
|
||||
const char *s = (const char *) src;
|
||||
|
||||
if (d < s)
|
||||
while (n--)
|
||||
*d++ = *s++;
|
||||
else
|
||||
{
|
||||
d += n;
|
||||
s += n;
|
||||
|
||||
while (n--)
|
||||
*--d = *--s;
|
||||
}
|
||||
}
|
60
grub-core/boot/decompressor/xz.c
Normal file
60
grub-core/boot/decompressor/xz.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/decompressor.h>
|
||||
|
||||
#include "xz.h"
|
||||
#include "xz_stream.h"
|
||||
|
||||
void
|
||||
grub_decompress_core (void *src, void *dst, unsigned long srcsize,
|
||||
unsigned long dstsize)
|
||||
{
|
||||
struct xz_dec *dec;
|
||||
struct xz_buf buf;
|
||||
|
||||
find_scratch (src, dst, srcsize, dstsize);
|
||||
|
||||
dec = xz_dec_init (GRUB_DECOMPRESSOR_DICT_SIZE);
|
||||
|
||||
buf.in = src;
|
||||
buf.in_pos = 0;
|
||||
buf.in_size = srcsize;
|
||||
buf.out = dst;
|
||||
buf.out_pos = 0;
|
||||
buf.out_size = dstsize;
|
||||
|
||||
while (buf.in_pos != buf.in_size)
|
||||
{
|
||||
enum xz_ret xzret;
|
||||
xzret = xz_dec_run (dec, &buf);
|
||||
switch (xzret)
|
||||
{
|
||||
case XZ_MEMLIMIT_ERROR:
|
||||
case XZ_FORMAT_ERROR:
|
||||
case XZ_OPTIONS_ERROR:
|
||||
case XZ_DATA_ERROR:
|
||||
case XZ_BUF_ERROR:
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -185,7 +185,7 @@ real_code_2:
|
|||
call LOCAL(move_memory)
|
||||
|
||||
/* Check for multiboot signature. */
|
||||
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE)
|
||||
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART)
|
||||
jz 1f
|
||||
|
||||
movl (ramdisk_image - start), %esi
|
||||
|
|
187
grub-core/boot/mips/startup_raw.S
Normal file
187
grub-core/boot/mips/startup_raw.S
Normal file
|
@ -0,0 +1,187 @@
|
|||
/* startup.S - Startup code for the MIPS. */
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/offsets.h>
|
||||
|
||||
#define BASE_ADDR 8
|
||||
|
||||
.extern __bss_start
|
||||
.extern _end
|
||||
|
||||
.globl __start, _start, start
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
__start:
|
||||
_start:
|
||||
start:
|
||||
|
||||
bal codestart
|
||||
nop
|
||||
base:
|
||||
. = _start + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE
|
||||
compressed_size:
|
||||
.long 0
|
||||
. = _start + GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE
|
||||
uncompressed_size:
|
||||
.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_YEELOONG
|
||||
move $s2, $zero
|
||||
move $s3, $zero
|
||||
move $s4, $zero
|
||||
move $s5, $zero
|
||||
|
||||
/* $a2 has the environment. */
|
||||
addiu $t0, $a2, 1
|
||||
beq $t0, $zero, argdone
|
||||
nop
|
||||
move $t0, $a2
|
||||
argcont:
|
||||
lw $t1, 0($t0)
|
||||
beq $t1, $zero, argdone
|
||||
nop
|
||||
#define DO_PARSE(str, reg) \
|
||||
addiu $t2, $s0, (str-base);\
|
||||
bal parsestr;\
|
||||
nop ;\
|
||||
beq $v0, $zero, 1f;\
|
||||
nop ;\
|
||||
b 2f;\
|
||||
move reg, $v0; \
|
||||
1:
|
||||
DO_PARSE (busclockstr, $s2)
|
||||
DO_PARSE (cpuclockstr, $s3)
|
||||
DO_PARSE (memsizestr, $s4)
|
||||
DO_PARSE (highmemsizestr, $s5)
|
||||
2:
|
||||
b argcont
|
||||
addiu $t0, $t0, 4
|
||||
parsestr:
|
||||
move $v0, $zero
|
||||
move $t3, $t1
|
||||
3:
|
||||
lb $t4, 0($t2)
|
||||
lb $t5, 0($t3)
|
||||
addiu $t2, $t2, 1
|
||||
addiu $t3, $t3, 1
|
||||
beq $t5, $zero, 1f
|
||||
nop
|
||||
beq $t5, $t4, 3b
|
||||
nop
|
||||
bne $t4, $zero, 1f
|
||||
nop
|
||||
|
||||
addiu $t3, $t3, 0xffff
|
||||
digcont:
|
||||
lb $t5, 0($t3)
|
||||
/* Substract '0' from digit. */
|
||||
addiu $t5, $t5, 0xffd0
|
||||
bltz $t5, 1f
|
||||
nop
|
||||
addiu $t4, $t5, 0xfff7
|
||||
bgtz $t4, 1f
|
||||
nop
|
||||
/* Multiply $v0 by 10 with bitshifts. */
|
||||
sll $v0, $v0, 1
|
||||
sll $t4, $v0, 2
|
||||
addu $v0, $v0, $t4
|
||||
addu $v0, $v0, $t5
|
||||
addiu $t3, $t3, 1
|
||||
b digcont
|
||||
nop
|
||||
1:
|
||||
jr $ra
|
||||
nop
|
||||
busclockstr: .asciiz "busclock="
|
||||
cpuclockstr: .asciiz "cpuclock="
|
||||
memsizestr: .asciiz "memsize="
|
||||
highmemsizestr: .asciiz "highmemsize="
|
||||
.p2align 2
|
||||
argdone:
|
||||
#endif
|
||||
/* Copy the decompressor. */
|
||||
lui $t1, %hi(base)
|
||||
addiu $t1, $t1, %lo(base)
|
||||
lui $t3, %hi(__bss_start)
|
||||
addiu $t3, $t3, %lo(__bss_start)
|
||||
move $t2, $s0
|
||||
|
||||
1:
|
||||
beq $t1, $t3, 2f
|
||||
lb $t4, 0($t2)
|
||||
sb $t4, 0($t1)
|
||||
addiu $t1, $t1, 1
|
||||
b 1b
|
||||
addiu $t2, $t2, 1
|
||||
2:
|
||||
/* Clean out its BSS. */
|
||||
lui $t1, %hi(__bss_start)
|
||||
addiu $t1, $t1, %lo(__bss_start)
|
||||
lui $t2, %hi(_end)
|
||||
addiu $t2, $t2, %lo(_end)
|
||||
1:
|
||||
beq $t1, $t2, 2f
|
||||
nop
|
||||
sb $zero, 0($t1)
|
||||
b 1b
|
||||
addiu $t1, $t1, 1
|
||||
2:
|
||||
|
||||
/* Decompress the payload. */
|
||||
lui $a0, %hi(__bss_start)
|
||||
addiu $a0, $a0, %lo(__bss_start)
|
||||
lui $t0, %hi(base)
|
||||
addiu $t0, $t0, %lo(base)
|
||||
subu $a0, $a0, $t0
|
||||
addu $a0, $a0, $s0
|
||||
|
||||
lui $a1, %hi(GRUB_MACHINE_LINK_ADDR)
|
||||
addiu $a1, %lo(GRUB_MACHINE_LINK_ADDR)
|
||||
lw $a2, (GRUB_KERNEL_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
lw $a3, (GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
move $s1, $a1
|
||||
|
||||
/* $a0 contains source compressed address, $a1 is destination,
|
||||
$a2 is compressed size, $a3 is uncompressed size.
|
||||
*/
|
||||
move $s6, $a3
|
||||
|
||||
lui $sp, %hi(_start - 256)
|
||||
|
||||
bal EXT_C(grub_decompress_core)
|
||||
addiu $sp, $sp, %lo(_start - 256)
|
||||
|
||||
move $a0, $s1
|
||||
move $a1, $s6
|
||||
|
||||
#include "../../kern/mips/cache_flush.S"
|
||||
|
||||
lui $t1, %hi(GRUB_MACHINE_LINK_ADDR)
|
||||
addiu $t1, %lo(GRUB_MACHINE_LINK_ADDR)
|
||||
|
||||
jr $t1
|
||||
nop
|
|
@ -150,7 +150,7 @@ typedef enum
|
|||
#define GRUB_OHCI_RESET_CONNECT_CHANGE (1 << 16)
|
||||
#define GRUB_OHCI_CTRL_EDS 256
|
||||
#define GRUB_OHCI_BULK_EDS 510
|
||||
#define GRUB_OHCI_TDS 256
|
||||
#define GRUB_OHCI_TDS 640
|
||||
|
||||
#define GRUB_OHCI_ED_ADDR_MASK 0x7ff
|
||||
|
||||
|
@ -220,7 +220,6 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
|||
grub_pci_address_t addr;
|
||||
struct grub_ohci *o;
|
||||
grub_uint32_t revision;
|
||||
int cs5536;
|
||||
int j;
|
||||
|
||||
/* Determine IO base address. */
|
||||
|
@ -230,7 +229,6 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
|||
{
|
||||
grub_uint64_t basereg;
|
||||
|
||||
cs5536 = 1;
|
||||
basereg = grub_cs5536_read_msr (dev, GRUB_CS5536_MSR_USB_OHCI_BASE);
|
||||
if (!(basereg & GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE))
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#define GRUB_UHCI_IOMASK (0x7FF << 5)
|
||||
|
||||
#define N_QH 256
|
||||
#define N_TD 640
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -105,7 +106,7 @@ struct grub_uhci
|
|||
/* N_QH Queue Heads. */
|
||||
grub_uhci_qh_t qh;
|
||||
|
||||
/* 256 Transfer Descriptors. */
|
||||
/* N_TD Transfer Descriptors. */
|
||||
grub_uhci_td_t td;
|
||||
|
||||
/* Free Transfer Descriptors. */
|
||||
|
@ -213,7 +214,7 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
|
||||
/* The QH pointer of UHCI is only 32 bits, make sure this
|
||||
code works on on 64 bits architectures. */
|
||||
u->qh = (grub_uhci_qh_t) grub_memalign (4096, 4096);
|
||||
u->qh = (grub_uhci_qh_t) grub_memalign (4096, sizeof(struct grub_uhci_qh)*N_QH);
|
||||
if (! u->qh)
|
||||
goto fail;
|
||||
|
||||
|
@ -227,7 +228,7 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
|
||||
/* The TD pointer of UHCI is only 32 bits, make sure this
|
||||
code works on on 64 bits architectures. */
|
||||
u->td = (grub_uhci_td_t) grub_memalign (4096, 4096*2);
|
||||
u->td = (grub_uhci_td_t) grub_memalign (4096, sizeof(struct grub_uhci_td)*N_TD);
|
||||
if (! u->td)
|
||||
goto fail;
|
||||
|
||||
|
@ -244,9 +245,9 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
|
||||
/* Link all Transfer Descriptors in a list of available Transfer
|
||||
Descriptors. */
|
||||
for (i = 0; i < 256; i++)
|
||||
for (i = 0; i < N_TD; i++)
|
||||
u->td[i].linkptr = (grub_uint32_t) (grub_addr_t) &u->td[i + 1];
|
||||
u->td[255 - 1].linkptr = 0;
|
||||
u->td[N_TD - 2].linkptr = 0;
|
||||
u->tdfree = u->td;
|
||||
|
||||
/* Make sure UHCI is disabled! */
|
||||
|
|
|
@ -228,7 +228,7 @@ grub_usb_bulk_setup_readwrite (grub_usb_device_t dev,
|
|||
if (dev->initialized)
|
||||
{
|
||||
struct grub_usb_desc_endp *endpdesc;
|
||||
endpdesc = grub_usb_get_endpdescriptor (dev, 0);
|
||||
endpdesc = grub_usb_get_endpdescriptor (dev, endpoint);
|
||||
|
||||
if (endpdesc)
|
||||
max = endpdesc->maxpacket;
|
||||
|
|
|
@ -16,9 +16,28 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef GRUB_DSDT_TEST
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#define grub_dprintf(cond, args...) printf ( args )
|
||||
#define grub_printf printf
|
||||
typedef uint64_t grub_uint64_t;
|
||||
typedef uint32_t grub_uint32_t;
|
||||
typedef uint16_t grub_uint16_t;
|
||||
typedef uint8_t grub_uint8_t;
|
||||
|
||||
#endif
|
||||
|
||||
#include <grub/acpi.h>
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/misc.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#endif
|
||||
|
||||
static inline grub_uint32_t
|
||||
decode_length (const grub_uint8_t *ptr, int *numlen)
|
||||
|
@ -123,6 +142,7 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
|||
return 0;
|
||||
break;
|
||||
case GRUB_ACPI_EXTOPCODE_FIELD_OP:
|
||||
case GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP:
|
||||
ptr++;
|
||||
ptr += decode_length (ptr, 0);
|
||||
break;
|
||||
|
@ -136,7 +156,7 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
|||
static int
|
||||
get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
||||
{
|
||||
grub_uint8_t *ptr, *prev;
|
||||
grub_uint8_t *ptr, *prev = table;
|
||||
int sleep_type = -1;
|
||||
|
||||
ptr = table + sizeof (struct grub_acpi_table_header);
|
||||
|
@ -156,11 +176,12 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
|||
break;
|
||||
case GRUB_ACPI_OPCODE_NAME:
|
||||
ptr++;
|
||||
if (memcmp (ptr, "_S5_", 4) == 0)
|
||||
if (memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0)
|
||||
{
|
||||
int ll;
|
||||
grub_uint8_t *ptr2 = ptr;
|
||||
ptr2 += 4;
|
||||
grub_dprintf ("acpi", "S5 found\n");
|
||||
ptr2 += skip_name_string (ptr, end);
|
||||
if (*ptr2 != 0x12)
|
||||
{
|
||||
grub_printf ("Unknown opcode in _S5: 0x%x\n", *ptr2);
|
||||
|
@ -208,6 +229,47 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
|||
return sleep_type;
|
||||
}
|
||||
|
||||
#ifdef GRUB_DSDT_TEST
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
FILE *f;
|
||||
size_t len;
|
||||
unsigned char *buf;
|
||||
if (argc < 2)
|
||||
printf ("Usage: %s FILE\n", argv[0]);
|
||||
f = fopen (argv[1], "rb");
|
||||
if (!f)
|
||||
{
|
||||
printf ("Couldn't open file\n");
|
||||
return 1;
|
||||
}
|
||||
fseek (f, 0, SEEK_END);
|
||||
len = ftell (f);
|
||||
fseek (f, 0, SEEK_SET);
|
||||
buf = malloc (len);
|
||||
if (!buf)
|
||||
{
|
||||
printf ("Couldn't malloc buffer\n");
|
||||
fclose (f);
|
||||
return 2;
|
||||
}
|
||||
if (fread (buf, 1, len, f) != len)
|
||||
{
|
||||
printf ("Read failed\n");
|
||||
free (buf);
|
||||
fclose (f);
|
||||
return 2;
|
||||
}
|
||||
|
||||
printf ("Sleep type = %d\n", get_sleep_type (buf, buf + len));
|
||||
free (buf);
|
||||
fclose (f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
grub_acpi_halt (void)
|
||||
{
|
||||
|
@ -264,3 +326,4 @@ grub_acpi_halt (void)
|
|||
|
||||
grub_printf ("ACPI shutdown failed\n");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -225,7 +225,9 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||
int argc, char **args)
|
||||
{
|
||||
int i;
|
||||
#ifdef TODO
|
||||
int no_mem_option = 0;
|
||||
#endif
|
||||
struct grub_command *cmd;
|
||||
char **cutargs;
|
||||
int cutargc;
|
||||
|
@ -235,7 +237,9 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||
/* FIXME: really support this. */
|
||||
if (argc >= 1 && grub_strcmp (args[0], "--no-mem-option") == 0)
|
||||
{
|
||||
#ifdef TODO
|
||||
no_mem_option = 1;
|
||||
#endif
|
||||
argc--;
|
||||
args++;
|
||||
continue;
|
||||
|
|
|
@ -259,7 +259,7 @@ grub_lvm_scan_device (const char *name)
|
|||
{
|
||||
grub_err_t err;
|
||||
grub_disk_t disk;
|
||||
grub_uint64_t da_offset, da_size, mda_offset, mda_size;
|
||||
grub_uint64_t mda_offset, mda_size;
|
||||
char buf[GRUB_LVM_LABEL_SIZE];
|
||||
char vg_id[GRUB_LVM_ID_STRLEN+1];
|
||||
char pv_id[GRUB_LVM_ID_STRLEN+1];
|
||||
|
@ -319,8 +319,6 @@ grub_lvm_scan_device (const char *name)
|
|||
pv_id[j] = '\0';
|
||||
|
||||
dlocn = pvh->disk_areas_xl;
|
||||
da_offset = grub_le_to_cpu64 (dlocn->offset);
|
||||
da_size = grub_le_to_cpu64 (dlocn->size);
|
||||
|
||||
dlocn++;
|
||||
/* Is it possible to have multiple data/metadata areas? I haven't
|
||||
|
|
|
@ -107,6 +107,14 @@ grub_raid_memberlist (grub_disk_t disk)
|
|||
|
||||
return list;
|
||||
}
|
||||
|
||||
static const char *
|
||||
grub_raid_getname (struct grub_disk *disk)
|
||||
{
|
||||
struct grub_raid_array *array = disk->data;
|
||||
|
||||
return array->driver->name;
|
||||
}
|
||||
#endif
|
||||
|
||||
static grub_err_t
|
||||
|
@ -476,7 +484,8 @@ grub_raid_write (grub_disk_t disk __attribute ((unused)),
|
|||
|
||||
static grub_err_t
|
||||
insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
|
||||
grub_disk_addr_t start_sector, const char *scanner_name)
|
||||
grub_disk_addr_t start_sector, const char *scanner_name,
|
||||
grub_raid_t raid __attribute__ ((unused)))
|
||||
{
|
||||
struct grub_raid_array *array = 0, *p;
|
||||
|
||||
|
@ -524,6 +533,9 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
|
|||
|
||||
*array = *new_array;
|
||||
array->nr_devs = 0;
|
||||
#ifdef GRUB_UTIL
|
||||
array->driver = raid;
|
||||
#endif
|
||||
grub_memset (&array->device, 0, sizeof (array->device));
|
||||
grub_memset (&array->start_sector, 0, sizeof (array->start_sector));
|
||||
|
||||
|
@ -662,7 +674,8 @@ grub_raid_register (grub_raid_t raid)
|
|||
|
||||
if ((disk->total_sectors != GRUB_ULONG_MAX) &&
|
||||
(! grub_raid_list->detect (disk, &array, &start_sector)) &&
|
||||
(! insert_array (disk, &array, start_sector, grub_raid_list->name)))
|
||||
(! insert_array (disk, &array, start_sector, grub_raid_list->name,
|
||||
grub_raid_list)))
|
||||
return 0;
|
||||
|
||||
/* This error usually means it's not raid, no need to display
|
||||
|
@ -706,6 +719,7 @@ static struct grub_disk_dev grub_raid_dev =
|
|||
.write = grub_raid_write,
|
||||
#ifdef GRUB_UTIL
|
||||
.memberlist = grub_raid_memberlist,
|
||||
.raidname = grub_raid_getname,
|
||||
#endif
|
||||
.next = 0
|
||||
};
|
||||
|
|
|
@ -266,11 +266,13 @@ grub_efiemu_prepare (void)
|
|||
if (prepared)
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
err = grub_efiemu_autocore ();
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
grub_dprintf ("efiemu", "Preparing %d-bit efiemu\n",
|
||||
8 * grub_efiemu_sizeof_uintn_t ());
|
||||
|
||||
err = grub_efiemu_autocore ();
|
||||
|
||||
/* Create NVRAM. */
|
||||
grub_efiemu_pnvram ();
|
||||
|
||||
|
|
|
@ -601,7 +601,6 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path)
|
|||
char fpath[grub_strlen (path)];
|
||||
char *name = fpath;
|
||||
char *next;
|
||||
unsigned int pos = 0;
|
||||
struct grub_jfs_diropen *diro;
|
||||
|
||||
grub_strncpy (fpath, path, grub_strlen (path) + 1);
|
||||
|
@ -664,8 +663,6 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path)
|
|||
if (!next)
|
||||
return 0;
|
||||
|
||||
pos = 0;
|
||||
|
||||
name = next;
|
||||
next = grub_strchr (name, '/');
|
||||
if (next)
|
||||
|
|
|
@ -436,7 +436,6 @@ grub_minix_dir (grub_device_t device, const char *path,
|
|||
const struct grub_dirhook_info *info))
|
||||
{
|
||||
struct grub_minix_data *data = 0;
|
||||
struct grub_minix_sblock *sblock;
|
||||
unsigned int pos = 0;
|
||||
|
||||
data = grub_minix_mount (device->disk);
|
||||
|
@ -447,8 +446,6 @@ grub_minix_dir (grub_device_t device, const char *path,
|
|||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
sblock = &data->sblock;
|
||||
|
||||
grub_minix_find_file (data, path);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
|
|
|
@ -149,7 +149,6 @@ grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block,
|
|||
struct grub_sfs_btree *tree;
|
||||
int i;
|
||||
int next;
|
||||
int prev;
|
||||
|
||||
treeblock = grub_malloc (data->blocksize);
|
||||
if (!block)
|
||||
|
@ -161,8 +160,6 @@ grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block,
|
|||
/* Handle this level in the btree. */
|
||||
do
|
||||
{
|
||||
prev = 0;
|
||||
|
||||
grub_disk_read (data->disk, next, 0, data->blocksize, treeblock);
|
||||
if (grub_errno)
|
||||
{
|
||||
|
|
|
@ -568,7 +568,6 @@ grub_ufs_dir (grub_device_t device, const char *path,
|
|||
const struct grub_dirhook_info *info))
|
||||
{
|
||||
struct grub_ufs_data *data;
|
||||
struct grub_ufs_sblock *sblock;
|
||||
unsigned int pos = 0;
|
||||
|
||||
data = grub_ufs_mount (device->disk);
|
||||
|
@ -579,8 +578,6 @@ grub_ufs_dir (grub_device_t device, const char *path,
|
|||
if (grub_errno)
|
||||
return grub_errno;
|
||||
|
||||
sblock = &data->sblock;
|
||||
|
||||
if (!path || path[0] != '/')
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
|
||||
|
|
|
@ -38,10 +38,10 @@ rm -f $tmpfile $outfile
|
|||
objcopy -R .modname -R .moddeps $infile $tmpfile
|
||||
|
||||
# Attach .modname and .moddeps sections
|
||||
t1=`mktemp`
|
||||
t1=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
printf "$modname\0" >$t1
|
||||
|
||||
t2=`mktemp`
|
||||
t2=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
for dep in $deps; do printf "$dep\0" >> $t2; done
|
||||
|
||||
if test -n "$deps"; then
|
||||
|
|
|
@ -287,8 +287,10 @@ grub_gettext_init_ext (const char *lang)
|
|||
/* Will try adding .gz as well. */
|
||||
if (fd_mo == NULL)
|
||||
{
|
||||
grub_free (mo_file);
|
||||
char *mo_file_old;
|
||||
mo_file_old = mo_file;
|
||||
mo_file = grub_xasprintf ("%s.gz", mo_file);
|
||||
grub_free (mo_file_old);
|
||||
if (!mo_file)
|
||||
return;
|
||||
fd_mo = grub_mofile_open (mo_file);
|
||||
|
|
|
@ -563,7 +563,6 @@ grub_gui_list_new (void)
|
|||
list_impl_t self;
|
||||
grub_font_t default_font;
|
||||
grub_gui_color_t default_fg_color;
|
||||
grub_gui_color_t default_bg_color;
|
||||
|
||||
self = grub_zalloc (sizeof (*self));
|
||||
if (! self)
|
||||
|
@ -576,7 +575,6 @@ grub_gui_list_new (void)
|
|||
|
||||
default_font = grub_font_get ("Unknown Regular 16");
|
||||
default_fg_color = grub_gui_color_rgb (0, 0, 0);
|
||||
default_bg_color = grub_gui_color_rgb (255, 255, 255);
|
||||
|
||||
self->icon_width = 32;
|
||||
self->icon_height = 32;
|
||||
|
|
|
@ -309,10 +309,8 @@ redraw_menu_visit (grub_gui_component_t component,
|
|||
view = userdata;
|
||||
if (component->ops->is_instance (component, "list"))
|
||||
{
|
||||
grub_gui_list_t list;
|
||||
grub_video_rect_t bounds;
|
||||
|
||||
list = (grub_gui_list_t) component;
|
||||
component->ops->get_bounds (component, &bounds);
|
||||
grub_gfxmenu_view_redraw (view, &bounds);
|
||||
}
|
||||
|
|
|
@ -79,21 +79,9 @@ static void
|
|||
draw (grub_gfxmenu_box_t self, int x, int y)
|
||||
{
|
||||
int height_n;
|
||||
int height_s;
|
||||
int height_e;
|
||||
int height_w;
|
||||
int width_n;
|
||||
int width_s;
|
||||
int width_e;
|
||||
int width_w;
|
||||
|
||||
height_n = get_height (self->scaled_pixmaps[BOX_PIXMAP_N]);
|
||||
height_s = get_height (self->scaled_pixmaps[BOX_PIXMAP_S]);
|
||||
height_e = get_height (self->scaled_pixmaps[BOX_PIXMAP_E]);
|
||||
height_w = get_height (self->scaled_pixmaps[BOX_PIXMAP_W]);
|
||||
width_n = get_width (self->scaled_pixmaps[BOX_PIXMAP_N]);
|
||||
width_s = get_width (self->scaled_pixmaps[BOX_PIXMAP_S]);
|
||||
width_e = get_width (self->scaled_pixmaps[BOX_PIXMAP_E]);
|
||||
width_w = get_width (self->scaled_pixmaps[BOX_PIXMAP_W]);
|
||||
|
||||
/* Draw sides. */
|
||||
|
|
|
@ -25,26 +25,13 @@
|
|||
#define NEXT_MEMORY_DESCRIPTOR(desc, size) \
|
||||
((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size)))
|
||||
|
||||
#define BYTES_TO_PAGES(bytes) ((bytes) >> 12)
|
||||
#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12)
|
||||
#define PAGES_TO_BYTES(pages) ((pages) << 12)
|
||||
|
||||
/* The size of a memory map obtained from the firmware. This must be
|
||||
a multiplier of 4KB. */
|
||||
#define MEMORY_MAP_SIZE 0x3000
|
||||
|
||||
/* Maintain the list of allocated pages. */
|
||||
struct allocated_page
|
||||
{
|
||||
grub_efi_physical_address_t addr;
|
||||
grub_efi_uint64_t num_pages;
|
||||
};
|
||||
|
||||
#define ALLOCATED_PAGES_SIZE 0x1000
|
||||
#define MAX_ALLOCATED_PAGES \
|
||||
(ALLOCATED_PAGES_SIZE / sizeof (struct allocated_page))
|
||||
|
||||
static struct allocated_page *allocated_pages = 0;
|
||||
|
||||
/* The minimum and maximum heap size for GRUB itself. */
|
||||
#define MIN_HEAP_SIZE 0x100000
|
||||
#define MAX_HEAP_SIZE (1600 * 0x100000)
|
||||
|
@ -102,22 +89,6 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (allocated_pages)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < MAX_ALLOCATED_PAGES; i++)
|
||||
if (allocated_pages[i].addr == 0)
|
||||
{
|
||||
allocated_pages[i].addr = address;
|
||||
allocated_pages[i].num_pages = pages;
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == MAX_ALLOCATED_PAGES)
|
||||
grub_fatal ("too many page allocations");
|
||||
}
|
||||
|
||||
return (void *) ((grub_addr_t) address);
|
||||
}
|
||||
|
||||
|
@ -128,20 +99,6 @@ grub_efi_free_pages (grub_efi_physical_address_t address,
|
|||
{
|
||||
grub_efi_boot_services_t *b;
|
||||
|
||||
if (allocated_pages
|
||||
&& ((grub_efi_physical_address_t) ((grub_addr_t) allocated_pages)
|
||||
!= address))
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < MAX_ALLOCATED_PAGES; i++)
|
||||
if (allocated_pages[i].addr == address)
|
||||
{
|
||||
allocated_pages[i].addr = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
b = grub_efi_system_table->boot_services;
|
||||
efi_call_2 (b->free_pages, address, pages);
|
||||
}
|
||||
|
@ -422,14 +379,6 @@ grub_efi_mm_init (void)
|
|||
grub_efi_uint64_t required_pages;
|
||||
int mm_status;
|
||||
|
||||
/* First of all, allocate pages to maintain allocations. */
|
||||
allocated_pages
|
||||
= grub_efi_allocate_pages (0, BYTES_TO_PAGES (ALLOCATED_PAGES_SIZE));
|
||||
if (! allocated_pages)
|
||||
grub_fatal ("cannot allocate memory");
|
||||
|
||||
grub_memset (allocated_pages, 0, ALLOCATED_PAGES_SIZE);
|
||||
|
||||
/* Prepare a memory region to store two memory maps. */
|
||||
memory_map = grub_efi_allocate_pages (0,
|
||||
2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE));
|
||||
|
@ -447,6 +396,9 @@ grub_efi_mm_init (void)
|
|||
((grub_efi_physical_address_t) ((grub_addr_t) memory_map),
|
||||
2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE));
|
||||
|
||||
/* Freeing/allocating operations may increase memory map size. */
|
||||
map_size += desc_size * 32;
|
||||
|
||||
memory_map = grub_efi_allocate_pages (0, 2 * BYTES_TO_PAGES (map_size));
|
||||
if (! memory_map)
|
||||
grub_fatal ("cannot allocate memory");
|
||||
|
@ -499,24 +451,3 @@ grub_efi_mm_init (void)
|
|||
grub_efi_free_pages ((grub_addr_t) memory_map,
|
||||
2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE));
|
||||
}
|
||||
|
||||
void
|
||||
grub_efi_mm_fini (void)
|
||||
{
|
||||
if (allocated_pages)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < MAX_ALLOCATED_PAGES; i++)
|
||||
{
|
||||
struct allocated_page *p;
|
||||
|
||||
p = allocated_pages + i;
|
||||
if (p->addr != 0)
|
||||
grub_efi_free_pages ((grub_addr_t) p->addr, p->num_pages);
|
||||
}
|
||||
|
||||
grub_efi_free_pages ((grub_addr_t) allocated_pages,
|
||||
BYTES_TO_PAGES (ALLOCATED_PAGES_SIZE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,9 +61,11 @@ void
|
|||
grub_emu_post_init (void)
|
||||
{
|
||||
grub_lvm_fini ();
|
||||
grub_mdraid_fini ();
|
||||
grub_mdraid09_fini ();
|
||||
grub_mdraid1x_fini ();
|
||||
grub_raid_fini ();
|
||||
grub_raid_init ();
|
||||
grub_mdraid_init ();
|
||||
grub_mdraid09_init ();
|
||||
grub_mdraid1x_init ();
|
||||
grub_lvm_init ();
|
||||
}
|
||||
|
|
|
@ -189,31 +189,40 @@ find_root_device_from_libzfs (const char *dir)
|
|||
{
|
||||
zpool_handle_t *zpool;
|
||||
libzfs_handle_t *libzfs;
|
||||
nvlist_t *nvlist;
|
||||
nvlist_t **nvlist_array;
|
||||
nvlist_t *config, *vdev_tree;
|
||||
nvlist_t **children, **path;
|
||||
unsigned int nvlist_count;
|
||||
unsigned int i;
|
||||
|
||||
libzfs = grub_get_libzfs_handle ();
|
||||
if (! libzfs)
|
||||
return NULL;
|
||||
|
||||
zpool = zpool_open (libzfs, poolname);
|
||||
nvlist = zpool_get_config (zpool, NULL);
|
||||
config = zpool_get_config (zpool, NULL);
|
||||
|
||||
if (nvlist_lookup_nvlist (nvlist, "vdev_tree", &nvlist) != 0)
|
||||
if (nvlist_lookup_nvlist (config, "vdev_tree", &vdev_tree) != 0)
|
||||
error (1, errno, "nvlist_lookup_nvlist (\"vdev_tree\")");
|
||||
|
||||
if (nvlist_lookup_nvlist_array (nvlist, "children", &nvlist_array, &nvlist_count) != 0)
|
||||
if (nvlist_lookup_nvlist_array (vdev_tree, "children", &children, &nvlist_count) != 0)
|
||||
error (1, errno, "nvlist_lookup_nvlist_array (\"children\")");
|
||||
assert (nvlist_count > 0);
|
||||
|
||||
do
|
||||
while (nvlist_lookup_nvlist_array (children[0], "children",
|
||||
&children, &nvlist_count) == 0)
|
||||
assert (nvlist_count > 0);
|
||||
|
||||
for (i = 0; i < nvlist_count; i++)
|
||||
{
|
||||
assert (nvlist_count > 0);
|
||||
} while (nvlist_lookup_nvlist_array (nvlist_array[0], "children",
|
||||
&nvlist_array, &nvlist_count) == 0);
|
||||
if (nvlist_lookup_string (children[i], "path", &device) != 0)
|
||||
error (1, errno, "nvlist_lookup_string (\"path\")");
|
||||
|
||||
if (nvlist_lookup_string (nvlist_array[0], "path", &device) != 0)
|
||||
error (1, errno, "nvlist_lookup_string (\"path\")");
|
||||
struct stat st;
|
||||
if (stat (device, &st) == 0)
|
||||
break;
|
||||
|
||||
device = NULL;
|
||||
}
|
||||
|
||||
zpool_close (zpool);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* hostdisk.c - emulate biosdisk */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2006,2007,2008,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
|
||||
|
@ -115,6 +115,9 @@ struct hd_geometry
|
|||
# include <util.h> /* getrawpartition */
|
||||
# endif /* HAVE_GETRAWPARTITION */
|
||||
# include <sys/fdio.h>
|
||||
# ifndef FLOPPY_MAJOR
|
||||
# define FLOPPY_MAJOR 2
|
||||
# endif /* ! FLOPPY_MAJOR */
|
||||
# ifndef RAW_FLOPPY_MAJOR
|
||||
# define RAW_FLOPPY_MAJOR 9
|
||||
# endif /* ! RAW_FLOPPY_MAJOR */
|
||||
|
@ -1624,7 +1627,16 @@ grub_util_biosdisk_is_floppy (grub_disk_t disk)
|
|||
return 1;
|
||||
#endif
|
||||
|
||||
#if defined(FLOPPY_MAJOR)
|
||||
if (major(st.st_rdev) == FLOPPY_MAJOR)
|
||||
#else
|
||||
/* Some kernels (e.g. kFreeBSD) don't have a static major number
|
||||
for floppies, but they still use a "fd[0-9]" pathname. */
|
||||
if (map[disk->id].device[5] == 'f'
|
||||
&& map[disk->id].device[6] == 'd'
|
||||
&& map[disk->id].device[7] >= '0'
|
||||
&& map[disk->id].device[7] <= '9')
|
||||
#endif
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/stat.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -416,6 +416,10 @@ grub_make_system_path_relative_to_its_root (const char *path)
|
|||
{
|
||||
free (buf);
|
||||
free (buf2);
|
||||
#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
|
||||
if (poolfs)
|
||||
return xasprintf ("/%s/@", poolfs);
|
||||
#endif
|
||||
return xstrdup ("");
|
||||
}
|
||||
else
|
||||
|
|
|
@ -77,69 +77,6 @@
|
|||
#define RepLenCoder (LenCoder + kNumLenProbs)
|
||||
#define Literal (RepLenCoder + kNumLenProbs)
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
DbgOut:
|
||||
pushf
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %edx
|
||||
pushl %ecx
|
||||
pushl %ebx
|
||||
pushl %eax
|
||||
|
||||
call _DebugPrint
|
||||
|
||||
popl %eax
|
||||
popl %ebx
|
||||
popl %ecx
|
||||
popl %edx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
popf
|
||||
|
||||
ret
|
||||
|
||||
|
||||
/*
|
||||
* int LzmaDecodeProperties(CLzmaProperties *propsRes,
|
||||
* const unsigned char *propsData,
|
||||
* int size);
|
||||
*/
|
||||
|
||||
_LzmaDecodePropertiesA:
|
||||
movb (%edx), %dl
|
||||
|
||||
xorl %ecx, %ecx
|
||||
1:
|
||||
cmpb $45, %dl
|
||||
jb 2f
|
||||
incl %ecx
|
||||
subb $45, %dl
|
||||
jmp 1b
|
||||
2:
|
||||
movl %ecx, 8(%eax) /* pb */
|
||||
xorl %ecx, %ecx
|
||||
1:
|
||||
cmpb $9, %dl
|
||||
jb 2f
|
||||
incl %ecx
|
||||
subb $9, %dl
|
||||
2:
|
||||
movl %ecx, 4(%eax) /* lp */
|
||||
movb %dl, %cl
|
||||
movl %ecx, (%eax) /* lc */
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
xorl %eax, %eax
|
||||
#endif
|
||||
ret
|
||||
|
||||
#define out_size 8(%ebp)
|
||||
|
||||
#define now_pos -4(%ebp)
|
||||
|
|
|
@ -100,6 +100,8 @@ VARIABLE(grub_install_dos_part)
|
|||
.long 0xFFFFFFFF
|
||||
VARIABLE(grub_install_bsd_part)
|
||||
.long 0xFFFFFFFF
|
||||
reed_solomon_redundancy:
|
||||
.long 0
|
||||
|
||||
#ifdef APPLE_CC
|
||||
bss_start:
|
||||
|
@ -107,7 +109,58 @@ bss_start:
|
|||
bss_end:
|
||||
.long 0
|
||||
#endif
|
||||
/*
|
||||
* This is the area for all of the special variables.
|
||||
*/
|
||||
|
||||
VARIABLE(grub_boot_drive)
|
||||
.byte 0
|
||||
|
||||
/* the real mode code continues... */
|
||||
LOCAL (codestart):
|
||||
cli /* we're not safe here! */
|
||||
|
||||
/* set up %ds, %ss, and %es */
|
||||
xorw %ax, %ax
|
||||
movw %ax, %ds
|
||||
movw %ax, %ss
|
||||
movw %ax, %es
|
||||
|
||||
/* set up the real mode/BIOS stack */
|
||||
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp
|
||||
movl %ebp, %esp
|
||||
|
||||
sti /* we're safe again */
|
||||
|
||||
/* save the boot drive */
|
||||
ADDR32 movb %dl, EXT_C(grub_boot_drive)
|
||||
|
||||
/* reset disk system (%ah = 0) */
|
||||
int $0x13
|
||||
|
||||
/* transition to protected mode */
|
||||
DATA32 call real_to_prot
|
||||
|
||||
/* The ".code32" directive takes GAS out of 16-bit mode. */
|
||||
.code32
|
||||
|
||||
incl %eax
|
||||
call grub_gate_a20
|
||||
|
||||
movl EXT_C(grub_compressed_size), %edx
|
||||
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART), %edx
|
||||
movl reed_solomon_redundancy, %ecx
|
||||
leal _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART, %eax
|
||||
testl %edx, %edx
|
||||
jz post_reed_solomon
|
||||
call EXT_C (grub_reed_solomon_recover)
|
||||
jmp post_reed_solomon
|
||||
|
||||
#include <rs_decoder.S>
|
||||
|
||||
.text
|
||||
|
||||
. = _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART
|
||||
/*
|
||||
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
|
||||
* This uses the a.out kludge to load raw binary to the area starting at 1MB,
|
||||
|
@ -171,38 +224,8 @@ multiboot_trampoline:
|
|||
movb $0xFF, %dh
|
||||
/* enter the usual booting */
|
||||
call prot_to_real
|
||||
.code16
|
||||
|
||||
/* the real mode code continues... */
|
||||
LOCAL (codestart):
|
||||
cli /* we're not safe here! */
|
||||
|
||||
/* set up %ds, %ss, and %es */
|
||||
xorw %ax, %ax
|
||||
movw %ax, %ds
|
||||
movw %ax, %ss
|
||||
movw %ax, %es
|
||||
|
||||
/* set up the real mode/BIOS stack */
|
||||
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp
|
||||
movl %ebp, %esp
|
||||
|
||||
sti /* we're safe again */
|
||||
|
||||
/* save the boot drive */
|
||||
ADDR32 movb %dl, EXT_C(grub_boot_drive)
|
||||
|
||||
/* reset disk system (%ah = 0) */
|
||||
int $0x13
|
||||
|
||||
/* transition to protected mode */
|
||||
DATA32 call real_to_prot
|
||||
|
||||
/* The ".code32" directive takes GAS out of 16-bit mode. */
|
||||
.code32
|
||||
|
||||
incl %eax
|
||||
call grub_gate_a20
|
||||
post_reed_solomon:
|
||||
|
||||
#ifdef ENABLE_LZMA
|
||||
movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi
|
||||
|
@ -271,15 +294,6 @@ LOCAL (codestart):
|
|||
*/
|
||||
call EXT_C(grub_main)
|
||||
|
||||
/*
|
||||
* This is the area for all of the special variables.
|
||||
*/
|
||||
|
||||
VARIABLE(grub_boot_drive)
|
||||
.byte 0
|
||||
|
||||
.p2align 2 /* force 4-byte alignment */
|
||||
|
||||
#include "../realmode.S"
|
||||
|
||||
/*
|
||||
|
@ -577,7 +591,7 @@ FUNCTION(grub_console_putchar)
|
|||
|
||||
|
||||
LOCAL(bypass_table):
|
||||
.word 0x0100 | '\e',0x0f00 | '\t', 0x0e00 | '\b', 0x1c00 | '\r'
|
||||
.word 0x011b, 0x0f00 | '\t', 0x0e00 | '\b', 0x1c00 | '\r'
|
||||
.word 0x1c00 | '\n'
|
||||
LOCAL(bypass_table_end):
|
||||
|
||||
|
@ -601,6 +615,7 @@ LOCAL(bypass_table_end):
|
|||
|
||||
FUNCTION(grub_console_getkey)
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
|
||||
call prot_to_real
|
||||
.code16
|
||||
|
@ -630,15 +645,16 @@ FUNCTION(grub_console_getkey)
|
|||
jz 1f
|
||||
|
||||
andl %edx, %eax
|
||||
cmp %eax, 0x20
|
||||
ja 2f
|
||||
cmpl $0x20, %eax
|
||||
jae 2f
|
||||
movl %edx, %eax
|
||||
leal LOCAL(bypass_table), %esi
|
||||
leal LOCAL(bypass_table), %edi
|
||||
movl $((LOCAL(bypass_table_end) - LOCAL(bypass_table)) / 2), %ecx
|
||||
repne cmpsw
|
||||
repne scasw
|
||||
jz 3f
|
||||
|
||||
addl $('a' - 1 | GRUB_TERM_CTRL), %eax
|
||||
andl $0xff, %eax
|
||||
addl $(('a' - 1) | GRUB_TERM_CTRL), %eax
|
||||
jmp 2f
|
||||
3:
|
||||
andl $0xff, %eax
|
||||
|
@ -647,7 +663,8 @@ FUNCTION(grub_console_getkey)
|
|||
1: movl %edx, %eax
|
||||
shrl $8, %eax
|
||||
orl $GRUB_TERM_EXTENDED, %eax
|
||||
2:
|
||||
2:
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
|
@ -803,6 +820,10 @@ FUNCTION(grub_console_setcursor)
|
|||
DATA32 call real_to_prot
|
||||
.code32
|
||||
|
||||
cmp %cl, %ch
|
||||
jb 3f
|
||||
movw $0x0d0e, %cx
|
||||
3:
|
||||
movw %cx, console_cursor_shape
|
||||
1:
|
||||
/* set %cx to the designated cursor shape */
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
|
||||
FUNCTION (grub_cpu_flush_cache)
|
||||
FUNCTION (grub_arch_sync_caches)
|
||||
#include "cache_flush.S"
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
subu $t1, $t3, $t2
|
||||
1:
|
||||
cache 1, 0($t0)
|
||||
addiu $t0, $t0, 0x1
|
||||
addiu $t1, $t1, 0xffff
|
||||
bne $t1, $zero, 1b
|
||||
addiu $t0, $t0, 0x1
|
||||
sync
|
||||
move $t0, $t2
|
||||
subu $t1, $t3, $t2
|
||||
2:
|
||||
cache 0, 0($t0)
|
||||
addiu $t0, $t0, 0x1
|
||||
addiu $t1, $t1, 0xffff
|
||||
bne $t1, $zero, 2b
|
||||
addiu $t0, $t0, 0x1
|
||||
sync
|
||||
|
|
|
@ -22,128 +22,23 @@
|
|||
#include <grub/machine/memory.h>
|
||||
#include <grub/offsets.h>
|
||||
|
||||
#define BASE_ADDR 8
|
||||
|
||||
.extern __bss_start
|
||||
.extern _end
|
||||
|
||||
#define BASE_ADDR 8
|
||||
|
||||
.globl __start, _start, start
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
__start:
|
||||
_start:
|
||||
start:
|
||||
bal codestart
|
||||
base:
|
||||
. = _start + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE
|
||||
compressed_size:
|
||||
.long 0
|
||||
. = _start + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
|
||||
start:
|
||||
.extern __bss_start
|
||||
.extern _end
|
||||
bal cont
|
||||
nop
|
||||
|
||||
. = _start + GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE
|
||||
total_module_size:
|
||||
.long 0
|
||||
. = _start + GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE
|
||||
kernel_image_size:
|
||||
.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_YEELOONG
|
||||
move $s2, $zero
|
||||
move $s3, $zero
|
||||
move $s4, $zero
|
||||
move $s5, $zero
|
||||
|
||||
/* $a2 has the environment. */
|
||||
addiu $t0, $a2, 1
|
||||
beq $t0, $zero, argdone
|
||||
move $t0, $a2
|
||||
argcont:
|
||||
lw $t1, 0($t0)
|
||||
beq $t1, $zero, argdone
|
||||
#define DO_PARSE(str, reg) \
|
||||
addiu $t2, $s0, (str-base);\
|
||||
bal parsestr;\
|
||||
beq $v0, $zero, 1f;\
|
||||
move reg, $v0;\
|
||||
b 2f;\
|
||||
1:
|
||||
DO_PARSE (busclockstr, $s2)
|
||||
DO_PARSE (cpuclockstr, $s3)
|
||||
DO_PARSE (memsizestr, $s4)
|
||||
DO_PARSE (highmemsizestr, $s5)
|
||||
2:
|
||||
addiu $t0, $t0, 4
|
||||
b argcont
|
||||
parsestr:
|
||||
move $v0, $zero
|
||||
move $t3, $t1
|
||||
3:
|
||||
lb $t4, 0($t2)
|
||||
lb $t5, 0($t3)
|
||||
addiu $t2, $t2, 1
|
||||
addiu $t3, $t3, 1
|
||||
beq $t5, $zero, 1f
|
||||
beq $t5, $t4, 3b
|
||||
bne $t4, $zero, 1f
|
||||
|
||||
addiu $t3, $t3, 0xffff
|
||||
digcont:
|
||||
lb $t5, 0($t3)
|
||||
/* Substract '0' from digit. */
|
||||
addiu $t5, $t5, 0xffd0
|
||||
bltz $t5, 1f
|
||||
addiu $t4, $t5, 0xfff7
|
||||
bgtz $t4, 1f
|
||||
/* Multiply $v0 by 10 with bitshifts. */
|
||||
sll $v0, $v0, 1
|
||||
sll $t4, $v0, 2
|
||||
addu $v0, $v0, $t4
|
||||
addu $v0, $v0, $t5
|
||||
addiu $t3, $t3, 1
|
||||
b digcont
|
||||
1:
|
||||
jr $ra
|
||||
busclockstr: .asciiz "busclock="
|
||||
cpuclockstr: .asciiz "cpuclock="
|
||||
memsizestr: .asciiz "memsize="
|
||||
highmemsizestr: .asciiz "highmemsize="
|
||||
.p2align 2
|
||||
argdone:
|
||||
#endif
|
||||
|
||||
/* Decompress the payload. */
|
||||
addiu $a0, $s0, GRUB_KERNEL_MACHINE_RAW_SIZE - BASE_ADDR
|
||||
lui $a1, %hi(compressed)
|
||||
addiu $a1, %lo(compressed)
|
||||
lw $a2, (GRUB_KERNEL_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
move $s1, $a1
|
||||
|
||||
/* $a0 contains source compressed address, $a1 is destination,
|
||||
$a2 is compressed size. FIXME: put LZMA here. Don't clober $s0,
|
||||
$s1, $s2, $s3, $s4 and $s5.
|
||||
On return $v0 contains uncompressed size.
|
||||
*/
|
||||
move $v0, $a2
|
||||
reloccont:
|
||||
lb $t4, 0($a0)
|
||||
sb $t4, 0($a1)
|
||||
addiu $a1,$a1,1
|
||||
addiu $a0,$a0,1
|
||||
addiu $a2, 0xffff
|
||||
bne $a2, $0, reloccont
|
||||
|
||||
move $a0, $s1
|
||||
move $a1, $v0
|
||||
|
||||
#include "cache_flush.S"
|
||||
|
||||
lui $t1, %hi(cont)
|
||||
addiu $t1, %lo(cont)
|
||||
|
||||
jr $t1
|
||||
. = _start + GRUB_KERNEL_MACHINE_RAW_SIZE
|
||||
compressed:
|
||||
. = _start + GRUB_KERNEL_MACHINE_PREFIX
|
||||
|
||||
VARIABLE(grub_prefix)
|
||||
|
@ -166,6 +61,8 @@ VARIABLE (grub_arch_highmemsize)
|
|||
.long 0
|
||||
#endif
|
||||
cont:
|
||||
/* Save our base. */
|
||||
move $s0, $ra
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
lui $t1, %hi(grub_arch_busclock)
|
||||
|
@ -177,15 +74,13 @@ cont:
|
|||
#endif
|
||||
|
||||
/* Move the modules out of BSS. */
|
||||
lui $t1, %hi(_start)
|
||||
addiu $t1, %lo(_start)
|
||||
lw $t2, (GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE - BASE_ADDR)($s0)
|
||||
addu $t2, $t1, $t2
|
||||
lui $t2, %hi(__bss_start)
|
||||
addiu $t2, %lo(__bss_start)
|
||||
|
||||
lui $t1, %hi(_end)
|
||||
addiu $t1, %lo(_end)
|
||||
addiu $t1, (GRUB_KERNEL_MACHINE_MOD_ALIGN-1)
|
||||
li $t3, (GRUB_KERNEL_MACHINE_MOD_ALIGN-1)
|
||||
addiu $t1, (GRUB_KERNEL_MACHINE_MOD_ALIGN - 1)
|
||||
li $t3, (GRUB_KERNEL_MACHINE_MOD_ALIGN - 1)
|
||||
nor $t3, $t3, $0
|
||||
and $t1, $t1, $t3
|
||||
|
||||
|
@ -194,33 +89,38 @@ cont:
|
|||
/* Backward copy. */
|
||||
add $t1, $t1, $t3
|
||||
add $t2, $t2, $t3
|
||||
addiu $t1, $t1, 0xffff
|
||||
addiu $t2, $t2, 0xffff
|
||||
addiu $t1, $t1, -1
|
||||
addiu $t2, $t2, -1
|
||||
|
||||
/* $t2 is source. $t1 is destination. $t3 is size. */
|
||||
modulesmovcont:
|
||||
beq $t3, $0, modulesmovdone
|
||||
nop
|
||||
lb $t4, 0($t2)
|
||||
sb $t4, 0($t1)
|
||||
addiu $t1,$t1,0xffff
|
||||
addiu $t2,$t2,0xffff
|
||||
addiu $t3, 0xffff
|
||||
bne $t3, $0, modulesmovcont
|
||||
addiu $t2, $t2, -1
|
||||
addiu $t1, $t1, -1
|
||||
b modulesmovcont
|
||||
addiu $t3, $t3, -1
|
||||
modulesmovdone:
|
||||
|
||||
/* Clean BSS. */
|
||||
|
||||
lui $t1, %hi(__bss_start)
|
||||
addiu $t1, %lo(__bss_start)
|
||||
addiu $t1, $t1, %lo(__bss_start)
|
||||
lui $t2, %hi(_end)
|
||||
addiu $t2, %lo(_end)
|
||||
addiu $t2, $t2, %lo(_end)
|
||||
bsscont:
|
||||
sb $0,0($t1)
|
||||
addiu $t1,$t1,1
|
||||
sltu $t3,$t1,$t2
|
||||
addiu $t1, $t1, 1
|
||||
sltu $t3, $t1, $t2
|
||||
bne $t3, $0, bsscont
|
||||
nop
|
||||
|
||||
li $sp, GRUB_MACHINE_MEMORY_STACK_HIGH
|
||||
lui $t1, %hi(grub_main)
|
||||
addiu $t1, %lo(grub_main)
|
||||
|
||||
lui $sp, %hi(GRUB_MACHINE_MEMORY_STACK_HIGH)
|
||||
jr $t1
|
||||
addiu $sp, $sp, %lo(GRUB_MACHINE_MEMORY_STACK_HIGH)
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
* See <http://www.7-zip.org>, for more information about LZMA.
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <grub/lib/LzFind.h>
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
* See <http://www.7-zip.org>, for more information about LZMA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
char *option = 0;
|
||||
|
||||
/* No option is used. */
|
||||
if ((num && GRUB_COMMAND_OPTIONS_AT_START)
|
||||
if ((num && (cmd->cmd->flags & GRUB_COMMAND_OPTIONS_AT_START))
|
||||
|| arg[0] != '-' || grub_strlen (arg) == 1)
|
||||
{
|
||||
if (add_arg (arg) != 0)
|
||||
|
|
|
@ -486,8 +486,12 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
|
|||
|
||||
if (legacy_commands[cmdnum].flags & FLAG_TERMINAL)
|
||||
{
|
||||
int dumb = 0, no_echo = 0, no_edit = 0, lines = 24;
|
||||
int console = 0, serial = 0, hercules = 0;
|
||||
int dumb = 0, lines = 24;
|
||||
#ifdef TODO
|
||||
int no_echo = 0, no_edit = 0;
|
||||
int hercules = 0;
|
||||
#endif
|
||||
int console = 0, serial = 0;
|
||||
/* Big enough for any possible resulting command. */
|
||||
char outbuf[256] = "";
|
||||
char *outptr;
|
||||
|
@ -497,13 +501,13 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
|
|||
" [console] [serial] [hercules]"*/
|
||||
if (grub_memcmp (ptr, "--dumb", sizeof ("--dumb") - 1) == 0)
|
||||
dumb = 1;
|
||||
|
||||
#ifdef TODO
|
||||
if (grub_memcmp (ptr, "--no-echo", sizeof ("--no-echo") - 1) == 0)
|
||||
no_echo = 1;
|
||||
|
||||
if (grub_memcmp (ptr, "--no-edit", sizeof ("--no-edit") - 1) == 0)
|
||||
no_edit = 1;
|
||||
|
||||
#endif
|
||||
if (grub_memcmp (ptr, "--lines=", sizeof ("--lines=") - 1) == 0)
|
||||
{
|
||||
lines = grub_strtoul (ptr + sizeof ("--lines=") - 1, 0, 0);
|
||||
|
@ -519,10 +523,10 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
|
|||
|
||||
if (grub_memcmp (ptr, "serial", sizeof ("serial") - 1) == 0)
|
||||
serial = 1;
|
||||
|
||||
#ifdef TODO
|
||||
if (grub_memcmp (ptr, "hercules", sizeof ("hercules") - 1) == 0)
|
||||
hercules = 1;
|
||||
|
||||
#endif
|
||||
while (*ptr && !grub_isspace (*ptr))
|
||||
ptr++;
|
||||
while (*ptr && grub_isspace (*ptr))
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
.p2align 4 /* force 16-byte alignment */
|
||||
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
|
||||
VARIABLE (grub_relocator_forward_start)
|
||||
move $a0, $9
|
||||
move $a1, $10
|
||||
|
@ -28,9 +31,9 @@ copycont1:
|
|||
lb $11,0($8)
|
||||
sb $11,0($9)
|
||||
addiu $8, $8, 1
|
||||
addiu $9, $9, 1
|
||||
addiu $10, $10, -1
|
||||
bne $10, $0, copycont1
|
||||
addiu $9, $9, 1
|
||||
|
||||
#include "../../kern/mips/cache_flush.S"
|
||||
|
||||
|
@ -49,9 +52,9 @@ copycont2:
|
|||
lb $11,0($8)
|
||||
sb $11,0($9)
|
||||
addiu $8, $8, -1
|
||||
addiu $9, $9, -1
|
||||
addiu $10, $10, -1
|
||||
bne $10, $0, copycont2
|
||||
addiu $9, $9, -1
|
||||
|
||||
#include "../../kern/mips/cache_flush.S"
|
||||
|
||||
|
|
518
grub-core/lib/reed_solomon.c
Normal file
518
grub-core/lib/reed_solomon.c
Normal file
|
@ -0,0 +1,518 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifdef TEST
|
||||
#include <stdio.h>
|
||||
#define xmalloc malloc
|
||||
#define grub_memset memset
|
||||
#define grub_memcpy memcpy
|
||||
#endif
|
||||
|
||||
#ifndef STANDALONE
|
||||
#ifdef TEST
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
typedef unsigned int grub_size_t;
|
||||
typedef unsigned char grub_uint8_t;
|
||||
typedef unsigned short grub_uint16_t;
|
||||
#else
|
||||
#include <grub/types.h>
|
||||
#include <grub/reed_solomon.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/misc.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef STANDALONE
|
||||
#ifdef TEST
|
||||
typedef unsigned int grub_size_t;
|
||||
typedef unsigned char grub_uint8_t;
|
||||
typedef unsigned short grub_uint16_t;
|
||||
#else
|
||||
#include <grub/types.h>
|
||||
#endif
|
||||
void
|
||||
grub_reed_solomon_recover (void *ptr_, grub_size_t s, grub_size_t rs);
|
||||
#endif
|
||||
|
||||
#define GF_SIZE 8
|
||||
typedef grub_uint8_t gf_single_t;
|
||||
typedef grub_uint16_t gf_double_t;
|
||||
#define GF_POLYNOMIAL 0x1d
|
||||
#define GF_INVERT2 0x8e
|
||||
#if defined (STANDALONE) && !defined (TEST)
|
||||
static char *gf_invert __attribute__ ((section(".text"))) = (void *) 0x100000;
|
||||
static char *scratch __attribute__ ((section(".text"))) = (void *) 0x100100;
|
||||
#else
|
||||
static char *scratch;
|
||||
static grub_uint8_t gf_invert[256];
|
||||
#endif
|
||||
|
||||
#define SECTOR_SIZE 512
|
||||
#define MAX_BLOCK_SIZE (200 * SECTOR_SIZE)
|
||||
|
||||
static gf_single_t
|
||||
gf_reduce (gf_double_t a)
|
||||
{
|
||||
int i;
|
||||
for (i = GF_SIZE - 1; i >= 0; i--)
|
||||
if (a & (1ULL << (i + GF_SIZE)))
|
||||
a ^= (((gf_double_t) GF_POLYNOMIAL) << i);
|
||||
return a & ((1ULL << GF_SIZE) - 1);
|
||||
}
|
||||
|
||||
static gf_single_t
|
||||
gf_mul (gf_single_t a, gf_single_t b)
|
||||
{
|
||||
gf_double_t res = 0;
|
||||
int i;
|
||||
for (i = 0; i < GF_SIZE; i++)
|
||||
if (b & (1 << i))
|
||||
res ^= ((gf_double_t) a) << i;
|
||||
return gf_reduce (res);
|
||||
}
|
||||
|
||||
static void
|
||||
init_inverts (void)
|
||||
{
|
||||
gf_single_t a = 1, ai = 1;
|
||||
do
|
||||
{
|
||||
a = gf_mul (a, 2);
|
||||
ai = gf_mul (ai, GF_INVERT2);
|
||||
gf_invert[a] = ai;
|
||||
}
|
||||
while (a != 1);
|
||||
}
|
||||
|
||||
static gf_single_t
|
||||
pol_evaluate (gf_single_t *pol, grub_size_t degree, gf_single_t x)
|
||||
{
|
||||
int i;
|
||||
gf_single_t xn = 1, s = 0;
|
||||
for (i = degree; i >= 0; i--)
|
||||
{
|
||||
s ^= gf_mul (pol[i], xn);
|
||||
xn = gf_mul (x, xn);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
#if !defined (STANDALONE)
|
||||
static void
|
||||
rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs)
|
||||
{
|
||||
gf_single_t *rs_polynomial, a = 1;
|
||||
int i, j;
|
||||
gf_single_t *m;
|
||||
m = xmalloc ((s + rs) * sizeof (gf_single_t));
|
||||
grub_memcpy (m, data, s * sizeof (gf_single_t));
|
||||
grub_memset (m + s, 0, rs * sizeof (gf_single_t));
|
||||
rs_polynomial = xmalloc ((rs + 1) * sizeof (gf_single_t));
|
||||
grub_memset (rs_polynomial, 0, (rs + 1) * sizeof (gf_single_t));
|
||||
rs_polynomial[rs] = 1;
|
||||
/* Multiply with X - a^r */
|
||||
for (j = 0; j < rs; j++)
|
||||
{
|
||||
if (a & (1 << (GF_SIZE - 1)))
|
||||
{
|
||||
a <<= 1;
|
||||
a ^= GF_POLYNOMIAL;
|
||||
}
|
||||
else
|
||||
a <<= 1;
|
||||
for (i = 0; i < rs; i++)
|
||||
rs_polynomial[i] = rs_polynomial[i + 1] ^ gf_mul (a, rs_polynomial[i]);
|
||||
rs_polynomial[rs] = gf_mul (a, rs_polynomial[rs]);
|
||||
}
|
||||
for (j = 0; j < s; j++)
|
||||
if (m[j])
|
||||
{
|
||||
gf_single_t f = m[j];
|
||||
for (i = 0; i <= rs; i++)
|
||||
m[i+j] ^= gf_mul (rs_polynomial[i], f);
|
||||
}
|
||||
free (rs_polynomial);
|
||||
grub_memcpy (data + s, m + s, rs * sizeof (gf_single_t));
|
||||
free (m);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
syndroms (gf_single_t *m, grub_size_t s, grub_size_t rs,
|
||||
gf_single_t *sy)
|
||||
{
|
||||
gf_single_t xn = 1;
|
||||
unsigned i;
|
||||
for (i = 0; i < rs; i++)
|
||||
{
|
||||
if (xn & (1 << (GF_SIZE - 1)))
|
||||
{
|
||||
xn <<= 1;
|
||||
xn ^= GF_POLYNOMIAL;
|
||||
}
|
||||
else
|
||||
xn <<= 1;
|
||||
sy[i] = pol_evaluate (m, s + rs - 1, xn);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gauss_eliminate (gf_single_t *eq, int n, int m, int *chosen)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0 ; i < n; i++)
|
||||
{
|
||||
int nzidx;
|
||||
int k;
|
||||
gf_single_t r;
|
||||
for (nzidx = 0; nzidx < m && (eq[i * (m + 1) + nzidx] == 0);
|
||||
nzidx++);
|
||||
if (nzidx == m)
|
||||
continue;
|
||||
chosen[i] = nzidx;
|
||||
r = gf_invert [eq[i * (m + 1) + nzidx]];
|
||||
for (j = 0; j < m + 1; j++)
|
||||
eq[i * (m + 1) + j] = gf_mul (eq[i * (m + 1) + j], r);
|
||||
for (j = i + 1; j < n; j++)
|
||||
{
|
||||
gf_single_t rr = eq[j * (m + 1) + nzidx];
|
||||
for (k = 0; k < m + 1; k++)
|
||||
eq[j * (m + 1) + k] ^= gf_mul (eq[i * (m + 1) + k], rr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gauss_solve (gf_single_t *eq, int n, int m, gf_single_t *sol)
|
||||
{
|
||||
int *chosen;
|
||||
int i, j;
|
||||
|
||||
#ifndef STANDALONE
|
||||
chosen = xmalloc (n * sizeof (int));
|
||||
grub_memset (chosen, -1, n * sizeof (int));
|
||||
#else
|
||||
chosen = (void *) scratch;
|
||||
scratch += n;
|
||||
#endif
|
||||
for (i = 0; i < m; i++)
|
||||
sol[i] = 0;
|
||||
gauss_eliminate (eq, n, m, chosen);
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
{
|
||||
gf_single_t s = 0;
|
||||
if (chosen[i] == -1)
|
||||
continue;
|
||||
for (j = 0; j < m; j++)
|
||||
s ^= gf_mul (eq[i * (m + 1) + j], sol[j]);
|
||||
s ^= eq[i * (m + 1) + m];
|
||||
sol[chosen[i]] = s;
|
||||
}
|
||||
#ifndef STANDALONE
|
||||
free (chosen);
|
||||
#else
|
||||
scratch -= n;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
rs_recover (gf_single_t *m, grub_size_t s, grub_size_t rs)
|
||||
{
|
||||
grub_size_t rs2 = rs / 2;
|
||||
gf_single_t *sigma;
|
||||
gf_single_t *errpot;
|
||||
int *errpos;
|
||||
gf_single_t *sy;
|
||||
int errnum = 0;
|
||||
int i, j;
|
||||
|
||||
#ifndef STANDALONE
|
||||
sigma = xmalloc (rs2 * sizeof (gf_single_t));
|
||||
errpot = xmalloc (rs2 * sizeof (gf_single_t));
|
||||
errpos = xmalloc (rs2 * sizeof (int));
|
||||
sy = xmalloc (rs * sizeof (gf_single_t));
|
||||
#else
|
||||
sigma = (void *) scratch;
|
||||
scratch += rs2 * sizeof (gf_single_t);
|
||||
errpot = (void *) scratch;
|
||||
scratch += rs2 * sizeof (gf_single_t);
|
||||
errpos = (void *) scratch;
|
||||
scratch += rs2 * sizeof (int);
|
||||
sy = (void *) scratch;
|
||||
scratch += rs * sizeof (gf_single_t);
|
||||
#endif
|
||||
|
||||
syndroms (m, s, rs, sy);
|
||||
|
||||
{
|
||||
gf_single_t *eq;
|
||||
|
||||
#ifndef STANDALONE
|
||||
eq = xmalloc (rs2 * (rs2 + 1) * sizeof (gf_single_t));
|
||||
#else
|
||||
eq = (void *) scratch;
|
||||
scratch += rs2 * (rs2 + 1) * sizeof (gf_single_t);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < (int) rs; i++)
|
||||
if (sy[i] != 0)
|
||||
break;
|
||||
|
||||
/* No error detected. */
|
||||
if (i == (int) rs)
|
||||
return;
|
||||
|
||||
for (i = 0; i < (int) rs2; i++)
|
||||
for (j = 0; j < (int) rs2 + 1; j++)
|
||||
eq[i * (rs2 + 1) + j] = sy[i+j];
|
||||
|
||||
for (i = 0; i < (int) rs2; i++)
|
||||
sigma[i] = 0;
|
||||
|
||||
gauss_solve (eq, rs2, rs2, sigma);
|
||||
|
||||
#ifndef STANDALONE
|
||||
free (eq);
|
||||
#else
|
||||
scratch -= rs2 * (rs2 + 1) * sizeof (gf_single_t);
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
gf_single_t xn = 1, yn = 1;
|
||||
for (i = 0; i < (int) (rs + s); i++)
|
||||
{
|
||||
gf_single_t ev = (gf_mul (pol_evaluate (sigma, rs2 - 1, xn), xn) ^ 1);
|
||||
if (ev == 0)
|
||||
{
|
||||
errpot[errnum] = yn;
|
||||
errpos[errnum++] = s + rs - i - 1;
|
||||
}
|
||||
yn = gf_mul (yn, 2);
|
||||
xn = gf_mul (xn, GF_INVERT2);
|
||||
}
|
||||
}
|
||||
{
|
||||
gf_single_t *errvals;
|
||||
gf_single_t *eq;
|
||||
|
||||
#ifndef STANDALONE
|
||||
eq = xmalloc (rs * (errnum + 1) * sizeof (gf_single_t));
|
||||
errvals = xmalloc (errnum * sizeof (int));
|
||||
#else
|
||||
eq = (void *) scratch;
|
||||
scratch += rs * (errnum + 1) * sizeof (gf_single_t);
|
||||
errvals = (void *) scratch;
|
||||
scratch += errnum * sizeof (int);
|
||||
#endif
|
||||
|
||||
for (j = 0; j < errnum; j++)
|
||||
eq[j] = errpot[j];
|
||||
eq[errnum] = sy[0];
|
||||
for (i = 1; i < (int) rs; i++)
|
||||
{
|
||||
for (j = 0; j < (int) errnum; j++)
|
||||
eq[(errnum + 1) * i + j] = gf_mul (errpot[j],
|
||||
eq[(errnum + 1) * (i - 1) + j]);
|
||||
eq[(errnum + 1) * i + errnum] = sy[i];
|
||||
}
|
||||
|
||||
gauss_solve (eq, rs, errnum, errvals);
|
||||
|
||||
for (i = 0; i < (int) errnum; i++)
|
||||
m[errpos[i]] ^= errvals[i];
|
||||
#ifndef STANDALONE
|
||||
free (eq);
|
||||
free (errvals);
|
||||
#else
|
||||
scratch -= rs * (errnum + 1) * sizeof (gf_single_t);
|
||||
scratch -= errnum * sizeof (int);
|
||||
#endif
|
||||
}
|
||||
#ifndef STANDALONE
|
||||
free (sigma);
|
||||
free (errpot);
|
||||
free (errpos);
|
||||
free (sy);
|
||||
#else
|
||||
scratch -= rs2 * sizeof (gf_single_t);
|
||||
scratch -= rs2 * sizeof (gf_single_t);
|
||||
scratch -= rs2 * sizeof (int);
|
||||
scratch -= rs * sizeof (gf_single_t);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
decode_block (gf_single_t *ptr, grub_size_t s,
|
||||
gf_single_t *rptr, grub_size_t rs)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < SECTOR_SIZE; i++)
|
||||
{
|
||||
grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
|
||||
grub_size_t rr = (rs + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
|
||||
gf_single_t m[ds + rr];
|
||||
|
||||
for (j = 0; j < (int) ds; j++)
|
||||
m[j] = ptr[SECTOR_SIZE * j + i];
|
||||
for (j = 0; j < (int) rr; j++)
|
||||
m[j + ds] = rptr[SECTOR_SIZE * j + i];
|
||||
|
||||
rs_recover (m, ds, rr);
|
||||
|
||||
for (j = 0; j < (int) ds; j++)
|
||||
ptr[SECTOR_SIZE * j + i] = m[j];
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined (STANDALONE)
|
||||
static void
|
||||
encode_block (gf_single_t *ptr, grub_size_t s,
|
||||
gf_single_t *rptr, grub_size_t rs)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < SECTOR_SIZE; i++)
|
||||
{
|
||||
grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
|
||||
grub_size_t rr = (rs + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
|
||||
gf_single_t m[ds + rr];
|
||||
for (j = 0; j < ds; j++)
|
||||
m[j] = ptr[SECTOR_SIZE * j + i];
|
||||
rs_encode (m, ds, rr);
|
||||
for (j = 0; j < rr; j++)
|
||||
rptr[SECTOR_SIZE * j + i] = m[j + ds];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined (STANDALONE)
|
||||
void
|
||||
grub_reed_solomon_add_redundancy (void *buffer, grub_size_t data_size,
|
||||
grub_size_t redundancy)
|
||||
{
|
||||
grub_size_t s = data_size;
|
||||
grub_size_t rs = redundancy;
|
||||
gf_single_t *ptr = buffer;
|
||||
gf_single_t *rptr = ptr + s;
|
||||
|
||||
while (s > 0)
|
||||
{
|
||||
grub_size_t tt;
|
||||
grub_size_t cs, crs;
|
||||
cs = s;
|
||||
crs = rs;
|
||||
tt = cs + crs;
|
||||
if (tt > MAX_BLOCK_SIZE)
|
||||
{
|
||||
cs = (cs * MAX_BLOCK_SIZE) / tt;
|
||||
crs = (crs * MAX_BLOCK_SIZE) / tt;
|
||||
}
|
||||
encode_block (ptr, cs, rptr, crs);
|
||||
ptr += cs;
|
||||
rptr += crs;
|
||||
s -= cs;
|
||||
rs -= crs;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
grub_reed_solomon_recover (void *ptr_, grub_size_t s, grub_size_t rs)
|
||||
{
|
||||
gf_single_t *ptr = ptr_;
|
||||
gf_single_t *rptr = ptr + s;
|
||||
|
||||
#if defined (STANDALONE)
|
||||
init_inverts ();
|
||||
#endif
|
||||
|
||||
while (s > 0)
|
||||
{
|
||||
grub_size_t tt;
|
||||
grub_size_t cs, crs;
|
||||
cs = s;
|
||||
crs = rs;
|
||||
tt = cs + crs;
|
||||
if (tt > MAX_BLOCK_SIZE)
|
||||
{
|
||||
cs = cs * MAX_BLOCK_SIZE / tt;
|
||||
crs = crs * MAX_BLOCK_SIZE / tt;
|
||||
}
|
||||
decode_block (ptr, cs, rptr, crs);
|
||||
ptr += cs;
|
||||
rptr += crs;
|
||||
s -= cs;
|
||||
rs -= crs;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
FILE *in, *out;
|
||||
grub_size_t s, rs;
|
||||
char *buf;
|
||||
|
||||
#ifdef STANDALONE
|
||||
scratch = xmalloc (1048576);
|
||||
#endif
|
||||
|
||||
#ifndef STANDALONE
|
||||
init_inverts ();
|
||||
#endif
|
||||
|
||||
in = fopen ("tst.bin", "rb");
|
||||
if (!in)
|
||||
return 1;
|
||||
fseek (in, 0, SEEK_END);
|
||||
s = ftell (in);
|
||||
fseek (in, 0, SEEK_SET);
|
||||
rs = 1024 * ((s + MAX_BLOCK_SIZE - 1) / (MAX_BLOCK_SIZE - 1024));
|
||||
buf = xmalloc (s + rs + SECTOR_SIZE);
|
||||
fread (buf, 1, s, in);
|
||||
|
||||
s = 0x5fbb;
|
||||
rs = 0x6af9;
|
||||
|
||||
#if 0
|
||||
grub_reed_solomon_add_redundancy (buf, s, rs);
|
||||
|
||||
out = fopen ("tst_rs.bin", "wb");
|
||||
fwrite (buf, 1, s + rs, out);
|
||||
fclose (out);
|
||||
|
||||
grub_memset (buf + 512 * 15, 0, 512);
|
||||
|
||||
out = fopen ("tst_dam.bin", "wb");
|
||||
fwrite (buf, 1, s + rs, out);
|
||||
fclose (out);
|
||||
#endif
|
||||
s = 0x5fbb;
|
||||
rs = 0x6af9;
|
||||
grub_reed_solomon_recover (buf, s, rs);
|
||||
|
||||
out = fopen ("tst_rec.bin", "wb");
|
||||
fwrite (buf, 1, s, out);
|
||||
fclose (out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
|
@ -40,7 +40,6 @@ struct grub_relocator_subchunk
|
|||
#endif
|
||||
} type;
|
||||
grub_mm_region_t reg;
|
||||
grub_mm_header_t head;
|
||||
grub_phys_addr_t start;
|
||||
grub_size_t size;
|
||||
grub_size_t pre_size;
|
||||
|
@ -355,11 +354,11 @@ free_subchunk (const struct grub_relocator_subchunk *subchu)
|
|||
}
|
||||
case CHUNK_TYPE_IN_REGION:
|
||||
{
|
||||
grub_mm_header_t h = (grub_mm_header_t) ALIGN_DOWN ((grub_addr_t) subchu->head,
|
||||
grub_mm_header_t h = (grub_mm_header_t) ALIGN_DOWN ((grub_addr_t) subchu->start,
|
||||
GRUB_MM_ALIGN);
|
||||
h->size
|
||||
= ((subchu->start + subchu->size + GRUB_MM_ALIGN - 1) / GRUB_MM_ALIGN)
|
||||
- (subchu->start / GRUB_MM_ALIGN);
|
||||
- (subchu->start / GRUB_MM_ALIGN) - 1;
|
||||
h->next = h;
|
||||
h->magic = GRUB_MM_ALLOC_MAGIC;
|
||||
grub_free (h + 1);
|
||||
|
@ -579,21 +578,17 @@ malloc_in_range (struct grub_relocator *rel,
|
|||
|
||||
for (ra = &base_saved, r = *ra; r; ra = &(r->next), r = *ra)
|
||||
{
|
||||
int pre_added = 0;
|
||||
pa = r->first;
|
||||
p = pa->next;
|
||||
if (p->magic == GRUB_MM_ALLOC_MAGIC)
|
||||
continue;
|
||||
do
|
||||
{
|
||||
grub_dprintf ("relocator", "free block %p+0x%lx\n",
|
||||
p, (unsigned long) p->size);
|
||||
if (p->magic != GRUB_MM_FREE_MAGIC)
|
||||
grub_fatal (__FILE__":%d free magic broken at %p (0x%x)\n",
|
||||
__LINE__, p, p->magic);
|
||||
if (p == (grub_mm_header_t) (r + 1))
|
||||
{
|
||||
pre_added = 1;
|
||||
events[N].type = REG_BEG_START;
|
||||
events[N].pos = grub_vtop (r) - r->pre_size;
|
||||
events[N].reg = r;
|
||||
|
@ -669,7 +664,6 @@ malloc_in_range (struct grub_relocator *rel,
|
|||
const int nlefto = 0;
|
||||
#endif
|
||||
grub_addr_t starta = 0;
|
||||
int numstarted;
|
||||
for (j = from_low_priv ? 0 : N - 1; from_low_priv ? j < N : (j + 1);
|
||||
from_low_priv ? j++ : j--)
|
||||
{
|
||||
|
@ -727,11 +721,8 @@ malloc_in_range (struct grub_relocator *rel,
|
|||
isinsideafter = (!ncollisions && (nstarted || ((nlefto || nstartedfw)
|
||||
&& !nblockfw)));
|
||||
if (!isinsidebefore && isinsideafter)
|
||||
{
|
||||
starta = from_low_priv ? ALIGN_UP (events[j].pos, align)
|
||||
: ALIGN_DOWN (events[j].pos - size, align) + size;
|
||||
numstarted = j;
|
||||
}
|
||||
starta = from_low_priv ? ALIGN_UP (events[j].pos, align)
|
||||
: ALIGN_DOWN (events[j].pos - size, align) + size;
|
||||
if (isinsidebefore && !isinsideafter && from_low_priv)
|
||||
{
|
||||
target = starta;
|
||||
|
@ -979,7 +970,6 @@ malloc_in_range (struct grub_relocator *rel,
|
|||
|| typepre == CHUNK_TYPE_IN_REGION)
|
||||
{
|
||||
curschu->reg = events[last_start].reg;
|
||||
curschu->head = events[last_start].head;
|
||||
curschu->pre_size = alloc_start - events[j - 1].pos;
|
||||
}
|
||||
if (!oom && (typepre == CHUNK_TYPE_REGION_START
|
||||
|
@ -1504,7 +1494,8 @@ grub_relocator_prepare_relocs (struct grub_relocator *rel, grub_addr_t addr,
|
|||
grub_relocator_align,
|
||||
rel->relocators_size, &movers_chunk, 1, 1))
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
|
||||
rels = rels0 = grub_map_memory (movers_chunk.src, movers_chunk.size);
|
||||
movers_chunk.srcv = rels = rels0
|
||||
= grub_map_memory (movers_chunk.src, movers_chunk.size);
|
||||
|
||||
if (relsize)
|
||||
*relsize = rel->relocators_size;
|
||||
|
|
|
@ -520,9 +520,18 @@ enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s,
|
|||
return s->ret;
|
||||
}
|
||||
|
||||
#ifdef GRUB_EMBED_DECOMPRESSOR
|
||||
struct xz_dec_bcj bcj;
|
||||
#endif
|
||||
|
||||
struct xz_dec_bcj * xz_dec_bcj_create(bool single_call)
|
||||
{
|
||||
struct xz_dec_bcj *s = kmalloc(sizeof(*s), GFP_KERNEL);
|
||||
struct xz_dec_bcj *s;
|
||||
#ifdef GRUB_EMBED_DECOMPRESSOR
|
||||
s = &bcj;
|
||||
#else
|
||||
s = kmalloc(sizeof(*s), GFP_KERNEL);
|
||||
#endif
|
||||
if (s != NULL)
|
||||
s->single_call = single_call;
|
||||
|
||||
|
|
|
@ -1100,10 +1100,16 @@ enum xz_ret xz_dec_lzma2_run(
|
|||
return XZ_OK;
|
||||
}
|
||||
|
||||
#ifdef GRUB_EMBED_DECOMPRESSOR
|
||||
#include <grub/decompressor.h>
|
||||
static struct xz_dec_lzma2 lzma2;
|
||||
#endif
|
||||
|
||||
struct xz_dec_lzma2 * xz_dec_lzma2_create(uint32_t dict_max)
|
||||
{
|
||||
struct xz_dec_lzma2 *s;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
/* Maximum supported dictionary by this implementation is 3 GiB. */
|
||||
if (dict_max > ((uint32_t)3 << 30))
|
||||
return NULL;
|
||||
|
@ -1120,6 +1126,11 @@ struct xz_dec_lzma2 * xz_dec_lzma2_create(uint32_t dict_max)
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
s = &lzma2;
|
||||
s->dict.buf = grub_decompressor_scratch;
|
||||
#endif
|
||||
|
||||
s->dict.allocated = dict_max;
|
||||
|
||||
return s;
|
||||
|
@ -1135,6 +1146,7 @@ enum xz_ret xz_dec_lzma2_reset(
|
|||
s->dict.size = 2 + (props & 1);
|
||||
s->dict.size <<= (props >> 1) + 11;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
if (s->dict.allocated > 0 && s->dict.allocated < s->dict.size)
|
||||
{
|
||||
/* enlarge dictionary buffer */
|
||||
|
@ -1146,7 +1158,7 @@ enum xz_ret xz_dec_lzma2_reset(
|
|||
s->dict.buf = newdict;
|
||||
s->dict.allocated = s->dict.size;
|
||||
}
|
||||
|
||||
#endif
|
||||
s->dict.end = s->dict.size;
|
||||
|
||||
s->lzma.len = 0;
|
||||
|
@ -1159,10 +1171,12 @@ enum xz_ret xz_dec_lzma2_reset(
|
|||
return XZ_OK;
|
||||
}
|
||||
|
||||
void xz_dec_lzma2_end(struct xz_dec_lzma2 *s)
|
||||
void xz_dec_lzma2_end(struct xz_dec_lzma2 *s __attribute__ ((unused)))
|
||||
{
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
if (s->dict.allocated > 0)
|
||||
vfree(s->dict.buf);
|
||||
|
||||
kfree(s);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
struct xz_dec_hash {
|
||||
vli_type unpadded;
|
||||
vli_type uncompressed;
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
uint8_t *crc32_context;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct xz_dec {
|
||||
|
@ -247,9 +249,11 @@ static enum xz_ret dec_block(struct xz_dec *s, struct xz_buf *b)
|
|||
> s->block_header.uncompressed)
|
||||
return XZ_DATA_ERROR;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
if (s->has_crc32)
|
||||
GRUB_MD_CRC32->write(s->crc32_context,b->out + s->out_start,
|
||||
b->out_pos - s->out_start);
|
||||
#endif
|
||||
|
||||
if (ret == XZ_STREAM_END) {
|
||||
if (s->block_header.compressed != VLI_UNKNOWN
|
||||
|
@ -269,8 +273,10 @@ static enum xz_ret dec_block(struct xz_dec *s, struct xz_buf *b)
|
|||
|
||||
s->block.hash.uncompressed += s->block.uncompressed;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
GRUB_MD_CRC32->write(s->block.hash.crc32_context,
|
||||
(const uint8_t *)&s->block.hash, 2 * sizeof(vli_type));
|
||||
#endif
|
||||
|
||||
++s->block.count;
|
||||
}
|
||||
|
@ -283,7 +289,9 @@ static void index_update(struct xz_dec *s, const struct xz_buf *b)
|
|||
{
|
||||
size_t in_used = b->in_pos - s->in_start;
|
||||
s->index.size += in_used;
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
GRUB_MD_CRC32->write(s->crc32_context,b->in + s->in_start, in_used);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -328,8 +336,10 @@ static enum xz_ret dec_index(struct xz_dec *s, struct xz_buf *b)
|
|||
case SEQ_INDEX_UNCOMPRESSED:
|
||||
s->index.hash.uncompressed += s->vli;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
GRUB_MD_CRC32->write(s->index.hash.crc32_context,
|
||||
(const uint8_t *)&s->index.hash, 2 * sizeof(vli_type));
|
||||
#endif
|
||||
|
||||
--s->index.count;
|
||||
s->index.sequence = SEQ_INDEX_UNPADDED;
|
||||
|
@ -346,24 +356,30 @@ static enum xz_ret dec_index(struct xz_dec *s, struct xz_buf *b)
|
|||
*/
|
||||
static enum xz_ret crc32_validate(struct xz_dec *s, struct xz_buf *b)
|
||||
{
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
if(s->crc32_temp == 0)
|
||||
{
|
||||
GRUB_MD_CRC32->final(s->crc32_context);
|
||||
s->crc32_temp = get_unaligned_be32(GRUB_MD_CRC32->read(s->crc32_context));
|
||||
}
|
||||
#endif
|
||||
|
||||
do {
|
||||
if (b->in_pos == b->in_size)
|
||||
return XZ_OK;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
if (((s->crc32_temp >> s->pos) & 0xFF) != b->in[b->in_pos++])
|
||||
return XZ_DATA_ERROR;
|
||||
#endif
|
||||
|
||||
s->pos += 8;
|
||||
|
||||
} while (s->pos < 32);
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
GRUB_MD_CRC32->init(s->crc32_context);
|
||||
#endif
|
||||
s->crc32_temp = 0;
|
||||
s->pos = 0;
|
||||
|
||||
|
@ -376,6 +392,7 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
|
|||
if (! memeq(s->temp.buf, HEADER_MAGIC, HEADER_MAGIC_SIZE))
|
||||
return XZ_FORMAT_ERROR;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
uint8_t crc32_context[GRUB_MD_CRC32->contextsize];
|
||||
|
||||
GRUB_MD_CRC32->init(crc32_context);
|
||||
|
@ -387,6 +404,7 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
|
|||
|
||||
if(resultcrc != readcrc)
|
||||
return XZ_DATA_ERROR;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Decode the Stream Flags field. Of integrity checks, we support
|
||||
|
@ -407,6 +425,7 @@ static enum xz_ret dec_stream_footer(struct xz_dec *s)
|
|||
if (! memeq(s->temp.buf + 10, FOOTER_MAGIC, FOOTER_MAGIC_SIZE))
|
||||
return XZ_DATA_ERROR;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
uint8_t crc32_context[GRUB_MD_CRC32->contextsize];
|
||||
|
||||
GRUB_MD_CRC32->init(crc32_context);
|
||||
|
@ -418,6 +437,7 @@ static enum xz_ret dec_stream_footer(struct xz_dec *s)
|
|||
|
||||
if(resultcrc != readcrc)
|
||||
return XZ_DATA_ERROR;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Validate Backward Size. Note that we never added the size of the
|
||||
|
@ -447,7 +467,7 @@ static enum xz_ret dec_block_header(struct xz_dec *s)
|
|||
* eight bytes so this is safe.
|
||||
*/
|
||||
s->temp.size -= 4;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
uint8_t crc32_context[GRUB_MD_CRC32->contextsize];
|
||||
|
||||
GRUB_MD_CRC32->init(crc32_context);
|
||||
|
@ -459,6 +479,7 @@ static enum xz_ret dec_block_header(struct xz_dec *s)
|
|||
|
||||
if (resultcrc != readcrc)
|
||||
return XZ_DATA_ERROR;
|
||||
#endif
|
||||
|
||||
s->temp.pos = 2;
|
||||
|
||||
|
@ -669,6 +690,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
|
|||
/* Finish the CRC32 value and Index size. */
|
||||
index_update(s, b);
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
/* Compare the hashes to validate the Index field. */
|
||||
GRUB_MD_CRC32->final(s->block.hash.crc32_context);
|
||||
GRUB_MD_CRC32->final(s->index.hash.crc32_context);
|
||||
|
@ -681,6 +703,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
|
|||
{
|
||||
return XZ_DATA_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
s->sequence = SEQ_INDEX_CRC32;
|
||||
|
||||
|
@ -764,12 +787,22 @@ enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef GRUB_EMBED_DECOMPRESSOR
|
||||
struct xz_dec decoder;
|
||||
#endif
|
||||
|
||||
struct xz_dec * xz_dec_init(uint32_t dict_max)
|
||||
{
|
||||
struct xz_dec *s = kmalloc(sizeof(*s), GFP_KERNEL);
|
||||
struct xz_dec *s;
|
||||
#ifdef GRUB_EMBED_DECOMPRESSOR
|
||||
s = &decoder;
|
||||
#else
|
||||
s = kmalloc(sizeof(*s), GFP_KERNEL);
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
/* prepare CRC32 calculators */
|
||||
if(GRUB_MD_CRC32 == NULL)
|
||||
{
|
||||
|
@ -803,10 +836,11 @@ struct xz_dec * xz_dec_init(uint32_t dict_max)
|
|||
|
||||
|
||||
GRUB_MD_CRC32->init(s->crc32_context);
|
||||
s->crc32_temp = 0;
|
||||
GRUB_MD_CRC32->init(s->index.hash.crc32_context);
|
||||
GRUB_MD_CRC32->init(s->block.hash.crc32_context);
|
||||
#endif
|
||||
|
||||
s->crc32_temp = 0;
|
||||
|
||||
s->single_call = dict_max == 0;
|
||||
|
||||
|
@ -828,7 +862,9 @@ error_lzma2:
|
|||
xz_dec_bcj_end(s->bcj);
|
||||
error_bcj:
|
||||
#endif
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
kfree(s);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -839,34 +875,45 @@ void xz_dec_reset(struct xz_dec *s)
|
|||
s->pos = 0;
|
||||
|
||||
{
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
uint8_t *t;
|
||||
t = s->block.hash.crc32_context;
|
||||
#endif
|
||||
memzero(&s->block, sizeof(s->block));
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
s->block.hash.crc32_context = t;
|
||||
t = s->index.hash.crc32_context;
|
||||
#endif
|
||||
memzero(&s->index, sizeof(s->index));
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
s->index.hash.crc32_context = t;
|
||||
#endif
|
||||
}
|
||||
s->temp.pos = 0;
|
||||
s->temp.size = STREAM_HEADER_SIZE;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
GRUB_MD_CRC32->init(s->crc32_context);
|
||||
s->crc32_temp = 0;
|
||||
GRUB_MD_CRC32->init(s->index.hash.crc32_context);
|
||||
GRUB_MD_CRC32->init(s->block.hash.crc32_context);
|
||||
|
||||
#endif
|
||||
s->crc32_temp = 0;
|
||||
}
|
||||
|
||||
void xz_dec_end(struct xz_dec *s)
|
||||
{
|
||||
if (s != NULL) {
|
||||
xz_dec_lzma2_end(s->lzma2);
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
kfree(s->index.hash.crc32_context);
|
||||
kfree(s->block.hash.crc32_context);
|
||||
kfree(s->crc32_context);
|
||||
#endif
|
||||
#ifdef XZ_DEC_BCJ
|
||||
xz_dec_bcj_end(s->bcj);
|
||||
#endif
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
kfree(s);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1559,6 +1559,9 @@ grub_cmd_netbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
|
|||
grub_memset (&serial, 0, sizeof (serial));
|
||||
grub_strcpy (serial.devname, "com");
|
||||
|
||||
serial.addr = grub_ns8250_hw_get_port (0);
|
||||
serial.speed = 9600;
|
||||
|
||||
if (ctxt->state[NETBSD_SERIAL_ARG].arg)
|
||||
{
|
||||
ptr = ctxt->state[NETBSD_SERIAL_ARG].arg;
|
||||
|
@ -1581,7 +1584,7 @@ grub_cmd_netbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
|
|||
return grub_errno;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
grub_bsd_add_meta (NETBSD_BTINFO_CONSOLE, &serial, sizeof (serial));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -396,10 +396,8 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
|
|||
Elf_Shdr *s, *symsh, *strsh;
|
||||
char *shdr;
|
||||
unsigned symsize, strsize;
|
||||
Elf_Sym *sym;
|
||||
void *sym_chunk;
|
||||
grub_uint8_t *curload;
|
||||
const char *str;
|
||||
grub_size_t chunk_size;
|
||||
Elf_Ehdr *e2;
|
||||
struct grub_netbsd_btinfo_symtab symtab;
|
||||
|
@ -473,7 +471,6 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
|
|||
|
||||
if (grub_file_seek (file, symsh->sh_offset) == (grub_off_t) -1)
|
||||
return grub_errno;
|
||||
sym = (Elf_Sym *) curload;
|
||||
if (grub_file_read (file, curload, symsize) != (grub_ssize_t) symsize)
|
||||
{
|
||||
if (! grub_errno)
|
||||
|
@ -484,7 +481,6 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
|
|||
|
||||
if (grub_file_seek (file, strsh->sh_offset) == (grub_off_t) -1)
|
||||
return grub_errno;
|
||||
str = (char *) curload;
|
||||
if (grub_file_read (file, curload, strsize) != (grub_ssize_t) strsize)
|
||||
{
|
||||
if (! grub_errno)
|
||||
|
|
|
@ -53,7 +53,7 @@ static void
|
|||
fill_bsd64_pagetable (grub_uint8_t *src, grub_addr_t target)
|
||||
{
|
||||
grub_uint64_t *pt2, *pt3, *pt4;
|
||||
grub_addr_t pt2t, pt3t, pt4t;
|
||||
grub_addr_t pt2t, pt3t;
|
||||
int i;
|
||||
|
||||
#define PG_V 0x001
|
||||
|
@ -65,7 +65,6 @@ fill_bsd64_pagetable (grub_uint8_t *src, grub_addr_t target)
|
|||
pt3 = (grub_uint64_t *) (src + 4096);
|
||||
pt2 = (grub_uint64_t *) (src + 8192);
|
||||
|
||||
pt4t = target;
|
||||
pt3t = target + 4096;
|
||||
pt2t = target + 8192;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#ifdef GRUB_MACHINE_EFI
|
||||
#include <grub/efi/efi.h>
|
||||
#define HAS_VGA_TEXT 0
|
||||
#define DEFAULT_VIDEO_MODE "800x600"
|
||||
#define DEFAULT_VIDEO_MODE "auto"
|
||||
#elif defined (GRUB_MACHINE_IEEE1275)
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#define HAS_VGA_TEXT 0
|
||||
|
|
|
@ -188,6 +188,10 @@ grub_multiboot_load (grub_file_t file)
|
|||
return err;
|
||||
}
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE || GRUB_MACHINE_HAS_VGA_TEXT
|
||||
#include <grub/i386/pc/vbe.h>
|
||||
#endif
|
||||
|
||||
static grub_size_t
|
||||
grub_multiboot_get_mbi_size (void)
|
||||
{
|
||||
|
@ -200,7 +204,7 @@ grub_multiboot_get_mbi_size (void)
|
|||
+ grub_get_multiboot_mmap_count () * sizeof (struct multiboot_mmap_entry)
|
||||
+ elf_sec_entsize * elf_sec_num
|
||||
+ 256 * sizeof (struct multiboot_color)
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
#if GRUB_MACHINE_HAS_VBE || GRUB_MACHINE_HAS_VGA_TEXT
|
||||
+ sizeof (struct grub_vbe_info_block)
|
||||
+ sizeof (struct grub_vbe_mode_info_block)
|
||||
#endif
|
||||
|
@ -260,15 +264,17 @@ grub_fill_multiboot_mmap (struct multiboot_mmap_entry *first_entry)
|
|||
grub_mmap_iterate (hook);
|
||||
}
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
#if GRUB_MACHINE_HAS_VBE || GRUB_MACHINE_HAS_VGA_TEXT
|
||||
|
||||
static grub_err_t
|
||||
fill_vbe_info (struct multiboot_info *mbi, grub_uint8_t *ptrorig,
|
||||
grub_uint32_t ptrdest, int fill_generic)
|
||||
{
|
||||
grub_vbe_status_t status;
|
||||
grub_uint32_t vbe_mode;
|
||||
void *scratch = (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
||||
struct grub_vbe_mode_info_block *mode_info;
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
grub_vbe_status_t status;
|
||||
void *scratch = (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
||||
|
||||
status = grub_vbe_bios_get_controller_info (scratch);
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
|
@ -278,11 +284,18 @@ fill_vbe_info (struct multiboot_info *mbi, grub_uint8_t *ptrorig,
|
|||
grub_memcpy (ptrorig, scratch, sizeof (struct grub_vbe_info_block));
|
||||
ptrorig += sizeof (struct grub_vbe_info_block);
|
||||
ptrdest += sizeof (struct grub_vbe_info_block);
|
||||
|
||||
#else
|
||||
mbi->vbe_control_info = 0;
|
||||
#endif
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
status = grub_vbe_bios_get_mode (scratch);
|
||||
vbe_mode = *(grub_uint32_t *) scratch;
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return grub_error (GRUB_ERR_IO, "can't get VBE mode");
|
||||
#else
|
||||
vbe_mode = 3;
|
||||
#endif
|
||||
mbi->vbe_mode = vbe_mode;
|
||||
|
||||
mode_info = (struct grub_vbe_mode_info_block *) ptrorig;
|
||||
|
@ -297,18 +310,22 @@ fill_vbe_info (struct multiboot_info *mbi, grub_uint8_t *ptrorig,
|
|||
}
|
||||
else
|
||||
{
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
status = grub_vbe_bios_get_mode_info (vbe_mode, scratch);
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return grub_error (GRUB_ERR_IO, "can't get mode info");
|
||||
grub_memcpy (mode_info, scratch,
|
||||
sizeof (struct grub_vbe_mode_info_block));
|
||||
#endif
|
||||
}
|
||||
ptrorig += sizeof (struct grub_vbe_mode_info_block);
|
||||
ptrdest += sizeof (struct grub_vbe_mode_info_block);
|
||||
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
grub_vbe_bios_get_pm_interface (&mbi->vbe_interface_seg,
|
||||
&mbi->vbe_interface_off,
|
||||
&mbi->vbe_interface_len);
|
||||
#endif
|
||||
|
||||
mbi->flags |= MULTIBOOT_INFO_VBE_INFO;
|
||||
|
||||
|
|
|
@ -705,7 +705,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined (GRUB_MACHINE_EFI) && __x86_64__
|
||||
#if defined (GRUB_MACHINE_EFI) && defined (__x86_64__)
|
||||
{
|
||||
struct multiboot_tag_efi64 *tag = (struct multiboot_tag_efi64 *) ptrorig;
|
||||
tag->type = MULTIBOOT_TAG_TYPE_EFI64;
|
||||
|
@ -715,9 +715,9 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined (GRUB_MACHINE_EFI) && __i386_
|
||||
#if defined (GRUB_MACHINE_EFI) && defined (__i386__)
|
||||
{
|
||||
struct multiboot_tag_efi64 *tag = (struct multiboot_tag_efi32 *) ptrorig;
|
||||
struct multiboot_tag_efi32 *tag = (struct multiboot_tag_efi32 *) ptrorig;
|
||||
tag->type = MULTIBOOT_TAG_TYPE_EFI32;
|
||||
tag->size = sizeof (*tag);
|
||||
tag->pointer = (grub_addr_t) grub_efi_system_table;
|
||||
|
|
|
@ -201,7 +201,6 @@ grub_auth_check_authentication (const char *userlist)
|
|||
{
|
||||
char login[1024];
|
||||
struct grub_auth_user *cur = NULL;
|
||||
grub_err_t err;
|
||||
static unsigned long punishment_delay = 1;
|
||||
char entered[GRUB_AUTH_MAX_PASSLEN];
|
||||
struct grub_auth_user *user;
|
||||
|
@ -233,7 +232,7 @@ grub_auth_check_authentication (const char *userlist)
|
|||
if (!cur || ! cur->callback)
|
||||
goto access_denied;
|
||||
|
||||
err = cur->callback (login, entered, cur->arg);
|
||||
cur->callback (login, entered, cur->arg);
|
||||
if (is_authenticated (userlist))
|
||||
{
|
||||
punishment_delay = 1;
|
||||
|
|
|
@ -376,8 +376,8 @@ read_terminal_list (const char *prefix)
|
|||
if (! cur->modname)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
grub_free (cur);
|
||||
grub_free (cur->name);
|
||||
grub_free (cur);
|
||||
continue;
|
||||
}
|
||||
cur->next = *target;
|
||||
|
|
|
@ -124,9 +124,9 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
|
||||
#ifdef GRUB_UTIL
|
||||
static grub_err_t
|
||||
gpt_partition_map_embed (struct grub_disk *disk, unsigned int nsectors,
|
||||
gpt_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t *sectors)
|
||||
grub_disk_addr_t **sectors)
|
||||
{
|
||||
grub_disk_addr_t start = 0, len = 0;
|
||||
unsigned i;
|
||||
|
@ -168,13 +168,17 @@ gpt_partition_map_embed (struct grub_disk *disk, unsigned int nsectors,
|
|||
"This GPT partition label has no BIOS Boot Partition;"
|
||||
" embedding won't be possible!");
|
||||
|
||||
if (len < nsectors)
|
||||
if (len < *nsectors)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"Your BIOS Boot Partition is too small;"
|
||||
" embedding won't be possible!");
|
||||
|
||||
for (i = 0; i < nsectors; i++)
|
||||
sectors[i] = start + i;
|
||||
*nsectors = len;
|
||||
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
|
||||
if (!*sectors)
|
||||
return grub_errno;
|
||||
for (i = 0; i < *nsectors; i++)
|
||||
(*sectors)[i] = start + i;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -145,9 +145,9 @@ grub_partition_msdos_iterate (grub_disk_t disk,
|
|||
|
||||
#ifdef GRUB_UTIL
|
||||
static grub_err_t
|
||||
pc_partition_map_embed (struct grub_disk *disk, unsigned int nsectors,
|
||||
pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t *sectors)
|
||||
grub_disk_addr_t **sectors)
|
||||
{
|
||||
grub_disk_addr_t end = ~0ULL;
|
||||
struct grub_msdos_partition_mbr mbr;
|
||||
|
@ -232,11 +232,15 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int nsectors,
|
|||
break;
|
||||
}
|
||||
|
||||
if (end >= nsectors + 1)
|
||||
if (end >= *nsectors + 1)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nsectors; i++)
|
||||
sectors[i] = 1 + i;
|
||||
*nsectors = end - 1;
|
||||
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
|
||||
if (!*sectors)
|
||||
return grub_errno;
|
||||
for (i = 0; i < *nsectors; i++)
|
||||
(*sectors)[i] = 1 + i;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
@ -245,7 +249,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int nsectors,
|
|||
"This msdos-style partition label has no "
|
||||
"post-MBR gap; embedding won't be possible!");
|
||||
|
||||
if (nsectors > 62)
|
||||
if (*nsectors > 62)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"Your core.img is unusually large. "
|
||||
"It won't fit in the embedding area.");
|
||||
|
|
|
@ -513,6 +513,7 @@ grub_script_execute_sourcecode (const char *source, int argc, char **args)
|
|||
|
||||
new_scope.argv.argc = argc;
|
||||
new_scope.argv.args = args;
|
||||
new_scope.flags = 0;
|
||||
|
||||
old_scope = scope;
|
||||
scope = &new_scope;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <grub/parser.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
|
|
|
@ -71,6 +71,8 @@ static void copy_string (struct grub_parser_param *, const char *,
|
|||
|
||||
%top{
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef size_t yy_size_t;
|
||||
|
|
|
@ -24,10 +24,6 @@
|
|||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/console.h>
|
||||
|
||||
static const grub_uint8_t
|
||||
grub_console_standard_color = GRUB_EFI_TEXT_ATTR (GRUB_EFI_YELLOW,
|
||||
GRUB_EFI_BACKGROUND_BLACK);
|
||||
|
||||
static grub_uint32_t
|
||||
map_char (grub_uint32_t c)
|
||||
{
|
||||
|
@ -208,13 +204,14 @@ grub_console_setcolorstate (struct grub_term_output *term,
|
|||
|
||||
switch (state) {
|
||||
case GRUB_TERM_COLOR_STANDARD:
|
||||
efi_call_2 (o->set_attributes, o, grub_console_standard_color);
|
||||
efi_call_2 (o->set_attributes, o, GRUB_TERM_DEFAULT_STANDARD_COLOR
|
||||
& 0x7f);
|
||||
break;
|
||||
case GRUB_TERM_COLOR_NORMAL:
|
||||
efi_call_2 (o->set_attributes, o, term->normal_color);
|
||||
efi_call_2 (o->set_attributes, o, term->normal_color & 0x7f);
|
||||
break;
|
||||
case GRUB_TERM_COLOR_HIGHLIGHT:
|
||||
efi_call_2 (o->set_attributes, o, term->highlight_color);
|
||||
efi_call_2 (o->set_attributes, o, term->highlight_color & 0x7f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -266,10 +263,8 @@ static struct grub_term_output grub_console_term_output =
|
|||
.cls = grub_console_cls,
|
||||
.setcolorstate = grub_console_setcolorstate,
|
||||
.setcursor = grub_console_setcursor,
|
||||
.normal_color = GRUB_EFI_TEXT_ATTR (GRUB_EFI_LIGHTGRAY,
|
||||
GRUB_EFI_BACKGROUND_BLACK),
|
||||
.highlight_color = GRUB_EFI_TEXT_ATTR (GRUB_EFI_BLACK,
|
||||
GRUB_EFI_BACKGROUND_LIGHTGRAY),
|
||||
.normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
|
||||
.highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
|
||||
.flags = GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS
|
||||
};
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ grub_ofconsole_dimensions (void)
|
|||
|
||||
if (! grub_ieee1275_get_property (options, "screen-#columns",
|
||||
val, lval, 0))
|
||||
grub_ofconsole_terminfo_output->width
|
||||
grub_ofconsole_terminfo_output.width
|
||||
= (grub_uint8_t) grub_strtoul (val, 0, 10);
|
||||
}
|
||||
if (! grub_ieee1275_get_property_length (options, "screen-#rows", &lval)
|
||||
|
@ -99,16 +99,16 @@ grub_ofconsole_dimensions (void)
|
|||
char val[lval];
|
||||
if (! grub_ieee1275_get_property (options, "screen-#rows",
|
||||
val, lval, 0))
|
||||
grub_ofconsole_terminfo_output->height
|
||||
grub_ofconsole_terminfo_output.height
|
||||
= (grub_uint8_t) grub_strtoul (val, 0, 10);
|
||||
}
|
||||
}
|
||||
|
||||
/* Use a small console by default. */
|
||||
if (! grub_ofconsole_terminfo_output->width)
|
||||
grub_ofconsole_terminfo_output->width = 80;
|
||||
if (! grub_ofconsole_terminfo_output->height)
|
||||
grub_ofconsole_terminfo_output->height = 24;
|
||||
if (! grub_ofconsole_terminfo_output.width)
|
||||
grub_ofconsole_terminfo_output.width = 80;
|
||||
if (! grub_ofconsole_terminfo_output.height)
|
||||
grub_ofconsole_terminfo_output.height = 24;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/time.h>
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#include <grub/machine/memory.h>
|
||||
|
@ -90,6 +91,8 @@ do_real_config (struct grub_serial_port *port)
|
|||
if (port->configured)
|
||||
return;
|
||||
|
||||
port->broken = 0;
|
||||
|
||||
divisor = serial_get_divisor (port->config.speed);
|
||||
|
||||
/* Turn off the interrupt. */
|
||||
|
@ -145,18 +148,30 @@ serial_hw_fetch (struct grub_serial_port *port)
|
|||
static void
|
||||
serial_hw_put (struct grub_serial_port *port, const int c)
|
||||
{
|
||||
unsigned int timeout = 100000;
|
||||
grub_uint64_t endtime;
|
||||
|
||||
do_real_config (port);
|
||||
|
||||
if (port->broken > 5)
|
||||
endtime = grub_get_time_ms ();
|
||||
else if (port->broken > 1)
|
||||
endtime = grub_get_time_ms () + 50;
|
||||
else
|
||||
endtime = grub_get_time_ms () + 200;
|
||||
/* Wait until the transmitter holding register is empty. */
|
||||
while ((grub_inb (port->port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0)
|
||||
{
|
||||
if (--timeout == 0)
|
||||
/* There is something wrong. But what can I do? */
|
||||
return;
|
||||
if (grub_get_time_ms () > endtime)
|
||||
{
|
||||
port->broken++;
|
||||
/* There is something wrong. But what can I do? */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (port->broken)
|
||||
port->broken--;
|
||||
|
||||
grub_outb (c, port->port + UART_TX);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
#ifndef GRUB_ACPI_HEADER
|
||||
#define GRUB_ACPI_HEADER 1
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#endif
|
||||
|
||||
struct grub_acpi_rsdp_v10
|
||||
{
|
||||
|
@ -139,6 +141,7 @@ enum
|
|||
GRUB_ACPI_MADT_ENTRY_SAPIC_FLAGS_ENABLED = 1
|
||||
};
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
struct grub_acpi_rsdp_v10 *grub_acpi_get_rsdpv1 (void);
|
||||
struct grub_acpi_rsdp_v20 *grub_acpi_get_rsdpv2 (void);
|
||||
struct grub_acpi_rsdp_v10 *grub_machine_acpi_get_rsdpv1 (void);
|
||||
|
@ -148,6 +151,7 @@ grub_uint8_t grub_byte_checksum (void *base, grub_size_t size);
|
|||
grub_err_t grub_acpi_create_ebda (void);
|
||||
|
||||
void grub_acpi_halt (void);
|
||||
#endif
|
||||
|
||||
#define GRUB_ACPI_SLP_EN (1 << 13)
|
||||
#define GRUB_ACPI_SLP_TYP_OFFSET 10
|
||||
|
@ -165,7 +169,8 @@ enum
|
|||
{
|
||||
GRUB_ACPI_EXTOPCODE_MUTEX = 0x01,
|
||||
GRUB_ACPI_EXTOPCODE_OPERATION_REGION = 0x80,
|
||||
GRUB_ACPI_EXTOPCODE_FIELD_OP = 0x81
|
||||
GRUB_ACPI_EXTOPCODE_FIELD_OP = 0x81,
|
||||
GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP = 0x86,
|
||||
};
|
||||
|
||||
#endif /* ! GRUB_ACPI_HEADER */
|
||||
|
|
34
include/grub/decompressor.h
Normal file
34
include/grub/decompressor.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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_DECOMPRESSOR_HEADER
|
||||
#define GRUB_DECOMPRESSOR_HEADER 1
|
||||
|
||||
void
|
||||
grub_decompress_core (void *src, void *dst, unsigned long srcsize,
|
||||
unsigned long dstsize);
|
||||
|
||||
void
|
||||
find_scratch (void *src, void *dst, unsigned long srcsize,
|
||||
unsigned long dstsize);
|
||||
|
||||
#define GRUB_DECOMPRESSOR_DICT_SIZE (1 << 16)
|
||||
|
||||
extern void *grub_decompressor_scratch;
|
||||
|
||||
#endif
|
|
@ -79,6 +79,7 @@ struct grub_disk_dev
|
|||
|
||||
#ifdef GRUB_UTIL
|
||||
struct grub_disk_memberlist *(*memberlist) (struct grub_disk *disk);
|
||||
const char * (*raidname) (struct grub_disk *disk);
|
||||
#endif
|
||||
|
||||
/* The next disk device. */
|
||||
|
|
|
@ -55,25 +55,25 @@ struct grub_extcmd_context
|
|||
};
|
||||
typedef struct grub_extcmd_context *grub_extcmd_context_t;
|
||||
|
||||
grub_extcmd_t grub_register_extcmd (const char *name,
|
||||
grub_extcmd_func_t func,
|
||||
grub_command_flags_t flags,
|
||||
const char *summary,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser);
|
||||
grub_extcmd_t EXPORT_FUNC(grub_register_extcmd) (const char *name,
|
||||
grub_extcmd_func_t func,
|
||||
grub_command_flags_t flags,
|
||||
const char *summary,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser);
|
||||
|
||||
grub_extcmd_t grub_register_extcmd_prio (const char *name,
|
||||
grub_extcmd_func_t func,
|
||||
grub_command_flags_t flags,
|
||||
const char *summary,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser,
|
||||
int prio);
|
||||
grub_extcmd_t EXPORT_FUNC(grub_register_extcmd_prio) (const char *name,
|
||||
grub_extcmd_func_t func,
|
||||
grub_command_flags_t flags,
|
||||
const char *summary,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser,
|
||||
int prio);
|
||||
|
||||
void grub_unregister_extcmd (grub_extcmd_t cmd);
|
||||
void EXPORT_FUNC(grub_unregister_extcmd) (grub_extcmd_t cmd);
|
||||
|
||||
grub_err_t
|
||||
grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args,
|
||||
struct grub_script *script);
|
||||
grub_err_t EXPORT_FUNC(grub_extcmd_dispatcher) (struct grub_command *cmd,
|
||||
int argc, char **args,
|
||||
struct grub_script *script);
|
||||
|
||||
#endif /* ! GRUB_EXTCMD_HEADER */
|
||||
|
|
|
@ -72,7 +72,7 @@ struct grub_extcmd;
|
|||
int grub_arg_parse (struct grub_extcmd *cmd, int argc, char **argv,
|
||||
struct grub_arg_list *usr, char ***args, int *argnum);
|
||||
|
||||
void grub_arg_show_help (struct grub_extcmd *cmd);
|
||||
void EXPORT_FUNC(grub_arg_show_help) (struct grub_extcmd *cmd);
|
||||
struct grub_arg_list* grub_arg_list_alloc (struct grub_extcmd *cmd,
|
||||
int argc, char *argv[]);
|
||||
|
||||
|
|
|
@ -53,15 +53,19 @@ grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize,
|
|||
grub_uint32_t grub_get_multiboot_mmap_count (void);
|
||||
grub_err_t grub_multiboot_set_video_mode (void);
|
||||
|
||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||
#include <grub/i386/pc/vbe.h>
|
||||
#define GRUB_MACHINE_HAS_VGA_TEXT 1
|
||||
/* FIXME: support coreboot as well. */
|
||||
#if defined (GRUB_MACHINE_PCBIOS)
|
||||
#define GRUB_MACHINE_HAS_VBE 1
|
||||
#else
|
||||
#define GRUB_MACHINE_HAS_VGA_TEXT 0
|
||||
#define GRUB_MACHINE_HAS_VBE 0
|
||||
#endif
|
||||
|
||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||
#define GRUB_MACHINE_HAS_VGA_TEXT 1
|
||||
#else
|
||||
#define GRUB_MACHINE_HAS_VGA_TEXT 0
|
||||
#endif
|
||||
|
||||
#if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT)
|
||||
#define GRUB_MACHINE_HAS_ACPI 1
|
||||
#else
|
||||
|
|
|
@ -34,11 +34,13 @@
|
|||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
||||
#define GRUB_KERNEL_I386_PC_INSTALL_BSD_PART 0x18
|
||||
|
||||
/* The offset of multiboot signature. */
|
||||
#define GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE 0x1c
|
||||
/* Offset of reed_solomon_redundancy. */
|
||||
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x1c
|
||||
|
||||
/* The size of the first region which won't be compressed. */
|
||||
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0x5D8
|
||||
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xc90
|
||||
|
||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x6f8
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE
|
||||
|
@ -102,13 +104,12 @@
|
|||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE 0x200
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_KERNEL_IMAGE_SIZE 0x10
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE 0xc
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE + 0x48
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END 0x54
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
|
||||
|
@ -158,6 +159,7 @@
|
|||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _TOTAL_MODULE_SIZE)
|
||||
#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_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX)
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX_END)
|
||||
|
|
|
@ -48,8 +48,9 @@ struct grub_partition_map
|
|||
const grub_partition_t partition));
|
||||
#ifdef GRUB_UTIL
|
||||
/* Determine sectors available for embedding. */
|
||||
grub_err_t (*embed) (struct grub_disk *disk, unsigned int nsectors,
|
||||
grub_embed_type_t embed_type, grub_disk_addr_t *sectors);
|
||||
grub_err_t (*embed) (struct grub_disk *disk, unsigned int *nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t **sectors);
|
||||
#endif
|
||||
};
|
||||
typedef struct grub_partition_map *grub_partition_map_t;
|
||||
|
|
|
@ -54,6 +54,10 @@ struct grub_raid_array
|
|||
grub_disk_addr_t start_sector[GRUB_RAID_MAX_DEVICES];
|
||||
/* Start of each device, in 512 byte sectors. */
|
||||
struct grub_raid_array *next;
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
struct grub_raid *driver;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct grub_raid
|
||||
|
|
30
include/grub/reed_solomon.h
Normal file
30
include/grub/reed_solomon.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_REED_SOLOMON_HEADER
|
||||
#define GRUB_REED_SOLOMON_HEADER 1
|
||||
|
||||
void
|
||||
grub_reed_solomon_add_redundancy (void *buffer, grub_size_t data_size,
|
||||
grub_size_t redundancy);
|
||||
|
||||
void
|
||||
grub_reed_solomon_recover (void *buffer, grub_size_t data_size,
|
||||
grub_size_t redundancy);
|
||||
|
||||
#endif
|
|
@ -40,7 +40,7 @@ static inline grub_uint32_t
|
|||
grub_make_scsi_id (int subsystem, int bus, int lun)
|
||||
{
|
||||
return (subsystem << GRUB_SCSI_ID_SUBSYSTEM_SHIFT)
|
||||
| (bus << GRUB_SCSI_ID_BUS_SHIFT) | (lun << GRUB_SCSI_ID_BUS_SHIFT);
|
||||
| (bus << GRUB_SCSI_ID_BUS_SHIFT) | (lun << GRUB_SCSI_ID_LUN_SHIFT);
|
||||
}
|
||||
|
||||
struct grub_scsi_dev
|
||||
|
|
|
@ -72,7 +72,11 @@ struct grub_serial_port
|
|||
*/
|
||||
union
|
||||
{
|
||||
grub_port_t port;
|
||||
struct
|
||||
{
|
||||
grub_port_t port;
|
||||
int broken;
|
||||
};
|
||||
struct
|
||||
{
|
||||
grub_usb_device_t usbdev;
|
||||
|
|
|
@ -27,7 +27,7 @@ cmd='test_blockarg { true }'
|
|||
v=`echo "$cmd" | @builddir@/grub-shell`
|
||||
error_if_not "$v" '{ true }'
|
||||
|
||||
tmp=`mktemp`
|
||||
tmp=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
cmd='test_blockarg { test_blockarg { true } }'
|
||||
echo "$cmd" | @builddir@/grub-shell >$tmp
|
||||
error_if_not "`head -n1 $tmp|tail -n1`" '{ test_blockarg { true } }'
|
||||
|
|
|
@ -51,8 +51,8 @@ list_parts () {
|
|||
echo
|
||||
}
|
||||
|
||||
imgfile=`mktemp`
|
||||
outfile=`mktemp`
|
||||
imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
outfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
|
||||
#
|
||||
# MSDOS partition types
|
||||
|
|
|
@ -83,17 +83,17 @@ for option in "$@"; do
|
|||
done
|
||||
|
||||
if [ "x${source}" = x ] ; then
|
||||
tmpfile=`mktemp`
|
||||
tmpfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
while read REPLY; do
|
||||
echo $REPLY >> ${tmpfile}
|
||||
done
|
||||
source=${tmpfile}
|
||||
fi
|
||||
|
||||
outfile1=`mktemp`
|
||||
outfile1=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
@builddir@/grub-shell --qemu-opts="${qemuopts}" --modules=${modules} ${source} >${outfile1}
|
||||
|
||||
outfile2=`mktemp`
|
||||
outfile2=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
bash ${source} >${outfile2}
|
||||
|
||||
if ! diff -q ${outfile1} ${outfile2} >/dev/null
|
||||
|
|
|
@ -107,14 +107,14 @@ for option in "$@"; do
|
|||
done
|
||||
|
||||
if [ "x${source}" = x ] ; then
|
||||
tmpfile=`mktemp`
|
||||
tmpfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
while read REPLY; do
|
||||
echo "$REPLY" >> ${tmpfile}
|
||||
done
|
||||
source=${tmpfile}
|
||||
fi
|
||||
|
||||
cfgfile=`mktemp`
|
||||
cfgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
cat <<EOF >${cfgfile}
|
||||
grubshell=yes
|
||||
insmod serial
|
||||
|
@ -123,7 +123,7 @@ terminal_input serial
|
|||
terminal_output serial
|
||||
EOF
|
||||
|
||||
rom_directory=`mktemp -d`
|
||||
rom_directory=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
|
||||
for mod in ${modules}
|
||||
do
|
||||
|
@ -135,7 +135,7 @@ source /boot/grub/testcase.cfg
|
|||
halt
|
||||
EOF
|
||||
|
||||
isofile=`mktemp`
|
||||
isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
if [ x$boot != xnet ]; then
|
||||
sh @builddir@/grub-mkrescue --grub-mkimage=${builddir}/grub-mkimage --output=${isofile} --override-directory=${builddir}/grub-core \
|
||||
--rom-directory="${rom_directory}" \
|
||||
|
@ -161,7 +161,7 @@ if [ x$boot = xqemu ]; then
|
|||
fi
|
||||
|
||||
if [ x$boot = xcoreboot ]; then
|
||||
imgfile=`mktemp`
|
||||
imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
cp "${GRUB_COREBOOT_ROM}" "${imgfile}"
|
||||
"${GRUB_CBFSTOOL}" "${imgfile}" add-payload "${rom_directory}/coreboot.elf" fallback/payload
|
||||
bootdev="-bios ${imgfile}"
|
||||
|
@ -169,7 +169,7 @@ if [ x$boot = xcoreboot ]; then
|
|||
fi
|
||||
|
||||
if [ x$boot = xnet ]; then
|
||||
netdir=`mktemp -d`
|
||||
netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
sh @builddir@/grub-mknetdir --grub-mkimage=${builddir}/grub-mkimage --override-directory=${builddir}/grub-core --net-directory=$netdir
|
||||
cp ${cfgfile} $netdir/boot/grub/grub.cfg
|
||||
cp ${source} $netdir/boot/grub/testcase.cfg
|
||||
|
|
|
@ -107,6 +107,8 @@ Install GRUB on your drive.
|
|||
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
|
||||
--grub-probe=FILE use FILE as grub-probe
|
||||
--no-floppy do not probe any floppy drive
|
||||
--allow-floppy Make the drive also bootable as floppy
|
||||
(default for fdX devices). May break on some BIOSes.
|
||||
--recheck probe a device map even if it already exists
|
||||
--force install even if problems are detected
|
||||
EOF
|
||||
|
@ -148,6 +150,8 @@ argument () {
|
|||
echo $1
|
||||
}
|
||||
|
||||
allow_floppy=""
|
||||
|
||||
# Check the arguments.
|
||||
while test $# -gt 0
|
||||
do
|
||||
|
@ -221,6 +225,9 @@ do
|
|||
--removable)
|
||||
removable=yes ;;
|
||||
|
||||
--allow-floppy)
|
||||
allow_floppy="--allow-floppy" ;;
|
||||
|
||||
--disk-module)
|
||||
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
|
||||
disk_module=`argument $option "$@"`; shift;
|
||||
|
@ -512,7 +519,7 @@ if [ "x${devabstraction_module}" = "x" ] ; then
|
|||
grub_drive="`$grub_probe --target=drive --device ${grub_device}`" || exit 1
|
||||
|
||||
# Strip partition number
|
||||
grub_partition="`echo ${grub_drive} | sed -e 's/^[^,]*,//; s/)$//'`"
|
||||
grub_partition="`echo ${grub_drive} | sed -e 's/^[^,]*[,)]//; s/)$//'`"
|
||||
grub_drive="`echo ${grub_drive} | sed -e s/,[a-z0-9,]*//g`"
|
||||
if [ "$disk_module" = ata ] ; then
|
||||
# generic method (used on coreboot and ata mod)
|
||||
|
@ -537,7 +544,11 @@ if [ "x${devabstraction_module}" = "x" ] ; then
|
|||
modules="$modules search_fs_uuid"
|
||||
elif [ "x$platform" = xefi ] || [ "x$platform" = xpc ]; then
|
||||
# we need to hardcode the partition number in the core image's prefix.
|
||||
prefix_drive="(,$grub_partition)"
|
||||
if [ x"$grub_partition" = x ]; then
|
||||
prefix_drive="()"
|
||||
else
|
||||
prefix_drive="(,$grub_partition)"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
prefix_drive=`$grub_probe --target=drive --device ${grub_device}` || exit 1
|
||||
|
@ -572,7 +583,7 @@ fi
|
|||
# Perform the platform-dependent install
|
||||
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
|
||||
# Now perform the installation.
|
||||
$grub_setup ${setup_verbose} ${setup_force} --directory=${grubdir} \
|
||||
$grub_setup ${allow_floppy} ${setup_verbose} ${setup_force} --directory=${grubdir} \
|
||||
--device-map=${device_map} ${install_device} || exit 1
|
||||
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
|
||||
if [ x"$update_nvram" = xyes ]; then
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/macho.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <grub/legacy_parse.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -257,8 +257,7 @@ export GRUB_DEFAULT \
|
|||
GRUB_TERMINAL_OUTPUT \
|
||||
GRUB_SERIAL_COMMAND \
|
||||
GRUB_DISABLE_LINUX_UUID \
|
||||
GRUB_DISABLE_LINUX_RECOVERY \
|
||||
GRUB_DISABLE_NETBSD_RECOVERY \
|
||||
GRUB_DISABLE_RECOVERY \
|
||||
GRUB_VIDEO_BACKEND \
|
||||
GRUB_GFXMODE \
|
||||
GRUB_BACKGROUND \
|
||||
|
|
|
@ -45,7 +45,16 @@
|
|||
|
||||
#define ALIGN_ADDR(x) (ALIGN_UP((x), image_target->voidp_sizeof))
|
||||
|
||||
#ifdef HAVE_LIBLZMA
|
||||
#include <lzma.h>
|
||||
#endif
|
||||
|
||||
#define TARGET_NO_FIELD 0xffffffff
|
||||
|
||||
typedef enum {
|
||||
COMPRESSION_AUTO, COMPRESSION_NONE, COMPRESSION_XZ
|
||||
} grub_compression_t;
|
||||
|
||||
struct image_target_desc
|
||||
{
|
||||
const char *name;
|
||||
|
@ -60,7 +69,8 @@ struct image_target_desc
|
|||
enum
|
||||
{
|
||||
PLATFORM_FLAGS_NONE = 0,
|
||||
PLATFORM_FLAGS_LZMA = 1
|
||||
PLATFORM_FLAGS_LZMA = 1,
|
||||
PLATFORM_FLAGS_DECOMPRESSORS = 2
|
||||
} flags;
|
||||
unsigned prefix;
|
||||
unsigned prefix_end;
|
||||
|
@ -75,6 +85,7 @@ struct image_target_desc
|
|||
unsigned install_dos_part, install_bsd_part;
|
||||
grub_uint64_t link_addr;
|
||||
unsigned mod_gap, mod_align;
|
||||
grub_compression_t default_compression;
|
||||
};
|
||||
|
||||
struct image_target_desc image_targets[] =
|
||||
|
@ -248,40 +259,42 @@ struct image_target_desc image_targets[] =
|
|||
.voidp_sizeof = 4,
|
||||
.bigendian = 0,
|
||||
.id = IMAGE_YEELOONG_FLASH,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_YEELOONG_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END,
|
||||
.raw_size = GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE,
|
||||
.kernel_image_size = GRUB_KERNEL_MIPS_YEELOONG_KERNEL_IMAGE_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_YEELOONG_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN
|
||||
.link_align = GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN,
|
||||
.default_compression = COMPRESSION_NONE
|
||||
},
|
||||
{
|
||||
.name = "mipsel-yeeloong-elf",
|
||||
.voidp_sizeof = 4,
|
||||
.bigendian = 0,
|
||||
.id = IMAGE_YEELOONG_ELF,
|
||||
.flags = PLATFORM_FLAGS_NONE,
|
||||
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
||||
.prefix = GRUB_KERNEL_MIPS_YEELOONG_PREFIX,
|
||||
.prefix_end = GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END,
|
||||
.raw_size = GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE,
|
||||
.raw_size = 0,
|
||||
.total_module_size = GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE,
|
||||
.compressed_size = GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE,
|
||||
.kernel_image_size = GRUB_KERNEL_MIPS_YEELOONG_KERNEL_IMAGE_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_YEELOONG_LINK_ADDR,
|
||||
.elf_target = EM_MIPS,
|
||||
.link_align = GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN
|
||||
.link_align = GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN,
|
||||
.default_compression = COMPRESSION_NONE
|
||||
},
|
||||
{
|
||||
.name = "powerpc-ieee1275",
|
||||
|
@ -493,9 +506,66 @@ compress_kernel_lzma (char *kernel_img, size_t kernel_size,
|
|||
*core_size += raw_size;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBLZMA
|
||||
static void
|
||||
compress_kernel_xz (char *kernel_img, size_t kernel_size,
|
||||
char **core_img, size_t *core_size, size_t raw_size)
|
||||
{
|
||||
lzma_stream strm = LZMA_STREAM_INIT;
|
||||
lzma_ret xzret;
|
||||
lzma_options_lzma lzopts = {
|
||||
.dict_size = 1 << 16,
|
||||
.preset_dict = NULL,
|
||||
.preset_dict_size = 0,
|
||||
.lc = 3,
|
||||
.lp = 0,
|
||||
.pb = 2,
|
||||
.mode = LZMA_MODE_NORMAL,
|
||||
.nice_len = 64,
|
||||
.mf = LZMA_MF_BT4,
|
||||
.depth = 0,
|
||||
};
|
||||
lzma_filter fltrs[] = {
|
||||
{ .id = LZMA_FILTER_LZMA2, .options = &lzopts},
|
||||
{ .id = LZMA_VLI_UNKNOWN, .options = NULL}
|
||||
};
|
||||
|
||||
if (kernel_size < raw_size)
|
||||
grub_util_error (_("the core image is too small"));
|
||||
|
||||
xzret = lzma_stream_encoder (&strm, fltrs, LZMA_CHECK_NONE);
|
||||
if (xzret != LZMA_OK)
|
||||
grub_util_error (_("cannot compress the kernel image"));
|
||||
|
||||
*core_img = xmalloc (kernel_size);
|
||||
memcpy (*core_img, kernel_img, raw_size);
|
||||
|
||||
*core_size = kernel_size - raw_size;
|
||||
strm.next_in = (unsigned char *) kernel_img + raw_size;
|
||||
strm.avail_in = kernel_size - raw_size;
|
||||
strm.next_out = (unsigned char *) *core_img + raw_size;
|
||||
strm.avail_out = *core_size;
|
||||
|
||||
while (1)
|
||||
{
|
||||
xzret = lzma_code (&strm, LZMA_FINISH);
|
||||
if (xzret == LZMA_OK)
|
||||
continue;
|
||||
if (xzret == LZMA_STREAM_END)
|
||||
break;
|
||||
grub_util_error (_("cannot compress the kernel image"));
|
||||
}
|
||||
|
||||
*core_size -= strm.avail_out;
|
||||
|
||||
*core_size += raw_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
compress_kernel (struct image_target_desc *image_target, char *kernel_img,
|
||||
size_t kernel_size, char **core_img, size_t *core_size)
|
||||
size_t kernel_size, char **core_img, size_t *core_size,
|
||||
grub_compression_t comp)
|
||||
{
|
||||
if (image_target->flags & PLATFORM_FLAGS_LZMA)
|
||||
{
|
||||
|
@ -504,6 +574,20 @@ compress_kernel (struct image_target_desc *image_target, char *kernel_img,
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBLZMA
|
||||
if (image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS
|
||||
&& (comp == COMPRESSION_XZ))
|
||||
{
|
||||
compress_kernel_xz (kernel_img, kernel_size, core_img,
|
||||
core_size, image_target->raw_size);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS
|
||||
&& (comp != COMPRESSION_NONE))
|
||||
grub_util_error ("unknown compression %d\n", comp);
|
||||
|
||||
*core_img = xmalloc (kernel_size);
|
||||
memcpy (*core_img, kernel_img, kernel_size);
|
||||
*core_size = kernel_size;
|
||||
|
@ -527,7 +611,8 @@ struct fixup_block_list
|
|||
static void
|
||||
generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
||||
char *memdisk_path, char *config_path,
|
||||
struct image_target_desc *image_target, int note)
|
||||
struct image_target_desc *image_target, int note,
|
||||
grub_compression_t comp)
|
||||
{
|
||||
char *kernel_img, *core_img;
|
||||
size_t kernel_size, total_module_size, core_size, exec_size;
|
||||
|
@ -539,6 +624,10 @@ 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;
|
||||
|
||||
if (comp == COMPRESSION_AUTO)
|
||||
comp = image_target->default_compression;
|
||||
|
||||
path_list = grub_util_resolve_dependencies (dir, "moddep.lst", mods);
|
||||
|
||||
kernel_path = grub_util_get_path (dir, "kernel.img");
|
||||
|
@ -653,13 +742,19 @@ 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);
|
||||
&core_img, &core_size, comp);
|
||||
|
||||
grub_util_info ("the core size is 0x%x", core_size);
|
||||
|
||||
if (image_target->total_module_size != TARGET_NO_FIELD)
|
||||
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_host_to_target32 (total_module_size);
|
||||
if (image_target->kernel_image_size != TARGET_NO_FIELD)
|
||||
|
@ -680,6 +775,53 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
= grub_host_to_target32 (-2);
|
||||
}
|
||||
|
||||
if (image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS)
|
||||
{
|
||||
char *full_img;
|
||||
size_t full_size;
|
||||
char *decompress_path, *decompress_img;
|
||||
size_t decompress_size;
|
||||
const char *name;
|
||||
|
||||
switch (comp)
|
||||
{
|
||||
case COMPRESSION_XZ:
|
||||
name = "xz_decompress.img";
|
||||
break;
|
||||
case COMPRESSION_NONE:
|
||||
name = "none_decompress.img";
|
||||
break;
|
||||
default:
|
||||
grub_util_error ("unknown compression %d\n", comp);
|
||||
}
|
||||
|
||||
decompress_path = grub_util_get_path (dir, name);
|
||||
decompress_size = grub_util_get_image_size (decompress_path);
|
||||
decompress_img = grub_util_read_image (decompress_path);
|
||||
|
||||
*((grub_uint32_t *) (decompress_img + GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE))
|
||||
= grub_host_to_target32 (core_size);
|
||||
|
||||
*((grub_uint32_t *) (decompress_img + GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE))
|
||||
= grub_host_to_target32 (kernel_size + total_module_size);
|
||||
|
||||
full_size = core_size + decompress_size;
|
||||
|
||||
full_img = xmalloc (full_size);
|
||||
memset (full_img, 0, full_size);
|
||||
|
||||
memcpy (full_img, decompress_img, decompress_size);
|
||||
|
||||
memcpy (full_img + decompress_size, core_img, core_size);
|
||||
|
||||
memset (full_img + decompress_size + core_size, 0,
|
||||
full_size - (decompress_size + core_size));
|
||||
|
||||
free (core_img);
|
||||
core_img = full_img;
|
||||
core_size = full_size;
|
||||
}
|
||||
|
||||
switch (image_target->id)
|
||||
{
|
||||
case IMAGE_I386_PC:
|
||||
|
@ -1218,6 +1360,7 @@ static struct option options[] =
|
|||
{"output", required_argument, 0, 'o'},
|
||||
{"note", no_argument, 0, 'n'},
|
||||
{"format", required_argument, 0, 'O'},
|
||||
{"compression", required_argument, 0, 'C'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
|
@ -1260,6 +1403,7 @@ Make a bootable image of GRUB.\n\
|
|||
-o, --output=FILE output a generated image to FILE [default=stdout]\n\
|
||||
-O, --format=FORMAT generate an image in format\n\
|
||||
available formats: %s\n\
|
||||
-C, --compression=(xz|none|auto) choose the compression to use\n\
|
||||
-h, --help display this message and exit\n\
|
||||
-V, --version print version information and exit\n\
|
||||
-v, --verbose print verbose messages\n\
|
||||
|
@ -1286,6 +1430,7 @@ main (int argc, char *argv[])
|
|||
FILE *fp = stdout;
|
||||
int note = 0;
|
||||
struct image_target_desc *image_target = NULL;
|
||||
grub_compression_t comp = COMPRESSION_AUTO;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
|
||||
|
@ -1293,7 +1438,7 @@ main (int argc, char *argv[])
|
|||
|
||||
while (1)
|
||||
{
|
||||
int c = getopt_long (argc, argv, "d:p:m:c:o:O:f:hVvn", options, 0);
|
||||
int c = getopt_long (argc, argv, "d:p:m:c:o:O:f:C:hVvn", options, 0);
|
||||
|
||||
if (c == -1)
|
||||
break;
|
||||
|
@ -1350,6 +1495,22 @@ main (int argc, char *argv[])
|
|||
config = xstrdup (optarg);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
if (grub_strcmp (optarg, "xz") == 0)
|
||||
{
|
||||
#ifdef HAVE_LIBLZMA
|
||||
comp = COMPRESSION_XZ;
|
||||
#else
|
||||
grub_util_error ("grub-mkimage is compiled without XZ support",
|
||||
optarg);
|
||||
#endif
|
||||
}
|
||||
else if (grub_strcmp (optarg, "none") == 0)
|
||||
comp = COMPRESSION_NONE;
|
||||
else
|
||||
grub_util_error ("Unknown compression format %s", optarg);
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
usage (0);
|
||||
break;
|
||||
|
@ -1408,7 +1569,7 @@ main (int argc, char *argv[])
|
|||
|
||||
generate_image (dir, prefix ? : DEFAULT_DIRECTORY, fp,
|
||||
argv + optind, memdisk, config,
|
||||
image_target, note);
|
||||
image_target, note, comp);
|
||||
|
||||
fclose (fp);
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/term.h>
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/emu/misc.h>
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/emu/misc.h>
|
||||
|
|
|
@ -152,15 +152,7 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if test "x$TMP" != x; then
|
||||
MKTEMP_TEMPLATE="$TMP/grub-mkrescue.XXXXXXXXXX"
|
||||
elif test "x$TEMP" != x; then
|
||||
MKTEMP_TEMPLATE="$TEMP/grub-mkrescue.XXXXXXXXXX"
|
||||
else
|
||||
MKTEMP_TEMPLATE="/tmp/grub-mkrescue.XXXXXXXXXX"
|
||||
fi
|
||||
|
||||
iso9660_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
|
||||
iso9660_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
mkdir -p ${iso9660_dir}/boot/grub
|
||||
|
||||
process_input_dir ()
|
||||
|
@ -197,8 +189,8 @@ make_image ()
|
|||
|
||||
echo "Enabling $2 support ..."
|
||||
|
||||
memdisk_img=`mktemp "$MKTEMP_TEMPLATE"`
|
||||
memdisk_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
|
||||
memdisk_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
memdisk_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
mkdir -p ${memdisk_dir}/boot/grub
|
||||
|
||||
cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
|
||||
|
@ -263,12 +255,12 @@ grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${i
|
|||
# build BIOS core.img
|
||||
if test -e "${pc_dir}" ; then
|
||||
echo "Enabling BIOS support ..."
|
||||
core_img=`mktemp "$MKTEMP_TEMPLATE"`
|
||||
core_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
$grub_mkimage -O i386-pc -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
|
||||
iso9660 biosdisk
|
||||
cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img
|
||||
|
||||
embed_img=`mktemp "$MKTEMP_TEMPLATE"`
|
||||
embed_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
cat ${pc_dir}/boot.img ${core_img} > ${embed_img}
|
||||
|
||||
rm -f ${core_img}
|
||||
|
@ -287,7 +279,7 @@ fi
|
|||
make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/multiboot.img" "ata at_keyboard"
|
||||
|
||||
if test -e "${efi64_dir}" || test -e "${efi32_dir}"; then
|
||||
efi_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
|
||||
efi_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
mkdir -p "${efi_dir}/efi/boot"
|
||||
|
||||
# build bootx64.efi
|
||||
|
|
|
@ -175,7 +175,8 @@ probe (const char *path, char *device_name)
|
|||
printf ("raid5rec ");
|
||||
if (is_raid6)
|
||||
printf ("raid6rec ");
|
||||
printf ("mdraid ");
|
||||
if (dev->disk->dev->raidname)
|
||||
printf ("%s ", dev->disk->dev->raidname (dev->disk));
|
||||
}
|
||||
|
||||
if (is_lvm)
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include <assert.h>
|
||||
#include <grub/emu/getroot.h>
|
||||
#include "progname.h"
|
||||
#include <grub/reed_solomon.h>
|
||||
|
||||
#define _GNU_SOURCE 1
|
||||
#include <argp.h>
|
||||
|
@ -176,7 +177,7 @@ static void
|
|||
setup (const char *dir,
|
||||
const char *boot_file, const char *core_file,
|
||||
const char *root, const char *dest, int must_embed, int force,
|
||||
int fs_probe)
|
||||
int fs_probe, int allow_floppy)
|
||||
{
|
||||
char *boot_path, *core_path, *core_path_dev, *core_path_dev_full;
|
||||
char *boot_img, *core_img;
|
||||
|
@ -312,33 +313,22 @@ setup (const char *dir,
|
|||
/* If DEST_DRIVE is a hard disk, enable the workaround, which is
|
||||
for buggy BIOSes which don't pass boot drive correctly. Instead,
|
||||
they pass 0x00 or 0x01 even when booted from 0x80. */
|
||||
if (!grub_util_biosdisk_is_floppy (dest_dev->disk))
|
||||
if (!allow_floppy && !grub_util_biosdisk_is_floppy (dest_dev->disk))
|
||||
/* Replace the jmp (2 bytes) with double nop's. */
|
||||
*boot_drive_check = 0x9090;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Clean out the blocklists. */
|
||||
block = first_block;
|
||||
while (block->len)
|
||||
{
|
||||
grub_memset (block, 0, sizeof (block));
|
||||
|
||||
block--;
|
||||
|
||||
if ((char *) block <= core_img)
|
||||
grub_util_error ("No terminator in the core image");
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
{
|
||||
grub_partition_map_t dest_partmap = NULL;
|
||||
grub_partition_t container = dest_dev->disk->partition;
|
||||
int multiple_partmaps = 0;
|
||||
grub_err_t err;
|
||||
grub_disk_addr_t sectors[core_sectors];
|
||||
grub_disk_addr_t *sectors;
|
||||
int i;
|
||||
grub_fs_t fs;
|
||||
unsigned int nsec;
|
||||
|
||||
/* Unlike root_dev, with dest_dev we're interested in the partition map even
|
||||
if dest_dev itself is a whole disk. */
|
||||
|
@ -419,8 +409,11 @@ setup (const char *dir,
|
|||
goto unable_to_embed;
|
||||
}
|
||||
|
||||
err = dest_partmap->embed (dest_dev->disk, core_sectors,
|
||||
GRUB_EMBED_PCBIOS, sectors);
|
||||
nsec = core_sectors;
|
||||
err = dest_partmap->embed (dest_dev->disk, &nsec,
|
||||
GRUB_EMBED_PCBIOS, §ors);
|
||||
if (nsec > 2 * core_sectors)
|
||||
nsec = 2 * core_sectors;
|
||||
|
||||
if (err)
|
||||
{
|
||||
|
@ -429,16 +422,42 @@ setup (const char *dir,
|
|||
goto unable_to_embed;
|
||||
}
|
||||
|
||||
/* Clean out the blocklists. */
|
||||
block = first_block;
|
||||
while (block->len)
|
||||
{
|
||||
grub_memset (block, 0, sizeof (block));
|
||||
|
||||
block--;
|
||||
|
||||
if ((char *) block <= core_img)
|
||||
grub_util_error ("No terminator in the core image");
|
||||
}
|
||||
|
||||
save_first_sector (sectors[0] + grub_partition_get_start (container),
|
||||
0, GRUB_DISK_SECTOR_SIZE);
|
||||
|
||||
block = first_block;
|
||||
for (i = 1; i < core_sectors; i++)
|
||||
for (i = 1; i < nsec; i++)
|
||||
save_blocklists (sectors[i] + grub_partition_get_start (container),
|
||||
0, GRUB_DISK_SECTOR_SIZE);
|
||||
|
||||
write_rootdev (core_img, root_dev, boot_img, first_sector);
|
||||
|
||||
core_img = realloc (core_img, nsec * GRUB_DISK_SECTOR_SIZE);
|
||||
first_block = (struct grub_boot_blocklist *) (core_img
|
||||
+ GRUB_DISK_SECTOR_SIZE
|
||||
- sizeof (*block));
|
||||
|
||||
*(grub_uint32_t *) (core_img + GRUB_DISK_SECTOR_SIZE
|
||||
+ GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY)
|
||||
= grub_host_to_target32 (nsec * GRUB_DISK_SECTOR_SIZE - core_size);
|
||||
|
||||
grub_reed_solomon_add_redundancy (core_img + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + GRUB_DISK_SECTOR_SIZE,
|
||||
core_size - GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART - GRUB_DISK_SECTOR_SIZE,
|
||||
nsec * GRUB_DISK_SECTOR_SIZE
|
||||
- core_size);
|
||||
|
||||
/* Make sure that the second blocklist is a terminator. */
|
||||
block = first_block - 1;
|
||||
block->start = 0;
|
||||
|
@ -446,14 +465,13 @@ setup (const char *dir,
|
|||
block->segment = 0;
|
||||
|
||||
/* Write the core image onto the disk. */
|
||||
for (i = 0; i < core_sectors; i++)
|
||||
for (i = 0; i < nsec; i++)
|
||||
grub_disk_write (dest_dev->disk, sectors[i], 0,
|
||||
(core_size - i * GRUB_DISK_SECTOR_SIZE
|
||||
< GRUB_DISK_SECTOR_SIZE) ? core_size
|
||||
- i * GRUB_DISK_SECTOR_SIZE
|
||||
: GRUB_DISK_SECTOR_SIZE,
|
||||
GRUB_DISK_SECTOR_SIZE,
|
||||
core_img + i * GRUB_DISK_SECTOR_SIZE);
|
||||
|
||||
grub_free (sectors);
|
||||
|
||||
goto finish;
|
||||
}
|
||||
#endif
|
||||
|
@ -660,6 +678,9 @@ static struct argp_option options[] = {
|
|||
N_("Do not probe for filesystems in DEVICE"), 0},
|
||||
{"verbose", 'v', 0, 0,
|
||||
N_("Print verbose messages."), 0},
|
||||
{"allow-floppy", 'a', 0, 0,
|
||||
N_("Make the drive also bootable as floppy (default for fdX devices). May break on some BIOSes."), 0},
|
||||
|
||||
{ 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -694,6 +715,7 @@ struct arguments
|
|||
char *root_dev;
|
||||
int force;
|
||||
int fs_probe;
|
||||
int allow_floppy;
|
||||
char *device;
|
||||
};
|
||||
|
||||
|
@ -719,6 +741,10 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
|||
|
||||
switch (key)
|
||||
{
|
||||
case 'a':
|
||||
arguments->allow_floppy = 1;
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
if (arguments->boot_file)
|
||||
free (arguments->boot_file);
|
||||
|
@ -820,10 +846,6 @@ main (int argc, char *argv[])
|
|||
int must_embed = 0;
|
||||
struct arguments arguments;
|
||||
|
||||
#ifdef GRUB_MACHINE_IEEE1275
|
||||
force = 1;
|
||||
#endif
|
||||
|
||||
set_program_name (argv[0]);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
@ -839,6 +861,10 @@ main (int argc, char *argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_IEEE1275
|
||||
arguments.force = 1;
|
||||
#endif
|
||||
|
||||
if (verbosity > 1)
|
||||
grub_env_set ("debug", "all");
|
||||
|
||||
|
@ -932,7 +958,8 @@ main (int argc, char *argv[])
|
|||
arguments.boot_file ? : DEFAULT_BOOT_FILE,
|
||||
arguments.core_file ? : DEFAULT_CORE_FILE,
|
||||
root_dev, grub_util_get_grub_dev (devicelist[i]), 1,
|
||||
arguments.force, arguments.fs_probe);
|
||||
arguments.force, arguments.fs_probe,
|
||||
arguments.allow_floppy);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -941,7 +968,8 @@ main (int argc, char *argv[])
|
|||
setup (arguments.dir ? : DEFAULT_DIRECTORY,
|
||||
arguments.boot_file ? : DEFAULT_BOOT_FILE,
|
||||
arguments.core_file ? : DEFAULT_CORE_FILE,
|
||||
root_dev, dest_dev, must_embed, arguments.force, arguments.fs_probe);
|
||||
root_dev, dest_dev, must_embed, arguments.force,
|
||||
arguments.fs_probe, arguments.allow_floppy);
|
||||
|
||||
/* Free resources. */
|
||||
grub_fini_all ();
|
||||
|
|
|
@ -68,9 +68,13 @@ kfreebsd_entry ()
|
|||
{
|
||||
os="$1"
|
||||
version="$2"
|
||||
recovery="$3" # not used yet
|
||||
args="$4" # not used yet
|
||||
title="$(gettext_quoted "%s, with kFreeBSD %s")"
|
||||
recovery="$3"
|
||||
args="$4"
|
||||
if ${recovery} ; then
|
||||
title="$(gettext_quoted "%s, with kFreeBSD %s (recovery mode)")"
|
||||
else
|
||||
title="$(gettext_quoted "%s, with kFreeBSD %s")"
|
||||
fi
|
||||
printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
if [ -z "${prepare_boot_cache}" ]; then
|
||||
|
@ -80,7 +84,7 @@ kfreebsd_entry ()
|
|||
printf '%s\n' "${prepare_boot_cache}"
|
||||
cat << EOF
|
||||
echo '$(printf "$(gettext_quoted "Loading kernel of FreeBSD %s ...")" ${version})'
|
||||
kfreebsd ${rel_dirname}/${basename}
|
||||
kfreebsd ${rel_dirname}/${basename} ${args}
|
||||
EOF
|
||||
|
||||
if test -n "${devices}" ; then
|
||||
|
@ -172,7 +176,10 @@ while [ "x$list" != "x" ] ; do
|
|||
module_dir_rel=$(make_system_path_relative_to_its_root $module_dir)
|
||||
fi
|
||||
|
||||
kfreebsd_entry "${OS}" "${version}"
|
||||
kfreebsd_entry "${OS}" "${version}" false
|
||||
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
||||
kfreebsd_entry "${OS}" "${version}" true "-s"
|
||||
fi
|
||||
|
||||
list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '`
|
||||
done
|
||||
|
|
|
@ -102,7 +102,7 @@ EOF
|
|||
EOF
|
||||
}
|
||||
|
||||
list=`for i in /boot/vmlinu[zx]-* /vmlinu[zx]-* ; do
|
||||
list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* ; do
|
||||
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
||||
done`
|
||||
prepare_boot_cache=
|
||||
|
@ -127,16 +127,26 @@ while [ "x$list" != "x" ] ; do
|
|||
break
|
||||
fi
|
||||
done
|
||||
|
||||
initramfs=
|
||||
for i in "config-${version}" "config-${alt_version}"; do
|
||||
if test -e "${dirname}/${i}" ; then
|
||||
initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${dirname}/${i}" | cut -f2 -d= | tr -d \"`
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test -n "${initrd}" ; then
|
||||
echo "Found initrd image: ${dirname}/${initrd}" >&2
|
||||
else
|
||||
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
|
||||
elif test -z "${initramfs}" ; then
|
||||
# "UUID=" magic is parsed by initrd or initramfs. Since there's
|
||||
# no initrd or builtin initramfs, it can't work here.
|
||||
linux_root_device_thisversion=${GRUB_DEVICE}
|
||||
fi
|
||||
|
||||
linux_entry "${OS}" "${version}" false \
|
||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||
if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
|
||||
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
||||
linux_entry "${OS}" "${version}" true \
|
||||
"single ${GRUB_CMDLINE_LINUX}"
|
||||
fi
|
||||
|
|
|
@ -80,7 +80,7 @@ for k in $(ls -t /netbsd*) ; do
|
|||
echo "Found NetBSD kernel: $k" >&2
|
||||
netbsd_entry "knetbsd" "$k" false "${GRUB_CMDLINE_NETBSD_DEFAULT}"
|
||||
netbsd_entry "multiboot" "$k" false "${GRUB_CMDLINE_NETBSD_DEFAULT}"
|
||||
if [ "x${GRUB_DISABLE_NETBSD_RECOVERY}" != "xtrue" ]; then
|
||||
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
||||
netbsd_entry "knetbsd" "$k" true "-s"
|
||||
netbsd_entry "multiboot" "$k" true "-s"
|
||||
fi
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue