I too use ubifs on a kirkwood platform: eSATA Sheevaplug.

Although the error message is annoying, it's not troublesome.
If resolving root for a specific device fails, couldn't we pick it up
from /proc/cmdline?

* Martin Michlmayr <t...@cyrius.com> [2010-08-07 19:50:07 -0400]
> I'm sort of leaning towards the last option since it's imho the
> cleanest variant. (The first one probably doesn't work because of
> size constraints and the second assumes that ubifs is built in, which
> I won't guarantee will be the case in the future.)

I agree, in that a uImage / uInitrd will not work across hardware.
However, if the root directive is detected in the cmdline we should be
able to use it.

Currently, I do not use uInitrd and the kernel cmdline being used on the
eSATA Sheevaplug is:

console=ttyS0,115200 ubi.mtd=2,2048 root=ubi0:rootfs rootfstype=ubifs

This allows the device to boot directly to the root device thwarting the
use of initrd. One can simply turn off the uInitrd generation. However,
I do have two / entries in /proc/mounts:

rootfs on / type rootfs (rw)
ubi0:rootfs on / type ubifs (ro,noatime)

and my /etc/fstab / entry looks like:

/dev/root       /               ubifs   defaults,noatime,ro          0 0

The kernel cmdline has been mentioned above.


However, I believe Daniel is correct in saying saving the kernel to
flash should be an option; perhaps configuration driven as uInitrd
generation is.

I wrote a little dash script that I run after a new kernel has been
installed onto the system. I'm just not sure where to put it, so that it
will be hooked into the flash-kernel procedure.

The script is rather spottish and not sure it will work on other
platforms w/o alteration. I will certainly be happy to make the script
more generic, once I know what guidelines must be observed.



___________________________________________

Cellent Finance Solutions AG

Firmensitz: Calwer Straße 33, 70173 Stuttgart
Registergericht: Amtsgericht Stuttgart, HRB 720743
Vorstand: Thomas Wild
Vorsitzender des Aufsichtsrats: Rudolf Zipf
#!/bin/dash

U_IMAGE=/boot/uImage

type flash_erase >/dev/null 2>&1 &&
        type flash_eraseall >/dev/null 2>&1 &&
                type nandwrite >/dev/null 2>&1 || {
                        echo "Could not find mtd manipulation utilites." >&2
                        echo "Please install package mtd-utils." >&2
                        exit 1
                }

# determine root on ubifs
if ! grep -qs '^ubi[0-9]:rootfs ' /proc/mounts; then
        echo "Can not determine whether root on ubifs." >&2
        echo "Not saving $U_IMAGE to flash." >&2
        exit 10
fi

# determine uImage mtd device
mtd_device=$(sed '/"uImage"$/!d; s/:.*//; s/mtd//' /proc/mtd)
if [ -z "$mtd_device" ]; then
        echo "Can not determine uImage mtd device." >&2
        echo "Not saving $U_IMAGE to flash." >&2
        exit 11
fi

[ -r "$U_IMAGE" ] &&
        echo "Saving $U_IMAGE to /dev/mtd${mtd_device}" &&
                flash_erase /dev/mtdblock${mtd_device} &&
                        flash_eraseall /dev/mtd${mtd_device} &&
                                nandwrite -p /dev/mtd${mtd_device} $U_IMAGE || {
                                        echo "Failed to save $U_IMAGE to 
/dev/mtd${mtd_device}" >&2
                                        exit 20
                                }

Reply via email to