mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-28 17:11:34 +02:00
Revert "Import grub2 1.99-r2"
This reverts commit c4412d9028298f65cf2768493a508ed9790702e7 Change-Id: I19f052d98e3029478f946cca1b52c1ae5f49204a Reviewed-on: https://gerrit.chromium.org/gerrit/12068 Reviewed-by: Jon Kliegman <kliegs@chromium.org> Tested-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Sean Paul <seanpaul@chromium.org>
This commit is contained in:
parent
820bc66af0
commit
82245eaab8
@ -1,12 +0,0 @@
|
|||||||
diff -urN grub-1.99/util/grub.d/30_os-prober.in grub-1.99.new/util/grub.d/30_os-prober.in
|
|
||||||
--- grub-1.99/util/grub.d/30_os-prober.in 2010-12-25 18:13:57.000000000 +0100
|
|
||||||
+++ grub-1.99.new/util/grub.d/30_os-prober.in 2011-08-28 12:35:40.965038455 +0200
|
|
||||||
@@ -168,7 +168,7 @@
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
macosx)
|
|
||||||
- OSXUUID="`grub-probe --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
|
|
||||||
+ OSXUUID="`${grub_probe} --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
|
|
||||||
osx_entry xnu_kernel 32
|
|
||||||
osx_entry xnu_kernel64 64
|
|
||||||
;;
|
|
@ -1,65 +0,0 @@
|
|||||||
--- grub-core/kern/emu/getroot.c 2011-05-18 07:35:47 +0000
|
|
||||||
+++ grub-core/kern/emu/getroot.c 2011-05-21 05:03:55 +0000
|
|
||||||
@@ -358,7 +358,7 @@
|
|
||||||
|
|
||||||
if (S_ISLNK (st.st_mode)) {
|
|
||||||
#ifdef __linux__
|
|
||||||
- if (strcmp (dir, "mapper") == 0) {
|
|
||||||
+ if (strcmp (dir, "mapper") == 0 || strcmp (dir, "/dev/mapper") == 0) {
|
|
||||||
/* Follow symbolic links under /dev/mapper/; the canonical name
|
|
||||||
may be something like /dev/dm-0, but the names under
|
|
||||||
/dev/mapper/ are more human-readable and so we prefer them if
|
|
||||||
@@ -609,20 +609,27 @@
|
|
||||||
|
|
||||||
if (os_dev)
|
|
||||||
{
|
|
||||||
- if (stat (os_dev, &st) >= 0)
|
|
||||||
- dev = st.st_rdev;
|
|
||||||
- else
|
|
||||||
+ char *tmp = os_dev;
|
|
||||||
+ os_dev = canonicalize_file_name (os_dev);
|
|
||||||
+ free (tmp);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (os_dev)
|
|
||||||
+ {
|
|
||||||
+ if (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) != 0)
|
|
||||||
+ return os_dev;
|
|
||||||
+ if (stat (os_dev, &st) < 0)
|
|
||||||
grub_util_error ("cannot stat `%s'", os_dev);
|
|
||||||
free (os_dev);
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
- if (stat (dir, &st) >= 0)
|
|
||||||
- dev = st.st_dev;
|
|
||||||
- else
|
|
||||||
- grub_util_error ("cannot stat `%s'", dir);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
+ dev = st.st_rdev;
|
|
||||||
+ return grub_find_device ("/dev/mapper", dev);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (stat (dir, &st) < 0)
|
|
||||||
+ grub_util_error ("cannot stat `%s'", dir);
|
|
||||||
+
|
|
||||||
+ dev = st.st_dev;
|
|
||||||
+
|
|
||||||
#ifdef __CYGWIN__
|
|
||||||
/* Cygwin specific function. */
|
|
||||||
os_dev = grub_find_device (dir, dev);
|
|
||||||
|
|
||||||
--- grub-core/kern/emu/hostdisk.c 2011-05-18 07:35:47 +0000
|
|
||||||
+++ grub-core/kern/emu/hostdisk.c 2011-05-21 05:03:55 +0000
|
|
||||||
@@ -1408,7 +1408,8 @@
|
|
||||||
if (tree)
|
|
||||||
dm_tree_free (tree);
|
|
||||||
free (path);
|
|
||||||
- char *ret = grub_find_device (NULL, (major << 8) | minor);
|
|
||||||
+ char *ret = grub_find_device ("/dev/mapper",
|
|
||||||
+ (major << 8) | minor);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,279 +0,0 @@
|
|||||||
--- grub-core/kern/emu/getroot.c 2011-04-21 09:26:29 +0000
|
|
||||||
+++ grub-core/kern/emu/getroot.c 2011-05-18 07:35:47 +0000
|
|
||||||
@@ -34,6 +34,10 @@
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <grub/util/misc.h>
|
|
||||||
|
|
||||||
+#ifdef HAVE_DEVICE_MAPPER
|
|
||||||
+# include <libdevmapper.h>
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#ifdef __GNU__
|
|
||||||
#include <hurd.h>
|
|
||||||
#include <hurd/lookup.h>
|
|
||||||
@@ -634,32 +638,65 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
-grub_util_is_dmraid (const char *os_dev)
|
|
||||||
+grub_util_is_lvm (const char *os_dev)
|
|
||||||
{
|
|
||||||
- if (! strncmp (os_dev, "/dev/mapper/nvidia_", 19))
|
|
||||||
- return 1;
|
|
||||||
- else if (! strncmp (os_dev, "/dev/mapper/isw_", 16))
|
|
||||||
- return 1;
|
|
||||||
- else if (! strncmp (os_dev, "/dev/mapper/hpt37x_", 19))
|
|
||||||
- return 1;
|
|
||||||
- else if (! strncmp (os_dev, "/dev/mapper/hpt45x_", 19))
|
|
||||||
- return 1;
|
|
||||||
- else if (! strncmp (os_dev, "/dev/mapper/via_", 16))
|
|
||||||
- return 1;
|
|
||||||
- else if (! strncmp (os_dev, "/dev/mapper/lsi_", 16))
|
|
||||||
- return 1;
|
|
||||||
- else if (! strncmp (os_dev, "/dev/mapper/pdc_", 16))
|
|
||||||
- return 1;
|
|
||||||
- else if (! strncmp (os_dev, "/dev/mapper/jmicron_", 20))
|
|
||||||
- return 1;
|
|
||||||
- else if (! strncmp (os_dev, "/dev/mapper/asr_", 16))
|
|
||||||
- return 1;
|
|
||||||
- else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
|
|
||||||
- return 1;
|
|
||||||
- else if (! strncmp (os_dev, "/dev/mapper/ddf1_", 17))
|
|
||||||
- return 1;
|
|
||||||
-
|
|
||||||
- return 0;
|
|
||||||
+ if ((strncmp ("/dev/mapper/", os_dev, 12) != 0))
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+#ifdef HAVE_DEVICE_MAPPER
|
|
||||||
+ {
|
|
||||||
+ struct dm_tree *tree;
|
|
||||||
+ uint32_t maj, min;
|
|
||||||
+ struct dm_tree_node *node = NULL;
|
|
||||||
+ const char *node_uuid;
|
|
||||||
+ struct stat st;
|
|
||||||
+
|
|
||||||
+ if (stat (os_dev, &st) < 0)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ tree = dm_tree_create ();
|
|
||||||
+ if (! tree)
|
|
||||||
+ {
|
|
||||||
+ grub_printf ("Failed to create tree\n");
|
|
||||||
+ grub_dprintf ("hostdisk", "dm_tree_create failed\n");
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ maj = major (st.st_rdev);
|
|
||||||
+ min = minor (st.st_rdev);
|
|
||||||
+
|
|
||||||
+ if (! dm_tree_add_dev (tree, maj, min))
|
|
||||||
+ {
|
|
||||||
+ grub_dprintf ("hostdisk", "dm_tree_add_dev failed\n");
|
|
||||||
+ dm_tree_free (tree);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ node = dm_tree_find_node (tree, maj, min);
|
|
||||||
+ if (! node)
|
|
||||||
+ {
|
|
||||||
+ grub_dprintf ("hostdisk", "dm_tree_find_node failed\n");
|
|
||||||
+ dm_tree_free (tree);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ node_uuid = dm_tree_node_get_uuid (node);
|
|
||||||
+ if (! node_uuid)
|
|
||||||
+ {
|
|
||||||
+ grub_dprintf ("hostdisk", "%s has no DM uuid\n", os_dev);
|
|
||||||
+ dm_tree_free (tree);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ if (strncmp (node_uuid, "LVM-", 4) != 0)
|
|
||||||
+ {
|
|
||||||
+ dm_tree_free (tree);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ dm_tree_free (tree);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+#else
|
|
||||||
+ return 1;
|
|
||||||
+#endif /* HAVE_DEVICE_MAPPER */
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
@@ -671,13 +708,11 @@
|
|
||||||
return GRUB_DEV_ABSTRACTION_NONE;
|
|
||||||
|
|
||||||
/* Check for LVM. */
|
|
||||||
- if (!strncmp (os_dev, "/dev/mapper/", 12)
|
|
||||||
- && ! grub_util_is_dmraid (os_dev)
|
|
||||||
- && strncmp (os_dev, "/dev/mapper/mpath", 17) != 0)
|
|
||||||
+ if (grub_util_is_lvm (os_dev))
|
|
||||||
return GRUB_DEV_ABSTRACTION_LVM;
|
|
||||||
|
|
||||||
/* Check for RAID. */
|
|
||||||
- if (!strncmp (os_dev, "/dev/md", 7))
|
|
||||||
+ if (!strncmp (os_dev, "/dev/md", 7) && ! grub_util_device_is_mapped (os_dev))
|
|
||||||
return GRUB_DEV_ABSTRACTION_RAID;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
=== modified file 'grub-core/kern/emu/hostdisk.c'
|
|
||||||
--- grub-core/kern/emu/hostdisk.c 2011-05-09 16:59:35 +0000
|
|
||||||
+++ grub-core/kern/emu/hostdisk.c 2011-05-18 07:35:47 +0000
|
|
||||||
@@ -24,6 +24,7 @@
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/emu/misc.h>
|
|
||||||
#include <grub/emu/hostdisk.h>
|
|
||||||
+#include <grub/emu/getroot.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
#include <grub/list.h>
|
|
||||||
@@ -331,18 +332,23 @@
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
+int
|
|
||||||
+grub_util_device_is_mapped (const char *dev)
|
|
||||||
+{
|
|
||||||
#ifdef HAVE_DEVICE_MAPPER
|
|
||||||
-static int
|
|
||||||
-device_is_mapped (const char *dev)
|
|
||||||
-{
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
+ if (!grub_device_mapper_supported ())
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
if (stat (dev, &st) < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return dm_is_dm_major (major (st.st_rdev));
|
|
||||||
+#else
|
|
||||||
+ return 0;
|
|
||||||
+#endif /* HAVE_DEVICE_MAPPER */
|
|
||||||
}
|
|
||||||
-#endif /* HAVE_DEVICE_MAPPER */
|
|
||||||
|
|
||||||
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
|
|
||||||
/* FIXME: geom actually gives us the whole container hierarchy.
|
|
||||||
@@ -418,7 +424,7 @@
|
|
||||||
# endif /* !defined(HAVE_DIOCGDINFO) */
|
|
||||||
|
|
||||||
# ifdef HAVE_DEVICE_MAPPER
|
|
||||||
- if (grub_device_mapper_supported () && device_is_mapped (dev)) {
|
|
||||||
+ if (grub_util_device_is_mapped (dev)) {
|
|
||||||
struct dm_task *task = NULL;
|
|
||||||
grub_uint64_t start, length;
|
|
||||||
char *target_type, *params, *space;
|
|
||||||
@@ -1149,6 +1155,54 @@
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef HAVE_DEVICE_MAPPER
|
|
||||||
+static int
|
|
||||||
+grub_util_get_dm_node_linear_info (const char *dev,
|
|
||||||
+ int *maj, int *min)
|
|
||||||
+{
|
|
||||||
+ struct dm_task *dmt;
|
|
||||||
+ void *next = NULL;
|
|
||||||
+ uint64_t length, start;
|
|
||||||
+ char *target, *params;
|
|
||||||
+ char *ptr;
|
|
||||||
+ int major, minor;
|
|
||||||
+
|
|
||||||
+ dmt = dm_task_create(DM_DEVICE_TABLE);
|
|
||||||
+ if (!dmt)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ if (!dm_task_set_name(dmt, dev))
|
|
||||||
+ return 0;
|
|
||||||
+ dm_task_no_open_count(dmt);
|
|
||||||
+ if (!dm_task_run(dmt))
|
|
||||||
+ return 0;
|
|
||||||
+ next = dm_get_next_target(dmt, next, &start, &length,
|
|
||||||
+ &target, ¶ms);
|
|
||||||
+ if (grub_strcmp (target, "linear") != 0)
|
|
||||||
+ return 0;
|
|
||||||
+ major = grub_strtoul (params, &ptr, 10);
|
|
||||||
+ if (grub_errno)
|
|
||||||
+ {
|
|
||||||
+ grub_errno = GRUB_ERR_NONE;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ if (*ptr != ':')
|
|
||||||
+ return 0;
|
|
||||||
+ ptr++;
|
|
||||||
+ minor = grub_strtoul (ptr, 0, 10);
|
|
||||||
+ if (grub_errno)
|
|
||||||
+ {
|
|
||||||
+ grub_errno = GRUB_ERR_NONE;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ if (maj)
|
|
||||||
+ *maj = major;
|
|
||||||
+ if (min)
|
|
||||||
+ *min = minor;
|
|
||||||
+ return 1;
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
static char *
|
|
||||||
convert_system_partition_to_system_disk (const char *os_dev, struct stat *st)
|
|
||||||
{
|
|
||||||
@@ -1325,9 +1379,39 @@
|
|
||||||
node = NULL;
|
|
||||||
goto devmapper_out;
|
|
||||||
}
|
|
||||||
- else if (strncmp (node_uuid, "DMRAID-", 7) != 0)
|
|
||||||
- {
|
|
||||||
+ if (strncmp (node_uuid, "LVM-", 4) == 0)
|
|
||||||
+ {
|
|
||||||
+ grub_dprintf ("hostdisk", "%s is an LVM\n", path);
|
|
||||||
+ node = NULL;
|
|
||||||
+ goto devmapper_out;
|
|
||||||
+ }
|
|
||||||
+ if (strncmp (node_uuid, "mpath-", 6) == 0)
|
|
||||||
+ {
|
|
||||||
+ /* Multipath partitions have partN-mpath-* UUIDs, and are
|
|
||||||
+ linear mappings so are handled by
|
|
||||||
+ grub_util_get_dm_node_linear_info. Multipath disks are not
|
|
||||||
+ linear mappings and must be handled specially. */
|
|
||||||
+ grub_dprintf ("hostdisk", "%s is a multipath disk\n", path);
|
|
||||||
+ mapper_name = dm_tree_node_get_name (node);
|
|
||||||
+ goto devmapper_out;
|
|
||||||
+ }
|
|
||||||
+ if (strncmp (node_uuid, "DMRAID-", 7) != 0)
|
|
||||||
+ {
|
|
||||||
+ int major, minor;
|
|
||||||
+ const char *node_name;
|
|
||||||
grub_dprintf ("hostdisk", "%s is not DM-RAID\n", path);
|
|
||||||
+
|
|
||||||
+ if ((node_name = dm_tree_node_get_name (node))
|
|
||||||
+ && grub_util_get_dm_node_linear_info (node_name,
|
|
||||||
+ &major, &minor))
|
|
||||||
+ {
|
|
||||||
+ if (tree)
|
|
||||||
+ dm_tree_free (tree);
|
|
||||||
+ free (path);
|
|
||||||
+ char *ret = grub_find_device (NULL, (major << 8) | minor);
|
|
||||||
+ return ret;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
node = NULL;
|
|
||||||
goto devmapper_out;
|
|
||||||
}
|
|
||||||
|
|
||||||
--- include/grub/emu/misc.h 2010-12-02 13:26:46 +0000
|
|
||||||
+++ include/grub/emu/misc.h 2011-05-18 07:35:47 +0000
|
|
||||||
@@ -54,6 +54,8 @@
|
|
||||||
|
|
||||||
char *grub_make_system_path_relative_to_its_root (const char *path)
|
|
||||||
__attribute__ ((warn_unused_result));
|
|
||||||
+int
|
|
||||||
+grub_util_device_is_mapped (const char *dev);
|
|
||||||
|
|
||||||
void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
|
|
||||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
--- grub-core/kern/emu/getroot.c 2011-05-21 05:03:55 +0000
|
|
||||||
+++ grub-core/kern/emu/getroot.c 2011-06-23 17:50:41 +0000
|
|
||||||
@@ -616,13 +616,15 @@
|
|
||||||
|
|
||||||
if (os_dev)
|
|
||||||
{
|
|
||||||
- if (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) != 0)
|
|
||||||
+ int dm = (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) == 0);
|
|
||||||
+ int root = (strcmp (os_dev, "/dev/root") == 0);
|
|
||||||
+ if (!dm && !root)
|
|
||||||
return os_dev;
|
|
||||||
if (stat (os_dev, &st) < 0)
|
|
||||||
grub_util_error ("cannot stat `%s'", os_dev);
|
|
||||||
free (os_dev);
|
|
||||||
dev = st.st_rdev;
|
|
||||||
- return grub_find_device ("/dev/mapper", dev);
|
|
||||||
+ return grub_find_device (dm ? "/dev/mapper" : "/dev", dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stat (dir, &st) < 0)
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
--- grub-core/kern/emu/getroot.c 2011-06-23 17:50:41 +0000
|
|
||||||
+++ grub-core/kern/emu/getroot.c 2011-06-24 02:32:54 +0000
|
|
||||||
@@ -620,11 +620,13 @@
|
|
||||||
int root = (strcmp (os_dev, "/dev/root") == 0);
|
|
||||||
if (!dm && !root)
|
|
||||||
return os_dev;
|
|
||||||
- if (stat (os_dev, &st) < 0)
|
|
||||||
- grub_util_error ("cannot stat `%s'", os_dev);
|
|
||||||
+ if (stat (os_dev, &st) >= 0)
|
|
||||||
+ {
|
|
||||||
+ free (os_dev);
|
|
||||||
+ dev = st.st_rdev;
|
|
||||||
+ return grub_find_device (dm ? "/dev/mapper" : "/dev", dev);
|
|
||||||
+ }
|
|
||||||
free (os_dev);
|
|
||||||
- dev = st.st_rdev;
|
|
||||||
- return grub_find_device (dm ? "/dev/mapper" : "/dev", dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stat (dir, &st) < 0)
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
|
|
||||||
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
|
|
||||||
# If you are not using Genkernel and you need help creating this file, you
|
|
||||||
# should consult the handbook. Alternatively, consult the grub.conf.sample that
|
|
||||||
# is included with the Grub documentation.
|
|
||||||
|
|
||||||
default 0
|
|
||||||
timeout 30
|
|
||||||
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
|
|
||||||
|
|
||||||
#title Gentoo Linux 2.6.24-r5
|
|
||||||
#root (hd0,0)
|
|
||||||
#kernel /boot/kernel-genkernel-x86-2.6.24-gentoo-r5 root=/dev/ram0 real_root=/dev/sda3
|
|
||||||
#initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r5
|
|
||||||
|
|
||||||
# vim:ft=conf:
|
|
@ -1,36 +0,0 @@
|
|||||||
# Copyright 1999-2011 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default,v 1.2 2011/08/30 06:45:04 scarabeus Exp $
|
|
||||||
#
|
|
||||||
# To populate all changes in this file you need to regenerate your
|
|
||||||
# grub configuration file afterwards:
|
|
||||||
# 'grub2-mkconfig -o /boot/grub2/grub.cfg'
|
|
||||||
#
|
|
||||||
# See the grub info page for documentation on possible variables and
|
|
||||||
# their associated values.
|
|
||||||
|
|
||||||
GRUB_DEFAULT=0
|
|
||||||
GRUB_HIDDEN_TIMEOUT=0
|
|
||||||
GRUB_HIDDEN_TIMEOUT_QUIET=true
|
|
||||||
GRUB_TIMEOUT=10
|
|
||||||
|
|
||||||
GRUB_CMDLINE_LINUX_DEFAULT=""
|
|
||||||
GRUB_CMDLINE_LINUX=""
|
|
||||||
|
|
||||||
# Uncomment to disable graphical terminal (grub-pc only)
|
|
||||||
#GRUB_TERMINAL=console
|
|
||||||
|
|
||||||
# The resolution used on graphical terminal.
|
|
||||||
# Note that you can use only modes which your graphic card supports via VBE.
|
|
||||||
# You can see them in real GRUB with the command `vbeinfo'.
|
|
||||||
#GRUB_GFXMODE=640x480
|
|
||||||
|
|
||||||
# Background image used on graphical terminal.
|
|
||||||
# Can be in various bitmap formats.
|
|
||||||
#GRUB_BACKGROUND="/boot/grub2/mybackground.png"
|
|
||||||
|
|
||||||
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
|
|
||||||
#GRUB_DISABLE_LINUX_UUID=true
|
|
||||||
|
|
||||||
# Uncomment to disable generation of recovery mode menu entries
|
|
||||||
#GRUB_DISABLE_RECOVERY=true
|
|
@ -1,338 +0,0 @@
|
|||||||
# Copyright 1999-2011 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-1.99-r2.ebuild,v 1.8 2011/11/18 00:04:29 vapier Exp $
|
|
||||||
|
|
||||||
EAPI=4
|
|
||||||
|
|
||||||
if [[ ${PV} == "9999" ]] ; then
|
|
||||||
EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
|
|
||||||
LIVE_ECLASS="bzr"
|
|
||||||
SRC_URI=""
|
|
||||||
DO_AUTORECONF="true"
|
|
||||||
else
|
|
||||||
MY_P=${P/_/\~}
|
|
||||||
SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
|
|
||||||
mirror://gentoo/${MY_P}.tar.xz"
|
|
||||||
# Masked until documentation guys consolidate the guide and approve
|
|
||||||
# it for usage.
|
|
||||||
#KEYWORDS="~amd64 ~mips ~x86"
|
|
||||||
S=${WORKDIR}/${MY_P}
|
|
||||||
fi
|
|
||||||
|
|
||||||
inherit mount-boot eutils flag-o-matic pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
|
|
||||||
unset LIVE_ECLASS
|
|
||||||
|
|
||||||
DESCRIPTION="GNU GRUB boot loader"
|
|
||||||
HOMEPAGE="http://www.gnu.org/software/grub/"
|
|
||||||
|
|
||||||
LICENSE="GPL-3"
|
|
||||||
SLOT="2"
|
|
||||||
IUSE="custom-cflags debug device-mapper efiemu nls static sdl truetype"
|
|
||||||
|
|
||||||
GRUB_PLATFORMS=(
|
|
||||||
# everywhere:
|
|
||||||
emu
|
|
||||||
# mips only:
|
|
||||||
qemu-mips yeeloong
|
|
||||||
# amd64, x86, ppc, ppc64:
|
|
||||||
ieee1275
|
|
||||||
# amd64, x86:
|
|
||||||
coreboot multiboot efi-32 pc qemu
|
|
||||||
# amd64:
|
|
||||||
efi-64
|
|
||||||
)
|
|
||||||
IUSE+=" ${GRUB_PLATFORMS[@]/#/grub_platforms_}"
|
|
||||||
|
|
||||||
# os-prober: Used on runtime to detect other OSes
|
|
||||||
# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
|
|
||||||
RDEPEND="
|
|
||||||
dev-libs/libisoburn
|
|
||||||
dev-libs/lzo
|
|
||||||
sys-boot/os-prober
|
|
||||||
>=sys-libs/ncurses-5.2-r5
|
|
||||||
debug? (
|
|
||||||
sdl? ( media-libs/libsdl )
|
|
||||||
)
|
|
||||||
device-mapper? ( >=sys-fs/lvm2-2.02.45 )
|
|
||||||
truetype? ( media-libs/freetype >=media-fonts/unifont-5 )"
|
|
||||||
DEPEND="${RDEPEND}
|
|
||||||
>=dev-lang/python-2.5.2
|
|
||||||
sys-devel/flex
|
|
||||||
virtual/yacc
|
|
||||||
sys-apps/texinfo
|
|
||||||
"
|
|
||||||
if [[ -n ${DO_AUTORECONF} ]] ; then
|
|
||||||
DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man"
|
|
||||||
else
|
|
||||||
DEPEND+=" app-arch/xz-utils"
|
|
||||||
fi
|
|
||||||
|
|
||||||
export STRIP_MASK="*/grub*/*/*.{mod,img}"
|
|
||||||
QA_EXECSTACK="
|
|
||||||
lib64/grub2/*/setjmp.mod
|
|
||||||
lib64/grub2/*/kernel.img
|
|
||||||
sbin/grub2-probe
|
|
||||||
sbin/grub2-setup
|
|
||||||
sbin/grub2-mkdevicemap
|
|
||||||
bin/grub2-script-check
|
|
||||||
bin/grub2-fstest
|
|
||||||
bin/grub2-mklayout
|
|
||||||
bin/grub2-menulst2cfg
|
|
||||||
bin/grub2-mkrelpath
|
|
||||||
bin/grub2-mkpasswd-pbkdf2
|
|
||||||
bin/grub2-mkfont
|
|
||||||
bin/grub2-editenv
|
|
||||||
bin/grub2-mkimage
|
|
||||||
"
|
|
||||||
|
|
||||||
QA_WX_LOAD="
|
|
||||||
lib*/grub2/*/kernel.img
|
|
||||||
lib*/grub2/*/setjmp.mod
|
|
||||||
"
|
|
||||||
|
|
||||||
grub_run_phase() {
|
|
||||||
local phase=$1
|
|
||||||
local platform=$2
|
|
||||||
[[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]"
|
|
||||||
|
|
||||||
[[ -d "${WORKDIR}/build-${platform}" ]] || \
|
|
||||||
{ mkdir "${WORKDIR}/build-${platform}" || die ; }
|
|
||||||
pushd "${WORKDIR}/build-${platform}" > /dev/null || die
|
|
||||||
|
|
||||||
echo ">>> Running ${phase} for platform \"${platform}\""
|
|
||||||
echo ">>> Working in: \"${WORKDIR}/build-${platform}\""
|
|
||||||
|
|
||||||
grub_${phase} ${platform}
|
|
||||||
|
|
||||||
popd > /dev/null || die
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_src_configure() {
|
|
||||||
local platform=$1
|
|
||||||
local target
|
|
||||||
|
|
||||||
[[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
|
|
||||||
|
|
||||||
# if we have no platform then --with-platform=guessed does not work
|
|
||||||
[[ ${platform} == "guessed" ]] && platform=""
|
|
||||||
|
|
||||||
# check if we have to specify the target (EFI)
|
|
||||||
# or just append correct --with-platform
|
|
||||||
if [[ -n ${platform} ]]; then
|
|
||||||
if [[ ${platform} == efi* ]]; then
|
|
||||||
# EFI platform hack
|
|
||||||
[[ ${platform/*-} == 32 ]] && target=i386
|
|
||||||
[[ ${platform/*-} == 64 ]] && target=x86_64
|
|
||||||
# program-prefix is required empty because otherwise it is equal to
|
|
||||||
# target variable, which we do not want at all
|
|
||||||
platform="
|
|
||||||
--with-platform=${platform/-*}
|
|
||||||
--target=${target}
|
|
||||||
--program-prefix=
|
|
||||||
"
|
|
||||||
else
|
|
||||||
platform=" --with-platform=${platform}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
ECONF_SOURCE="${WORKDIR}/${P}/" \
|
|
||||||
econf \
|
|
||||||
--disable-werror \
|
|
||||||
--sbindir=/sbin \
|
|
||||||
--bindir=/bin \
|
|
||||||
--libdir=/$(get_libdir) \
|
|
||||||
--program-transform-name=s,grub,grub2, \
|
|
||||||
$(use_enable debug mm-debug) \
|
|
||||||
$(use_enable debug grub-emu-usb) \
|
|
||||||
$(use_enable device-mapper) \
|
|
||||||
$(use_enable efiemu) \
|
|
||||||
$(use_enable nls) \
|
|
||||||
$(use_enable truetype grub-mkfont) \
|
|
||||||
$(use sdl && use_enable debug grub-emu-sdl) \
|
|
||||||
${platform}
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_src_compile() {
|
|
||||||
default_src_compile
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_src_install() {
|
|
||||||
default_src_install
|
|
||||||
}
|
|
||||||
|
|
||||||
src_prepare() {
|
|
||||||
local i j archs
|
|
||||||
|
|
||||||
epatch \
|
|
||||||
"${FILESDIR}/1.99-call_proper_grub_probe.patch" \
|
|
||||||
"${FILESDIR}/1.99-improve_devmapper.patch" \
|
|
||||||
"${FILESDIR}/1.99-do_not_stat_so_often.patch" \
|
|
||||||
"${FILESDIR}/1.99-stat_root_device_properly-p1.patch" \
|
|
||||||
"${FILESDIR}/1.99-stat_root_device_properly-p2.patch"
|
|
||||||
|
|
||||||
epatch_user
|
|
||||||
|
|
||||||
# fix texinfo file name, as otherwise the grub2.info file will be
|
|
||||||
# useless
|
|
||||||
sed -i \
|
|
||||||
-e '/setfilename/s:grub.info:grub2.info:' \
|
|
||||||
-e 's:(grub):(grub2):' \
|
|
||||||
"${S}"/docs/grub.texi
|
|
||||||
|
|
||||||
# autogen.sh does more than just run autotools
|
|
||||||
if [[ -n ${DO_AUTORECONF} ]] ; then
|
|
||||||
sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
|
|
||||||
(. ./autogen.sh) || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# install into the right dir for eselect #372735
|
|
||||||
sed -i \
|
|
||||||
-e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
|
|
||||||
util/bash-completion.d/Makefile.in || die
|
|
||||||
|
|
||||||
# get enabled platforms
|
|
||||||
GRUB_ENABLED_PLATFORMS=""
|
|
||||||
for i in ${GRUB_PLATFORMS[@]}; do
|
|
||||||
use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
|
|
||||||
done
|
|
||||||
[[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
|
|
||||||
elog "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
|
|
||||||
}
|
|
||||||
|
|
||||||
src_configure() {
|
|
||||||
local i
|
|
||||||
|
|
||||||
use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
|
|
||||||
use static && append-ldflags -static
|
|
||||||
|
|
||||||
for i in ${GRUB_ENABLED_PLATFORMS}; do
|
|
||||||
grub_run_phase ${FUNCNAME} ${i}
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
src_compile() {
|
|
||||||
local i
|
|
||||||
|
|
||||||
for i in ${GRUB_ENABLED_PLATFORMS}; do
|
|
||||||
grub_run_phase ${FUNCNAME} ${i}
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
src_install() {
|
|
||||||
local i
|
|
||||||
|
|
||||||
for i in ${GRUB_ENABLED_PLATFORMS}; do
|
|
||||||
grub_run_phase ${FUNCNAME} ${i}
|
|
||||||
done
|
|
||||||
|
|
||||||
# No need to move the info file with the live ebuild since we
|
|
||||||
# already changed the generated file name during the preparation
|
|
||||||
# phase.
|
|
||||||
if [[ ${PV} != "9999" ]]; then
|
|
||||||
# slot all collisions with grub legacy
|
|
||||||
mv "${ED}"/usr/share/info/grub.info \
|
|
||||||
"${ED}"/usr/share/info/grub2.info || die
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Do pax marking
|
|
||||||
local PAX=(
|
|
||||||
"sbin/grub2-probe"
|
|
||||||
"sbin/grub2-setup"
|
|
||||||
"sbin/grub2-mkdevicemap"
|
|
||||||
"bin/grub2-script-check"
|
|
||||||
"bin/grub2-fstest"
|
|
||||||
"bin/grub2-mklayout"
|
|
||||||
"bin/grub2-menulst2cfg"
|
|
||||||
"bin/grub2-mkrelpath"
|
|
||||||
"bin/grub2-mkpasswd-pbkdf2"
|
|
||||||
"bin/grub2-editenv"
|
|
||||||
"bin/grub2-mkimage"
|
|
||||||
)
|
|
||||||
for e in ${PAX[@]}; do
|
|
||||||
pax-mark -mp "${ED}/${e}"
|
|
||||||
done
|
|
||||||
|
|
||||||
# can't be in docs array as we use default_src_install in different builddir
|
|
||||||
dodoc AUTHORS ChangeLog NEWS README THANKS TODO
|
|
||||||
insinto /etc/default
|
|
||||||
newins "${FILESDIR}"/grub.default grub
|
|
||||||
cat <<EOF >> "${ED}"/lib*/grub2/grub-mkconfig_lib
|
|
||||||
GRUB_DISTRIBUTOR="Gentoo"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
elog
|
|
||||||
elog "To configure GRUB 2, check the defaults in /etc/default/grub and"
|
|
||||||
elog "then run 'emerge --config =${CATEGORY}/${PF}'."
|
|
||||||
|
|
||||||
# display the link to guide
|
|
||||||
show_doc_url
|
|
||||||
}
|
|
||||||
|
|
||||||
show_doc_url() {
|
|
||||||
elog
|
|
||||||
elog "For informations how to configure grub-2 please refer to the guide:"
|
|
||||||
elog " http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_boot_dir() {
|
|
||||||
local dir=$1
|
|
||||||
local use_legacy='n'
|
|
||||||
|
|
||||||
# Make sure target directory exists
|
|
||||||
mkdir -p "${dir}"
|
|
||||||
|
|
||||||
if [[ -e ${dir/2/}/menu.lst ]] ; then
|
|
||||||
# Legacy config exists, ask user what to do
|
|
||||||
einfo "Found legacy GRUB configuration. Do you want to convert it"
|
|
||||||
einfo "instead of using autoconfig (y/N)?"
|
|
||||||
read use_legacy
|
|
||||||
|
|
||||||
use_legacy=${use_legacy,,[A-Z]}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${use_legacy} == y* ]] ; then
|
|
||||||
grub1_cfg=${dir/2/}/menu.lst
|
|
||||||
grub2_cfg=${dir}/grub.cfg
|
|
||||||
|
|
||||||
# GRUB legacy configuration exists. Use it instead of doing
|
|
||||||
# our normal autoconfigure.
|
|
||||||
#
|
|
||||||
|
|
||||||
einfo "Converting legacy config at '${grub1_cfg}' for use by GRUB2."
|
|
||||||
ebegin "Running: grub2-menulst2cfg '${grub1_cfg}' '${grub2_cfg}'"
|
|
||||||
grub2-menulst2cfg "${grub1_cfg}" "${grub2_cfg}" &> /dev/null
|
|
||||||
eend $?
|
|
||||||
|
|
||||||
ewarn
|
|
||||||
ewarn "Even though the conversion above succeeded, you are STRONGLY"
|
|
||||||
ewarn "URGED to upgrade to the new GRUB2 configuration format."
|
|
||||||
|
|
||||||
# Remind the user about the documentation
|
|
||||||
show_doc_url
|
|
||||||
else
|
|
||||||
# Run GRUB 2 autoconfiguration
|
|
||||||
einfo "Running GRUB 2 autoconfiguration."
|
|
||||||
ebegin "grub2-mkconfig -o '${dir}/grub.cfg'"
|
|
||||||
grub2-mkconfig -o "${dir}/grub.cfg" &> /dev/null
|
|
||||||
eend $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
einfo
|
|
||||||
einfo "Remember to run grub2-install to activate GRUB2 as your default"
|
|
||||||
einfo "bootloader."
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_config() {
|
|
||||||
local dir
|
|
||||||
|
|
||||||
mount-boot_mount_boot_partition
|
|
||||||
|
|
||||||
einfo "Enter the directory where you want to setup grub2 ('${ROOT}boot/grub2/'):"
|
|
||||||
read dir
|
|
||||||
|
|
||||||
[[ -z ${dir} ]] && dir="${ROOT}"boot/grub2
|
|
||||||
|
|
||||||
setup_boot_dir "${dir}"
|
|
||||||
|
|
||||||
mount-boot_pkg_postinst
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user