Bug#497133: initramfs-tools: explodes when kernel is booted with root=mtd0
On Mon, 1 Sep 2008 15:58:15 +0200
maximilian attems <max@stro.at> wrote:
> On Sat, 30 Aug 2008, Andres Salomon wrote:
>
> > Package: initramfs-tools
> > Version: 0.92f
> >
> > 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".
>
> could you try to give the full device string root=/dev/mtd0
>
Already tried that, it simply fails to find root then. I also tried
root=/dev/mtdblock0, but that's not a real solution (mtd block emulation
is slower than just mtd).
> > 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 /.
>
> parse_numeric is for legacy lilo support, right. does aboves
> circumvent it?
>
> thanks for report!
>
How about something like the following (untested) patch? It's not foolproof,
but it at least ignores things that can't possibly be hex strings.
--- /usr//share/initramfs-tools/scripts/functions.orig 2008-09-01 11:14:11.000000000 -0400
+++ /usr//share/initramfs-tools/scripts/functions 2008-09-01 11:18:57.000000000 -0400
@@ -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}
Reply to: