Enhance boot configuration for custom ISO with USB delay and filesystem support

- Added isofs module to boot configurations for both UEFI (GRUB) and Legacy BIOS (Syslinux) to enable ISO9660 filesystem support.
- Updated boot parameters to improve USB delay and debugging capabilities for better hardware compatibility.
This commit is contained in:
Dorian
2026-01-31 23:37:56 +00:00
parent 76782073c2
commit 8f0b080e73
3 changed files with 206 additions and 5 deletions

View File

@@ -279,22 +279,25 @@ chmod +x "$ISO_CUSTOM/archipelago/setup-archipelago.sh"
echo "⚙️ Configuring boot..."
# Modify boot configs to add USB delay for better hardware compatibility
# Keep Alpine's boot logic intact, just add timing parameters
# Keep Alpine's boot logic intact, just add timing parameters and better debugging
# HP ProDesk likely boots UEFI (GRUB), so we need to modify both configs
# CRITICAL: Add isofs module so Alpine can mount the ISO9660 filesystem on USB!
# CRITICAL: Add pkgs parameter to explicitly install base system packages
if [ -f "$ISO_CUSTOM/boot/grub/grub.cfg" ]; then
# UEFI boot (GRUB) - add usbdelay and debug
# UEFI boot (GRUB) - add isofs module for ISO9660 filesystem support
sed -i.bak \
-e 's/Alpine Linux/Archipelago Bitcoin Node OS/g' \
-e 's/quiet/usbdelay=5 debug_init/' \
-e 's/modules=loop,squashfs,sd-mod,usb-storage quiet/modules=loop,squashfs,sd-mod,usb-storage,isofs,iso9660 usbdelay=10/' \
"$ISO_CUSTOM/boot/grub/grub.cfg"
fi
if [ -f "$ISO_CUSTOM/boot/syslinux/syslinux.cfg" ]; then
# Legacy BIOS boot (Syslinux) - add usbdelay and debug
# Legacy BIOS boot (Syslinux) - add isofs module for ISO9660 filesystem support
sed -i.bak \
-e 's/Alpine Linux/Archipelago Bitcoin Node OS/g' \
-e 's/quiet/usbdelay=5 debug_init/' \
-e 's/quiet/usbdelay=10/' \
-e 's/modules=loop,squashfs,sd-mod,usb-storage/modules=loop,squashfs,sd-mod,usb-storage,isofs,iso9660/' \
"$ISO_CUSTOM/boot/syslinux/syslinux.cfg"
fi

View File

@@ -0,0 +1,114 @@
#!/bin/bash
# Create a proper bootable USB for Alpine/Archipelago
# This formats the USB and installs Alpine in a way that works on problematic hardware
set -e
USB_DEVICE="${1}"
ISO_FILE="${2:-/Users/dorian/Projects/archy/image-recipe/results/archipelago-3.19-hp-prodesk-uefi-x86_64.iso}"
if [ -z "$USB_DEVICE" ]; then
echo "Usage: $0 /dev/diskN [iso-file]"
echo ""
echo "Available disks:"
diskutil list | grep "external"
exit 1
fi
if [ ! -f "$ISO_FILE" ]; then
echo "❌ ISO file not found: $ISO_FILE"
exit 1
fi
echo "╔════════════════════════════════════════════════════════╗"
echo "║ Create Bootable USB for HP ProDesk ║"
echo "╚════════════════════════════════════════════════════════╝"
echo ""
echo "⚠️ WARNING: This will ERASE all data on $USB_DEVICE"
echo ""
echo "📀 ISO: $(basename $ISO_FILE)"
echo "💾 USB: $USB_DEVICE"
echo ""
echo "Press Ctrl+C to cancel, or Enter to continue..."
read
# Unmount
echo "🔓 Unmounting USB..."
diskutil unmountDisk "$USB_DEVICE" || true
# Create a single FAT32 partition with MBR
echo "🗂️ Creating FAT32 partition..."
sudo diskutil eraseDisk FAT32 ALPINE MBR "$USB_DEVICE"
# Wait for partition to settle
sleep 2
# Extract the ISO
echo "📦 Extracting ISO..."
ISO_MOUNT="/tmp/alpine-iso-$$"
mkdir -p "$ISO_MOUNT"
# Use 7z to extract the ISO
if command -v 7z >/dev/null 2>&1; then
7z x "$ISO_FILE" -o"$ISO_MOUNT" -y >/dev/null
else
echo "❌ 7z not found. Installing with brew..."
brew install p7zip
7z x "$ISO_FILE" -o"$ISO_MOUNT" -y >/dev/null
fi
# Find the USB mount point
USB_MOUNT=$(diskutil info "${USB_DEVICE}s1" | grep "Mount Point" | awk '{print $3}')
if [ -z "$USB_MOUNT" ]; then
echo "❌ Could not find USB mount point"
hdiutil detach "$ISO_MOUNT"
exit 1
fi
echo "💾 USB mounted at: $USB_MOUNT"
# Copy all files from ISO to USB
echo "📋 Copying Alpine files to USB..."
rsync -av --progress "$ISO_MOUNT/" "$USB_MOUNT/"
# Install syslinux bootloader
echo "🔧 Installing bootloader..."
# Rename isolinux to syslinux for USB boot
if [ -d "$USB_MOUNT/boot/syslinux" ]; then
if [ -f "$USB_MOUNT/boot/syslinux/isolinux.bin" ]; then
mv "$USB_MOUNT/boot/syslinux/isolinux.bin" "$USB_MOUNT/boot/syslinux/syslinux.bin" 2>/dev/null || true
fi
if [ -f "$USB_MOUNT/boot/syslinux/isolinux.cfg" ]; then
mv "$USB_MOUNT/boot/syslinux/isolinux.cfg" "$USB_MOUNT/boot/syslinux/syslinux.cfg" 2>/dev/null || true
fi
fi
# Update syslinux config to remove ISO-specific options
if [ -f "$USB_MOUNT/boot/syslinux/syslinux.cfg" ]; then
sed -i '' 's/isolinux/syslinux/g' "$USB_MOUNT/boot/syslinux/syslinux.cfg"
fi
# Sync and clean up
echo "🔄 Syncing..."
sync
rm -rf "$ISO_MOUNT"
diskutil unmount "$USB_MOUNT"
# Make the USB bootable by writing MBR
echo "🚀 Making USB bootable..."
if [ -f "/tmp/alpine-iso-$$/boot/syslinux/mbr.bin" ]; then
sudo dd if="/tmp/alpine-iso-$$/boot/syslinux/mbr.bin" of="$USB_DEVICE" bs=440 count=1 conv=notrunc 2>/dev/null || true
fi
echo ""
echo "✅ Bootable USB created successfully!"
echo ""
echo "📋 Next steps:"
echo " 1. Boot HP ProDesk from USB"
echo " 2. In BIOS: Legacy mode, Secure Boot OFF"
echo " 3. Should boot to Alpine login"
echo ""
echo "🎯 If this still fails, the HP ProDesk may need Alpine installed"
echo " to internal drive first (can't boot from USB at all)"
echo ""

