This commit is contained in:
ading2210 2024-05-21 20:16:58 -07:00
parent dff0132f03
commit 0ac7dc2cfe
1 changed files with 15 additions and 20 deletions

View File

@ -28,6 +28,20 @@ enable_debug_console() {
invoke_terminal "${tty}" "[Bootstrap Debug Console]" "/bin/busybox sh" 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() { find_rootfs_partitions() {
local disks=$(fdisk -l | sed -n "s/Disk \(\/dev\/.*\):.*/\1/p") local disks=$(fdisk -l | sed -n "s/Disk \(\/dev\/.*\):.*/\1/p")
if [ ! "${disks}" ]; then if [ ! "${disks}" ]; then
@ -40,7 +54,7 @@ find_rootfs_partitions() {
continue continue
fi fi
for partition in $partitions; do for partition in $partitions; do
echo "${disk}${partition}" get_part_dev "$disk" "$partition"
done done
done done
} }
@ -182,25 +196,6 @@ contains_word() {
return 1 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() { copy_progress() {
local source="$1" local source="$1"
local destination="$2" local destination="$2"