FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 06-08-2010, 08:49 PM
Daniel Kahn Gillmor
 
Default Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs

On 06/08/2010 03:31 PM, Martin Michlmayr wrote:
> * Daniel Kahn Gillmor <dkg@fifthhorseman.net> [2010-06-08 15:22]:
>>>> rootfs on / type rootfs (rw)
>>>> ubi0:root on / type ubifs (rw,relatime)
> ^^^^^^^^^
> This is the output from 'mount', and here's what i-t does:
>
> eval "$(mount | awk '//dev// {if ($3 == "/") {print "root=" $1 "
FSTYPE=" $5; exit}}')"
>
> it looks for something with /dev/ in it. In your case, this does't
> match so root= and FSTYPE= are empty. I think we should simply add a
> check to i-t at this point to produce an error when $root is empty.
>
> Daniel, do you know if ubi0:root in /etc/fstab is valid? Is that what
> the ubi people recommend to use? Shouldn't this be a device like
> /dev/ubiX_Y? (This would make i-t happy)


according to:

http://www.linux-mtd.infradead.org/faq/ubifs.html#L_mount_ubifs

the /dev/ubiX_Y method is the recommended method for newer kernels.

however, i was unable to get that to work when i tried with
2.6.32-5-kirkwood (unfortunately, i don't have a log of that interaction
-- would one be useful?).

The old-style "device-less" method worked for me, though (and appears to
be reflected in /proc/mounts).

--dkg
 
Old 06-08-2010, 09:01 PM
Martin Michlmayr
 
Default Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs

* Daniel Kahn Gillmor <dkg@fifthhorseman.net> [2010-06-08 16:49]:
> http://www.linux-mtd.infradead.org/faq/ubifs.html#L_mount_ubifs

Ok, so it sounds like ubiX:name might be quite common.

Maybe the "awk '//dev//" in i-t should be changed to something like
"awk '//dev/|ubi/" or "awk '//dev/|ubi[0-9]/" but I'll leave that
to the i-t maintainer(s).
--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100608210137.GC32012@jirafa.cyrius.com">http://lists.debian.org/20100608210137.GC32012@jirafa.cyrius.com
 
Old 06-13-2010, 04:17 PM
Martin Michlmayr
 
Default Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs

* Martin Michlmayr <tbm@cyrius.com> [2010-06-08 23:01]:
> > http://www.linux-mtd.infradead.org/faq/ubifs.html#L_mount_ubifs
>
> Ok, so it sounds like ubiX:name might be quite common.
>
> Maybe the "awk '//dev//" in i-t should be changed to something like
> "awk '//dev/|ubi/" or "awk '//dev/|ubi[0-9]/" but I'll leave that
> to the i-t maintainer(s).

Note: it should probably be |ubi rather than |ubi[0-9] since
something like ubi:rootfs is valid too.

--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100613161720.GA1727@jirafa.cyrius.com">http://lists.debian.org/20100613161720.GA1727@jirafa.cyrius.com
 
Old 06-13-2010, 04:18 PM
Martin Michlmayr
 
Default Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs

mika, the patch below is still required and is imho a good idea in all
cases since it makes the error explicit.

* Martin Michlmayr <tbm@cyrius.com> [2010-06-08 21:43]:
> [PATCH] Produce an error when root cannot be determined with MODULES=dep
>
> A lot of code in dep_add_modules() uses $root. Therefore, produce an
> error message if we cannot determine the root device.
>
> Signed-off-by: Martin Michlmayr <tbm@cyrius.com>
>
> diff --git a/hook-functions b/hook-functions
> index 6a6e233..154ae3e 100644
> --- a/hook-functions
> +++ b/hook-functions
> @@ -226,6 +226,11 @@ dep_add_modules()
>
> # findout root block device + fstype
> eval "$(mount | awk '//dev// {if ($3 == "/") {print "root=" $1 "
FSTYPE=" $5; exit}}')"
> + if [ -z "$root" ]; then
> + echo "mkinitramfs: failed to determine root device"
> + echo "mkinitramfs: workaround is MODULES=most"
> + echo "Error please report bug on initramfs-tools and include the output of 'mount'"
> + fi
>
> # handle ubifs and return since ubifs root is a char device but
> # most of the commands below only work with block devices.
>
> --
> Martin Michlmayr
> http://www.cyrius.com/

--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100613161850.GB1727@jirafa.cyrius.com">http://lists.debian.org/20100613161850.GB1727@jirafa.cyrius.com
 
Old 06-13-2010, 04:23 PM
Martin Michlmayr
 
