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
+17 -1
View File
@@ -53,8 +53,24 @@ func (s *Service) Upload(ctx context.Context, p UploadParams) (*model.Image, err
return nil, fmt.Errorf("extract ISO: %w", err)
}
report := func(stage, detail string) {
if p.OnProgress != nil {
p.OnProgress(stage, detail)
}
}
report("packaging", "Creating PXE boot image (embedding ISO in initrd)...")
origInitrdPath := filepath.Join(destDir, result.InitrdFilename)
origISOPath := filepath.Join(destDir, result.ISOFilename)
pxeInitrdFile := "initrd-pxe.img"
pxeInitrdPath := filepath.Join(destDir, pxeInitrdFile)
if err := CreatePXEInitrd(origInitrdPath, origISOPath, pxeInitrdPath); err != nil {
os.RemoveAll(destDir)
return nil, fmt.Errorf("create PXE initrd: %w", err)
}
kernelPath := filepath.Join(p.Name, result.KernelFilename)
initrdPath := filepath.Join(p.Name, result.InitrdFilename)
initrdPath := filepath.Join(p.Name, pxeInitrdFile)
isoPath := filepath.Join(p.Name, result.ISOFilename)
id, err := s.Store.Create(ctx, model.Image{