From 0ac7dc2cfeccd3d568ebd6a13eba2cac9276e234 Mon Sep 17 00:00:00 2001 From: ading2210 Date: Tue, 21 May 2024 20:16:58 -0700 Subject: [PATCH] fix #12 maybe --- bootloader/bin/bootstrap.sh | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/bootloader/bin/bootstrap.sh b/bootloader/bin/bootstrap.sh index 1a8862b..fa7c1a1 100755 --- a/bootloader/bin/bootstrap.sh +++ b/bootloader/bin/bootstrap.sh @@ -28,6 +28,20 @@ enable_debug_console() { invoke_terminal "${tty}" "[Bootstrap Debug Console]" "/bin/busybox sh" } +#get a partition block device from a disk path and a part number +get_part_dev() { + local disk="$1" + local partition="$2" + + #disk paths ending with a number will have a "p" before the partition number + last_char="$(echo -n "$disk" | tail -c 1)" + if [ "$last_char" -eq "$last_char" ] 2>/dev/null; then + echo "${disk}p${partition}" + else + echo "${disk}${partition}" + fi +} + find_rootfs_partitions() { local disks=$(fdisk -l | sed -n "s/Disk \(\/dev\/.*\):.*/\1/p") if [ ! "${disks}" ]; then @@ -40,7 +54,7 @@ find_rootfs_partitions() { continue fi for partition in $partitions; do - echo "${disk}${partition}" + get_part_dev "$disk" "$partition" done done } @@ -182,25 +196,6 @@ contains_word() { return 1 } -#might be useful in case we need to disable the tpm -#currently this causes a kernel panic when we try to boot cros -unbind_driver() { - local driver_path="$1" - local sys_files="$(ls $driver_path)" - local excluded_files="bind uevent unbind" - for file in $sys_files; do - if ! contains_word "$file" "$excluded_files"; then - echo "$file" > "${driver_path}/unbind" - fi - done -} - -unbind_tpm() { - unbind_driver "/sys/bus/spi/drivers/tpm_tis_spi" - unbind_driver "/sys/bus/pnp/drivers/tpm_tis" - unbind_driver "/sys/bus/platform/drivers/tpm_tis" -} - copy_progress() { local source="$1" local destination="$2"