Skip to content
Snippets Groups Projects
Unverified Commit a6eec253 authored by Caleb Connolly's avatar Caleb Connolly :recycle:
Browse files

postmarketos-initramfs: switch to udev


mdev is slow and missing features, it also requires that we load all the
modules that we include at once making the boot process slower.

udev is required for unl0kr (and buffyboard), it can also load modules
on demand (and asynchronously). Making the boot process considerably
faster on devices, especially for generic images where we have lots of
drivers for different display panels in the initramfs.

This brings us more in line with other distros and generally improves
compatibility.

If devices use broken kernel modules which don't correctly define
modalias', these drivers may not be loaded by udev. This should be fixed
by defining the missing modalias statements in the driver.

Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
parent 7e4d36a1
No related branches found
No related tags found
No related merge requests found
Pipeline #205795 failed
......@@ -3,12 +3,17 @@
/bin/sh
/etc/deviceinfo
/etc/unudhcpd.conf
/lib/mdev/persistent-storage
/sbin/blkid
/usr/bin/unudhcpd
/usr/sbin/kpartx
/usr/share/deviceinfo/deviceinfo
/usr/share/initramfs/init.sh:/init
/usr/share/initramfs/init_functions.sh:/init_functions.sh
/usr/share/initramfs/mdev.conf:/etc/mdev.conf
/usr/share/misc/source_deviceinfo
/usr/bin/iskey
/usr/share/libinput/*.quirks
/bin/udevadm
/sbin/udevd
/etc/udev/rules.d
/lib/udev/rules.d
/lib/udev/scsi_id
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=postmarketos-initramfs
pkgver=2.6.1
pkgver=2.7.0
pkgrel=0
pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra"
url="https://postmarketos.org"
......@@ -19,12 +19,13 @@ depends="
e2fsprogs
e2fsprogs-extra
f2fs-tools
iskey
lz4
mdev-conf
multipath-tools
parted
postmarketos-fde-unlocker
postmarketos-mkinitfs>=2.2
udev
unudhcpd
util-linux-misc
xz
......@@ -37,7 +38,6 @@ source="
init.sh
init_functions.sh
unudhcpd.conf
mdev.conf
"
arch="noarch"
license="GPL-2.0-or-later"
......@@ -88,11 +88,9 @@ package() {
sha512sums="
59be0649ed87a72d93624bd8a2e3f8c99a0f32f7b7a26f99436de782beba55671472c269eeee86440efc87e0d7148a0bb335fa537791092e73878ca21330544a 00-default.modules
5b364300f31c91fd0591eb0715f67cbf5383f45246a5fb9f34b79f7cb2e3b15768b2130e5f32f816cc169950f988c1beabc879ba31645c58ce131a288dbc071d 00-initramfs-base.dirs
ab41b45b0613f25a61114ed8c8b92bc53c60838f6e2e0ba18c76e5369b2984e6023a0661887692673aca3f647f268c468a468f6b1ac424cfee609017a89481dd 00-initramfs-base.files
ede9eb44fe180578ca97b7abfa2c4f1b4e277a49e4ca8b8911005acd844dbce38f200bc84280ded5a35fe5abd32bec391efc4af1929db12aa52da0c1036c6983 00-initramfs-fullsize.files
6604d9fcdff7722a130abdb91318d02831ae696454dad276f4079f875a1cd80f6cd0a93324cc728090bfabc3f3b3c3778ee745aa9351a16f057eefd46dd56008 00-initramfs-base.files
8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files
42ff1c71326ce8ad1f023031b3aa3d96e2b6ab5daf035a363f59a9c17255a348d59adbe808d44f6c31cb03a1c4a0278111c8b7842b7cf1854c1693db3836b7a9 init.sh
4e1536b338352608abfefc1564712656392a218a0e3bdc23077d60bd4f991843799e107822b03afcdcf3579e8fd7e28167f9d13e66839c3b6a882e039148cebd init_functions.sh
6a9b340de06901087d910b4b6e2e84dfa1d2ef35d5c97dd67d68980a4df6971df35b5c432949ff1ce8e53070857fdc137e9e1536526bb442b5c8e164c3f192e5 init.sh
db06ac44f21eed3b4da31e4ccd3d59aad95c8a7fe9d71f39ea74ef627e8b68a69d8e999dd6e616a5b7f780014e94b528bf063074b03fa65078e0d9ef5a98f4e2 init_functions.sh
ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf
675e7d5bee39b2df7d322117f8dcaccc274d61beaf4d50ead19bbf2109446d64b1c0aa0c5b4f9846eb6c1c403418f28f6364eff4537ba41120fbfcbc484b7da7 mdev.conf
"
......@@ -28,16 +28,13 @@ setup_log
setup_firmware_path
if [ "$IN_CI" = "false" ]; then
# shellcheck disable=SC2154
load_modules /lib/modules/initramfs.load "libcomposite"
setup_framebuffer
show_splash "Loading..."
setup_mdev
setup_dynamic_partitions "${deviceinfo_super_partitions:=}"
else
# loads all modules
setup_udev
fi
setup_udev
setup_dynamic_partitions "${deviceinfo_super_partitions:=}"
run_hooks /hooks
if [ "$IN_CI" = "true" ]; then
......
......@@ -67,31 +67,19 @@ setup_firmware_path() {
echo -n /lib/firmware/postmarketos >$SYS
}
# shellcheck disable=SC3043
load_modules() {
local file="$1"
local modules="$2"
[ -f "$file" ] && modules="$modules $(grep -v ^\# "$file")"
# shellcheck disable=SC2086
modprobe -a $modules
}
setup_mdev() {
# Start mdev daemon
mdev -d
}
setup_udev() {
# Use udev to coldplug all devices so that they can be used via libinput (e.g.
# by unl0kr). This is the same series of steps performed by the udev,
if ! command -v udevd > /dev/null || ! command -v udevadm > /dev/null; then
echo "ERROR: udev not found!"
return
fi
# This is the same series of steps performed by the udev,
# udev-trigger and udev-settle RC services. See also:
# - https://git.alpinelinux.org/aports/tree/main/eudev/setup-udev
# - https://git.alpinelinux.org/aports/tree/main/udev-init-scripts/APKBUILD
if command -v udevd > /dev/null && command -v udevadm > /dev/null; then
udevd -d
udevadm trigger --type=devices --action=add
udevadm settle
fi
udevd -d --resolve-names=never
udevadm trigger --type=devices --action=add
udevadm settle
}
get_uptime_seconds() {
......@@ -856,6 +844,7 @@ debug_shell() {
if [ -x /usr/bin/buffyboard ]; then
hide_splash
modprobe uinput
setfont /usr/share/consolefonts/ter-128n.psf.gz -C /dev/tty1
buffyboard 2>/dev/tty1 &
if [ "$active_console" != "tty1" ]; then
run_getty tty1
......
#
# This is an mdev config for the postmarketOS initramfs
#
# Devices:
# Syntax: %s %d:%d %s
# devices user:group mode
$MODALIAS=.* 0:0 0660 @modprobe -q -b "$MODALIAS"
# null does already exist; therefore ownership has to be changed with command
null 0:0 0666 @chmod 666 $MDEV
zero 0:0 0666
full 0:0 0666
random 0:0 0666
urandom 0:0 0444
hwrandom 0:0 0660
console 0:0 0600
kmem 0:0 0640
mem 0:0 0640
# Set up /dev/disk/by-* symlinks
dasd.* 0:0 0660 */lib/mdev/persistent-storage
mmcblk.* 0:0 0660 */lib/mdev/persistent-storage
nbd.* 0:0 0660 */lib/mdev/persistent-storage
nvme.* 0:0 0660 */lib/mdev/persistent-storage
sd[a-z].* 0:0 0660 */lib/mdev/persistent-storage
sr[0-9]+ 0:0 0660 */lib/mdev/persistent-storage
vd[a-z].* 0:0 0660 */lib/mdev/persistent-storage
xvd[a-z].* 0:0 0660 */lib/mdev/persistent-storage
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment