aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts/initramfs-framework
AgeCommit message (Collapse)Author
2018-09-19initramfs-framework/udev: call settle before killAnuj Mittal
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] Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-13initramfs-framework: Don't use 'tr'Andrew Bresticker
tr is available in busybox, but not in toybox. Just use sed instead. Signed-off-by: Andrew Bresticker <abrestic@waymo.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-07initramfs-framework: add nfsrootfs moduleOleksii Konoplitskyi
nfsrootfs module mounts rootfs via nfs parsing "nfsroot" and "ip" cmdline options. Signed-off-by: Oleksii Konoplitskyi <okonopli@cisco.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-16initramfs-framework: rootfs: add support for LABELRicardo Salveti
The rootfs can also be found via the partition label. Signed-off-by: Ricardo Salveti <ricardo@opensourcefoundries.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-12-10initramfs-framework: Add exec moduleOtavio Salvador
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. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-11-29initramfs-module-install-efi: point to original copy and delete new fileCalifornia Sullivan
There is no need to maintain two of the exact same files. Signed-off-by: California Sullivan <california.l.sullivan@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-12initramfs-framework: Allow directories with spacesOtavio Salvador
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 `---- Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-24initramfs-framework/setup-live: quote bootparam_root variableCalifornia Sullivan
When bootparam_root was empty the if statement would resolve into invalid syntax instead of short circuiting after the -z, causing a boot failure. Signed-off-by: California Sullivan <california.l.sullivan@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-19initramfs-framework/setup-live: also boot live image if root=/dev/ram0California Sullivan
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. Signed-off-by: California Sullivan <california.l.sullivan@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-09initramfs-framework/setup-live: remove superfluous breakCalifornia Sullivan
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. Signed-off-by: California Sullivan <california.l.sullivan@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-07-27initramfs-framework: include install-efi module in recipe for installationNg, Wei Tee
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] Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-27initramfs-framework: module to support boot live imageNg, Wei Tee
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] Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-08initramfs-framework: Add support for PartUUIDsIgor Stoppa
The rootfs can be addressed also by referring to the PartUUID value from the GPT. This patch enables such type of reference. 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>
2016-07-08initramfs-framework: add retry loop for slow boot devices (like USB)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). Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-06-23initramfs-framework: base: Ensures /run/lock is availableOtavio Salvador
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. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-12-08initramfs-framework: create directory /var/runWills Wang
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 Signed-off-by: Wills Wang <wills.wang@live.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-09-21initramfs-framework: better error reporting for invalid root boot parameterPatrick Ohly
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. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-09-21initramfs-framework: fix "support dropping into shell on failure"Patrick Ohly
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. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-09-12initramfs-framework: support dropping into shell on failurePatrick Ohly
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... Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-09-12initramfs-framework: support init boot parameterPatrick Ohly
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. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-09-12initramfs-framework: support ro boot parameterPatrick Ohly
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. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-09-12initramfs-framework: support rootflags and rootfstype boot parameterPatrick Ohly
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()])}" Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-09-06initramfs-framework: handle kernel parameters with . insidePatrick Ohly
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. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-23initramfs-framework: fix test that filter backup module filesMichaël Burtin
Test that filter backup module files (files starting with ~) was accidentally reversed in e6039e6e3b98d6ab91252a5012d76279b1fac6e8, this patch restore initial behavior. Signed-off-by: Michaël Burtin <michael.burtin@innotis.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-17Revert "initrdscripts: look for new systemd-udevd location"Ross Burton
systemd-udevd is back in /lib, so revert this change. This reverts commit 27bb516be433ed9dcde6fe4a17d2429951a010a0. 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-08-05initramfs-framework: fix bashismChen Qi
Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-04-13initrdscripts: look for new systemd-udevd locationRoss Burton
As per the previous commit, systemd-udevd is now in /sbin/systemd/. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-10initrdscripts: Add udev sbin based libexec pathRichard Purdie
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-04initramds-framework: add shutdown hook for udevIan Reinhart Geiser
In cases where other initramfs modules need to rely on udev running (ie in my case I have to load firmware on a device that is slow to start) there needs to be a way to keep it running during the lifecycle of the initramfs but still be shut down before swith_root is called. I added a module_pre_hook that will shut down udev before the finish module is called. Signed-off-by: Ian Reinhart Geiser <igeiser@devonit.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-03initramfs-framework: udev: Handle alternative binary pathsOtavio Salvador
This allows use of udev daemon for different installation destinations so allowing use of udev's from systemd code for initramfs. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-03initramfs-framework: init: Stop mount warnings during bootOtavio Salvador
For a completely quiet boot using recent versions of utilities, the /etc/fstab and /var/lock need to be available. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-12initrdscripts: fix udevd in the live boot init scriptsRoss Burton
udevd moved location and isn't in $PATH anymore, so use an absolute path to start it. The control socket path moved too, so mkdir the directory it's in. Mounts the new devtmpfs on /dev device tree. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Alexandru Damian <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-08initramfs-framework: provides a modular initramfsOtavio Salvador
Provides the API and modules for a modular initramfs. The currently included modules are: * initramfs-module-debug adds support to dynamic debugging of initramfs using bootparams * initramfs-module-udev: enables udev usage * initramfs-module-mdev: enables mdev usage * initramfs-module-e2fs: adds support for ext4, ext3 and ext2 filesystems Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>