Embed ISO in initrd for PXE boot with loop-mount wrapper
build-and-push / test (push) Successful in 35s
build-and-push / build-and-push (push) Successful in 1m8s

Instead of sanboot (which can't pass kernel params for automation),
switch back to kernel/initrd boot. The ISO is embedded in the initrd
as a CPIO append. A pxe-init wrapper script loop-mounts the ISO
before handing off to the original init, so the installer finds it
as a block device. Uses rdinit=/pxe-init kernel parameter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-14 12:11:18 -04:00
parent a8f8801a90
commit e2dd78d8f9
3 changed files with 147 additions and 5 deletions
+9 -4
View File
@@ -7,11 +7,16 @@ import (
)
func BuildIPXEScript(publicURL string, img *model.Image, mac string) string {
isoURL := fmt.Sprintf("%s/images/boot/%s", publicURL, img.ISOPath)
kernelURL := fmt.Sprintf("%s/images/boot/%s", publicURL, img.KernelPath)
initrdURL := fmt.Sprintf("%s/images/boot/%s", publicURL, img.InitrdPath)
return fmt.Sprintf(`#!ipxe
echo Provisioning: booting %s on ${mac}
echo Booting ISO via HTTP SAN...
sanboot %s
`, img.Name, isoURL)
echo Loading kernel...
kernel %s ramdisk_size=16777216 vga=791 video=vesafb:lfb:on rw quiet splash=verbose rdinit=/pxe-init initrd=initrd
echo Loading initrd (this may take a few minutes)...
initrd --name initrd %s
echo Booting...
boot
`, img.Name, kernelURL, initrdURL)
}