Commit graph

289 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
8585e54bec factor cryptodisk part out 2011-04-23 18:00:42 +02:00
Vladimir 'phcoder' Serbinenko
24089d19e2 Add cheatmounting 2011-04-22 19:20:46 +02:00
Vladimir 'phcoder' Serbinenko
0aaa85f1a0 merge lazy into luks 2011-04-22 15:13:12 +02:00
Vladimir 'phcoder' Serbinenko
4defebbec8 automatic raid members addition 2011-04-22 13:55:30 +02:00
Vladimir 'phcoder' Serbinenko
65b4742cd7 Add lost lvm/ prefix. Autoadd lvm subdevices. 2011-04-22 02:46:36 +02:00
Vladimir 'phcoder' Serbinenko
c0c837c10b merge devmapper into lazy 2011-04-22 01:21:26 +02:00
Vladimir 'phcoder' Serbinenko
5dad99b730 more linux-like name for LVM volumes 2011-04-22 01:10:24 +02:00
Vladimir 'phcoder' Serbinenko
24b905a11c Lazy LVM and RAID assembly 2011-04-22 00:09:07 +02:00
Vladimir 'phcoder' Serbinenko
a10e7a5a89 Support grub-probe -t drive 2011-04-21 12:39:31 +02:00
Vladimir 'phcoder' Serbinenko
0c910e9626 merge devmapper into luks 2011-04-21 11:59:51 +02:00
Colin Watson
92051871b7 * grub-core/kern/emu/getroot.c
(grub_find_root_device_from_mountinfo): Remove non-virtual-device
test that was incorrectly reintroduced in r3214.
Reported by: Ian Dall.  Fixes Savannah bug #33133.
2011-04-21 10:26:29 +01:00
Vladimir 'phcoder' Serbinenko
e8f28d4c0e * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_flush):
New function.
	(grub_util_biosdisk_close): Use grub_util_biosdisk_flush.
	* include/grub/emu/hostdisk.h (grub_util_biosdisk_flush): New proto.
	* util/grub-setup.c (setup): Use grub_util_biosdisk_flush.
2011-04-19 22:39:14 +02:00
Vladimir 'phcoder' Serbinenko
93a777e388 Complete 64-bit division support.
* grub-core/kern/misc.c (grub_divmod64): Rename to ...
	(grub_divmod64_full): ... this. Support 64-bit divisor and reminder.
	* include/grub/misc.h (grub_divmod64): Rename to ...
	(grub_divmod64_full): ... this.
	(grub_divmod64): New inline function.
2011-04-18 23:03:52 +02:00
Vladimir 'phcoder' Serbinenko
50d2cc5ae5 Identify RAID by its UUID rather than (guessed) name.
* grub-core/disk/raid.c (ascii2hex): New function.
	(grub_raid_open): Accept mduuid/%s specification.
	* grub-core/kern/emu/getroot.c (get_mdadm_name): Revamped into ...
	(get_mdadm_uuid): ... this.
	(grub_util_get_grub_dev): Use mduuid/%s if UUID is available.
2011-04-16 15:27:35 +02:00
Vladimir 'phcoder' Serbinenko
d8a2bcf564 contiguous read 2011-04-15 21:42:29 +02:00
Colin Watson
78fa584f67 Rewrite /proc/self/mountinfo handling to cope with bind-mounts and
move-mounts appearing out of order.  Fixes Ubuntu bug #738345.

* grub-core/kern/emu/getroot.c (find_root_device_from_mountinfo):
Build a list of relevant visible mounts using the mnt_id and
parent_mnt_id fields, and then scan that list at the end.
2011-04-13 12:36:04 +01:00
Vladimir 'phcoder' Serbinenko
fe6b2cbaa6 BtrFS support. Written by me (Vladimir) with important bugfixes and
even more important testing by Colin.

	* Makefile.util.def (libgrubmods.a): Add crc.c and gzio.c
	* grub-core/Makefile.core.def (btrfs): Add crc.c.
	* grub-core/fs/btrfs.c: Stub replaced with real implementation.
	* grub-core/io/gzio.c (grub_gzio): New fields mem_input_size,
	mem_input_off and mem_input. All users updated to accept in-RAM input.
	(gzio_seek): New function.
	(test_zlib_header): Likewise.
	(grub_gzio_read): Likewise.
	(grub_zlib_decompress): Likewise.
	* grub-core/kern/emu/getroot.c (grub_find_root_device_from_mountinfo):
	Accept partial and non-virtual mounts.
	(grub_guess_root_device): Do rescanning after device_from_mountinfo to
	avoid receiving /dev/dm-X as device.
	* grub-core/kern/emu/misc.c (grub_make_system_path_relative_to_its_root):
	Handle bind and partial mounts.
	* grub-core/lib/crc.c: New file.
	* include/grub/deflate.h: Likewise.
	* include/grub/emu/misc.h (grub_find_root_device_from_mountinfo): New
	proto.
	* include/grub/lib/crc.h: New file.
