mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-24 07:06:42 +00:00
Eliminate use of CONFIG_USB_BOOT_DEV
mount-usb switched to dynamic USB device detection a while back, so eliminate instances of CONFIG_BOOT_USB_DEV, and derive the mounted USB device from /etc/mtab in the one place where it's actually needed (usb-scan). Clean up areas around calls to mount-usb for clarity/readability. Addresses issue #673 Test: Build Librem 13v4, boot ISO file on USB Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
This commit is contained in:
parent
508034b4d9
commit
1bd93d6679
@ -28,7 +28,6 @@ export CONFIG_BOOT_REQ_ROLLBACK=n
|
||||
export CONFIG_BOOT_KERNEL_ADD="nohz=on console=ttyS1,115200n8 "
|
||||
export CONFIG_BOOT_KERNEL_REMOVE=""
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
export CONFIG_BOOT_RECOVERY_SERIAL="/dev/ttyS0"
|
||||
export CONFIG_FLASHROM_OPTIONS="--force --noverify -p internal"
|
||||
#export CONFIG_BOOT_STATIC_IP=192.168.1.2
|
||||
|
@ -42,7 +42,6 @@ export CONFIG_TPM=n
|
||||
export CONFIG_BOOT_REQ_HASH=n
|
||||
export CONFIG_BOOT_REQ_ROLLBACK=n
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
|
||||
$(build)/$(BOARD)/linuxboot.rom: linuxboot.intermediate
|
||||
|
||||
|
@ -32,7 +32,6 @@ export CONFIG_BOOT_KERNEL_ADD="intel_iommu=on"
|
||||
export CONFIG_BOOT_KERNEL_REMOVE=""
|
||||
export CONFIG_BOOT_DEV="/dev/nvme0n1p1"
|
||||
export CONFIG_BOOT_GUI_MENU_NAME="Purism Librem 13v2 Heads Boot Menu"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
export CONFIG_WARNING_BG_COLOR="--background-gradient 0 0 0 150 125 0"
|
||||
export CONFIG_ERROR_BG_COLOR="--background-gradient 0 0 0 150 0 0"
|
||||
export CONFIG_FLASHROM_OPTIONS="-p internal:laptop=force_I_want_a_brick,ich_spi_mode=hwseq"
|
||||
|
@ -32,7 +32,6 @@ export CONFIG_BOOT_KERNEL_ADD="intel_iommu=on"
|
||||
export CONFIG_BOOT_KERNEL_REMOVE=""
|
||||
export CONFIG_BOOT_DEV="/dev/nvme0n1p1"
|
||||
export CONFIG_BOOT_GUI_MENU_NAME="Purism Librem 13v2 Heads Boot Menu"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
export CONFIG_WARNING_BG_COLOR="--background-gradient 0 0 0 150 125 0"
|
||||
export CONFIG_ERROR_BG_COLOR="--background-gradient 0 0 0 150 0 0"
|
||||
export CONFIG_FLASHROM_OPTIONS="-p internal:laptop=force_I_want_a_brick,ich_spi_mode=hwseq"
|
||||
|
@ -34,7 +34,6 @@ export CONFIG_BOOT_KERNEL_ADD="intel_iommu=on"
|
||||
export CONFIG_BOOT_KERNEL_REMOVE=""
|
||||
export CONFIG_BOOT_DEV="/dev/nvme0n1p1"
|
||||
export CONFIG_BOOT_GUI_MENU_NAME="Purism Librem 15v3 Heads Boot Menu"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
export CONFIG_WARNING_BG_COLOR="--background-gradient 0 0 0 150 125 0"
|
||||
export CONFIG_ERROR_BG_COLOR="--background-gradient 0 0 0 150 0 0"
|
||||
export CONFIG_FLASHROM_OPTIONS="-p internal:laptop=force_I_want_a_brick,ich_spi_mode=hwseq"
|
||||
|
@ -34,7 +34,6 @@ export CONFIG_BOOT_KERNEL_ADD="intel_iommu=on"
|
||||
export CONFIG_BOOT_KERNEL_REMOVE=""
|
||||
export CONFIG_BOOT_DEV="/dev/nvme0n1p1"
|
||||
export CONFIG_BOOT_GUI_MENU_NAME="Purism Librem 15v4 Heads Boot Menu"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
export CONFIG_WARNING_BG_COLOR="--background-gradient 0 0 0 150 125 0"
|
||||
export CONFIG_ERROR_BG_COLOR="--background-gradient 0 0 0 150 0 0"
|
||||
export CONFIG_FLASHROM_OPTIONS="-p internal:laptop=force_I_want_a_brick,ich_spi_mode=hwseq"
|
||||
|
@ -49,7 +49,6 @@ export CONFIG_BOOTSCRIPT=/bin/generic-init
|
||||
export CONFIG_TPM=n
|
||||
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
|
||||
#run: coreboot.intermediate
|
||||
run:
|
||||
|
@ -36,7 +36,6 @@ export CONFIG_BOOTSCRIPT_NETWORK=/bin/network-init-recovery
|
||||
export CONFIG_BOOT_REQ_HASH=n
|
||||
export CONFIG_BOOT_REQ_ROLLBACK=n
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
export CONFIG_BOOT_STATIC_IP=10.0.2.15
|
||||
|
||||
# You can ssh into the qemu instance by running
|
||||
|
@ -28,4 +28,3 @@ export CONFIG_BOOTSCRIPT=/bin/generic-init
|
||||
export CONFIG_BOOT_REQ_HASH=n
|
||||
export CONFIG_BOOT_REQ_ROLLBACK=n
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
|
@ -40,4 +40,3 @@ export CONFIG_BOOTSCRIPT=/bin/generic-init
|
||||
export CONFIG_BOOT_REQ_HASH=n
|
||||
export CONFIG_BOOT_REQ_ROLLBACK=n
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
|
@ -31,7 +31,6 @@ export CONFIG_BOOT_KERNEL_ADD="intel_iommu=on intel_iommu=igfx_off"
|
||||
export CONFIG_BOOT_KERNEL_REMOVE="quiet"
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_BOOT_GUI_MENU_NAME="ThinkPad T420 Heads Boot Menu"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
export CONFIG_WARNING_BG_COLOR="--background-gradient 0 0 0 150 125 0"
|
||||
export CONFIG_ERROR_BG_COLOR="--background-gradient 0 0 0 150 0 0"
|
||||
export CONFIG_FLASHROM_OPTIONS="--force --noverify-all -p internal:laptop=force_I_want_a_brick,ich_spi_mode=hwseq --ifd --image bios"
|
||||
|
@ -43,7 +43,6 @@ export CONFIG_TPM=n
|
||||
export CONFIG_BOOT_REQ_HASH=n
|
||||
export CONFIG_BOOT_REQ_ROLLBACK=n
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
|
||||
$(build)/$(BOARD)/linuxboot.rom: linuxboot.intermediate
|
||||
|
||||
|
@ -42,7 +42,6 @@ export CONFIG_TPM=n
|
||||
export CONFIG_BOOT_REQ_HASH=n
|
||||
export CONFIG_BOOT_REQ_ROLLBACK=n
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
|
||||
#$(build)/$(BOARD)/linuxboot.rom: $(build)/$(linuxboot_dir)/
|
||||
|
||||
|
@ -31,7 +31,6 @@ export CONFIG_BOOT_KERNEL_ADD="intel_iommu=on intel_iommu=igfx_off"
|
||||
export CONFIG_BOOT_KERNEL_REMOVE="quiet"
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_BOOT_GUI_MENU_NAME="ThinkPad X220 Heads Boot Menu"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
export CONFIG_WARNING_BG_COLOR="--background-gradient 0 0 0 150 125 0"
|
||||
export CONFIG_ERROR_BG_COLOR="--background-gradient 0 0 0 150 0 0"
|
||||
export CONFIG_FLASHROM_OPTIONS="--force --noverify-all -p internal:laptop=force_I_want_a_brick,ich_spi_mode=hwseq --ifd --image bios"
|
||||
|
@ -15,7 +15,6 @@ CONFIG_LINUX_CONFIG=config/linux-x230-flash.config
|
||||
CONFIG_LINUX_USB=y
|
||||
CONFIG_LINUX_E1000E=y
|
||||
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
export CONFIG_BOOTSCRIPT=/bin/x230-flash.init
|
||||
export CONFIG_FLASHROM_OPTIONS="--force --noverify-all -p internal:laptop=force_I_want_a_brick,ich_spi_mode=hwseq --ifd --image bios"
|
||||
|
||||
|
@ -31,7 +31,6 @@ export CONFIG_BOOT_KERNEL_ADD="intel_iommu=on intel_iommu=igfx_off"
|
||||
export CONFIG_BOOT_KERNEL_REMOVE="quiet"
|
||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||
export CONFIG_BOOT_GUI_MENU_NAME="Thinkpad X230 Heads Boot Menu"
|
||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
||||
export CONFIG_WARNING_BG_COLOR="--background-gradient 0 0 0 150 125 0"
|
||||
export CONFIG_ERROR_BG_COLOR="--background-gradient 0 0 0 150 0 0"
|
||||
export CONFIG_FLASHROM_OPTIONS="--force --noverify-all -p internal:laptop=force_I_want_a_brick,ich_spi_mode=hwseq --ifd --image bios"
|
||||
|
@ -7,16 +7,14 @@ set -e -o pipefail
|
||||
mount_usb(){
|
||||
# Mount the USB boot device
|
||||
if ! grep -q /media /proc/mounts ; then
|
||||
mount-usb "$CONFIG_USB_BOOT_DEV" && USB_FAILED=0 || USB_FAILED=1
|
||||
mount-usb && USB_FAILED=0 || USB_FAILED=1
|
||||
if [ $USB_FAILED -ne 0 ]; then
|
||||
if [ ! -e "$CONFIG_USB_BOOT_DEV" ]; then
|
||||
whiptail --title 'USB Drive Missing' \
|
||||
--msgbox "Insert your USB drive and press Enter to continue." 16 60 USB_FAILED=0
|
||||
mount-usb "$CONFIG_USB_BOOT_DEV" || USB_FAILED=1
|
||||
fi
|
||||
--msgbox "Insert your USB drive and press Enter to continue." 16 60
|
||||
mount-usb && USB_FAILED=0 || USB_FAILED=1
|
||||
if [ $USB_FAILED -ne 0 ]; then
|
||||
whiptail $CONFIG_ERROR_BG_COLOR --title 'ERROR: Mounting /media Failed' \
|
||||
--msgbox "Unable to mount $CONFIG_USB_BOOT_DEV" 16 60
|
||||
--msgbox "Unable to mount USB device" 16 60
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -7,16 +7,14 @@ set -e -o pipefail
|
||||
mount_usb(){
|
||||
# Mount the USB boot device
|
||||
if ! grep -q /media /proc/mounts ; then
|
||||
mount-usb "$CONFIG_USB_BOOT_DEV" || USB_FAILED=1
|
||||
mount-usb && USB_FAILED=0 || USB_FAILED=1
|
||||
if [ $USB_FAILED -ne 0 ]; then
|
||||
if [ ! -e "$CONFIG_USB_BOOT_DEV" ]; then
|
||||
whiptail --title 'USB Drive Missing' \
|
||||
--msgbox "Insert your USB drive and press Enter to continue." 16 60 USB_FAILED=0
|
||||
mount-usb "$CONFIG_USB_BOOT_DEV" || USB_FAILED=1
|
||||
fi
|
||||
--msgbox "Insert your USB drive and press Enter to continue." 16 60
|
||||
mount-usb && USB_FAILED=0 || USB_FAILED=1
|
||||
if [ $USB_FAILED -ne 0 ]; then
|
||||
whiptail $CONFIG_ERROR_BG_COLOR --title 'ERROR: Mounting /media Failed' \
|
||||
--msgbox "Unable to mount $CONFIG_USB_BOOT_DEV" 16 60
|
||||
--msgbox "Unable to mount USB device" 16 60
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -15,6 +15,8 @@ if ! grep -q /media /proc/mounts ; then
|
||||
mount-usb "$CONFIG_USB_BOOT_DEV" \
|
||||
|| die "Unable to mount /media"
|
||||
fi
|
||||
# Get USB boot device
|
||||
USB_BOOT_DEV=$(grep "/media" /etc/mtab | cut -f 1 -d' ')
|
||||
|
||||
# Check for ISO first
|
||||
get_menu_option() {
|
||||
@ -72,7 +74,7 @@ if [ `cat /tmp/iso_menu.txt | wc -l` -gt 0 ]; then
|
||||
if [ -n "$option" ]; then
|
||||
MOUNTED_ISO=$option
|
||||
ISO=${option:7} # remove /media/ to get device relative path
|
||||
kexec-iso-init $MOUNTED_ISO $ISO $CONFIG_USB_BOOT_DEV
|
||||
kexec-iso-init $MOUNTED_ISO $ISO $USB_BOOT_DEV
|
||||
|
||||
die "Something failed in iso init"
|
||||
fi
|
||||
|
@ -97,9 +97,6 @@ combine_configs
|
||||
if [ ! -z "$CONFIG_BOOT_DEV" ]; then
|
||||
echo >> /etc/fstab "$CONFIG_BOOT_DEV /boot auto defaults,ro 0 0"
|
||||
fi
|
||||
if [ ! -z "$CONFIG_USB_BOOT_DEV" ]; then
|
||||
echo >> /etc/fstab "$CONFIG_USB_BOOT_DEV /media auto defaults,ro 0 0"
|
||||
fi
|
||||
|
||||
if [ ! -x "$CONFIG_BOOTSCRIPT" -a ! -x "$CONFIG_BOOTSCRIPT_NETWORK" ]; then
|
||||
recovery 'Boot script missing? Entering recovery shell'
|
||||
|
Loading…
Reference in New Issue
Block a user