summaryrefslogtreecommitdiff
path: root/scripts/functions
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2008-09-01 11:22:34 -0400
committermaximilian attems <maks@debian.org>2008-09-02 10:11:15 +0200
commit115d0aa6a71e89888765fac12c5135c97aef12c6 (patch)
tree3a72b8d54146bc425f122f4d0bb44a8baf706914 /scripts/functions
parent88643d542f0be841f840d749d11f5e969b2cb0fe (diff)
downloadinitramfs-tools-115d0aa6a71e89888765fac12c5135c97aef12c6.tar.gz
initramfs-tools-115d0aa6a71e89888765fac12c5135c97aef12c6.zip
Fix parse_numeric() to ignore non hex root string prefixes
On OLPC machines, root is a nand device that is mounted as mtd0 (it is neither a block device nor a char device). The arguments passed to the kernel are "ro root=mtd0 rootfstype=jffs2". Unfortunately, attempting to use an initrd based upon initramfs-tools on such a machine results in a kernel panic and a syntax error. Begin: Mounting root file system ... /init: line 172: syntax error: 0xmtd0 The probably appears to be in parse_numeric(); the init scripts assume that normal devices are always prefixed with /, and root= strings that aren't are raw device numbers (prefixing them with 0x). I'm not sure if there are other devices similar to mtd that don't begin with a /. How about something like the following patch? It's not foolproof, but it at least ignores things that can't possibly be hex strings. fixes partially #497133
Diffstat (limited to 'scripts/functions')
-rw-r--r--scripts/functions5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/functions b/scripts/functions
index 5d81afd..299c29c 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -242,11 +242,14 @@ parse_numeric() {
minor=${1#*:}
major=${1%:*}
;;
- *)
+ [A-Fa-f0-9]*)
value=$(( 0x${1} ))
minor=$(( ${value} % 256 ))
major=$(( ${value} / 256 ))
;;
+ *)
+ return
+ ;;
esac
mknod -m 600 /dev/root b ${major} ${minor}