experimental-vms/trisquel-automatic-netinsta.../Makefile.am

86 lines
2.7 KiB
Makefile

# Copyright (C) 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
dist_pkgdata_DATA = rootfs.img
EXTRA_QEMU_ARGS =
if WANT_KVM
EXTRA_QEMU_ARGS += -enable-kvm -cpu host
endif # WANT_KVM
gnupg/pubring.kbx: ${srcdir}/D24DDAC9226D5BA5E9F3BED3F5DAAAF74AD4C938.asc
install -d gnupg
gpg \
--home=gnupg \
--import \
${srcdir}/D24DDAC9226D5BA5E9F3BED3F5DAAAF74AD4C938.asc || \
rm -rf gnupg
.PHONY: check-trisquel-installation-image
check-trisquel-installation-image: $(TRISQUEL_NETINSTALL) gnupg/pubring.kbx
gpg --home=gnupg \
--verify trisquel-netinst_11.0.1_amd64.iso.asc \
$(TRISQUEL_NETINSTALL)
grub/boot/linux: Makefile check-trisquel-installation-image
install -D -d grub/boot
xorriso -osirrox on \
-indev $(TRISQUEL_NETINSTALL) \
-extract /linux $@
chmod 770 $@
grub/boot/initrd.gz: Makefile check-trisquel-installation-image
install -D -d grub/boot
xorriso -osirrox on \
-indev $(TRISQUEL_NETINSTALL) \
-extract /initrd.gz $@
chmod 770 $@
grub/boot/grub/grub.cfg: Makefile grub.cfg
install -D -m 660 grub.cfg $@
# It is way more simple to just extract the kernel and initramfs and
# write some grub.cfg by hand than to somehow modify an existing
# installer iso.
grub.iso: Makefile grub/boot/linux grub/boot/initrd.gz grub/boot/grub/grub.cfg
grub-mkrescue -o $@ grub
preseed.cfg: preseed.cfg.tmpl
sed 's#\@MIRROR_HTTP_PROXY\@#$(MIRROR_HTTP_PROXY)#g' \
preseed.cfg.tmpl > $@
preseed.img: Makefile preseed.cfg
dd if=/dev/zero of=$@.tmp count=2048
mkfs.vfat --mbr=y -n MEDIA $@.tmp
mcopy -i $@.tmp preseed.cfg ::/preseed.cfg
mv $@.tmp $@
rootfs.img.tmp: Makefile
qemu-img create -f qcow2 $@ $(TRISQUEL_ROOTFS_SIZE)
# The 790M were found by trial and error. At 789M the netinstall
# complains about "low memory".
rootfs.img: preseed.img rootfs.img.tmp grub.iso
install -m 644 rootfs.img.tmp rootfs.img || rm -f rootfs.img
qemu-system-x86_64 \
-M q35 \
-m 807M \
-nographic \
-drive file=grub.iso,index=2,media=cdrom,if=ide \
-drive file=rootfs.img,index=1,media=disk,if=virtio \
-drive file=preseed.img,index=0,media=disk,if=none,format=raw,id=usb \
-usb -device usb-ehci,id=ehci -device usb-storage,bus=ehci.0,drive=usb \
$(EXTRA_QEMU_ARGS) || \
\
rm -f rootfs.img