Skip to contentSkip to conversation

busybox: fix udhcp check for NFS rootfs for new style /proc/mounts

PATCH In review Denys Dmytriyenko 3 participants 4 messages Feb 24, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 busybox: fix udhcp check for NFS rootfs for new style /proc/mounts

From: Denys Dmytriyenko <[email protected]>

* Newer kernels change the format of /proc/mounts slightly when rootfs is mounted over NFS.

* Old style:
/dev/root / nfs <options> 0 0

* New style:
<server>:<mount> / nfs <options> 0 0

* The regexp in grep can be simplified and rolled into one, but may become less strict...

---
 .../busybox-1.13.2/udhcpc-new-nfsroot.patch        |   16 ++++++++++++++++
 .../busybox-1.18.3/udhcpc-new-nfsroot.patch        |   16 ++++++++++++++++
 recipes/busybox/busybox_1.13.2.bb                  |    2 +-
 recipes/busybox/busybox_1.18.3.bb                  |    2 +-
 recipes/busybox/busybox_1.1x.inc                   |    1 +
 5 files changed, 35 insertions(+), 2 deletions(-)
 create mode 100644 recipes/busybox/busybox-1.13.2/udhcpc-new-nfsroot.patch
 create mode 100644 recipes/busybox/busybox-1.18.3/udhcpc-new-nfsroot.patch
recipes/busybox/busybox-1.13.2/udhcpc-new-nfsroot.patch new file +16 -0
new file mode 100644
index 0000000..46aaab9
@@ -0,0 +1,16 @@
+diff -uNr busybox-1.13.2.orig/examples/udhcp/simple.script busybox-1.13.2/examples/udhcp/simple.script
+--- busybox-1.13.2.orig/examples/udhcp/simple.script	2011-02-23 00:30:32.000000000 -0500
++++ busybox-1.13.2/examples/udhcp/simple.script	2011-02-23 17:05:37.873381763 -0500
+@@ -10,7 +10,12 @@
+ 
+ # return 0 if root is mounted on a network filesystem
+ root_is_nfs() {
++	# old style mounts
+ 	grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++	if ! $? ; then
++		# new style mounts
++		grep -qe '^.*:.* / \(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++	fi
+ }
+ 
+ case "$1" in
recipes/busybox/busybox-1.18.3/udhcpc-new-nfsroot.patch new file +16 -0
new file mode 100644
index 0000000..46aaab9
@@ -0,0 +1,16 @@
+diff -uNr busybox-1.13.2.orig/examples/udhcp/simple.script busybox-1.13.2/examples/udhcp/simple.script
+--- busybox-1.13.2.orig/examples/udhcp/simple.script	2011-02-23 00:30:32.000000000 -0500
++++ busybox-1.13.2/examples/udhcp/simple.script	2011-02-23 17:05:37.873381763 -0500
+@@ -10,7 +10,12 @@
+ 
+ # return 0 if root is mounted on a network filesystem
+ root_is_nfs() {
++	# old style mounts
+ 	grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++	if ! $? ; then
++		# new style mounts
++		grep -qe '^.*:.* / \(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++	fi
+ }
+ 
+ case "$1" in
recipes/busybox/busybox_1.13.2.bb +1 -1
index ef20c62..fca3e93 100644
@@ -1,5 +1,5 @@
 require busybox_1.1x.inc
-PR = "${INC_PR}.3"
+PR = "${INC_PR}.4"
 
 SRC_URI += "\
   file://busybox-1.13.2-awk.patch \
recipes/busybox/busybox_1.18.3.bb +1 -1
index 633b70b..f85de86 100644
@@ -1,5 +1,5 @@
 require busybox_1.1x.inc
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 
 SRC_URI += " \
 	http://busybox.net/downloads/fixes-1.18.3/busybox-1.18.3-buildsys.patch;name=patch01 \
recipes/busybox/busybox_1.1x.inc +1 -0
index 7623944..aefa57f 100644
@@ -5,6 +5,7 @@ SRC_URI = "\
   file://fdisk_nios2.patch \
   file://udhcpscript.patch \
   file://udhcpc-fix-nfsroot.patch \
+  file://udhcpc-new-nfsroot.patch \
   file://B921600.patch \
   file://get_header_tar.patch \
   file://busybox-appletlib-dependency.patch \
Signature · 1 line
1.7.0.4
#1 lore raw

