initramfs-framework enhancements
cover initramfs-framework enhancements
These are two enhancements that we've used for a while now in Ostro OS:
- a retry loop that we found necessary for some slow USB hardware
- finding the root partition by partition UUID (only filesystem UUID supported before)
The following changes since commit 646c366c2566bd8dd6f73681cea9f5b021589a56:
gst-player: upgrade to latest HEAD (2016-06-27 14:08:37 +0100)
are available in the git repository at:
git://github.com/pohly/openembedded-core initramfs-framework
https://github.com/pohly/openembedded-core/tree/initramfs-framework
Igor Stoppa (1):
meta-ostro-fixes: initramfs-framework: Add support for PartUUIDs
Patrick Ohly (1):
meta-ostro-fixes: initramfs-framework: add retry loop for slow boot
devices (like USB)
.../initrdscripts/initramfs-framework/finish | 33 ------------ .../initrdscripts/initramfs-framework/rootfs | 62 ++++++++++++++++++++++ .../initrdscripts/initramfs-framework_1.0.bb | 4 +- 3 files changed, 65 insertions(+), 34 deletions(-) create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/rootfs
Signature · 1 line
2.1.4
PATCH 1/2 meta-ostro-fixes: initramfs-framework: add retry loop for slow boot devices (like USB)
On some hardware platforms (Gigabyte, qemu), detection of USB devices by the kernel is slow enough such that it happens only after the first attempt to mount the rootfs. We need to keep trying for a while (default: 5s seconds, controlled by roottimeout=<seconds>) and sleep between each attempt (default: one second, rootdelay=<seconds>).
This change intentionally splits finding the rootfs (in the new "rootfs") and switching to it ("finish"). That is needed to keep udev running while waiting for the rootfs, because it shuts down before "finish" starts. It is also the direction that was discussed on the OE mailing list for future changes to initramfs-framework (like supporting a "live CD" module, which would replace or further augment mounting of the rootfs).
--- .../initrdscripts/initramfs-framework/finish | 33 ------------- .../initrdscripts/initramfs-framework/rootfs | 57 ++++++++++++++++++++++ .../initrdscripts/initramfs-framework_1.0.bb | 4 +- 3 files changed, 60 insertions(+), 34 deletions(-) create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/rootfs
meta/recipes-core/initrdscripts/initramfs-framework/finish +0 -33
@@ -8,39 +8,6 @@ finish_enabled() { finish_run() { if [ -n "$ROOTFS_DIR" ]; then - if [ -n "$bootparam_rootdelay" ]; then - debug "Sleeping for $rootdelay second(s) to wait root to settle..." - sleep $bootparam_rootdelay - fi - - if [ -n "$bootparam_root" ]; then - debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..." - - if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then - root_uuid=`echo $bootparam_root | cut -c6-` - bootparam_root="/dev/disk/by-uuid/$root_uuid" - fi - - if [ -e "$bootparam_root" ]; then - flags="" - if [ -n "$bootparam_ro" ]; then - if [ -n "$bootparam_rootflags" ]; then - bootparam_rootflags="$bootparam_rootflags," - fi - bootparam_rootflags="${bootparam_rootflags}ro" - fi - if [ -n "$bootparam_rootflags" ]; then - flags="$flags -o$bootparam_rootflags" - fi - if [ -n "$bootparam_rootfstype" ]; then - flags="$flags -t$bootparam_rootfstype" - fi - mount $flags $bootparam_root $ROOTFS_DIR - else - msg "root '$bootparam_root' doesn't exist." - fi - fi - if [ ! -d $ROOTFS_DIR/dev ]; then fatal "ERROR: There's no '/dev' on rootfs." fi
meta/recipes-core/initrdscripts/initramfs-framework/rootfs new file +57 -0
57 lines not on this page · raw message
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +3 -1
@@ -8,6 +8,7 @@ PR = "r2" inherit allarch SRC_URI = "file://init \ + file://rootfs \ file://finish \ file://mdev \ file://udev \
@@ -21,6 +22,7 @@ do_install() { # base install -m 0755 ${WORKDIR}/init ${D}/init + install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish # mdev
@@ -47,7 +49,7 @@ PACKAGES = "${PN}-base \ initramfs-module-e2fs \ initramfs-module-debug" -FILES_${PN}-base = "/init /init.d/99-finish /dev" +FILES_${PN}-base = "/init /init.d/90-rootfs /init.d/99-finish /dev" SUMMARY_initramfs-module-mdev = "initramfs support for mdev" RDEPENDS_initramfs-module-mdev = "${PN}-base busybox-mdev"
Signature · 1 line
2.1.4
PATCH 2/2 meta-ostro-fixes: initramfs-framework: Add support for PartUUIDs
From: Igor Stoppa <[email protected]>
The rootfs can be addressed also by referring to the PartUUID value from the GPT.
This patch enables such type of reference.
--- meta/recipes-core/initrdscripts/initramfs-framework/rootfs | 5 +++++ 1 file changed, 5 insertions(+)
meta/recipes-core/initrdscripts/initramfs-framework/rootfs +5 -0
@@ -26,6 +26,11 @@ rootfs_run() { bootparam_root="/dev/disk/by-uuid/$root_uuid" fi + if [ "`echo ${bootparam_root} | cut -c1-9`" = "PARTUUID=" ]; then + root_uuid=`echo $bootparam_root | cut -c10-` + bootparam_root="/dev/disk/by-partuuid/$root_uuid" + fi + if [ -e "$bootparam_root" ]; then flags="" if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | grep -w -q "ro"; then
Signature · 1 line
2.1.4
Re: [PATCH 1/2] meta-ostro-fixes: initramfs-framework: add retry loop for slow boot devices (like USB)
In reply to Patrick OhlyQuoted 14 lines · Patrick Ohly
On some hardware platforms (Gigabyte, qemu), detection of USB devices by the kernel is slow enough such that it happens only after the first attempt to mount the rootfs. We need to keep trying for a while (default: 5s seconds, controlled by roottimeout=<seconds>) and sleep between each attempt (default: one second, rootdelay=<seconds>).
This change intentionally splits finding the rootfs (in the new "rootfs") and switching to it ("finish"). That is needed to keep udev running while waiting for the rootfs, because it shuts down before "finish" starts. It is also the direction that was discussed on the OE mailing list for future changes to initramfs-framework (like supporting a "live CD" module, which would replace or further augment mounting of the rootfs).
Quoted 1 line
Signed-off-by Patrick Ohly <[email protected]>
Agreed but please split the rootfs in another module; so we don't force it to be included. The e2fs can rdepend on it.
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Re: [PATCH 1/2] meta-ostro-fixes: initramfs-framework: add retry loop for slow boot devices (like USB)
Hello Ross,
Quoted 15 lines · Otavio Salvador
Quoted 14 lines · Patrick Ohly
On some hardware platforms (Gigabyte, qemu), detection of USB devices by the kernel is slow enough such that it happens only after the first attempt to mount the rootfs. We need to keep trying for a while (default: 5s seconds, controlled by roottimeout=<seconds>) and sleep between each attempt (default: one second, rootdelay=<seconds>).
This change intentionally splits finding the rootfs (in the new "rootfs") and switching to it ("finish"). That is needed to keep udev running while waiting for the rootfs, because it shuts down before "finish" starts. It is also the direction that was discussed on the OE mailing list for future changes to initramfs-framework (like supporting a "live CD" module, which would replace or further augment mounting of the rootfs).
Quoted 4 lines
Quoted 1 line
Signed-off-by Patrick Ohly <[email protected]>Agreed but please split the rootfs in another module; so we don't force it to be included. The e2fs can rdepend on it.
I noticed this has been merged but my comment here was totally ignored. Why?
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Re: [PATCH 1/2] meta-ostro-fixes: initramfs-framework: add retry loop for slow boot devices (like USB)
Quoted 7 lines · Otavio Salvador
Hello Ross,
Quoted 2 lines · Otavio Salvador
Agreed but please split the rootfs in another module; so we don't force it to be included. The e2fs can rdepend on it.
I noticed this has been merged but my comment here was totally ignored. Why?
I can't speak for Ross, but perhaps he felt that it was already a worthwhile improvement. I wanted to address your comment (and still do), but didn't find the time last week. I'll do it via another patch now, okay?
Signature · 6 lines
Best Regards, Patrick Ohly The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter.
Re: [PATCH 1/2] meta-ostro-fixes: initramfs-framework: add retry loop for slow boot devices (like USB)
Quoted 7 lines · Patrick Ohly
Quoted 1 line
I noticed this has been merged but my comment here was totally ignored.
Why?
I can't speak for Ross, but perhaps he felt that it was already a worthwhile improvement. I wanted to address your comment (and still do), but didn't find the time last week. I'll do it via another patch now, okay?
Because I managed to remove it and then reintroduce it with a subsequent rebase, my fault entirely.
Thanks Patrick for offering a follow-up patch.
Ross
Re: [PATCH 1/2] meta-ostro-fixes: initramfs-framework: add retry loop for slow boot devices (like USB)
In reply to Patrick OhlyQuoted 7 lines · Patrick Ohly
Quoted 6 lines · Otavio Salvador
Hello Ross,
Quoted 2 lines · Otavio Salvador
Agreed but please split the rootfs in another module; so we don't force it to be included. The e2fs can rdepend on it.
Quoted 6 lines
Quoted 1 line
I noticed this has been merged but my comment here was totally ignored. Why?
I can't speak for Ross, but perhaps he felt that it was already a worthwhile improvement. I wanted to address your comment (and still do), but didn't find the time last week. I'll do it via another patch now, okay?
Ok but Ross action is wrong in my opinion, in worse case he should have asked before. If comments are ignored there is no point in people spend time doing so.
I wanted the change to be atomic and not two changes which may required more rework for same logic change. :-(
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Re: [PATCH 1/2] meta-ostro-fixes: initramfs-framework: add retry loop for slow boot devices (like USB)
Quoted 15 lines · Otavio Salvador
Quoted 7 lines · Patrick Ohly
Quoted 6 lines · Otavio Salvador
Hello Ross,
Quoted 2 lines · Otavio Salvador
Agreed but please split the rootfs in another module; so we don't force it to be included. The e2fs can rdepend on it.
Quoted 6 lines
Quoted 1 line
I noticed this has been merged but my comment here was totally ignored. Why?
I can't speak for Ross, but perhaps he felt that it was already a worthwhile improvement. I wanted to address your comment (and still do), but didn't find the time last week. I'll do it via another patch now, okay?
Quoted 6 lines
Ok but Ross action is wrong in my opinion, in worse case he should have asked before. If comments are ignored there is no point in people spend time doing so.
I wanted the change to be atomic and not two changes which may required more rework for same logic change. :-(
It turned out to be just a mistake that it was already merge.
On the other hand, one can also argue that these are two separate logical changes - adding the retry loop, and then making that code just the optional default implementation for mounting.
Anyway, see "initramfs-framework: make rootfs module optional" for that second part. Note that I did not make e2fs depend on rootfs, because there's no real connection between the two (for example, the rootfs could also be btrfs). Instead it is the finish script which depends on some kind of rootfs mounting.
Signature · 6 lines
Best Regards, Patrick Ohly The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter.