support pre-frecon shims

This commit is contained in:
ading2210 2023-11-09 21:13:59 +00:00
parent 48e194e7c4
commit af50ab0a86
4 changed files with 18 additions and 8 deletions

View File

@ -133,7 +133,7 @@ get_selection() {
reboot -f
elif [ "$selection" = "s" ]; then
reset
enable_debug_console "/dev/pts/0"
enable_debug_console "$TTY1"
return 0
elif [ "$selection" = "l" ]; then
clear
@ -266,8 +266,7 @@ boot_target() {
echo "switching root"
mkdir -p /newroot/bootloader
pivot_root /newroot /newroot/bootloader
local tty="/dev/pts/0"
exec /sbin/init < "$tty" >> "$tty" 2>&1
exec /sbin/init < "$TTY1" >> "$TTY1" 2>&1
}
boot_chromeos() {
@ -317,14 +316,13 @@ boot_chromeos() {
echo "starting init"
/sbin/modprobe zram
pkill frecon-lite
local tty="/dev/pts/0"
exec /sbin/init < "$tty" >> "$tty" 2>&1
exec /sbin/init < "$TTY1" >> "$TTY1" 2>&1
}
main() {
echo "starting the shimboot bootloader"
enable_debug_console "/dev/pts/1"
enable_debug_console "$TTY2"
local valid_partitions="$(find_all_partitions)"

View File

@ -10,6 +10,16 @@
set -x
detect_tty() {
if [ -f "/bin/frecon-lite" ]; then
export TTY1="/dev/pts/0"
export TTY2="/dev/pts/1"
else
export TTY1="/dev/tty1"
export TTY2="/dev/tty2"
fi
}
setup_environment() {
# Install additional utility programs.
/bin/busybox --install /bin || true
@ -17,10 +27,10 @@ setup_environment() {
main() {
setup_environment
detect_tty
# In case an error is not handled by bootstrapping, stop here
# so that an operator can see installation stop.
local tty="/dev/pts/0"
exec bootstrap.sh < "$tty" >> "$tty" 2>&1 || sleep 1d
exec bootstrap.sh < "$TTY1" >> "$TTY1" 2>&1 || sleep 1d
}
main "$@"

View File

@ -100,6 +100,7 @@ populate_partitions() {
local stateful_mount=/tmp/shim_stateful
safe_mount "${image_loop}p1" $stateful_mount
mkdir -p $stateful_mount/dev_image/etc/
mkdir -p $stateful_mount/dev_image/factory/sh
touch $stateful_mount/dev_image/etc/lsb-factory
umount $stateful_mount

View File

@ -0,0 +1 @@
tun