2011-04-11 23:26:41 +02:00
Vladimir 'phcoder' Serbinenko
e745cf0ca6 Implement automatic module license checking according to new GNU
guidelines.

	* grub-core/kern/dl.c (grub_dl_check_license): New function.
	(grub_dl_load_core): Use grub_dl_check_license.
	* include/grub/dl.h (GRUB_MOD_SECTION): New macro.
	(GRUB_MOD_LICENSE): Likewise.
	(GRUB_MOD_DUAL_LICENSE): Likewise.
	All modules updated.
2011-04-11 23:01:51 +02:00
Vladimir 'phcoder' Serbinenko
c7ba1ba62e merge mainline into butter 2011-04-11 07:56:31 +02:00
Vladimir 'phcoder' Serbinenko
9ee8d94faa * grub-core/kern/file.c (grub_file_open): Don't take into account the
parenthesis in the middle of the filename.
2011-04-11 07:38:42 +02:00
Vladimir 'phcoder' Serbinenko
5ca1a64de6 * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_data): New member
is_disk.
	(grub_util_biosdisk_open): Don't apply ioctl on non-disk devices.
	(open_device) Likewise.
	(grub_util_biosdisk_close): Likewise.
	Reported by: Mark Korenberger.
2011-04-10 16:08:58 +02:00
Vladimir 'phcoder' Serbinenko
478182a838 * grub-core/kern/emu/hostdisk.c (open_device): Sync on close and not
on open.
	(grub_util_biosdisk_close): Likewise.
2011-04-08 11:49:38 +02:00
Vladimir 'phcoder' Serbinenko
72a89a54e1 * grub-core/kern/emu/getroot.c (grub_util_get_grub_dev): Add missing
const attribute and use grub_isdigit.
2011-04-08 11:44:44 +02:00
Vladimir 'phcoder' Serbinenko
829ea451a4 * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_read): Don't close
on failed seek as it breaks open fd reusage.
2011-04-03 15:45:20 +02:00
Manoel Rebelo Abranches
25f1579b43 Adapt protocols to new network struct. 2011-04-01 05:42:34 -03:00
Manoel Rebelo Abranches
59b361a2df Use bootp packet to set prefix and card address. 2011-04-01 05:39:06 -03:00
Manoel Rebelo Abranches
50ee5d686d Merge mainline. 2011-04-01 04:45:37 -03:00
Vladimir 'phcoder' Serbinenko
91dc607330 * grub-core/kern/x86_64/efi/callwrap.S (efi_wrap_0): Preserve 16-byte
stack alignment.
	(efi_wrap_1): Likewise.
	(efi_wrap_2): Likewise.
	(efi_wrap_3): Likewise.
	(efi_wrap_4): Likewise.
	(efi_wrap_5): Likewise.
	(efi_wrap_6): Likewise.
	(efi_wrap_10): Likewise.
	Based on information by: Red Hat/Peter Jones.
2011-03-31 16:48:36 +02:00
Vladimir 'phcoder' Serbinenko
56445fb2b4 * grub-core/kern/emu/getroot.c (grub_util_get_grub_dev) [__linux__]:
Preserve partition number in mdadm code path.
2011-03-30 16:37:10 +02:00
Vladimir 'phcoder' Serbinenko
c871b1c6d0 * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev): Add
few potentially useful grub_util_info.
2011-03-30 13:13:25 +02:00
Vladimir 'phcoder' Serbinenko
9e4d19e0d3 * grub-core/kern/emu/hostdisk.c (find_partition_start)
[HAVE_DIOCGDINFO]: Add safety checks.
2011-03-29 15:00:23 +02:00
Vladimir 'phcoder' Serbinenko
09573499ff Initial variable sector size support 2011-03-29 02:02:55 +02:00
Seth Goldberg
c482ad98b3 * grub-core/kern/emu/getroot.c (find_root_device_from_libzfs): Don't return freed string. 2011-03-26 23:22:59 +01:00
Vladimir 'phcoder' Serbinenko
f4727da93f Use libgeom on FreeBSD to detect partitions.
* Makefile.util.def (grub-mkimage): Add LIBGEOM to ldadd.
	(grub-mkrelpath): Likewise.
	(grub-script-check): Likewise.
	(grub-editenv): Likewise.
	(grub-mkpasswd-pbkdf2): Likewise.
	(grub-fstest): Likewise.
	(grub-mkfont): Likewise.
	(grub-mkdevicemap): Likewise.
	(grub-probe): Likewise.
	(grub-setup): Likewise.
	(grub-ofpathname): Likewise.
	(grub-mklayout): Likewise.
	(example_unit_test): Likewise.
	(grub-menulst2cfg): Likewise.
	* grub-core/Makefile.core.def (grub-emu): Likewise.
	(grub-emu-lite): Likewise.
	* configure.ac: Check for -lgeom on FreeBSD and set LIBGEOM.
	* grub-core/kern/emu/hostdisk.c [FreeBSD]: Include libgeom.h. Don't
	define HAVE_DIOCGDINFO.
	(follow_geom_up) [FreeBSD]: New function.
	(find_partition_start) [FreeBSD]: Rewritten using follow_geom_up.
	(convert_system_partition_to_system_disk) [FreeBSD]: Likewise.
	(grub_util_biosdisk_get_grub_dev) [FreeBSD]: Use FreeBSD path
	unconditionally of HAVE_DIOCGDINFO.
2011-03-26 12:59:02 +01:00
Vladimir 'phcoder' Serbinenko
82fe6c751b Fix FreeBSD compilation problem.
* grub-core/kern/emu/hostdisk.c (MAJOR) [FreeBSD]: New definition.
	(FLOPPY_MAJOR) [FreeBSD]: Likewise.
2011-03-26 12:49:34 +01:00
Colin Watson
ebad0b81be remove unused variable 2011-03-23 14:45:04 +00:00
Vladimir 'phcoder' Serbinenko
54da1febce Rename mipsel-yeeloong to mipsel-loongson 2011-02-19 13:18:05 +01:00
Colin Watson
28f9509eb7 merge trunk 2011-02-17 14:51:11 +00:00
Vladimir 'phcoder' Serbinenko
028501a0e0 Workaround yet another IEEE1275 bug.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New enum value
	GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS.
	* grub-core/kern/ieee1275/mmap.c (grub_machine_mmap_iterate): Ignore
	adress_cells and size:cells if GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS
	is set.
	* grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
	GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS on powermacs.
2011-02-12 10:22:55 +03:00
Colin Watson
8c2c4ff2f5 Handle empty dir passed to grub_find_root_device_from_mountinfo; fixes grub-mkrelpath on btrfs subvolumes. 2011-02-04 13:33:16 +00:00
Colin Watson
118fb264ee Support probing multipath disks. 2011-01-25 16:51:23 +00:00
Colin Watson
307ed0b484 remove unused variables 2011-01-25 12:28:11 +00:00
Vladimir 'phcoder' Serbinenko
3533413cd5 * grub-core/kern/emu/getroot.c: Include config-util.h explicitly. 2011-01-22 15:37:05 +01:00
Vladimir 'phcoder' Serbinenko
99388e0cf8 Fuloong shutdown support 2011-01-18 19:39:12 +01:00
Vladimir 'phcoder' Serbinenko
cfe6539cfe initialise keylayout on fuloong too 2011-01-18 19:05:12 +01:00
Vladimir 'phcoder' Serbinenko
8f49d04c98 machtype autodetection 2011-01-18 19:04:27 +01:00
Vladimir 'phcoder' Serbinenko
74eea126f4 fuloong support 2011-01-18 15:28:44 +01:00
Vladimir 'phcoder' Serbinenko
01b08a0f15 initial SIS315PRO support 2011-01-18 13:44:16 +01:00
Vladimir 'phcoder' Serbinenko
46c9db88cd * grub-core/kern/mips/yeeloong/init.c (grub_machine_init): Init boot
module.
2011-01-14 19:23:34 +01:00
Vladimir 'phcoder' Serbinenko
f440c33fd2 Make qemu-mips compile again. Still no grub-mkimage support 2011-01-14 17:37:11 +01:00
Colin Watson
bd1a414714 Resolve the device returned by grub_find_root_device_from_mountinfo or
find_root_device_from_libzfs using grub_find_device.
Reported by: Roderich Schupp.
2011-01-12 17:27:52 -06:00
Colin Watson
6b978c4f04 merge trunk 2011-01-11 10:00:45 -06:00
Vladimir 'phcoder' Serbinenko
4531a206a1 * grub-core/fs/i386/pc/pxe.c (set_mac_env): Export variable.
(set_env_limn_ro): Likewise.
	(GRUB_MOD_INIT): Likewise.
	* grub-core/hook/datehook.c (GRUB_MOD_INIT): Likewise. Change to
	ARRAY_SIZE while on it.
	(GRUB_MOD_FINI): Change to ARRAY_SIZE.
	* grub-core/normal/context.c (grub_env_export): Move from here ...
	* grub-core/kern/env.c (grub_env_export): ... here.
	* grub-core/normal/context.c (grub_cmd_export): Skip exporting root and
	prefix.
	* grub-core/kern/main.c (grub_main): Export root and prefix.
	* include/grub/env.h (grub_env_export): Export.
	Reported by: Seth Goldberg.
2011-01-11 11:51:05 +01:00
Vladimir 'phcoder' Serbinenko
ae67942e78 Don't use post-4G memory on EFI even if 64-bit since some non-compliant
implementations bug on them.

	* grub-core/kern/efi/mm.c (grub_efi_allocate_pages): Skip post-4G
	memory.
	(filter_memory_map): Likewise.
2011-01-10 23:51:10 +01:00
Vladimir 'phcoder' Serbinenko
db87be2aea * grub-core/kern/i386/pc/init.c (grub_get_conv_memsize): Removed.
(grub_machine_init): Don't check amount of low memory as reportedly
	INT 12h can be broken and if low memory is too low we wouldn't have
	gotten into grub_machine_init anyway.
2011-01-10 17:54:21 +01:00
Vladimir 'phcoder' Serbinenko
c49849cc63 * grub-core/kern/i386/pc/mmap.c (grub_get_conv_memsize): New function.
(grub_machine_mmap_iterate): Take low memory into account
2011-01-10 17:51:06 +01:00
Vladimir 'phcoder' Serbinenko
4b07826647 partitioned mdraid support (untested) 2011-01-08 16:33:49 +01:00
Colin Watson
b7d86d53c4 merge trunk 2011-01-07 17:26:15 +00:00
Colin Watson
11b970d7c9 Always initialise *relroot in grub_find_root_device_from_mountinfo,
otherwise we free an uninitialised pointer if /proc is unmounted.
Reported by: Scott Moser.
2011-01-07 17:24:25 +00:00
Colin Watson
6383772c92 remove unused variable 2011-01-06 18:08:01 +00:00
Colin Watson
71b6a2b7a2 * grub-core/kern/emu/getroot.c (find_root_device_from_mountinfo):
Fix prefix check to handle the case where dir ends with a slash
(most significantly, "/" itself).
Reported by: Michael Vogt.
2011-01-06 11:09:17 +00:00
Colin Watson
304e349b7f include <grub/emu/getroot.h> for grub_find_device 2011-01-05 11:41:12 +00:00
Vladimir 'phcoder' Serbinenko
ebc71d284c * grub-core/kern/emu/getroot.c (grub_util_get_grub_dev): Check md/%s
names.
	Reported by: David Pravec.
2011-01-04 18:15:27 +01:00
Colin Watson
92882f28b6 merge trunk 2011-01-04 15:51:41 +00:00
Colin Watson
944404efb8 merge trunk 2011-01-04 15:41:07 +00:00
Vladimir 'phcoder' Serbinenko
092fd3a072 merge mainline into ahci 2011-01-03 16:03:13 +01:00
phcoder
c18271ed00 Fix compilation errors 2011-01-03 02:28:14 +01:00
Vladimir 'phcoder' Serbinenko
0718f66d12 Discard a bunch of junk code 2011-01-03 00:56:28 +01:00
phcoder
5faa440cb0 Discard several spurious differences from mainline 2011-01-03 00:47:21 +01:00
phcoder
0a2b2cdc95 Fix autogen 2011-01-03 00:30:26 +01:00
Vladimir 'phcoder' Serbinenko
0f35c665e6 merge mainline to ia64 2011-01-03 00:04:39 +01:00
Vladimir 'phcoder' Serbinenko
7edf63fce6 merge ia64-emu into ia64 2011-01-02 23:55:50 +01:00
phcoder
f49157dfe5 Restructure module loading and many fixes. Now normal.mod loads successfully 2011-01-02 23:30:25 +01:00
phcoder
bbbf84350e Working hello.mod with extcmd.mod 2011-01-02 19:20:28 +01:00
phcoder
73911575dd support for registering functions from modules (not tested yet) 2011-01-02 14:58:57 +01:00
phcoder
daca6c5f45 ltoff relocation support 2011-01-02 14:39:23 +01:00
phcoder
f9c30af6d0 Succesfully loaded return-only module on ia64-emu 2011-01-02 14:09:58 +01:00
Vladimir 'phcoder' Serbinenko
6f49d0aacb Add missing cache.c 2011-01-01 15:53:31 +01:00
Vladimir 'phcoder' Serbinenko
c76386454e Avoid using Reed-Solomon with 0 redundancy.
* grub-core/kern/i386/pc/startup.S: Remove 0-data check.
	* grub-core/lib/reed_solomon.c (decode_block): Do not proceed on 0 data
	or 0 redundancy.
	(grub_reed_solomon_add_redundancy): Do not proceed with 0 redundancy.
	(grub_reed_solomon_recover): Likewise.
2010-12-27 07:09:43 +01:00
Vladimir 'phcoder' Serbinenko
3d5f359d3b merge mainline into ahci 2010-12-26 11:20:12 +01:00
Vladimir 'phcoder' Serbinenko
0354b8672c * grub-core/commands/acpihalt.c (grub_acpi_halt): Sleep for 1.5 before
writing an error message because of async power management.
	* grub-core/kern/mips/yeeloong/init.c (grub_halt): Likewise.
	(grub_reboot): Likewise.
2010-12-25 14:09:36 +01:00
Vladimir 'phcoder' Serbinenko
de2690be7c merge mainline into ahci 2010-12-24 16:16:01 +01:00
Colin Watson
24b7938b32 * grub-core/kern/i386/pc/startup.S (grub_console_getkey): Use `>> 1'
rather than `/ 2', as the latter requires -Wa,--divide which would
require bumping our minimum binutils version.
2010-12-04 16:19:26 +00:00
Vladimir 'phcoder' Serbinenko
228cfb40bf support bind and subvolume mount 2010-12-02 14:26:46 +01:00
Modestas Vainius
d20a3b371c * grub-core/kern/emu/getroot.c (grub_util_is_dmraid): Recognise ddf1_
fakeraid.
2010-11-14 17:09:13 +01:00
Vladimir 'phcoder' Serbinenko
10001ac54b * grub-core/kern/i386/pc/startup.S (multiboot_trampoline): Add missing
jump.
2010-11-12 08:45:16 +01:00
Vladimir 'phcoder' Serbinenko
c0e103e4da Support for partitioned loop devices. Improved devmapper support 2010-11-08 16:51:50 +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
dc5aeea5b9 merge mainline into net 2010-10-25 13:19:10 +02: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
Szymon Janc
c5dc16905a Make enable of disk cache statistics code configurable.
* configure.ac: --enable-cache-stats added.
	* config.h.in (DISK_CACHE_STATS): New define.
	* grub-core/Makefile.core.def (cacheinfo): New command.
	* include/grub/disk.h(grub_disk_cache_get_performance): New function.
	* grub-core/commands/cacheinfo.c: New file.
	* grub-core/commands/minicmd.c (grub_rescue_cmd_info): Updated and
	moved to cacheinfo.c.
	* grub-core/kern/disk.c: Use DISK_CACHE_STATS to disable disk cache
	debug code.
	* include/grub/disk.h: Likewise.
