Files
Provisioning/internal/pxe/ipxe.go
T
josh e2dd78d8f9
build-and-push / test (push) Successful in 35s
build-and-push / build-and-push (push) Successful in 1m8s
Embed ISO in initrd for PXE boot with loop-mount wrapper
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>
2026-05-14 12:11:18 -04:00

23 lines
632 B
Go

package pxe
import (
"fmt"
"provisioning/internal/model"
)
func BuildIPXEScript(publicURL string, img *model.Image, mac string) string {
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 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)
}