main/postmarketos-initramfs: switch_root with /dev (MR 3230) (MR 4204)

Mount /dev (and /run) in initramfs so util-linux switch_root can move
the mounts over to the new sysroot before changing root.
BusyBox switch_root doesn't even attempt to move anything so use
util-linux's switch_root for this.

Explicitly disable tests too...
This commit is contained in:
Luca Weiss 2022-06-13 00:28:36 +02:00 committed by Caleb Connolly
parent 146c6b0f1c
commit 5f820deefc
No known key found for this signature in database
GPG key ID: 7A342565FF635F79
5 changed files with 6 additions and 7 deletions

View file

@ -4,6 +4,7 @@
/etc
/lib
/proc
/run
/sbin
/sys
/sysroot

View file

@ -2,6 +2,7 @@
/sbin/btrfs
/sbin/dmsetup
/sbin/e2fsck
/sbin/switch_root
/usr/sbin/parted
/usr/sbin/resize2fs
/usr/sbin/resize.f2fs

View file

@ -5,6 +5,7 @@ pkgver=1.4.0
pkgrel=0
pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra"
url="https://postmarketos.org"
options="!check" # no tests
depends="
btrfs-progs
busybox-extras
@ -21,6 +22,7 @@ depends="
postmarketos-fde-unlocker
postmarketos-mkinitfs
unudhcpd
util-linux-misc
xz
"
source="

View file

@ -53,10 +53,6 @@ setup_bootchart2
# Switch root
killall telnetd mdev udevd msm-fb-refresher 2>/dev/null
umount /proc
umount /sys
umount /dev/pts
umount /dev
# shellcheck disable=SC2093
exec switch_root /sysroot "$init"

View file

@ -25,6 +25,8 @@ mount_proc_sys_dev() {
# mdev
mount -t proc -o nodev,noexec,nosuid proc /proc || echo "Couldn't mount /proc"
mount -t sysfs -o nodev,noexec,nosuid sysfs /sys || echo "Couldn't mount /sys"
mount -t devtmpfs -o mode=0755,nosuid dev /dev || echo "Couldn't mount /dev"
mount -t tmpfs -o nosuid,nodev,mode=0755 run /run || echo "Couldn't mount /run"
mkdir /config
mount -t configfs -o nodev,noexec,nosuid configfs /config
@ -32,9 +34,6 @@ mount_proc_sys_dev() {
# /dev/pts (needed for telnet)
mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
# /run (needed for cryptsetup)
mkdir /run
}
create_device_nodes() {