All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Zhang <sen.zhang@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH 2/2] grub: fix error stating the root device
Date: Tue, 17 Jul 2012 15:28:58 +0800	[thread overview]
Message-ID: <1342510138-21888-3-git-send-email-sen.zhang@windriver.com> (raw)
In-Reply-To: <1342510138-21888-1-git-send-email-sen.zhang@windriver.com>

grub-mkconfig (and possibly other commands) complains:
    error: cannot stat /dev/root

Backport an upstream patch to fix the error.

[YOCTO #2777]

Signed-off-by: Jesse Zhang <sen.zhang@windriver.com>
---
 .../grub/grub-1.99/grub-1.99-lazy_stat.patch       |   64 ++++++++++++++++++++
 meta/recipes-bsp/grub/grub_1.99.bb                 |    3 +-
 2 files changed, 66 insertions(+), 1 deletions(-)
 create mode 100644 meta/recipes-bsp/grub/grub-1.99/grub-1.99-lazy_stat.patch

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 0000000..cde8b87
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-1.99/grub-1.99-lazy_stat.patch
@@ -0,0 +1,64 @@
+Upstream-Status: Backport
+
+Patch is a slightly edited version from debian. Upstream link is:
+http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/3318
+
+Description: Don't stat devices unless we have to
+Author: Vladimir Serbinenko <phcoder@gmail.com>
+Author: Colin Watson <cjwatson@ubuntu.com>
+Bug-Debian: http://bugs.debian.org/627587
+Forwarded: yes
+Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3318
+Last-Update: 2011-05-31
+
+Index: b/grub-core/kern/emu/getroot.c
+===================================================================
+--- a/grub-core/kern/emu/getroot.c
++++ b/grub-core/kern/emu/getroot.c
+@@ -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
+-	grub_util_error ("cannot stat `%s'", os_dev);
+-      free (os_dev);
++      char *tmp = os_dev;
++      os_dev = canonicalize_file_name (os_dev);
++      free (tmp);
+     }
+-  else
++
++  if (os_dev)
+     {
+-      if (stat (dir, &st) >= 0)
+-	dev = st.st_dev;
+-      else
+-	grub_util_error ("cannot stat `%s'", dir);
++      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);
++      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);
diff --git a/meta/recipes-bsp/grub/grub_1.99.bb b/meta/recipes-bsp/grub/grub_1.99.bb
index fc7017d..c38f214 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"
 
 DEPENDS = "autogen-native"
 RDEPENDS_${PN} = "diffutils freetype"
-PR = "r9"
+PR = "r10"
 
 SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
           file://grub-install.in.patch \
@@ -23,6 +23,7 @@ SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
           file://grub-1.99-gcc-4.7.0-uninitialized-var-errors.patch \
           file://grub-1.99-gcc-4.7.0-strict-aliasing-errors.patch \
           file://grub-1.99-fix-enable_execute_stack-check.patch \
+          file://grub-1.99-lazy_stat.patch \
           file://40_custom"
 
 SRC_URI[md5sum] = "ca9f2a2d571b57fc5c53212d1d22e2b5"
-- 
1.7.7




  parent reply	other threads:[~2012-07-17  7:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-17  7:28 [PATCH 0/2] grub: two backported patch for bug 2777 Jesse Zhang
2012-07-17  7:28 ` [PATCH 1/2] grub: fix grub-mkconfig_lib install dir Jesse Zhang
2012-07-17  7:28 ` Jesse Zhang [this message]
2012-07-17 18:41 ` [PATCH 0/2] grub: two backported patch for bug 2777 Saul Wold
2012-07-18  1:44   ` Jesse Zhang
2012-07-18  9:25   ` [PATCH v2 " Jesse Zhang
2012-07-18  9:25     ` [PATCH 1/2] grub: fix grub-mkconfig_lib install dir Jesse Zhang
2012-07-18  9:25     ` [PATCH 2/2] grub: fix error stating the root device Jesse Zhang
2012-07-20  4:23     ` [PATCH v2 0/2] grub: two backported patch for bug 2777 Saul Wold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342510138-21888-3-git-send-email-sen.zhang@windriver.com \
    --to=sen.zhang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.