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:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user