aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* firmware: copy only the necessary firmware(s) into initramfsDmitry Baranov2023-08-301-33/+58
| | | | | | | | | | | | | | | | | | | FIRMWARE=yes behavior is changed: Only the minimum number of firmware files will be copied. The list is generated using the `modinfo -F firmware [modules]...` command. The ability to copy all firmware(s) is also available with a new ALLFIRMWARE setting (see the modified genkernel.conf for more details). As for changes in the source code: gen_moddeps.sh: Significantly redesigned module list generation. To get a list of modules, use the `mod_dep_list()` function instead of `gen_dep_list()`. Modules that are not in the kernel (=n or invalid) will be filtered out. Aliases will be replaced with real names (including dependencies). Signed-off-by: Dmitry Baranov <reagentoo@gmail.com> Closes: https://github.com/gentoo/genkernel/pull/40 Signed-off-by: Sam James <sam@gentoo.org>
* Plymouth support for genkernel (squashed).FlyingWaffle2023-08-301-0/+57
| | | | | | Bug: https://bugs.gentoo.org/753617 Signed-off-by: FlyingWaffle <flyingwaffle@pm.me> Signed-off-by: Sam James <sam@gentoo.org>
* gen_initramfs.sh: force no-color on qlist callsBen Kohler2023-05-241-2/+2
| | | | | | | In some cases, qlist's pipe detection may not work, and this is fatal to our build. Let's just force -C on all qlist calls. Signed-off-by: Ben Kohler <bkohler@gentoo.org>
* genkernel: add keyctl support for loading LUKS passphrase into a keyringMaciej S. Szmigiero2022-05-221-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cryptsetup LUKS2 format comes with an ability to automatically unlock multiple devices (root, swap, etc.) sharing the same passphrase, without retyping it for each of them, by loading it into the user keyring. This commit adds such (optional) genkernel support for loading LUKS passphrase into the user keyring on boot. In the default mode of operation the newly added key is (possibly) used only to unlock root and swap devices and is removed soon after that. By providing appropriate kernel command line parameter the key can be left in the keyring instead (with an optional timeout) for unlocking other LUKS devices post-initramfs time. Because one of the most common use cases of this functionality will be having an encrypted swap for doing suspend to disk (hibernation) let's also make sure that we don't unlock the root device when doing so is unnecessary (when we are resuming the system from hibernation). Since the security of a FDE passphrase is of paramount importance in this solution significant care has been taken not to leak it accidentally: * The passphrase is read directly by keyctl to avoid storing it in the shell, * If the passphrase is used only to unlock root and swap devices (which is the default mode of operation) the init script will check whether its removal from keyring has actually succeeded and, if not, reboot the system rather than continue while leaving it exposed, * keyutils includes a patch (already upstreamed) to wipe the passphrase from memory when no longer needed. Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
* gen_initramfs.sh: append devicemanager only for specific modulesMike Gilbert2022-05-151-4/+7
| | | | | | | | | | dmraid luks lvm multipath Bug: https://bugs.gentoo.org/749957 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* gen_initramfs.sh: append_dropbear: NSS files module was merged into libc in ↵Thomas Deutschmann2021-11-151-2/+10
| | | | | | >=glibc-2.34 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_busybox: NSS dns module was merged into libc in ↵Thomas Deutschmann2021-11-151-2/+10
| | | | | | | >=glibc-2.34 Bug: https://bugs.gentoo.org/823716 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_modprobed(): Adopt changes from sys-apps/baselayout-2.8Thomas Deutschmann2021-09-301-3/+12
| | | | | | | | | In >=sys-apps/baselayout-2.8, /etc/modprobe.d was moved to /lib/modprobe.d. This commit will try to copy /etc/modprobe.d and /lib/modprobe.d but will no longer fail if one directory is missing. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* Refactor (compressed) kernel module handlingThomas Deutschmann2021-09-091-1/+21
| | | | | | | | | | | | | | | | | | | | | | To support a specific module compression algorithm, two things are needed: Used depmod utility on host system building the kernel must support chosen module compression algorithm to generate proper modules.dep file or genkernel would be unable to read module dependencies when copying modules to initramfs. At runtime, used modprobe utility must be able to handle chosen module compression algorithm or modules would be unloadable. To address the first requirement, genkernel will now check if used kmod utility on host system supports chosen module compression algorithm. To address the runtime requirement, this commit will switch from BusyBox's modutils implementation to kmod because BusyBox does not support ZSTD compression (yet). Bug: https://bugs.gentoo.org/809344 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_moddeps.sh: Move modules_kext() to determine_KEXT()Thomas Deutschmann2021-07-081-1/+2
| | | | | | | | | | | We want debug output but then we cannot use return value from this function. Transforming function to determine_KEXT() like determine_KV() will fix the problem and allows us to keep debug output. Fixes: 234ce29 ("gen_moddeps.sh: modules_kext() refactored") Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_modules(): Export KEXT variableThomas Deutschmann2021-07-061-4/+4
| | | | | | This will allow us to call modules_kext() just once. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_zfs(): Copy /etc/zfs/vdev_id.confThomas Deutschmann2021-03-271-1/+2
| | | | | | Used by vdev_id UDEV helper. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_zfs(): Update UDEV dir in UDEV rulesThomas Deutschmann2021-03-261-0/+9
| | | | | | | | | | Because we are copying UDEV rules from host system, we have to ensure that used UDEV dir matches our initramfs environment to prevent errors like failed to execute '/lib/udev/vdev_id' '/lib/udev/vdev_id -e': No such file or directory Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* Add RISC-V supportYixun Lan2021-03-191-1/+1
| | | | | Bug: https://bugs.gentoo.org/767937 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* Change --firmware-files handlingThomas Deutschmann2021-03-151-2/+2
| | | | | | | | | | | | | | | | - Move from space-separated list to comma-separated list to add support for firmware files with spaces. - Add support for firmware files with spaces. - Check for specified firmware files in determine_real_args() which will allow us to error out early. - Clarify documentation. Fixes: c576f99b0b ("Misc improvements for FIRMWARE* handling") Bug: https://bugs.gentoo.org/775221 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_eudev(): log udevadm errors to $LOGFILEThomas Deutschmann2021-02-091-1/+2
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: copy_binaries(): use global LC_ALLThomas Deutschmann2021-02-081-1/+1
| | | | | | Since commit 0785165ca64 we set LC_ALL in global scope. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: remove unused function is_static()Thomas Deutschmann2021-02-081-6/+0
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: fix typo: s/auxilary/auxiliary/gGöktürk Yüksek2021-02-061-3/+3
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_base_layout(): Create /etc/{group,passwd,shadow} in ↵Thomas Deutschmann2020-08-281-17/+58
| | | | | | | | this function These files should be present all the time, not just when built with --ssh option set. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_base_layout(): Symlink '/etc/mtab' to ↵Thomas Deutschmann2020-08-281-0/+3
| | | | | | '/proc/self/mounts' Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_base_layout(): Add /etc/initrd-releaseThomas Deutschmann2020-08-281-1/+10
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* defaults/linuxrc: Add gksosreportThomas Deutschmann2020-08-281-1/+7
| | | | | | | | | | To help debugging, 'gksosreport' was added (idea was borrowed from dracut): Whenever a user run into a problem and get to a rescue shell, running "gksosreport" will generate /run/initramfs/gksosreport.txt containing useful debug information suitable to attach to bug reports. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* defaults/linuxrc: Always preserve logThomas Deutschmann2020-08-281-7/+3
| | | | | | | | | | Now that we are using UDEV and have to preserve /run, we can also use /run to always store log from initramfs. This will make debugging easier because user don't have to explicit enable logging (disabling is still possible). Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* Remove --disklabel optionThomas Deutschmann2020-08-281-1/+0
| | | | | | | Now that we always build util-linux for switch_root, we no longer need this option. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* Use switch_root from util-linuxThomas Deutschmann2020-08-281-12/+12
| | | | | | | | | | switch_root from busybox does not move /dev, /sys, /proc and /run. If we do that manually there is a small window for a race condition when /dev, /sys or /proc is still needed but already moved. switch_root from util-linux will move these mounts on its own and will therefore avoid any potential problems. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_base_layout(): move /run/utmp to /var/run/utmpThomas Deutschmann2020-08-281-2/+2
| | | | | | | | | | Will fix syslogin_perform_logout: logout(pts/0) returned an error: No such file or directory error logged by dropbear. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_modules(): Update modules.* files to represent ↵Thomas Deutschmann2020-08-251-0/+5
| | | | | | initramfs content Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_multipath(): don't check package file list with ↵Thomas Deutschmann2020-08-241-1/+0
| | | | | | realpath Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_zfs(): don't check package file list with realpathThomas Deutschmann2020-08-241-1/+0
| | | | | Bug: https://bugs.gentoo.org/738740 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_modules(): Output used modules src directoryThomas Deutschmann2020-08-031-2/+2
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* Make use of expand_file() for --linuxrc optionThomas Deutschmann2020-08-031-8/+5
| | | | | Bug: https://bugs.gentoo.org/483146 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* Rename INSTALL_MOD_PATH option to KERNEL_MODULES_PREFIXThomas Deutschmann2020-08-031-2/+2
| | | | | | | | | | Before this change we had different names in config file and command-line for the same thing. With this change we have one option named KERNEL_MODULES_PREFIX and its corresponding --kernel-modules-prefix command-line argument. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: create_initramfs(): Use correct kernel configThomas Deutschmann2020-08-011-23/+22
| | | | | Bug: https://bugs.gentoo.org/733946 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* Unify grep usageThomas Deutschmann2020-08-011-1/+1
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: create_initramfs(): set_initramfs_compression_method() ↵Thomas Deutschmann2020-08-011-1/+1
| | | | | | | must be called when kerncache is used Follow-up: a864c2f ("gen_initramfs.sh: create_initramfs(): Call set_initramfs_compression_method() when not building kernel") Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* ZFS: Enable UDEV supportv4.1.0_beta1Thomas Deutschmann2020-07-241-1/+22
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* dmraid: Switch to UDEV usageThomas Deutschmann2020-07-241-0/+2
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* multipath: Switch to UDEV usageThomas Deutschmann2020-07-241-3/+28
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* bcache: Switch to UDEV usageThomas Deutschmann2020-07-241-0/+28
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* Switch from MDEV to UDEVThomas Deutschmann2020-07-241-17/+104
| | | | | | | | | We need to switch from using MDEV to UDEV to avoid boot problems due to timeouts caused by some UDEV rules from real system when real system is using systemd. Bug: https://bugs.gentoo.org/706434 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs: Fix styleThomas Deutschmann2020-07-241-6/+0
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: create_initramfs(): Call ↵Thomas Deutschmann2020-07-161-0/+7
| | | | | | | | | set_initramfs_compression_method() when not building kernel We need to call set_initramfs_compression_method() manually when we didn't build kernel in same run to ensure that $COMPRESS_INITRD_TYPE is initialized. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: create_initramfs(): Move and unify validation of ↵Thomas Deutschmann2020-07-161-61/+6
| | | | | | | | | | | | | | | --compress-initramfs-type to determine_real_args() This will allow us to error out early if required user space tool needed to compress initramfs based on specified --compress-initramfs-type is missing or selected type is invalid/unsupported. Best/fastest list is based on results from [Link1][Link2][Link3]. Link1: https://events.static.linuxfound.org/sites/events/files/lcjpcojp13_klee.pdf Link2: https://kernel.ubuntu.com/~cking/boot-speed-eoan-5.3/kernel-compression-method.txt Link3: https://lwn.net/Articles/817134/ Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_dropbear(): Add support for ed25519 host keysThomas Deutschmann2020-06-201-2/+15
| | | | Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_dropbear(): Fix error message shown when ↵Thomas Deutschmann2020-06-151-2/+2
| | | | | | net-misc/dropbear is required Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: copy_system_binaries(): Don't check for non-existing ↵Thomas Deutschmann2020-06-151-5/+0
| | | | | | | | | | | | linked libraries lddtree will always report "not found" when doing cross-compile. Because we will error out later nonetheless when copying will fail, we don't need such a check in advance. Closes: https://bugs.gentoo.org/727442 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* Add b2sumThomas Deutschmann2020-02-151-1/+30
| | | | | | | b2sum can be used to verify (boot) media since commit 5c55dd467a563623f16be27f670b5a3ddc79fb02. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_splash(): Fix splash_geninitramfs error handlingMichael Gerlach2020-02-131-1/+1
| | | | | | | Closes: https://bugs.gentoo.org/709478 Signed-off-by: Michael Gerlach <n3ph@cccfr.de> Closes: https://github.com/gentoo/genkernel/pull/13 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
* gen_initramfs.sh: append_splash(): Move check for splash_geninitramfs to ↵Thomas Deutschmann2020-01-141-5/+0
| | | | | | | | | determine_real_args() This will allow us to fail early if splash_geninitramfs isn't available. Bug: https://bugs.gentoo.org/705304 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>