Default Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs

* Martin Michlmayr <tbm@cyrius.com> [2010-06-07 18:10]:
> I'm not claiming that you'll actually be able to boot from ubifs with
> that ramdisk though. For that, i-t needs to be taught to know what to
> do about something like root=ubi0:rootfs.

Ok, here's a patch with which you can boot from ubi with i-t when ubi is
modular.

It essentially does three things:
- adds the correct modules to the ramdisk (for MODULES=dep and MODULES=most)
- reads ubi.mtd= from the command line
- loads ubi with the ubi.mtd info and ignores the "Waiting for root" check

I've successfully tested this with a kernel with modular ubi and with
the following boot variants:
console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs
console=ttyS0,115200 ubi.mtd=2 root=ubi0_0 rootfstype=ubifs

With
console=ttyS0,115200 ubi.mtd=2 root=/dev/ubi0_0 rootfstype=ubifs
I get an error that it cannot mount root but I suspect this is an
ubifs error and has nothing to do with i-t (since at this point I can
manually mount it with -t ubifs ubi0_0 whereas the /dev/ variant
doesn't work).

Tested with MODULES=dep and MODULES=most as well as with a kernel that
has ubifs built in.

Signed-off-by: Martin Michlmayr <tbm@cyrius.com>

diff --git a/hook-functions b/hook-functions
index 6a6e233..895eca0 100644
--- a/hook-functions
+++ b/hook-functions
@@ -231,6 +231,10 @@ dep_add_modules()
# most of the commands below only work with block devices.
if [ "${FSTYPE}" = "ubifs" ]; then
manual_add_modules "${FSTYPE}"
+ # add some modules required by ubifs on which it doesn's depend
+ manual_add_modules deflate
+ manual_add_modules zlib
+ manual_add_modules lzo
return
fi

@@ -424,6 +428,11 @@ auto_add_modules()
block)
copy_modules_dir kernel/drivers/block
;;
+ ubi)
+ for x in deflate zlib lzo ubi ubifs; do
+ manual_add_modules "${x}"
+ done
+ ;;
ieee1394)
for x in ohci1394 sbp2; do
manual_add_modules "${x}"
@@ -456,6 +465,7 @@ auto_add_modules()
auto_add_modules ata
auto_add_modules i2o
auto_add_modules dasd
+ auto_add_modules ubi
auto_add_modules ieee1394
auto_add_modules firewire
auto_add_modules mmc
diff --git a/init b/init
index 142eb14..798717c 100755
--- a/init
+++ b/init
@@ -42,6 +42,7 @@ export ROOTFSTYPE=
export IP=
export BOOT=
export BOOTIF=
+export UBIMTD=
export break=
export init=/sbin/init
export quiet=n
@@ -126,6 +127,9 @@ for x in $(cat /proc/cmdline); do
boot=*)
BOOT=${x#boot=}
;;
+ ubi.mtd=*)
+ UBIMTD=${x#ubi.mtd=}
+ ;;
resume=*)
RESUME="${x#resume=}"
;;
@@ -257,6 +261,7 @@ unset ROOT
unset IP
unset BOOT
unset BOOTIF
+unset UBIMTD
unset blacklist
unset break
unset noresume
diff --git a/scripts/local b/scripts/local
index cca5e8d..46ab0f3 100644
--- a/scripts/local
+++ b/scripts/local
@@ -8,6 +8,13 @@ pre_mountroot()

wait_for_udev 10

+ # Load ubi with the correct MTD partition and return since fstype
+ # doesn't work with a char device like ubi.
+ if [ -n "$UBIMTD" ]; then
+ modprobe ubi mtd=$UBIMTD
+ return
+ fi
+
# Don't wait for a root device that doesn't have a corresponding
# device in /dev (ie, mtd0)
if [ "${ROOT#/dev}" = "${ROOT}" ]; then

--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100613162314.GC1727@jirafa.cyrius.com">http://lists.debian.org/20100613162314.GC1727@jirafa.cyrius.com
 
Old 06-13-2010, 07:05 PM
maximilian attems
 
Default Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs

On Sun, 13 Jun 2010, Martin Michlmayr wrote:

> mika, the patch below is still required and is imho a good idea in all
> cases since it makes the error explicit.
>
thanks applied.

added error out in that case as it makes no sense to continue
beyond that point.



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100613190541.GB3735@stro.at">http://lists.debian.org/20100613190541.GB3735@stro.at
 
Old 06-14-2010, 10:35 AM
Michael Prokop
 
