summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/grub
diff options
context:
space:
mode:
authorJesse Zhang <sen.zhang@windriver.com>2012-07-18 17:25:49 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-19 17:22:27 +0100
commitd36fa9a8835cd5aa6e14800d862b1a9da4dae30a (patch)
tree0a3ac08827f3c2de4c6485aa7334d6e3054dda5a /meta/recipes-bsp/grub
parent8adc595dd998f95563188ed72196daac2911951b (diff)
downloadpoky-d36fa9a8835cd5aa6e14800d862b1a9da4dae30a.tar.gz
grub: fix error stating the root device
grub-mkconfig (and possibly other commands) complains: error: cannot stat /dev/root Backport an upstream patch to fix the error. [YOCTO #2777] (From OE-Core rev: 5b7da937cd298abd6f8f0eecfede2810b157179f) Signed-off-by: Jesse Zhang <sen.zhang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-bsp/grub')
-rw-r--r--meta/recipes-bsp/grub/grub-1.99/grub-1.99-lazy_stat.patch64
-rw-r--r--meta/recipes-bsp/grub/grub_1.99.bb3
2 files changed, 66 insertions, 1 deletions
diff --git a/meta/recipes-bsp/grub/grub-1.99/grub-1.99-lazy_stat.patch b/meta/recipes-bsp/grub/grub-1.99/grub-1.99-lazy_stat.patch
new file mode 100644
index 0000000000..cde8b87a47
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-1.99/grub-1.99-lazy_stat.patch
@@ -0,0 +1,64 @@
1Upstream-Status: Backport
2
3Patch is a slightly edited version from debian. Upstream link is:
4http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/3318
5
6Description: Don't stat devices unless we have to
7Author: Vladimir Serbinenko <phcoder@gmail.com>
8Author: Colin Watson <cjwatson@ubuntu.com>
9Bug-Debian: http://bugs.debian.org/627587
10Forwarded: yes
11Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3318
12Last-Update: 2011-05-31
13
14Index: b/grub-core/kern/emu/getroot.c
15===================================================================
16--- a/grub-core/kern/emu/getroot.c
17+++ b/grub-core/kern/emu/getroot.c
18@@ -358,7 +358,7 @@
19
20 if (S_ISLNK (st.st_mode)) {
21 #ifdef __linux__
22- if (strcmp (dir, "mapper") == 0) {
23+ if (strcmp (dir, "mapper") == 0 || strcmp (dir, "/dev/mapper") == 0) {
24 /* Follow symbolic links under /dev/mapper/; the canonical name
25 may be something like /dev/dm-0, but the names under
26 /dev/mapper/ are more human-readable and so we prefer them if
27@@ -609,20 +609,27 @@
28
29 if (os_dev)
30 {
31- if (stat (os_dev, &st) >= 0)
32- dev = st.st_rdev;
33- else
34- grub_util_error ("cannot stat `%s'", os_dev);
35- free (os_dev);
36+ char *tmp = os_dev;
37+ os_dev = canonicalize_file_name (os_dev);
38+ free (tmp);
39 }
40- else
41+
42+ if (os_dev)
43 {
44- if (stat (dir, &st) >= 0)
45- dev = st.st_dev;
46- else
47- grub_util_error ("cannot stat `%s'", dir);
48+ if (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) != 0)
49+ return os_dev;
50+ if (stat (os_dev, &st) < 0)
51+ grub_util_error ("cannot stat `%s'", os_dev);
52+ free (os_dev);
53+ dev = st.st_rdev;
54+ return grub_find_device ("/dev/mapper", dev);
55 }
56
57+ if (stat (dir, &st) < 0)
58+ grub_util_error ("cannot stat `%s'", dir);
59+
60+ dev = st.st_dev;
61+
62 #ifdef __CYGWIN__
63 /* Cygwin specific function. */
64 os_dev = grub_find_device (dir, dev);
diff --git a/meta/recipes-bsp/grub/grub_1.99.bb b/meta/recipes-bsp/grub/grub_1.99.bb
index 1009ce899f..f1ed7ca6a5 100644
--- a/meta/recipes-bsp/grub/grub_1.99.bb
+++ b/meta/recipes-bsp/grub/grub_1.99.bb
@@ -13,7 +13,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
13 13
14DEPENDS = "autogen-native" 14DEPENDS = "autogen-native"
15RDEPENDS_${PN} = "diffutils freetype" 15RDEPENDS_${PN} = "diffutils freetype"
16PR = "r10" 16PR = "r11"
17 17
18SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ 18SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
19 file://grub-install.in.patch \ 19 file://grub-install.in.patch \
@@ -24,6 +24,7 @@ SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
24 file://grub-1.99-gcc-4.7.0-strict-aliasing-errors.patch \ 24 file://grub-1.99-gcc-4.7.0-strict-aliasing-errors.patch \
25 file://grub-1.99-fix-enable_execute_stack-check.patch \ 25 file://grub-1.99-fix-enable_execute_stack-check.patch \
26 file://remove-gets.patch \ 26 file://remove-gets.patch \
27 file://grub-1.99-lazy_stat.patch \
27 file://40_custom" 28 file://40_custom"
28 29
29SRC_URI[md5sum] = "ca9f2a2d571b57fc5c53212d1d22e2b5" 30SRC_URI[md5sum] = "ca9f2a2d571b57fc5c53212d1d22e2b5"