2020-04-14 19:38:14 +01:00
all : shasums
2020-05-04 23:07:01 +01:00
# List all the supported and built Pi platforms here. They get expanded
# to names like 'raspi_2.yaml' and 'raspi_0w.img.xz'.
2020-06-30 10:09:14 +01:00
BUILD_PLATFORMS := 0w 2 3 4
2020-05-04 23:07:01 +01:00
platforms := $( addprefix raspi_,$( BUILD_PLATFORMS) )
shasums : $( addsuffix .sha 256,$ ( platforms ) ) $( addsuffix .xz .sha 256,$ ( platforms ) )
xzimages : $( addsuffix .img .xz ,$ ( platforms ) )
images : $( addsuffix .img ,$ ( platforms ) )
yaml : $( addsuffix .yaml ,$ ( platforms ) )
2019-12-17 20:41:16 +00:00
raspi_0w.yaml : raspi_master .yaml
cat raspi_master.yaml | sed "s/__ARCH__/armel/" | \
sed "s/__LINUX_IMAGE__/linux-image-rpi/" | \
sed "s/__EXTRA_PKGS__/- firmware-brcm80211/" | \
sed "s/__DTB__/\\/usr\\/lib\\/linux-image-*-rpi\\/bcm*rpi-*.dtb/" | \
2020-07-06 06:21:19 +01:00
grep -v "__OTHER_APT_ENABLE__" | \
2019-12-17 20:41:16 +00:00
sed "s/__HOST__/rpi0/" > $@
raspi_2.yaml : raspi_master .yaml
cat raspi_master.yaml | sed "s/__ARCH__/armhf/" | \
sed "s/__LINUX_IMAGE__/linux-image-armmp/" | \
grep -v "__EXTRA_PKGS__" | \
sed "s/__DTB__/\\/usr\\/lib\\/linux-image-*-armmp\\/bcm*rpi*.dtb/" | \
2020-04-24 17:00:10 +01:00
sed "s/__OTHER_APT_ENABLE__//" | \
2019-12-17 20:41:16 +00:00
sed "s/__HOST__/rpi2/" > $@
raspi_3.yaml : raspi_master .yaml
cat raspi_master.yaml | sed "s/__ARCH__/arm64/" | \
sed "s/__LINUX_IMAGE__/linux-image-arm64/" | \
sed "s/__EXTRA_PKGS__/- firmware-brcm80211/" | \
sed "s/__DTB__/\\/usr\\/lib\\/linux-image-*-arm64\\/broadcom\\/bcm*rpi*.dtb/" | \
2020-04-24 17:00:10 +01:00
sed "s/__OTHER_APT_ENABLE__//" | \
2019-12-17 20:41:16 +00:00
sed "s/__HOST__/rpi3/" > $@
2020-05-11 00:53:22 +01:00
raspi_4.yaml : raspi_master .yaml
cat raspi_master.yaml | sed "s/__ARCH__/arm64/" | \
sed "s#raspi3-firmware#raspi3-firmware/unstable#" | \
sed "s#apt-get update#echo 'APT::Default-Release \"stable\";' > /etc/apt/apt.conf\n apt-get update#" | \
sed " s#cmdline.txt#cmdline.txt\n sed -i 's/cma=64M //' /boot/firmware/cmdline.txt\n sed -i 's/cma=\\\$ $CMA //' /etc/kernel/postinst.d/z50-raspi-firmware# " | \
sed "s/__LINUX_IMAGE__/linux-image-arm64\/unstable/" | \
2020-07-22 22:31:12 +01:00
sed "s/__EXTRA_PKGS__/- firmware-brcm80211\/unstable/" | \
2020-05-11 00:53:22 +01:00
sed "s/__DTB__/\\/usr\\/lib\\/linux-image-*-arm64\\/broadcom\\/bcm*rpi*.dtb/" | \
sed "s/__OTHER_APT_ENABLE__/deb http:\/\/deb.debian.org\/debian\/ unstable main contrib non-free # raspi 4 needs the latest kernel (5.5 or higher) and raspi-firmware newer than buster's/" | \
sed "s/__HOST__/rpi4/" > $@
2020-04-15 04:27:20 +01:00
%.sha256 : %.img .xz
2020-04-27 17:59:56 +01:00
echo $@
sha256sum $( @:sha256= img) > $@
%.xz.sha256 : %.img .xz
echo $@
sha256sum $( @:xz.sha256= img.xz) > $@
2020-04-15 04:27:20 +01:00
%.img.xz : %.img
2020-04-24 16:37:52 +01:00
xz -f -k -z -9 $( @:.xz= )
2019-12-17 20:41:16 +00:00
2020-04-14 19:38:14 +01:00
%.img : %.yaml
touch $( @:.img= .log)
time nice vmdb2 --verbose --rootfs-tarball= $( subst .img,.tar.gz,$@ ) --output= $@ $( subst .img,.yaml,$@ ) --log $( subst .img,.log,$@ )
chmod 0644 $@ $( @,.img= .log)
2019-12-17 20:41:16 +00:00
_ck_root :
[ ` whoami` = 'root' ] # Only root can summon vmdb2 ☹
_clean_yaml :
2020-05-04 23:07:01 +01:00
rm -f $( addsuffix .yaml,$( platforms) )
2019-12-17 20:41:16 +00:00
_clean_images :
2020-05-04 23:07:01 +01:00
rm -f $( addsuffix .img,$( platforms) )
2020-04-24 16:37:52 +01:00
_clean_xzimages :
2020-05-04 23:07:01 +01:00
rm -f $( addsuffix .img.xz,$( platforms) )
2020-04-14 19:38:14 +01:00
_clean_shasums :
2020-05-04 23:07:01 +01:00
rm -f $( addsuffix .sha256,$( platforms) ) $( addsuffix .xz.sha256,$( platforms) )
2019-12-17 20:41:16 +00:00
_clean_logs :
2020-05-04 23:07:01 +01:00
rm -f $( addsuffix .log,$( platforms) )
2019-12-17 20:41:16 +00:00
_clean_tarballs :
2020-05-04 23:07:01 +01:00
rm -f $( addsuffix .tar.gz,$( platforms) )
2020-04-24 16:37:52 +01:00
clean : _clean_xzimages _clean_images _clean_shasums _clean_yaml _clean_tarballs _clean_logs
2019-12-17 20:41:16 +00:00
.PHONY : _ck_root _build_img clean _clean_images _clean_yaml _clean_tarballs _clean_logs