Commit Graph

55 Commits

Author SHA1 Message Date
Christos Gavros
07b2d077c7 initramfs-framework: remove hard dependency with busybox
In 'finish'script the Switch_root command with option -c is busybox specific.
When package-core-base-utils is selected the boot is breaking with message
"Switch_root: invalid option — ‘c’.It was reproduced using qemu.
Remove -c option to make it compatible with both providers.
It is tested using qemu with busybox and package-core-base-utils. In both cases
qemu boots successfully and filesystem is accessible.
Fixes [YOCTO #15716]

CC: Yoann Congal <yoann.congal@smile.fr>
CC: Randy MacLeod <randy.macleod@windriver.com>
CC: jbk <jbk@mm-software.com>
CC: Raj Khem <raj.khem@gmail.com>
CC: Adrian Freihofer <adrian.freihofer@gmail.com>
(From OE-Core rev: 0f745024fd40518f98390008b4f613d5641df416)

Signed-off-by: Christos Gavros <gavrosc@yahoo.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-04-11 11:49:59 +01:00
Walter Schweizer
e78b72075f initrdscripts: add UBI support
Mounting the rootfs failed when it was on UBI.
This patch allows the rootfs to live on UBI.

(From OE-Core rev: 197867f854cc19493b28fcd2300179cfc407e0a6)

Signed-off-by: Walter Schweizer <walter.schweizer@siemens.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-01-08 12:37:20 +00:00
Ulrich Ölmann
2f09eddfeb initramfs-framework: init: fix typo
Amend a small typing error.

(From OE-Core rev: c4ca9161d9de1a522a34c9088dedf6c346afbbed)

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-30 17:00:51 +01:00
Ulrich Ölmann
8de3508743 initramfs-framework: fix typos
Fix typos in debugging and error messages.

(From OE-Core rev: 4995e222ebdc9b5508c2f03a11868f184e4629a0)

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-25 11:50:58 +01:00
Igor Opaniuk
024205238e initramfs-framework: support force reboot if fatal error occurs
Add support for force reboot in the case of fatal error. In some cases
it's better to force reboot (especially when hw watchdog is not
engaged) instead of waiting for 3600 seconds, for example in order to
trigger some recovery procedure during next boot procedure
(after unsuccessful OTA update etc).

ALso fix indendation issues in the fatal() function implementation.

(From OE-Core rev: 6990855e91f2d5891e95995f3f4a1c3b5891c619)

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 09:38:23 +01:00
Johannes Schneider
e6047ee5e8 initramfs-framework: overlayroot: align bootparams with module name
Renaming the 'rootrw' kernel commandline parameter to
'overlayrootrwdev' to both align better with this modules name, and
point out the usage of the variable.

This patch also includes an if block to migrate the old 'rootrw'
block, should it be already used by someone.

(From OE-Core rev: a52b7f5c8ff3e50707b55843d9996983ab8efae2)

Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 14:56:23 +00:00
Johannes Schneider
8a531d1990 initramfs-framework: overlayroot: fix kernel commandline clash
The initramfs-framwork takes kernel commandline options and converts
them for internal use to variables following the 'bootparam_name'
pattern. The overlayroot module uses 'bootparam_rootfstype' and
'bootparam_rootfsflags' which both collide with linux kernel
parameters 'rootfstype' and 'rootfsflags'.  This collision is solved
by putting the variables in the namespace of the initramfs-framework
module.

(From OE-Core rev: ef20ef719c699b94fc52b81c520faa0b3714efeb)

Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 14:56:23 +00:00
Muhammad Hamza
af80b23aee initramfs-framework: move storage mounts to actual rootfs
Operations such as mkfs fail on devices that are not
switched to the actual rootfs before switch_root is
called. The kernel interprets these devices as still
being used even after unmounting and errors such as
below are seen when the target is fully booted

root@v1000:~# umount /dev/sdb1
root@v1000:~# mkfs.ext4 /dev/sdb1
mke2fs 1.43.8 (1-Jan-2018)
/dev/sdb1 contains a ext4 file system
        last mounted on Wed Nov 28 07:33:54 2018
Proceed anyway? (y,N) y
/dev/sdb1 is apparently in use by the system; will not make a filesystem here!

(From OE-Core rev: ec53ffd01972d1be2d6a28de828b3f0b80dc1e61)

Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: Muhammad Hamza <muhammad_hamza@mentor.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-06-21 18:44:27 +01:00
Alejandro Hernandez Samaniego
ed323de4dc initramfs-framework: Add overlayroot module
When installed, this module mounts a read-write (RW) overlay on
top of a root filesystem, which is kept read-only (RO), free
from modifications by the user, this might prove to be useful
if we want to access or restore the original unmodified rootfs.

The existing overlay-etc.bbclass does something similar, it
mounts an overlay on top of the /etc directory, however doing
the same for root causes the original root to be inaccessible
once the system is booted, hence why this module is added to
the initramfs boot flow, allowing us to mount the RW overlay,
while keeping the original rootfs mounted at /rofs once the
system finishes booting. This script is loosely based on that
class.

This module requires rootrw=<foo> to be passed as a kernel
parameter to specify the device/partition to be used as RW by the
overlay and has a dependency on overlayfs support being present
in the running kernel.

It does not require the read-only IMAGE_FEATURE to be enabled.

The module needs to be executed after the initramfs-module-rootfs
since it relies on it to mount the filesystem at initramfs startup
but before the finish module which normally switches root.
After overlayroot is executed the usual boot flow continues from
the real init process.

If something goes wrong while running this module, the rootfs
is still mounted RO (with no overlay) and the finish module is
executed to continue booting normally.

Its worth noting that, on purpose, this isnt installed by default
on any images that use initramfs-framework to keep the boot flow
unmodified, only when a user manually requests to install it,
then it becomes functional.

(From OE-Core rev: 4f876982a856c54a8074c85346632e33caa7ef53)

Signed-off-by: Alejandro Enedino Hernandez Samaniego <alhe@linux.microsoft.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-01 23:44:59 +00:00
Justin Bronder
2040c70fcc initramfs-framework: unmount automounts before switch_root
If mounts are left lingering, then after we switch_root, attempts to
modify the block devices will result in an EBUSY with no way to unmount
them.  As we're about to switch_root anyways, there isn't much use to
keep anything mounted unless it has the new rootfs.

(From OE-Core rev: 4dc7af6d25597ea10ea43e76c7c3d7251462c0e5)

Signed-off-by: Justin Bronder <jsbronder@cold-front.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-12 17:05:35 +00:00
Ulrich Ölmann
03876eb32b initramfs-framework/setup-live: fix shebang
(From OE-Core rev: 71f1f6bc9402ee0fad82aaf0757fffb73da4b706)

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-07-24 16:33:46 +01:00
Ming Liu
08dee904c1 initramfs-framework:rootfs: fix wrong indentions
(From OE-Core rev: cd4d76f43c6ead9f32dece1faa9c9c5da895d9cd)

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-05-22 09:59:04 +01:00
Ming Liu
fef6805f68 initramfs-framework:rootfs: fix some conditional check
Drop a duplicated check for "PARTLABEL=", also change to use elif to
avoid go through all the checks for root parameter.

(From OE-Core rev: 29e1e2ad0b6fd0db0e099831ba331b4ffa2b094b)

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-03-28 22:28:26 +01:00
Christophe GUIBOUT
909a9f5e8e initramfs-framework: support kernel cmdline with double quotes
It avoids init to crash when kernel cmdline contains a string with
spaces inside, like that:
dyndbg="file drivers/usb/core/hub.c +pltf"

(From OE-Core rev: 88b8b94bd2d052bca29d27bd5cd00eddb0f5999d)

Signed-off-by: Christophe Guibout <christophe.guibout@st.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-12 14:49:00 +01:00
Stefan Agner
fb9c85e3bf initramfs-framework: check successful mount using mountpoint
Instead of checking for existence of /dev in the mounted file system use
mountpoint to check if a root file system has been mounted. This allows
to use the rootfs module for OSTree based rootfs as well, where the file
system rootfs does not have any of the regular directories (at least
when using the modern layout).