Default Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs

tags 582858 + pending
thanks

* Martin Michlmayr <tbm@cyrius.com> [Sun Jun 13, 2010 at 05:23:14PM +0100]:
> * Martin Michlmayr <tbm@cyrius.com> [2010-06-07 18:10]:
> > I'm not claiming that you'll actually be able to boot from ubifs with
> > that ramdisk though. For that, i-t needs to be taught to know what to
> > do about something like root=ubi0:rootfs.

> Ok, here's a patch with which you can boot from ubi with i-t when ubi is
> modular.
[...]

Thanks, Martin!

Applied in branch mika/ubifs:

http://git.debian.org/?p=kernel/initramfs-tools.git;a=shortlog;h=refs/heads/mika/ubifs

Will be merged +_uploaded after final review together with maks.

regards,
-mika-
 
Old 06-15-2010, 04:14 PM
maximilian attems
 
Default Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs

On Mon, Jun 14, 2010 at 12:35:25PM +0200, Michael Prokop wrote:
> tags 582858 + pending
> thanks
>
> * Martin Michlmayr <tbm@cyrius.com> [Sun Jun 13, 2010 at 05:23:14PM +0100]:
> > * Martin Michlmayr <tbm@cyrius.com> [2010-06-07 18:10]:
> > > I'm not claiming that you'll actually be able to boot from ubifs with
> > > that ramdisk though. For that, i-t needs to be taught to know what to
> > > do about something like root=ubi0:rootfs.
>
> > Ok, here's a patch with which you can boot from ubi with i-t when ubi is
> > modular.
> [...]
>
> Thanks, Martin!
>
> Applied in branch mika/ubifs:
>
> http://git.debian.org/?p=kernel/initramfs-tools.git;a=shortlog;h=refs/heads/mika/ubifs
>

sorry to jump in so late and due to my complete ignorance of ubi,
please enlighten me on the importance of it?

i'm a bit hesitant of adding it to every initramfs out there:
/lib/modules/2.6.32-5-amd64/kernel/drivers/mtd/ubi/ubi.ko
could d-i add it to the relevant installation as hook?
who does need or may want to use ubi?

thanks



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100615161440.GL9869@baikonur.stro.at">http://lists.debian.org/20100615161440.GL9869@baikonur.stro.at
 
Old 06-15-2010, 05:51 PM
Martin Michlmayr
 
Default Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs

* maximilian attems <max@stro.at> [2010-06-15 18:14]:
> i'm a bit hesitant of adding it to every initramfs out there:
> /lib/modules/2.6.32-5-amd64/kernel/drivers/mtd/ubi/ubi.ko
> could d-i add it to the relevant installation as hook?
> who does need or may want to use ubi?

Yeah, I think this is a fair point. UBI/UBIFS is a filesystem for MTD
flash devices, so very few devices will need this. And d-i doesn't
even have support for UBI/UBIFS at the moment.

So how about you remove the line that adds ubi when MODULES=most is
used. Everything else in my patch should be ok, though, or did you
see any other issues?

--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100615175107.GJ7927@jirafa.cyrius.com">http://lists.debian.org/20100615175107.GJ7927@jirafa.cyrius.com
 
Old 06-16-2010, 08:44 AM
Michael Prokop
 
Default Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs

* Martin Michlmayr <tbm@cyrius.com> [Tue Jun 15, 2010 at 06:51:07PM +0100]:
> * maximilian attems <max@stro.at> [2010-06-15 18:14]:
> > i'm a bit hesitant of adding it to every initramfs out there:
> > /lib/modules/2.6.32-5-amd64/kernel/drivers/mtd/ubi/ubi.ko
> > could d-i add it to the relevant installation as hook?
> > who does need or may want to use ubi?

> Yeah, I think this is a fair point. UBI/UBIFS is a filesystem for MTD
> flash devices, so very few devices will need this. And d-i doesn't
> even have support for UBI/UBIFS at the moment.

Ok, thanks.

> So how about you remove the line that adds ubi when MODULES=most is
> used. Everything else in my patch should be ok, though, or did you
> see any other issues?

ACK. Done in:

http://git.debian.org/?p=kernel/initramfs-tools.git;a=shortlog;h=refs/heads/mika/ubifs

Keeping the "ubi)" within hook-functions should be fine AFAICS so a
hook script could call "auto_add_modules ubi".

Maks, please let me know whether merging mika/ubifs into master
would be fine for you.

regards,
-mika-
 

Thread Tools




All times are GMT. The time now is 12:44 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org