Skip to content

Commit

Permalink
PoC RFC Add iPXE files to install-amd64-minimal upload on demeter
Browse files Browse the repository at this point in the history
Extracts and generates needed files to perform iPXE boot from gentoo mirrors
Provided as PoC of what is needed for this to be vaild
If merged this would resolve NiKiZe/Gentoo-iPXE#2
Will be providing PoC for doing most of this in catalyst instead as well
Really want to have this in the same target as minimal livecd

To test result with qemu localy after build (replace your variables):
qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host -nic user,model=virtio,\
tftp="${BUILD_SRCDIR_BASE}"/builds/default,\
bootfile=install-amd64-minimal-${TIMESTAMP}.ipxe \
-watchdog i6300esb -watchdog-action reset -boot menu=on -usb

Signed-off-by: Christian Nilsson <nikize@gmail.com>
  • Loading branch information
NiKiZe committed Jul 28, 2021
1 parent 21c81fa commit 8408f98
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion tools/catalyst-auto-amd64-demeter.conf
Expand Up @@ -88,7 +88,39 @@ post_build() {
upload stage3-amd64-systemd-${TIMESTAMP}.tar.xz*
;;
installcd-stage2-minimal.spec)
upload install-amd64-minimal-${TIMESTAMP}.iso*
dstname=install-amd64-minimal-${TIMESTAMP}
isoname=${dstname}.iso

# This PXE extraction and pack part is to use the same files as livecd
# and also to not clober the support scripts and spec files
echo "Extract files from ${isoname} for PXE boot"
isoinfo -R -i ${isoname} -X -find -path /boot/gentoo && mv boot/gentoo ${dstname}.lkrn
isoinfo -R -i ${isoname} -X -find -path /image.squashfs
# combine original initrd with squashfs
# different variants can be used, compression
# the selected combination here gives most responsive boot (avoids several seconds of black screen)
(isoinfo -R -i ${isoname} -x /boot/gentoo.igz; (echo image.squashfs | cpio -H newc -o)) > ${dstname}.igz
# remove temp file, needed as file to create cpio header
rm image.squashfs
# grab the main kernel cmdline from boot config
grubkernel=$(isoinfo -R -i ${isoname} -x /grub/grub.cfg | grep "gentoo.* root=" | grep -v docache)
# remove grub command and kernel name to get only cmdline
grubkernel=${grubkernel#*/boot/gentoo }
ipxename=${dstname}.ipxe
echo "Generating iPXE script ${ipxename}"
echo '#!ipxe' > ${ipxename}
echo '# allow for external keymap setting' >> ${ipxename}
echo 'isset ${keymap} || set keymap dokeymap' >> ${ipxename}
echo '# allow for external cmdline options' >> ${ipxename}
echo 'isset ${cmdline} || set cmdline vga=791' >> ${ipxename}
# initrd= on cmdline is needed for efi
echo "kernel ${dstname}.lkrn ${grubkernel/dokeymap/\$\{keymap\}} initrd=${dstname}.igz \${cmdline}" >> ${ipxename}
echo "initrd ${dstname}.igz" >> ${ipxename}
echo 'imgstat' >> ${ipxename}
echo 'boot' >> ${ipxename}

# TODO create latest links (*-latest.ipxe) to ${ipxename}
upload ${dstname}*
;;
nomultilib/stage3-openrc.spec)
upload stage3-amd64-nomultilib-openrc-${TIMESTAMP}.tar.xz*
Expand Down

1 comment on commit 8408f98

@NiKiZe
Copy link
Owner Author

@NiKiZe NiKiZe commented on 8408f98 Aug 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated commit after file rename: b2c1ffb

Please sign in to comment.