From 4fdc2e8a586e5e1bea459af6a1fae7c7d6a3bbef Mon Sep 17 00:00:00 2001 From: Jean-Gabriel Gill-Couture Date: Wed, 3 Sep 2025 22:42:16 -0400 Subject: [PATCH] fix: mac-specific ipxe file was missing #!ipxe sheban causing bad exec format. Also added autofree to chainloading boot file so it won't cause kernel panics when fallback boots after a failed boot of a previous file --- harmony/templates/boot.ipxe.j2 | 4 +- harmony/templates/okd/bootstrap.ipxe.j2 | 57 ++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/harmony/templates/boot.ipxe.j2 b/harmony/templates/boot.ipxe.j2 index 9dc8c42..55b74c6 100644 --- a/harmony/templates/boot.ipxe.j2 +++ b/harmony/templates/boot.ipxe.j2 @@ -31,7 +31,7 @@ sleep 2 # 1. iPXE attempts to 'chain' the hostfile. # 2. If successful (returns 0), the "&& exit" part is executed, and this script terminates. # 3. If it fails (returns non-zero), the "||" part is triggered, and execution continues below. -chain ${hostfile} && exit || +chain --autofree --replace ${hostfile} && exit || # --- Fallback Boot Attempt --- # This part of the script is only reached if the 'chain ${hostfile}' command above failed. @@ -45,7 +45,7 @@ echo " Location: ${fallbackfile}" sleep 8 -chain ${fallbackfile} && exit || +chain --autofree --replace ${fallbackfile} && exit || # --- Final Failure --- # This part is only reached if BOTH chain commands have failed. diff --git a/harmony/templates/okd/bootstrap.ipxe.j2 b/harmony/templates/okd/bootstrap.ipxe.j2 index edc6534..7f1539c 100644 --- a/harmony/templates/okd/bootstrap.ipxe.j2 +++ b/harmony/templates/okd/bootstrap.ipxe.j2 @@ -1,7 +1,52 @@ -set base-url http://{{ http_ip }}:8080 -set scos-base-url = ${base-url}/{{ scos_path }} -set installation-device = {{ installation_device }} +#!ipxe -kernel ${scos-base-url}/scos-live-kernel.x86_64 initrd=main coreos.live.rootfs_url=${scos-base-url}/scos-live-rootfs.x86_64.img coreos.inst.install_dev=${installation-device} coreos.inst.ignition_url=${base-url}/{{ ignition_http_path }}/bootstrap.ign -initrd --name main ${scos-base-url}/scos-live-initramfs.x86_64.img -boot +# ================================================================== +# MAC-Specific Boot Script for CoreOS/FCOS Installation +# ================================================================== + +# --- Configuration --- +set http_ip {{ http_ip }} +set scos_path {{ scos_path }} +set inst_dev {{ installation_device }} +set ign_path {{ ignition_http_path }} +set ign_file bootstrap.ign + +# --- Derived Variables --- +set base-url http://${http_ip}:8080 +set scos-base-url ${base-url}/${scos_path} +set ignition-url ${base-url}/${ign_path}/${ign_file} + +# --- Pre-boot Logging & Verification --- +echo +echo "Starting MAC-specific installation..." +echo "--------------------------------------------------" +echo " Installation Device: ${inst_dev}" +echo " CoreOS Kernel URL: ${scos-base-url}/scos-live-kernel.x86_64" +echo " Ignition URL: ${ignition-url}" +echo "--------------------------------------------------" +echo "Waiting for 3 seconds before loading boot assets..." +sleep 3 + +# --- Load Boot Assets with Failure Checks --- +# The '|| goto failure' pattern provides a clean exit if any asset fails to load. +echo "Loading kernel..." +kernel ${scos-base-url}/scos-live-kernel.x86_64 initrd=main coreos.live.rootfs_url=${scos-base-url}/scos-live-rootfs.x86_64.img coreos.inst.install_dev=${inst_dev} coreos.inst.ignition_url=${ignition-url} || goto failure + +echo "Loading initramfs..." +initrd --name main ${scos-base-url}/scos-live-initramfs.x86_64.img || goto failure + +# --- Boot --- +echo "All assets loaded successfully. Starting boot process..." +boot || goto failure + +# This part is never reached on successful boot. + +# --- Failure Handling --- +:failure +echo +echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" +echo " ERROR: A boot component failed to load." +echo " Dropping to iPXE shell for manual debugging." +echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" +sleep 10 +shell