Skip to content
Snippets Groups Projects
Unverified Commit 485a41a8 authored by Casey's avatar Casey :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 2ed80cac
No related branches found
No related tags found
No related merge requests found
Pipeline #206078 failed
......@@ -3,7 +3,6 @@
/bin/sh
/etc/deviceinfo
/etc/unudhcpd.conf
/lib/mdev/persistent-storage
/sbin/blkid
/usr/bin/iskey
/usr/bin/unudhcpd
......@@ -11,7 +10,13 @@
/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/buffyboard
/usr/share/consolefonts/ter-128n.psf.gz
/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.0
pkgver=2.7.0
pkgrel=0
pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra"
url="https://postmarketos.org"
......@@ -23,11 +23,11 @@ depends="
font-terminus
iskey
lz4
mdev-conf
multipath-tools
parted
postmarketos-fde-unlocker
postmarketos-mkinitfs>=2.2
udev
unudhcpd
util-linux-misc
xz
......@@ -40,7 +40,6 @@ source="
init.sh
init_functions.sh
unudhcpd.conf
mdev.conf
"
arch="noarch"
license="GPL-2.0-or-later"
......@@ -79,9 +78,6 @@ package() {
-t "$pkgdir"/usr/share/mkinitfs/files-extra/
mkdir -p "$pkgdir"/etc/mkinitfs/files-extra
install -Dm644 "$srcdir"/mdev.conf \
-t "$pkgdir"/usr/share/initramfs/
mkdir -p "$pkgdir"/usr/share/mkinitfs/hooks
mkdir -p "$pkgdir"/usr/share/mkinitfs/hooks-extra
mkdir -p "$pkgdir"/etc/mkinitfs/hooks
......@@ -91,10 +87,9 @@ package() {
sha512sums="
59be0649ed87a72d93624bd8a2e3f8c99a0f32f7b7a26f99436de782beba55671472c269eeee86440efc87e0d7148a0bb335fa537791092e73878ca21330544a 00-default.modules
5b364300f31c91fd0591eb0715f67cbf5383f45246a5fb9f34b79f7cb2e3b15768b2130e5f32f816cc169950f988c1beabc879ba31645c58ce131a288dbc071d 00-initramfs-base.dirs
0fed7dfdf940f5de15ca2fa636214d44ee8549afe5001b81beb0e337e865eb737916e158bc0ed7a7803adc81176386ae8edfc21150de62bb136fdfcdcb888b8b 00-initramfs-base.files
7b103923db8752e64911afe25788621622760eae95ad2e76c1cdb078e4647a6ebc00b174f17e3fe0a3747bcbd034cdb500d31ae5212357eb5e91516d696c66d5 00-initramfs-base.files
8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files
c433684398bdab7b85383ba13f80ce306d24481bdc553aec64f5aaa2547fa97e7dc0934a962ed55a57a45dbde1878f8058579149bd6e0d953e6a2a3174f79613 init.sh
cf5b0beaffff0aa17196af39ac7e84d890ee5c9487920e12af7079728c713dc3bb170f3045797f09be436885d02d2ba5dea98c0a3ab08e3aad3bbf66aecb711d init_functions.sh
5f50c6df8b959efe8a3886f26939d69c12a28d16643bb1bb828959e1f69923967931857921b3e5e1541f45ae9b5f2bc3c93015a0d414d02d03aaf3e1a9f36141 init.sh
0624034b4ef87b71b06cdfbdf62131e1f02b013b4676a49536c09cacef56308895e077a1f4f742e05945864e5ae2f476b10e5d088be2e8e8701c68897fed227d 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() {
......
#
# 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