From 0cbcdf0e6fce10e8556b26a5da6385042aa2be0a Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 22 Oct 2010 14:17:33 +0100 Subject: [PATCH 1/8] * docs/grub.texi (Installing GRUB using grub-install): Proofread. (Supported kernels): Likewise. --- ChangeLog | 5 +++++ docs/grub.texi | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ded89247..00ec9d6a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-10-22 Colin Watson + + * docs/grub.texi (Installing GRUB using grub-install): Proofread. + (Supported kernels): Likewise. + 2010-10-18 Grégoire Sutre Make mktemp invocations portable. diff --git a/docs/grub.texi b/docs/grub.texi index 751dd9dc2..b37a5bfac 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -559,11 +559,12 @@ 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 it's the space between MBR and first partition (called -MBR gap), on GPT partition it uses a BIOS Boot Partition (a partition -having type 21686148-6449-6e6f-744e656564454649). If you use GRUB on -BIOS be sure to supply at least 31 KiB of embedding zone (512KiB or more +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 @@ -617,9 +618,9 @@ 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 first partition of USB pendrive as a floppy -instead of exposing pendrive as a hard disk (they call it ``USB-FDD'' boot) -In such cases you need to install as following: +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} @@ -3295,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) From e138c4583608b07376f1ce1bdc0aea88875adf3a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 22 Oct 2010 22:49:36 +0200 Subject: [PATCH 2/8] * grub-core/lib/relocator.c (grub_relocator_subchunk): Remove now useless field head. All users updated. (free_subchunk): Correct handling of IN_REGION subchunk. --- ChangeLog | 6 ++++++ grub-core/lib/relocator.c | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00ec9d6a5..85ff4d088 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-10-22 Vladimir Serbinenko + + * 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 * docs/grub.texi (Installing GRUB using grub-install): Proofread. diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c index b1412e73a..90f6802d7 100644 --- a/grub-core/lib/relocator.c +++ b/grub-core/lib/relocator.c @@ -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); @@ -971,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 From 5c81f8b349e4844d65d5b1717a1ebe61defd6062 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 23 Oct 2010 20:34:50 +0200 Subject: [PATCH 3/8] * grub-core/kern/emu/misc.c (grub_make_system_path_relative_to_its_root): Revert r2882. --- ChangeLog | 5 +++++ grub-core/kern/emu/misc.c | 21 ++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85ff4d088..bdeb62500 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-10-22 Vladimir Serbinenko + + * grub-core/kern/emu/misc.c + (grub_make_system_path_relative_to_its_root): Revert r2882. + 2010-10-22 Vladimir Serbinenko * grub-core/lib/relocator.c (grub_relocator_subchunk): Remove now diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c index cfc143bf9..d8db3be9d 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -406,7 +406,21 @@ grub_make_system_path_relative_to_its_root (const char *path) /* buf is another filesystem; we found it. */ if (st.st_dev != num) - break; + { + /* offset == 0 means path given is the mount point. + This works around special-casing of "/" in Un*x. This function never + prints trailing slashes (so that its output can be appended a slash + unconditionally). Each slash in is considered a preceding slash, and + therefore the root directory is an empty string. */ + if (offset == 0) + { + free (buf); + free (buf2); + return xstrdup (""); + } + else + break; + } offset = p - buf; /* offset == 1 means root directory. */ @@ -434,10 +448,7 @@ grub_make_system_path_relative_to_its_root (const char *path) } #endif - /* This works around special-casing of "/" in Un*x. This function never - prints trailing slashes (so that its output can be appended a slash - unconditionally). Each slash in it is considered a preceding slash, - and therefore the root directory is an empty string. */ + /* Remove trailing slashes, return empty string if root directory. */ len = strlen (buf3); while (len > 0 && buf3[len - 1] == '/') { From 4f6a2e217510c7fa0fb663418838cbbb632c3634 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 23 Oct 2010 20:39:08 +0200 Subject: [PATCH 4/8] * grub-core/kern/emu/misc.c (grub_make_system_path_relative_to_its_root) [HAVE_LIBZFS && HAVE_LIBNVPAIR]: Fix mountpoint return on ZFS. --- ChangeLog | 8 +++++++- grub-core/kern/emu/misc.c | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bdeb62500..fe368aa57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ -2010-10-22 Vladimir Serbinenko +2010-10-23 Vladimir Serbinenko + + * 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 * grub-core/kern/emu/misc.c (grub_make_system_path_relative_to_its_root): Revert r2882. diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c index d8db3be9d..c8b95443b 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -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 From 18568d18520b189ef796cdfc1535aad0c6bfac2e Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 26 Oct 2010 12:29:12 +0200 Subject: [PATCH 5/8] * include/grub/types.h (grub_target_off_t): Removed no longer used type. --- ChangeLog | 4 ++++ include/grub/types.h | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe368aa57..7c227ab86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-10-26 Vladimir Serbinenko + + * include/grub/types.h (grub_target_off_t): Removed no longer used type. + 2010-10-23 Vladimir Serbinenko * grub-core/kern/emu/misc.c diff --git a/include/grub/types.h b/include/grub/types.h index 221fef3c0..e57666a10 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -84,12 +84,10 @@ typedef unsigned long long grub_uint64_t; /* Misc types. */ #if GRUB_TARGET_SIZEOF_VOID_P == 8 typedef grub_uint64_t grub_target_addr_t; -typedef grub_uint64_t grub_target_off_t; typedef grub_uint64_t grub_target_size_t; typedef grub_int64_t grub_target_ssize_t; #else typedef grub_uint32_t grub_target_addr_t; -typedef grub_uint32_t grub_target_off_t; typedef grub_uint32_t grub_target_size_t; typedef grub_int32_t grub_target_ssize_t; #endif From 4171b3c5bcbc7654d1da9f6ddf5f562cd4ef7c41 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 26 Oct 2010 12:31:26 +0200 Subject: [PATCH 6/8] * util/grub-setup.c (setup): Clarify the error message. --- ChangeLog | 4 ++++ util/grub-setup.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7c227ab86..153121d9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-10-26 Vladimir Serbinenko + + * util/grub-setup.c (setup): Clarify the error message. + 2010-10-26 Vladimir Serbinenko * include/grub/types.h (grub_target_off_t): Removed no longer used type. diff --git a/util/grub-setup.c b/util/grub-setup.c index 8ab33590b..588c87526 100644 --- a/util/grub-setup.c +++ b/util/grub-setup.c @@ -385,7 +385,7 @@ setup (const char *dir, if (! dest_partmap) { - grub_util_warn (_("Attempting to install GRUB to a partitionless disk. This is a BAD idea.")); + grub_util_warn (_("Attempting to install GRUB to a partitionless disk or to a partition. This is a BAD idea.")); goto unable_to_embed; } if (multiple_partmaps || fs) From 26c53dc64c2172604330952713749aa59077f072 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 26 Oct 2010 12:33:57 +0200 Subject: [PATCH 7/8] * util/grub-setup.c (argp): Remove misleading example of installing to a partition. --- ChangeLog | 5 +++++ util/grub-setup.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 153121d9a..1f31dbb78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-10-26 Vladimir Serbinenko + + * util/grub-setup.c (argp): Remove misleading example of installing to + a partition. + 2010-10-26 Vladimir Serbinenko * util/grub-setup.c (setup): Clarify the error message. diff --git a/util/grub-setup.c b/util/grub-setup.c index 588c87526..c3d7dcf43 100644 --- a/util/grub-setup.c +++ b/util/grub-setup.c @@ -822,7 +822,7 @@ Set up images to boot from DEVICE.\n\ \n\ You should not normally run this program directly. Use grub-install instead.") "\v"N_("\ -DEVICE must be an OS device (e.g. /dev/sda1)."), +DEVICE must be an OS device (e.g. /dev/sda)."), NULL, help_filter, NULL }; From 95b9257e6e47eea622fa219093574ed6636e1195 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 26 Oct 2010 12:40:35 +0200 Subject: [PATCH 8/8] * util/grub-setup.c (setup): Refuse to do a cross-disk embeddingless install rather than creating a broken install. --- ChangeLog | 5 +++++ util/grub-setup.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1f31dbb78..a24c9e451 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-10-26 Vladimir Serbinenko + + * util/grub-setup.c (setup): Refuse to do a cross-disk embeddingless + install rather than creating a broken install. + 2010-10-26 Vladimir Serbinenko * util/grub-setup.c (argp): Remove misleading example of installing to diff --git a/util/grub-setup.c b/util/grub-setup.c index c3d7dcf43..fa95f94aa 100644 --- a/util/grub-setup.c +++ b/util/grub-setup.c @@ -482,6 +482,12 @@ unable_to_embed: grub_util_error (_("embedding is not possible, but this is required when " "the root device is on a RAID array or LVM volume")); +#ifdef GRUB_MACHINE_PCBIOS + if (dest_dev->disk->id != root_dev->disk->id) + grub_util_error (_("embedding is not possible, but this is required for " + "cross-disk install")); +#endif + grub_util_warn (_("Embedding is not possible. GRUB can only be installed in this " "setup by using blocklists. However, blocklists are UNRELIABLE and " "their use is discouraged."));