(From OE-Core rev: efdfd0d5dde4dde43cb67ef28a90d5f5fe3e0ac6)

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-09 13:13:59 +01:00
Stefan Eichenberger
cf2ea6cc27 initramfs-framework: fix boothang when console=null
If console=null systemd-udevd throws an assertion which prevents the
system from booting. This patch redirects stdin, stdout and stderr to
/dev/null in case that the console can't be opened so that udevd still
boots.

A systemd issue was reported here. However, they will not fix this
specific use-case:
https://github.com/systemd/systemd/issues/13332

(From OE-Core rev: dd6ee0b06cd8df6204cf600050516d15172302ea)

Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-13 23:00:26 +00:00
Diego Rondini
2657837f72 initramfs-framework: support PARTLABEL option
Since commit (kernel >= 4.20):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f027c34d844013d9d6c902af8fa01a82d6e5073d
specifying rootfs by PARTLABEL is supported. This commit adds support to
specify root by GPT partition label.

(From OE-Core rev: ebc974be12c3e83e961c99c24fde267d6c8e8bfc)

Signed-off-by: Diego Rondini <diego.rondini@kynetics.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-10-02 10:09:47 +01:00
Diego Rondini
3c9edf9b02 initramfs-framework: fix var name
Use appropriate variable name for root of partuuid.

(From OE-Core rev: d954ddcb2a9678b3b964279b41c0ec677ea9f03a)

Signed-off-by: Diego Rondini <diego.rondini@kynetics.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-27 13:02:16 +01:00
Richard Purdie
9c22a5a8a8 initramfs-framework: support PARTLABEL option
Since commit (kernel >= 4.20):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f027c34d844013d9d6c902af8fa01a82d6e5073d
specifying rootfs by PARTLABEL is supported. This commit adds support to
specify root by GPT partition label.

RP: [Fixup to match v2 of the patch]

(From OE-Core rev: 6901b7840dd9429064003ab939ba7e5cca5dc37f)

Signed-off-by: Diego Rondini <diego.rondini@kynetics.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-19 13:09:22 +01:00
Diego Rondini
4b3656a978 initramfs-framework: support PARTLABEL option
Since commit (kernel >= 4.20):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f027c34d844013d9d6c902af8fa01a82d6e5073d
specifying rootfs by PARTLABEL is supported. This commit adds support to
specify root by GPT partition label.

(From OE-Core rev: e714b8982c2decbc24598af46f44c3a94834591f)

Signed-off-by: Diego Rondini <diego.rondini@kynetics.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-19 10:54:32 +01:00
Liwei Song
ba771bf192 initramfs-framework: add lvm module
lvm module will initial lvm volume to support boot from
Logical Volume.

(From OE-Core rev: 3a4213f014fc4aa5be05dfc0722d87e01e5ff10c)

Signed-off-by: Liwei Song <liwei.song@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-25 23:13:48 +00:00
Liwei Song
2d15516d40 initramfs-framework: mount efivarfs to make Intel VROC work well
efivafs contain some meta data about Intel VROC, which will be
used by mdadm to create raid device.

These are preparation work to support boot from Intel VROC RAID
disk.

(From OE-Core rev: b25869c76975bbcec8d2f22f680e58976ec4de5c)

Signed-off-by: Liwei Song <liwei.song@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-25 23:13:48 +00:00
Anuj Mittal
f13f1dd286 initramfs-framework/udev: call settle before kill
When mount command is executed in rootfs module of initrd, eudev creates
a loop0 device node, applies rules and adds a inotify watch to it. Right
after this step, we execute finish which first tries to kill any running
udevd daemon before doing a switch_root.

In some cases, it is possible that switch_root is executed before
inotify_add_watch was actually processed which would lead to errors like:

| inotify_add_watch(6, /dev/loop0, 10) failed: No such file or directory

Make sure that we process all the events in queue before actually trying
to kill udevd to prevent this race.