2010-10-06 19:57:01 +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
760a7e5aed Merge mainline into net 2010-09-22 20:13:00 +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
Manoel R. Abranches
7bb47706c9 Merge grub_net into net. Compiles but is broken right now. 2010-09-16 21:57:31 +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
Vladimir 'phcoder' Serbinenko
cf9827de73 Support explicit user claim that a device is BIOS-visible.
* grub-core/kern/emu/getroot.c (grub_util_get_dev_abstraction):
	Return GRUB_DEV_ABSTRACTION_NONE if device is in device.map.
	* grub-core/kern/emu/hostdisk.c
	(convert_system_partition_to_system_disk): Support mdX.
	(find_system_device): New parameter add. All users updated.
	(grub_util_biosdisk_is_present): New function.
	* include/grub/emu/hostdisk.h (grub_util_biosdisk_is_present): New
	proto.
2010-09-13 13:09:58 +02:00
Vladimir 'phcoder' Serbinenko
768ec2e2ad * grub-core/kern/misc.c (grub_vprintf): Use va_copy when necessary.
(grub_xvasprintf): Likewise.
2010-09-12 14:00:44 +02:00
Vladimir 'phcoder' Serbinenko
4870900f8f * grub-core/kern/emu/main.c (main): Call hostfs_init only after init_all. 2010-09-12 13:55:52 +02:00
Vladimir 'phcoder' Serbinenko
050abaeaa8 Fix emu on mipsel.
* conf/Makefile.common (CFLAGS_PLATFORM): Add -mflush-func
	=grub_cpu_flush_cache on all mips and not only yeeloong.
	* configure.ac (COND_mips): New conditional.
	* grub-core/Makefile.am (KERNEL_HEADER_FILES): Add libgcc on all
	platforms.
	* grub-core/kern/emu/cache.S (__mips__): Use _flush_cache.
	* grub-core/kern/emu/full.c (grub_arch_dl_init_linker)
	[GRUB_LINKER_HAVE_INIT]: New function.
	(grub_emu_post_init): Likewise.
	* grub-core/kern/emu/lite.c (grub_emu_post_init): Likewise.
	* grub-core/kern/emu/main.c: Use grub_emu_post_init.
	* include/grub/cache.h (_mips): Include mips/cache.h.
	* include/grub/disk.h [GRUB_UTIL || GRUB_MACHINE_EMU]: Add missing
	LVM and RAID prototypes.
	* include/grub/emu/misc.h (grub_emu_post_init): New proto.
	* include/grub/mips/time.h (grub_cpu_idle) [GRUB_MACHINE_EMU]: New
	function.
2010-09-11 16:58:06 +02:00
Robert Millan
c38fe9f48e 2010-09-10 Robert Millan <rmh@gnu.org>
Solaris support in grub_find_zpool_from_dir().  Thanks
	Seth Goldberg for referring to getextmntent() facility.
	
	* configure.ac: Check for getextmntent(), `sys/mnttab.h' and
	`sys/mkdev.h'.
	* grub-core/kern/emu/misc.c [HAVE_SYS_MNTTAB_H]: Include
	`<sys/mnttab.h>'.
	[HAVE_SYS_MKDEV_H]: Include `<sys/mkdev.h>'.
	[HAVE_GETEXTMNTENT] (grub_find_zpool_from_dir): Add getextmntent()
	method for finding zpool name.
2010-09-10 14:32:28 +02:00
Robert Millan
fb90b54648 2010-09-10 Robert Millan <rmh@gnu.org>
* configure.ac: Check for `struct statfs.f_fstypename' and
	`struct statfs.f_mntfromname'.
	
	* grub-core/kern/emu/misc.c (grub_find_zpool_from_dir): Conditionalize
	kFreeBSD-specific code.
2010-09-10 14:02:54 +02:00
Vladimir 'phcoder' Serbinenko
43de930c20 Change to disk->name being raw name. It makes less hidden issues 2010-09-08 21:22:41 +02:00
Vladimir 'phcoder' Serbinenko
7051df3609 Fix an issue with new interface for device names 2010-09-08 21:02:51 +02:00
Vladimir 'phcoder' Serbinenko
dedb5f9be2 merge mainline into nested 2010-09-08 20:40:27 +02:00
Vladimir 'phcoder' Serbinenko
3fcb410549 Fix a double device name 2010-09-08 20:39:57 +02:00