cade409208
Huge thank you to @drebrez for his amazing work on this PR! * Add generation of initramfs-extra with additional binaries Extract both initramfs with `pmbootstrap initfs extract` Add new splashscreens for missing partitions/files errors Changes in init script: - use busybox findfs applet to find boot partition - mount boot partion - extract initramfs-extra - show error splashscreens accordingly and loop forever - start usb unlock directly from unlock_root_partition (hook removed) * Print out a text message for serial debugging in case of errors Add initramfs-extra files to `pmbootstrap initfs ls` output * Fix trailing whitespace in comment... * ls: Indicate which initramfs we're looking at / add wiki link I've rewritten the initramfs-development article to reflect the changes made in this PR. It will be a good read for someone who extracted the initramfs and wants to know why we have two files.
46 lines
1.1 KiB
Bash
46 lines
1.1 KiB
Bash
#!/bin/sh
|
|
. ./init_functions.sh
|
|
|
|
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
|
/bin/busybox --install -s
|
|
/bin/busybox-extras --install -s
|
|
|
|
# Mount everything, set up logging, modules, mdev
|
|
mount_proc_sys_dev
|
|
setup_log
|
|
[ -d /lib/modules ] && modprobe -a @MODULES@
|
|
setup_mdev
|
|
mount_subpartitions
|
|
|
|
# Hooks
|
|
for hook in /etc/postmarketos-mkinitfs/hooks/*.sh; do
|
|
[ -e "$hook" ] || continue
|
|
sh "$hook"
|
|
done
|
|
|
|
# Always run dhcp daemon/usb networking for now (later this should only
|
|
# be enabled, when having the usb-shell hook installed for debugging,
|
|
# or get activated after the initramfs is done with an OpenRC service).
|
|
setup_usb_network
|
|
start_udhcpd
|
|
|
|
mount_boot_partition
|
|
extract_initramfs_extra @INITRAMFS_EXTRA@
|
|
unlock_root_partition
|
|
|
|
# Switch root
|
|
show_splash /splash-loading.ppm.gz
|
|
killall telnetd mdev 2>/dev/null
|
|
umount /boot
|
|
umount /proc
|
|
umount /sys
|
|
umount /dev/pts
|
|
umount /dev
|
|
|
|
# shellcheck disable=SC2093
|
|
exec switch_root /sysroot /sbin/init
|
|
|
|
echo "ERROR: switch_root failed!"
|
|
echo "Looping forever. Install and use the usb-shell hook to debug this."
|
|
echo "For more information, see <https://postmarketos.org/usbhook>"
|
|
loop_forever
|