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>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user