summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpio_list.txt2
-rw-r--r--init18
2 files changed, 13 insertions, 7 deletions
diff --git a/cpio_list.txt b/cpio_list.txt
index 0707c03..ca93071 100644
--- a/cpio_list.txt
+++ b/cpio_list.txt
@@ -4,11 +4,11 @@
# basic directories. note that all required parent directories will be
# auto-generated by make, and everything will be sorted afterwards
dir /dev 0755 0 0
+dir /efivars 0755 0 0
dir /mnt 0755 0 0
dir /proc 0755 0 0
dir /run 0755 0 0
dir /run/cryptsetup 0755 0 0
-dir /sys 0755 0 0
# kernel does /init <>/dev/console and fails if it doesn't exist in initramfs
# devtmpfs will provide other devices
diff --git a/init b/init
index db96ac4..b1a78f3 100644
--- a/init
+++ b/init
@@ -10,13 +10,12 @@ mount -t devtmpfs devtmpfs /dev || exit
mkdir -p /dev/pts
# /dev/pts for dropbear
mount -t devpts devpts /dev/pts
-# for random seed
-mount -t sysfs sysfs /sys
-mount -t efivarfs efivarfs /sys/firmware/efi/efivars
/etc/modules.sh || exit
-load-random-seed /sys/firmware/efi/efivars/LoaderRandomSeed-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f
+mount -t efivarfs efivarfs /efivars
+load-random-seed /efivars/LoaderRandomSeed-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f
+umount /efivars
(
ip link set eth0 up
@@ -26,8 +25,9 @@ dropbear -p 2222
) >/dev/null 2>&1 &
root=$(findfs UUID=ec8fb072-1200-4275-9494-f6f869187806) || exit
-cryptsetup open --tries 65535 --allow-discards "$root" root
-# in case of /sbin/unlock
+if cryptsetup open --tries 65535 --allow-discards --perf-no_read_workqueue --perf-no_write_workqueue "$root" root; then
+ autologin=1
+fi
[ -e /dev/mapper/root ] || exit
e2fsck -C 0 -E inode_count_fullmap -p /dev/mapper/root || exit
mount -o nodev /dev/mapper/root /mnt || exit
@@ -35,5 +35,11 @@ mount -o nodev /dev/mapper/root /mnt || exit
kill -9 -1
cd /mnt || exit
+if [ -n "$autologin" ]; then
+ mount -t tmpfs -o mode=755,nodev,nosuid,strictatime tmpfs run || exit
+ mkdir -p run/systemd/system/getty.target.wants || exit
+ ln -s /dev/null run/systemd/system/getty.target.wants/getty@tty1.service || exit
+ ln -s /etc/systemd/system/getty-autologin.service run/systemd/system/getty.target.wants/ || exit
+fi
umount -n /dev/pts /dev /proc
exec switch_root . /usr/lib/systemd/systemd