Hello Denys,

Quoted 9 lines · Denys Dmytriyenko
recipes/busybox/busybox-1.13.2/udhcpc-new-nfsroot.patch new file +3 -0
new file mode 100644
index 0000000..46aaab9
@@ -0,0 +1,16 @@
+diff -uNr busybox-1.13.2.orig/examples/udhcp/simple.script busybox-1.13.2/examples/udhcp/simple.script
+--- busybox-1.13.2.orig/examples/udhcp/simple.script	2011-02-23 00:30:32.000000000 -0500
++++ busybox-1.13.2/examples/udhcp/simple.script	2011-02-23 17:05:37.873381763 -0500

recipes/busybox/busybox-1.13.2/udhcpc-new-nfsroot.patch line 13

Quoted 10 lines
recipes/busybox/busybox-1.13.2/udhcpc-new-nfsroot.patch new file +10 -0
+@@ -10,7 +10,12 @@
+ 
+ # return 0 if root is mounted on a network filesystem
+ root_is_nfs() {
++	# old style mounts
+ 	grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++	if ! $? ; then
++		# new style mounts
++		grep -qe '^.*:.* / \(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++	fi

Would "grep -qe '^\S\+ / \(nfs\|smbfs\|ncp\|coda\) ' /proc/mounts" work for both cases?

recipes/busybox/busybox_1.1x.inc SRC_URI = "\ · line 8

Quoted 9 lines
recipes/busybox/busybox_1.1x.inc +1 -0
index 7623944..aefa57f 100644
@@ -5,6 +5,7 @@ SRC_URI = "\
   file://fdisk_nios2.patch \
   file://udhcpscript.patch \
   file://udhcpc-fix-nfsroot.patch \
+  file://udhcpc-new-nfsroot.patch \

Should the two patches above be merged into a single patch?

Regards,
Andreas

#2 lore raw
Quoted 17 lines · Andreas Oberritter

Hello Denys,

Quoted 14 lines · Denys Dmytriyenko
recipes/busybox/busybox-1.13.2/udhcpc-new-nfsroot.patch new file +8 -0
new file mode 100644
index 0000000..46aaab9
@@ -0,0 +1,16 @@
+diff -uNr busybox-1.13.2.orig/examples/udhcp/simple.script busybox-1.13.2/examples/udhcp/simple.script
+--- busybox-1.13.2.orig/examples/udhcp/simple.script	2011-02-23 00:30:32.000000000 -0500
++++ busybox-1.13.2/examples/udhcp/simple.script	2011-02-23 17:05:37.873381763 -0500
+@@ -10,7 +10,12 @@
+ 
+ # return 0 if root is mounted on a network filesystem
+ root_is_nfs() {
++	# old style mounts
Quoted 8 lines

recipes/busybox/busybox-1.13.2/udhcpc-new-nfsroot.patch line 13

Quoted 5 lines
recipes/busybox/busybox-1.13.2/udhcpc-new-nfsroot.patch new file +5 -0
+ 	grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++	if ! $? ; then
++		# new style mounts
++		grep -qe '^.*:.* / \(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++	fi

Would "grep -qe '^\S\+ / \(nfs\|smbfs\|ncp\|coda\) ' /proc/mounts" work for both cases?

Andreas,

As I mentioned in the patch description:

* The regexp in grep can be simplified and rolled into one, but may become less strict...

So, it's definitely possible, but I was worried the regexp would become too loose and return false positives. Plus, I'm not sure how \S\+ would work on spaces in the pathname, such as My\ Documents.

Quoted 11 lines

recipes/busybox/busybox_1.1x.inc SRC_URI = "\ · line 8

Quoted 9 lines
recipes/busybox/busybox_1.1x.inc +1 -0
index 7623944..aefa57f 100644
@@ -5,6 +5,7 @@ SRC_URI = "\
   file://fdisk_nios2.patch \
   file://udhcpscript.patch \
   file://udhcpc-fix-nfsroot.patch \
+  file://udhcpc-new-nfsroot.patch \

Should the two patches above be merged into a single patch?

That can be done, if people feel strongly about it...

Signature · 1 line
Denys
Acked-by on v1 1/1
#3 lore raw
In reply to Denys Dmytriyenko
Quoted 8 lines · Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

* Newer kernels change the format of /proc/mounts slightly when rootfs is mounted over NFS.

* Old style:
/dev/root / nfs <options> 0 0

Quoted 7 lines

* New style:
<server>:<mount> / nfs <options> 0 0

* The regexp in grep can be simplified and rolled into one, but may become less strict...

OK

Quoted 97 lines

---
 .../busybox-1.13.2/udhcpc-new-nfsroot.patch        |   16 ++++++++++++++++ .../busybox-1.18.3/udhcpc-new-nfsroot.patch        |   16 ++++++++++++++++

 recipes/busybox/busybox_1.13.2.bb                  |    2 +-
 recipes/busybox/busybox_1.18.3.bb                  |    2 +-
 recipes/busybox/busybox_1.1x.inc                   |    1 +
 5 files changed, 35 insertions(+), 2 deletions(-)

 create mode 100644 recipes/busybox/busybox-1.13.2/udhcpc-new-nfsroot.patch create mode 100644 recipes/busybox/busybox-1.18.3/udhcpc-new-nfsroot.patch

recipes/busybox/busybox-1.13.2/udhcpc-new-nfsroot.patch new file +16 -0
new file mode 100644
index 0000000..46aaab9
@@ -0,0 +1,16 @@
+diff -uNr busybox-1.13.2.orig/examples/udhcp/simple.script busybox-1.13.2/examples/udhcp/simple.script
+--- busybox-1.13.2.orig/examples/udhcp/simple.script   2011-02-23 00:30:32.000000000 -0500
++++ busybox-1.13.2/examples/udhcp/simple.script        2011-02-23 17:05:37.873381763 -0500
+@@ -10,7 +10,12 @@
+
+ # return 0 if root is mounted on a network filesystem
+ root_is_nfs() {
++      # old style mounts
+       grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++      if ! $? ; then
++              # new style mounts
++              grep -qe '^.*:.* / \(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++      fi
+ }
+
+ case "$1" in
recipes/busybox/busybox-1.18.3/udhcpc-new-nfsroot.patch new file +16 -0
new file mode 100644
index 0000000..46aaab9
@@ -0,0 +1,16 @@
+diff -uNr busybox-1.13.2.orig/examples/udhcp/simple.script busybox-1.13.2/examples/udhcp/simple.script
+--- busybox-1.13.2.orig/examples/udhcp/simple.script   2011-02-23 00:30:32.000000000 -0500
++++ busybox-1.13.2/examples/udhcp/simple.script        2011-02-23 17:05:37.873381763 -0500
+@@ -10,7 +10,12 @@
+
+ # return 0 if root is mounted on a network filesystem
+ root_is_nfs() {
++      # old style mounts
+       grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++      if ! $? ; then
++              # new style mounts
++              grep -qe '^.*:.* / \(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
++      fi
+ }
+
+ case "$1" in
recipes/busybox/busybox_1.13.2.bb +0 -0
index ef20c62..fca3e93 100644
@@ -1,5 +1,5 @@

 require busybox_1.1x.inc

recipes/busybox/busybox_1.13.2.bb +1 -1
-PR = "${INC_PR}.3"
+PR = "${INC_PR}.4"

 SRC_URI += "\
  file://busybox-1.13.2-awk.patch \

recipes/busybox/busybox_1.18.3.bb +0 -0
index 633b70b..f85de86 100644
@@ -1,5 +1,5 @@

 require busybox_1.1x.inc

recipes/busybox/busybox_1.18.3.bb +1 -1
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"

 SRC_URI += " \
       http://busybox.net/downloads/fixes-1.18.3/busybox-1.18.3-buildsys.patch;name=patch01 \

recipes/busybox/busybox_1.1x.inc +1 -1
index 7623944..aefa57f 100644
@@ -5,6 +5,7 @@ SRC_URI = "\
   file://fdisk_nios2.patch \
   file://udhcpscript.patch \
   file://udhcpc-fix-nfsroot.patch \
+  file://udhcpc-new-nfsroot.patch \
   file://B921600.patch \
   file://get_header_tar.patch \
   file://busybox-appletlib-dependency.patch \
--

1.7.0.4

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel