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

View File

@ -10,6 +10,16 @@
set -x 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() { setup_environment() {
# Install additional utility programs. # Install additional utility programs.
/bin/busybox --install /bin || true /bin/busybox --install /bin || true
@ -17,10 +27,10 @@ setup_environment() {
main() { main() {
setup_environment setup_environment
detect_tty
# In case an error is not handled by bootstrapping, stop here # In case an error is not handled by bootstrapping, stop here
# so that an operator can see installation stop. # so that an operator can see installation stop.
local tty="/dev/pts/0" exec bootstrap.sh < "$TTY1" >> "$TTY1" 2>&1 || sleep 1d
exec bootstrap.sh < "$tty" >> "$tty" 2>&1 || sleep 1d
} }
main "$@" main "$@"

View File

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

View File

@ -0,0 +1 @@
tun