Commit graph

93 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
10001ac54b * grub-core/kern/i386/pc/startup.S (multiboot_trampoline): Add missing
jump.
2010-11-12 08:45:16 +01:00
Manoel Rebelo Abranches
9c4cf53bfe 2010-11-08 Manoel Rebelo Abranches <mrabran@br.ibm.com>
* include/grub/elfload.h (grub_elf32_size): New parameter. All users updated.
        Return maximum segments alignment.
        (grub_elf64_size): Likewise.
        * kern/elf.c (grub_elf32_size): New parameter. All users updated.
        Return maximum segments alignment.
        (grub_elf64_size): Likewise.
        * grub-core/loader/powerpc/ieee1275/linux.c:
        (grub_linux_claimmap_iterate): New function. Uses the "available"property
        in the "memory" node for memory allocation for kernel in the PowerPC loader.
        (grub_linux_load32): Correctly find linux entry point offset.
        (grub_linux_load64): Likewise.
2010-11-08 11:14:54 -02:00
Vladimir 'phcoder' Serbinenko
80c6d25eef * grub-core/kern/emu/hostdisk.c
(convert_system_partition_to_system_disk): Handle devices like "sdaa1".
2010-11-07 00:10:49 +01:00
Vladimir 'phcoder' Serbinenko
4f6a2e2175 * 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 20:39:08 +02:00
Vladimir 'phcoder' Serbinenko
5c81f8b349 * grub-core/kern/emu/misc.c
(grub_make_system_path_relative_to_its_root): Revert r2882.
2010-10-23 20:34:50 +02:00
Vladimir 'phcoder' Serbinenko
7bced4583e * grub-core/kern/i386/pc/startup.S (grub_console_setcursor): Check
cursor shape for sanity.
2010-10-17 01:49:06 +02:00
Vladimir 'phcoder' Serbinenko
fbfbeb394f 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 17:50:48 +02:00
Vladimir 'phcoder' Serbinenko
65f7ed7c9a * 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 17:44:35 +02:00
Robert Millan
1eb01cd276 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.
2010-10-16 02:30:14 +02:00
Vladimir 'phcoder' Serbinenko
d87c681fd4 * 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-14 15:35:55 +02:00
Vladimir 'phcoder' Serbinenko
74baff844e * grub-core/kern/i386/pc/startup.S (grub_console_getkey): Fix incorrect
handling of special keys.
2010-10-06 19:46:20 +02:00
Vladimir 'phcoder' Serbinenko
b65830fae1 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-29 21:33:38 +02:00
Robert Millan
8e57a6ca44 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 16:11:33 +02:00
Robert Millan
f913083640 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-26 15:53:05 +02:00
Vladimir 'phcoder' Serbinenko
25e09515ad Make mb header to protected part 2010-09-25 21:42:13 +02:00
Vladimir 'phcoder' Serbinenko
3ac9e79207 Multiple bugs correction for Reed-Solomon 2010-09-25 20:40:26 +02:00
Vladimir 'phcoder' Serbinenko
419cbeb06d hook Reed-Solomon into startup.S 2010-09-25 19:33:05 +02:00
BVK Chaitanya
96510fafd2 fix typo 2010-09-25 10:48:48 +05:30
BVK Chaitanya
449333eb7d 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-25 10:43:09 +05:30
Vladimir 'phcoder' Serbinenko
4f0de6881c C part of Reed-Solomon 2010-09-24 14:05:47 +02:00
Vladimir 'phcoder' Serbinenko
6d0fa83c79 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-23 02:10:44 +02:00
Grégoire Sutre
1b655af685 Define FLOPPY_MAJOR on NetBSD. 2010-09-22 23:32:58 +02:00
Vladimir 'phcoder' Serbinenko
9a0e5c815e Fix bugs in asm code 2010-09-22 00:53:34 +02:00
Vladimir 'phcoder' Serbinenko
e0a8ef26e4 MAke a separate scratch for decompressor 2010-09-21 19:39:51 +02:00
Colin Watson
4eff79d2f9 * grub-core/kern/emu/hostdisk.c (find_system_device): Only try to
convert partition names to disk names if the new `convert' parameter
is set.
(grub_util_biosdisk_get_grub_dev): If opening the disk device
returns GRUB_ERR_UNKNOWN_DEVICE, treat the partition device as a
disk in its own right.  This can happen with Xen disk images.
2010-09-21 10:36:44 +01:00
Vladimir 'phcoder' Serbinenko
f8926c32b4 C part of decompressor 2010-09-21 11:22:52 +02:00
Vladimir 'phcoder' Serbinenko
c5b4cd370e asm part for mips decompressor 2010-09-21 10:14:08 +02:00
Vladimir 'phcoder' Serbinenko
3197c86ba8 Remove dead code in decompressor 2010-09-21 10:07:12 +02:00
Vladimir 'phcoder' Serbinenko
a38b701cbf Rename jail to extractor 2010-09-20 23:01:34 +02:00
Vladimir 'phcoder' Serbinenko
1b71d7500b merge mainline into jail 2010-09-20 22:41:59 +02:00
Vladimir 'phcoder' Serbinenko
74342e312f Support some annoying BSD and Minix subpartitions.
* Makefile.util.def (libgrub.a): Add grub-core/partmap/bsdlabel.c.
	* grub-core/disk/efi/efidisk.c (grub_efidisk_get_device_name):
	Properly handle concatenation.
	* grub-core/kern/device.c (grub_device_iterate): Likewise.
	* grub-core/normal/completion.c (iterate_partition): Likewise.
	* grub-core/kern/disk.c (grub_disk_open): Make disk->name not
	contain partition. All users updated.
	* grub-core/partmap/bsdlabel.c (grub_netbsdlabel_partition_map): New
	struct.
	(grub_openbsdlabel_partition_map): Likewise.
	(bsdlabel_partition_map_iterate): Rename to ..
	(iterate_real): ... this. New arguments sector, freebsd and pmap.
	(bsdlabel_partition_map_iterate): New function.
	(netopenbsdlabel_partition_map_iterate): Likewise.
	(netbsdlabel_partition_map_iterate): Likewise.
	(openbsdlabel_partition_map_iterate): Likewise.
	(GRUB_MOD_INIT): Register new partmaps.
	(GRUB_MOD_FINI): Unregister new partmaps.
	* grub-core/partmap/msdos.c (pc_partition_map_iterate): Rename to ...
	(grub_partition_msdos_iterate): ... this. All users updated.
	Don't support embedding other than in a minix partition.
	* include/grub/msdos_partition.h (grub_partition_msdos_iterate): New
	proto.
	* include/grub/partition.h (grub_partition): New field msdostype.
	* util/grub-install.in: Handle openbsd and netbsd types being in
	part_bsd module.
2010-09-20 21:45:06 +02:00
Vladimir 'phcoder' Serbinenko
899d8af498 * grub-core/kern/emu/misc.c (asprintf): Use vsnprintf instead of
vsprintf.
2010-09-20 19:14:29 +02:00
Vladimir 'phcoder' Serbinenko
38c259a76a Pause the execution (10s max) if any errors are displayed so the user
has a chance to see them.

	* grub-core/kern/err.c (grub_err_printed_errors): New variable.
	(grub_print_error): Increment grub_err_printed_errors.
	* grub-core/normal/menu.c (grub_menu_execute_entry): Pause the
	execution if any errors were displayed.
	(show_menu): Remove old code for pause.
	* grub-core/normal/menu_entry.c (run): Likewise.
	* grub-core/normal/term.c (grub_normal_char_counter): Removed. All
	users updated.
	(grub_normal_get_char_counter): Likewise.
	* include/grub/err.h (grub_err_printed_errors): New external variable.
	* include/grub/normal.h (grub_normal_get_char_counter): Removed.
2010-09-20 17:46:35 +02:00
Colin Watson
a63c31b62d * kern/emu/hostdisk.c: Include <sys/ioctl.h> and <sys/disklabel.h>
on FreeBSD.  Define HAVE_DIOCGDINFO on NetBSD and FreeBSD to reduce
the verbosity of later #ifs.
(find_partition_start): Define this function on FreeBSD too.
(device_is_wholedisk) [__FreeBSD__ || __FreeBSD_kernel__]: New
function.
(grub_util_biosdisk_get_grub_dev): Use partition-start-sector logic
on FreeBSD.
2010-09-20 12:12:33 +01:00
Vladimir 'phcoder' Serbinenko
742f9232e3 Split config.h for util and core.
* acinclude.m4 (HAVE_ASM_USCORE): Transformed into a variable.
	(ADDR32): Likewise.
	(DATA32): Likewise.
	(BSS_START_SYMBOL): Likewise.
	(END_SYMBOL): Likewise.
	(NEED_ENABLE_EXECUTE_STACK): Likewise. All users updated.
	(grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK): Removed.
	* config.h.in: New file.
	* configure.ac: Use config-util.h as config define file.
	Rename MACHINE into GRUB_MACHINE. All users updated.
	(NEED_REGISTER_FRAME_INFO): Transformed into a variable. All users
	updated.
	(NESTED_FUNC_ATTR): Likewise.
	Substitue new variables.
	(COND_HAVE_ASM_USCORE): New conditional.
	* grub-core/Makefile.am (ASM_PREFIX): New variable.
	(kernel_syms.lst): Use ASM_PREFIX.
	* grub-core/kern/emu/console.c: Include config-util.h.
	* grub-core/kern/emu/misc.c: Likewise.
	* grub-core/kern/emu/mm.c: Likewise.
	* include/grub/emu/misc.h: Likewise.
	* include/grub/libgcc.h: Likewise.
2010-09-19 22:22:43 +02:00
Vladimir 'phcoder' Serbinenko
5d6015ddf6 Add lost part of GRUB_TERM_KEY_* commit 2010-09-19 22:12:25 +02:00
Vladimir 'phcoder' Serbinenko
39feb0e8f9 * grub-core/term/efi/console.c (efi_codes): Fix GRUB_TERM_KEY_*
constants usage.
	* grub-core/kern/emu/console.c (grub_ncurses_getkey):
	Fix GRUB_TERM_KEY_* constants usage.
	* grub-core/kern/emu/misc.c (asprintf): Fix vasprintf usage.
2010-09-19 22:09:05 +02:00
Carles Pina i Estany
1a9130dd3f Add keyboard layouts support.
* Makefile.util.def (grub-mklayout): New file.
	(grub-kbdcomp): New script.
	* grub-core/Makefile.am (KERNEL_HEADER_FILES) [COND_mips_yeeloong]:
	Add keyboard_layouts.h.
	* grub-core/Makefile.core.def (kernel): Add commands/keylayouts.c and
	commands/boot.c on yeeloong.
	(keylayouts): New module.
	* grub-core/bus/usb/ohci.c
	* grub-core/bus/usb/uhci.c
	* grub-core/bus/usb/usbhub.c (rescan): New variable.
	(grub_usb_add_hub): Poll interrupt pipe for device handling.
	(attach_root_port): Likewise.
	(poll_nonroot_hub): Likewise.
	(grub_usb_poll_devices): Likewise.
	(detach_device): Close transfer.
	* grub-core/bus/usb/usbtrans.c (grub_usb_execute_and_wait_transfer): New
	function.
	(grub_usb_bulk_setup_readwrite): Likewise.
	(grub_usb_bulk_finish_readwrite): Likewise.
	* grub-core/commands/keylayouts.c: New file.
	* grub-core/commands/keystatus.c (grub_getkeystatus): New function.
	* grub-core/commands/menuentry.c (hotkey_aliases): All several new
	aliases.
	* grub-core/term/at_keyboard.c: Restructured to use keylayouts and
	support scancode 2.
	* grub-core/term/usb_keyboard.c: Restructured to use keylayouts.
	* include/grub/keyboard_layouts.h: New file.
	* util/grub-mklayout.c: New file.
	* util/grub-kbdcomp.in: Likewise.

	Also-By: Aleš Nesrsta <starous@volny.cz>

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2010-09-19 01:01:35 +02:00
Vladimir 'phcoder' Serbinenko
a1d84a5e5e Unify memory types.
* grub-core/Makefile.am (KERNEL_HEADER_FILES): Include memory.h.
	* grub-core/commands/lsmmap.c (grub_cmd_lsmmap): Output user-readable
	types.
	* grub-core/kern/i386/multiboot_mmap.c (grub_lower_mem): Removed.
	(grub_upper_mem): Likewise.
	* grub-core/kern/ieee1275/init.c (grub_upper_mem): Likewise.
	* include/grub/memory.h (grub_memory_type_t): New enum.
	All users updated.
2010-09-19 00:04:31 +02:00
Colin Watson
bf8d13388d (convert_system_partition_to_system_disk): Initialise node.
* grub-core/kern/emu/hostdisk.c
2010-09-17 23:41:06 +01:00
Colin Watson
9c0bad2e15 * grub-core/kern/emu/hostdisk.c
(convert_system_partition_to_system_disk): Fix devmapper memory pool
leak.
Reported and based on patch by: Modestas Vainius.
2010-09-17 11:43:46 +01:00
Colin Watson
a939d135ec Fix DM-RAID probing with recent versions of device-mapper udev
rules.
* grub-core/kern/emu/hostdisk.c (read_device_map): Don't
canonicalise device paths under /dev/mapper/.
(convert_system_partition_to_system_disk): Compare the
uncanonicalised path to /dev/mapper/ rather than the canonicalised
path, since device nodes under /dev/mapper/ are often symlinks.
2010-09-17 11:00:37 +01:00
Vladimir 'phcoder' Serbinenko
7756d44436 Basic menuentry-retrieveing jail 2010-09-16 23:48:32 +02:00
Colin Watson
108538d8ff Support RAID on virtio devices, and others.
* grub-core/kern/emu/getroot.c [__MINGW32__] (find_root_device):
Rename to ...
[__MINGW32__] (grub_find_device): ... this.
[! __MINGW32__ && ! __CYGWIN__] (find_root_device): Rename to ...
[! __MINGW32__ && ! __CYGWIN__] (grub_find_device): ... this.  Use a
reasonable default if dir is NULL.
[! __MINGW32__ && __CYGWIN__] (find_cygwin_root_device): Rename to
...
[! __MINGW32__ && __CYGWIN__] (grub_find_device): ... this.
(grub_guess_root_device): Update callers.
* include/grub/emu/getroot.h (grub_find_device): Add prototype.
* util/raid.c (grub_util_getdiskname): Remove.
(grub_util_raid_getmembers): Use grub_find_device rather than
grub_util_getdiskname.
2010-09-16 14:55:28 +01:00
Vladimir 'phcoder' Serbinenko
f00478b719 * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy): New
function.
	* include/grub/emu/hostdisk.h (grub_util_biosdisk_is_floppy): New proto.
	* util/grub-setup.c (setup): Use grub_util_biosdisk_is_floppy.
2010-09-15 15:30:43 +02:00
Vladimir 'phcoder' Serbinenko
ed80f7d586 * include/grub/command.h (GRUB_COMMAND_FLAG_CMDLINE): Removed. All
users updated.
	(GRUB_COMMAND_FLAG_MENU): Likewise.
	(GRUB_COMMAND_FLAG_BOTH): Likewise.
	(GRUB_COMMAND_FLAG_TITLE): Removed.
	(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
	(GRUB_COMMAND_FLAG_EXTCMD): Moved into enum.
	(GRUB_COMMAND_FLAG_DYNCMD): Likewise.
	(GRUB_COMMAND_FLAG_BLOCKS): Likewise.
	(grub_command_flags_t): New enum. All users updated.
2010-09-14 23:06:01 +02:00
Vladimir 'phcoder' Serbinenko
b71c3faedb * grub-core/kern/sparc64/ieee1275/crt0.S: Align stack. 2010-09-14 20:59:00 +02:00
Vladimir 'phcoder' Serbinenko
275433e642 Don't export grub_gate_a20.
* grub-core/kern/i386/pc/init.c: Remove leftovers.
	* grub-core/kern/i386/pc/startup.S (FUNCTION(grub_gate_a20)): Rename
	to ...
	(grub_gate_a20): ... this. All users updated.
	* include/grub/i386/pc/init.h: Removed. All users updated.
2010-09-14 01:08:24 +02:00
Vladimir 'phcoder' Serbinenko
94564f81a8 * include/grub/disk.h (grub_disk): Remove has_partitions.
All users updated.
	* disk/loopback.c (grub_loopback): Remove has_partitions.
	All users updated.
	(options): Remove partitions. All users updated.
	* util/grub-fstest.c (fstest): Don't pass "-p" to loopback.
	* util/i386/pc/grub-setup.c (setup): copy partition table only when
	actual partition table is found.
2010-09-13 23:59:22 +02:00
Vladimir 'phcoder' Serbinenko
b2a30ac5e4 Filter devaliases and never open same device twice.
* grub-core/disk/ieee1275/ofdisk.c (last_devpath): New variable.
	(last_ihandle): Likewise.
	(ofdisk_hash_ent): New member shortest.
	(ofdisk_hash_add): Add canonical path too.
	(scan): New function.
	(grub_ofdisk_iterate): Iterate over hashed entries.
	(compute_dev_path): Don't add :0.
	(grub_ofdisk_open): Don't really open the disk.
	(grub_ofdisk_close): Avoid closing unrelated disk.
	(grub_ofdisk_read): Implement reopen logic.
	* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_canonicalise_devname):
	New function.
	* include/grub/ieee1275/ieee1275.h (grub_ieee1275_canonicalise_devname):
	New proto.
2010-09-13 19:17:29 +02:00