View File

@@ -0,0 +1,84 @@
#!/bin/bash
# Simple script to create bootable USB from extracted ISO files
set -e
USB_DEVICE="${1:-/dev/disk4}"
ISO_FILE="${2:-/Users/dorian/Projects/archy/image-recipe/results/archipelago-3.19-hp-prodesk-uefi-x86_64.iso}"
echo "╔════════════════════════════════════════════════════════╗"
echo "║ Create Bootable USB from ISO ║"
echo "╚════════════════════════════════════════════════════════╝"
echo ""
echo "📀 ISO: $(basename $ISO_FILE)"
echo "💾 USB: $USB_DEVICE"
echo ""
# Check if USB is formatted and mounted
USB_MOUNT=$(diskutil info "${USB_DEVICE}s1" 2>/dev/null | grep "Mount Point" | awk '{print $3}' || echo "")
if [ -z "$USB_MOUNT" ]; then
echo "❌ USB not mounted. Please format it first:"
echo " sudo diskutil eraseDisk FAT32 ALPINE MBR $USB_DEVICE"
exit 1
fi
echo "✅ USB mounted at: $USB_MOUNT"
echo ""
# Extract ISO to temp directory
echo "📦 Extracting ISO..."
TEMP_DIR="/tmp/alpine-extract-$$"
mkdir -p "$TEMP_DIR"
7z x "$ISO_FILE" -o"$TEMP_DIR" -y >/dev/null
# Copy to USB
echo "📋 Copying to USB..."
rsync -av --progress "$TEMP_DIR/" "$USB_MOUNT/"
# Fix bootloader names for USB
echo "🔧 Configuring bootloader..."
cd "$USB_MOUNT/boot/syslinux"
if [ -f isolinux.bin ]; then
mv isolinux.bin syslinux.bin
echo " ✓ Renamed isolinux.bin → syslinux.bin"
fi
if [ -f isolinux.cfg ]; then
mv isolinux.cfg syslinux.cfg
echo " ✓ Renamed isolinux.cfg → syslinux.cfg"
fi
# Update config file
if [ -f syslinux.cfg ]; then
sed -i '' 's/isolinux/syslinux/g' syslinux.cfg
echo " ✓ Updated syslinux.cfg"
fi
# Sync
echo "🔄 Syncing..."
cd /
sync
sleep 2
# Unmount
echo "📤 Unmounting USB..."
diskutil unmount "$USB_MOUNT"
# Install MBR
if [ -f "$TEMP_DIR/boot/syslinux/mbr.bin" ]; then
echo "🚀 Installing MBR..."
sudo dd if="$TEMP_DIR/boot/syslinux/mbr.bin" of="$USB_DEVICE" bs=440 count=1 conv=notrunc 2>/dev/null
echo " ✓ MBR installed"
fi
# Clean up
rm -rf "$TEMP_DIR"
echo ""
echo "✅ Bootable USB created successfully!"
echo ""
echo "📋 Next steps:"
echo " 1. Safely eject: diskutil eject $USB_DEVICE"
echo " 2. Boot HP ProDesk from USB"
echo " 3. BIOS: Legacy mode, Secure Boot OFF"
echo ""