Switch from sanboot to kernel/initrd boot with PXE overlay for ISO download
sanboot makes the ISO visible to UEFI but invisible to the Linux kernel after ExitBootServices(). Switch to direct kernel/initrd boot with a small CPIO overlay containing /pxe-init — a shell script that loads NIC drivers, configures DHCP, downloads the ISO via wget, and creates a loop device before handing off to the Proxmox installer init. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+14
-4
@@ -2,16 +2,26 @@ package pxe
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"provisioning/internal/model"
|
||||
)
|
||||
|
||||
func BuildIPXEScript(publicURL string, img *model.Image, mac string) string {
|
||||
isoURL := fmt.Sprintf("%s/images/boot/%s", publicURL, img.ISOPath)
|
||||
base := fmt.Sprintf("%s/images/boot", publicURL)
|
||||
kernelURL := fmt.Sprintf("%s/%s", base, img.KernelPath)
|
||||
initrdURL := fmt.Sprintf("%s/%s", base, img.InitrdPath)
|
||||
isoURL := fmt.Sprintf("%s/%s", base, img.ISOPath)
|
||||
overlayURL := fmt.Sprintf("%s/%s/pxe-overlay.img", base,
|
||||
strings.Split(filepath.ToSlash(img.KernelPath), "/")[0])
|
||||
answerURL := fmt.Sprintf("%s/api/boot/auto-answer", publicURL)
|
||||
|
||||
return fmt.Sprintf(`#!ipxe
|
||||
echo Provisioning: booting %s on ${mac}
|
||||
echo Booting ISO...
|
||||
sanboot %s
|
||||
`, img.Name, isoURL)
|
||||
kernel %s ro ramdisk_size=16777216 rw quiet splash=silent proxmox-start-auto-installer proxmox-auto-installer-answer-url=%s prov.iso=%s rdinit=/pxe-init
|
||||
initrd %s
|
||||
initrd %s
|
||||
boot
|
||||
`, img.Name, kernelURL, answerURL, isoURL, initrdURL, overlayURL)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user