Fixes [YOCTO #12861]

(From OE-Core rev: a85c34d263fcf1542bbedcaf1634302466bb20cf)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-20 05:41:31 -07:00
Andrew Bresticker
6c1ed635df initramfs-framework: Don't use 'tr'
tr is available in busybox, but not in toybox. Just use sed instead.

(From OE-Core rev: 518cca6711f737f44ff74a5ac1308de8c9b49e78)

Signed-off-by: Andrew Bresticker <abrestic@waymo.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-13 17:38:07 +01:00
Oleksii Konoplitskyi
f94c0c8e6f initramfs-framework: add nfsrootfs module
nfsrootfs module mounts rootfs via nfs parsing "nfsroot" and "ip" cmdline options.

(From OE-Core rev: d1737f2dabac5e338061863c78a91b4c115365c7)

Signed-off-by: Oleksii Konoplitskyi <okonopli@cisco.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-09 22:48:39 +01:00
Ricardo Salveti
51c6e1d1cb initramfs-framework: rootfs: add support for LABEL
The rootfs can also be found via the partition label.

(From OE-Core rev: 037255f3c448bfc05f3e7373e1ddeee4bbea2164)

Signed-off-by: Ricardo Salveti <ricardo@opensourcefoundries.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-16 18:05:40 +00:00
Otavio Salvador
72d677b2bd initramfs-framework: Add exec module
This new module allow for easy execution of external scripts or
applications. It runs anything found in /exec.d directory in order and
in case of no scripts to be available, it opens a shell.

(From OE-Core rev: 9b98c97338b4c3f985eca572d6a1e21324fa0fbc)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-10 22:45:19 +00:00
California Sullivan
2dfd3a0d4c initramfs-module-install-efi: point to original copy and delete new file
There is no need to maintain two of the exact same files.

(From OE-Core rev: 49ba882be9e28a51651a543779e6f02d33861393)

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-30 10:49:21 +00:00
Otavio Salvador
362a99fd59 initramfs-framework: Allow directories with spaces
When mdev module loads the Linux kernel modules, it can visit
directories with spaces. To allow that, we must quote the variable
otherwise it misunderstand it arguments as multiple entries.

Fixes:

,----
| Freeing unused kernel memory: 3072K (80d00000 - 81000000)
| cat: can't open '/sys/devices/platform/Vivante': No such file or directory
| cat: can't open 'GCCore/modalias': No such file or directory
`----

(From OE-Core rev: afc73dd6346325de0a39997a3045b6659f9658b5)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-12 23:55:28 +01:00
California Sullivan
26b6995f61 initramfs-framework/setup-live: quote bootparam_root variable
When bootparam_root was empty the if statement would resolve into
invalid syntax instead of short circuiting after the -z, causing a boot
failure.

(From OE-Core rev: dcd129504ea64986652e2e5907d9badf9373e367)

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-24 13:48:10 +01:00
California Sullivan
769c774f89 initramfs-framework/setup-live: also boot live image if root=/dev/ram0
Our grub and syslinux bootloaders both define root=/dev/ram0 for live
images by default. Kernel docs show that root=/dev/ram0 is just a
sentinel value for the kernel to mount the initrd as root, which then
mounts and switches to the real root. This is exactly what our scripts
do, so just check for root=/dev/ram0 as well.

See: https://www.kernel.org/doc/html/v4.11/admin-guide/initrd.html#operation

This fixes the issue where the new initramfs-framework scripts would not
boot live images that use grub or syslinux bootloaders.

(From OE-Core rev: a30f8f60017d566d845ee5d3a8cfc338017211b0)

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-19 22:15:39 +01:00
California Sullivan
511dbdbc9a initramfs-framework/setup-live: remove superfluous break
This causes us to fall out of the module setup/run loop in the base init
script should "root=" be defined, causing a boot failure.

(From OE-Core rev: 4f109da34a080c0d7cb86eaea1f7b6dfef3d04cb)

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-09 09:24:16 +01:00
Ng, Wei Tee
8b960914ac initramfs-framework: include install-efi module in recipe for installation
Utilized the existing init-install-efi.sh script and renamed it to
install-efi.sh to manage the installation process of images in
initramfs-framework model. This script will be executed when
"install" option is being chosen in the grub menu and install
the image on the target platform. A new install-efi module is
being added in the recipe to handle the installation process
using initramfs-framework.

[YOCTO #10989]

(From OE-Core rev: 41b34441c22143cbabace3d794ead05801afb7a0)

Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-27 22:36:53 +01:00
Ng, Wei Tee
716d5d9e65 initramfs-framework: module to support boot live image
setup-live module is a new module being introduced to integrate the
functionality of init-live.sh into new scriptlet named setup-live in
order to support the live boot image. The udev-extraconf rdepends is
being added to perform automounting. It gets to run before the rootfs
and finish module.

The setup-live scriplet include the changes for:

- Create a conditional loop for the bootparam_root variable. If it is
not set, then it will boot from ROOT_IMAGE. Else, it will boot normally
which is not from removable media.

- Gives a standard path to the original boot disk mount which can be
used to. While /media/sda is a good guess, it isn't always right, nor
is it a good assumption that only one boot disk is in the system.

- The current rootfs module has no support for rootfs images, currently
it only support for rootfs partitions for wic image. Therefore, there
is a need to assign the rootfs image for live image.

[YOCTO #11701]

(From OE-Core rev: 4d3300e85a8e65207a415b9cf84c9fa1f71b0406)

Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-27 22:36:53 +01:00
Igor Stoppa
d6a43d222d initramfs-framework: Add support for PartUUIDs
The rootfs can be addressed also by referring to the PartUUID
value from the GPT.
This patch enables such type of reference.

(From OE-Core rev: 1ab2ca141d3defe4b80212e28ac7c3f2271e2515)

Signed-off-by: Igor Stoppa <igor.stoppa@intel.com>
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-08 09:57:26 +01:00
Patrick Ohly
ee6a6c3461 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).

(From OE-Core rev: 2a50bb9ee8838e3d026c82dc09aaccb880a264f4)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-08 09:57:26 +01:00
Otavio Salvador
2f9b8e9134 initramfs-framework: base: Ensures /run/lock is available
Depending on the module we use, the /run/lock may be required. This
creates it as part of initial setup and thus makes it available for
every sub module.

(From OE-Core rev: 1cf288a0514ae9365fe55a0ff90b5abe35042cef)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-23 14:26:16 +01:00
Wills Wang
7a775a1c46 initramfs-framework: create directory /var/run
The following error occurs when udevd startup:
udevd[146]: bind failed: No such file or directory
error binding udev control socket
udevd[146]: error binding udev control socket

(From OE-Core rev: 4db089f10a379bc9a4df287bd657153eb4b94c45)

Signed-off-by: Wills Wang <wills.wang@live.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-08 10:20:53 +00:00
Patrick Ohly
d6e40e80d1 initramfs-framework: better error reporting for invalid root boot parameter
When the "boot" parameter refers to a non-existent device, the only
visible output at normal log levels was a rather confusing:
   ERROR: There's no '/dev' on rootfs.

That's because the actual error, not being able to find the root
device, was only a debug message, which gets ignored in the default
mode.

Promoting the "root '$bootparam_root' doesn't exist." message from
"debug" to "msg" gives sufficient context to understand the error. A
more intrusive change would be to change also the control flow.

(From OE-Core rev: 71d7803e5b13e26fd8001e87cfbac68114ddaa30)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23 09:52:59 +01:00
Patrick Ohly
288a9ffcf2 initramfs-framework: fix "support dropping into shell on failure"
Due to a missing $ before the variable name, all fatal errors ended up
invoking a shell, instead of only doing that when init_fatal_sh is set
as boot parameter.

(From OE-Core rev: 2a4335eae4b31ea9451a665dad2ba33ae4967670)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23 09:52:58 +01:00
Patrick Ohly
08ec92a04e initramfs-framework: support dropping into shell on failure
When the init_fatal_sh boot parameter is present (i.e. used without
value) and a fatal problem occurs inside the initramfs-module, a shell
will be started instead of looping forever.

Useful for debugging.

Interestingly enough, the code was already indented to support such an
if check...

(From OE-Core rev: 1d3dc681e809846dba7cae4f81566045a3f8c205)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12 22:48:43 +01:00
Patrick Ohly
04f4ef9766 initramfs-framework: support init boot parameter
It can be useful for debugging to override the default /sbin/init.
This is something typically done via the init boot parameter which
then gets interpreted by the kernel. But when using an initramfs, it
is the initramfs which must react to the option.

(From OE-Core rev: dfd6d4c765924f472ac2df724342547b5c15249a)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12 22:48:43 +01:00
Patrick Ohly
77524d791b initramfs-framework: support ro boot parameter
Default is to mount the rootfs read/write. "ro" can be used to turn
that into read-only, which is useful on systems where userspace does
an fsck before remounting read-write.

Giving both "ro" and "rw" will still mount read-only regardless of the
order, because the ordering information is not preserved by the
initramfs-framework's boot param support.

(From OE-Core rev: a09f10f9360862c16fb68972ac041d474d6e3a64)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12 22:48:42 +01:00
Patrick Ohly
d7508fee30 initramfs-framework: support rootflags and rootfstype boot parameter
These two parameters are supported by the kernel
(https://www.kernel.org/doc/Documentation/kernel-parameters.txt). When
an initramfs is used, the kernel does not mount the rootfs and the
initramfs needs to react to them.

The boot parameters can be set both by the image creator and
by users.

Supporting these two parameters is useful:
- rootflags is needed to ensure that the rootfs is already mounted as
  intended in the time between starting init and init remounting
  it (as systemd does); this is critical for IMA where iversion must be
  active already when system starts writing files.
- setting it correctly up-front avoids messages from the kernel ("cannot
  mount ... as ext2 because ...") when trying to guess the desired type.

For example, assuming that only one of ext4/ext3/ext2 is set,
rootfstype could be set in an image recipe with:
APPEND_append = "${@''.join([' rootfstype=' + i for i in ['ext4', 'ext3', 'ext2'] if i in d.getVar('IMAGE_FSTYPES', True).split()])}"

(From OE-Core rev: b8ea1c61b4b8071edf70f5d42119c54ea84de330)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12 22:48:42 +01:00
Patrick Ohly
82dd3fb27e initramfs-framework: handle kernel parameters with . inside
Kernel parameters like "uvesafb.mode_option=640x480-32" were turned
into shell variables named "bootparam_uvesafb.mode_option", which
triggered errors from the shell because the name is not valid. Now
points get replaced with underscores, leading to
bootparam_uvesafb_mode_option in this example.

(From OE-Core rev: de81e804f0654092d20ccb8e6e40f4ff614c4b09)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-06 15:26:24 +01:00
Michaël Burtin
c367ebd4d6 initramfs-framework: fix test that filter backup module files
Test that filter backup module files (files starting with ~)
was accidentally reversed in e6039e6e3b98d6ab91252a5012d76279b1fac6e8,
this patch restore initial behavior.

(From OE-Core rev: b2eb846ee12989add7a7ca8bbf45f293a3a7e56d)

Signed-off-by: Michaël Burtin <michael.burtin@innotis.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-23 07:14:13 +01:00
Ross Burton
242ad61580 Revert "initrdscripts: look for new systemd-udevd location"
systemd-udevd is back in /lib, so revert this change.

This reverts commit 27bb516be4.

(From OE-Core rev: 3f6324a86cb8c1c253af06a1033ac71fa61c58d3)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-17 14:35:19 +01:00
Chen Qi
ca365c603b initramfs-framework: fix bashism
(From OE-Core rev: e6039e6e3b98d6ab91252a5012d76279b1fac6e8)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-06 12:39:53 +01:00
Ross Burton
27bb516be4 initrdscripts: look for new systemd-udevd location
As per the previous commit, systemd-udevd is now in /sbin/systemd/.

(From OE-Core rev: ff0fd25206c3c75921d51cb80bcb6c94ca47b405)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-13 23:53:06 +01:00
Richard Purdie
51cc49ddda initrdscripts: Add udev sbin based libexec path
For better or worse we need to use base_sbindir for udev's libexec dir. This
updates the initrdscripts to also cover the new location. I'd prevously assumed
that it was already covered but its not. udev internal binaries shouldn't be in
PATH so we have to do this to deal with the issue.

(From OE-Core rev: 7e17cba75c20ad820d30128d9b4b0132e7b924a8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-10 11:49:04 +01:00