mirror of
https://gitlab.com/alemaire/image-specs.git
synced 2025-01-10 21:43:31 +00:00
5507be93ef
Create a variable called BUILD_PLATFORMS that lists the various pi images to build. This keeps the platform list in one place in the makefile, rather than sprinkled and repeated throughout multiple dependency and build lines. When a platform is added (ie, the pi4) or removed, it won't touch multiple rules and obscure other changes. This uses gmake-specific addprefix and addsuffix.
71 lines
2.4 KiB
Makefile
71 lines
2.4 KiB
Makefile
all: shasums
|
|
|
|
# List all the supported and built Pi platforms here. They get expanded
|
|
# to names like 'raspi_2.yaml' and 'raspi_0w.img.xz'.
|
|
BUILD_PLATFORMS := 0w 2 3
|
|
|
|
platforms := $(addprefix raspi_,$(BUILD_PLATFORMS))
|
|
shasums: $(addsuffix .sha256,$(platforms)) $(addsuffix .xz.sha256,$(platforms))
|
|
xzimages: $(addsuffix .img.xz,$(platforms))
|
|
images: $(addsuffix .img,$(platforms))
|
|
yaml: $(addsuffix .yaml,$(platforms))
|
|
|
|
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/" |\
|
|
sed "s/__OTHER_APT_ENABLE__/deb http:\/\/deb.debian.org\/debian\/ buster-proposed-updates main contrib non-free # Raspberries 0\/1 need raspi3-firmware >= 1.20190215-1+deb10u3/" |\
|
|
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/" |\
|
|
sed "s/__OTHER_APT_ENABLE__//" |\
|
|
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/" |\
|
|
sed "s/__OTHER_APT_ENABLE__//" |\
|
|
sed "s/__HOST__/rpi3/" > $@
|
|
|
|
%.sha256: %.img.xz
|
|
echo $@
|
|
sha256sum $(@:sha256=img) > $@
|
|
|
|
%.xz.sha256: %.img.xz
|
|
echo $@
|
|
sha256sum $(@:xz.sha256=img.xz) > $@
|
|
|
|
%.img.xz: %.img
|
|
xz -f -k -z -9 $(@:.xz=)
|
|
|
|
%.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)
|
|
|
|
_ck_root:
|
|
[ `whoami` = 'root' ] # Only root can summon vmdb2 ☹
|
|
|
|
_clean_yaml:
|
|
rm -f $(addsuffix .yaml,$(platforms))
|
|
_clean_images:
|
|
rm -f $(addsuffix .img,$(platforms))
|
|
_clean_xzimages:
|
|
rm -f $(addsuffix .img.xz,$(platforms))
|
|
_clean_shasums:
|
|
rm -f $(addsuffix .sha256,$(platforms)) $(addsuffix .xz.sha256,$(platforms))
|
|
_clean_logs:
|
|
rm -f $(addsuffix .log,$(platforms))
|
|
_clean_tarballs:
|
|
rm -f $(addsuffix .tar.gz,$(platforms))
|
|
clean: _clean_xzimages _clean_images _clean_shasums _clean_yaml _clean_tarballs _clean_logs
|
|
|
|
.PHONY: _ck_root _build_img clean _clean_images _clean_yaml _clean_tarballs _clean_logs
|