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
|
2021-01-25 20:06:46 +00:00
|
|
|
# to names like 'raspi_2_buster.yaml' and 'raspi_3_bullseye.img.xz'.
|
|
|
|
BUILD_FAMILIES := 1 2 3 4
|
2021-11-20 02:56:59 +00:00
|
|
|
BUILD_RELEASES := buster bullseye bookworm
|
2021-01-25 20:06:46 +00:00
|
|
|
|
|
|
|
platforms := $(foreach plat, $(BUILD_FAMILIES),$(foreach rel, $(BUILD_RELEASES), raspi_$(plat)_$(rel)))
|
2020-05-04 23:07:01 +01:00
|
|
|
|
2021-08-24 19:22:36 +01:00
|
|
|
shasums: $(addsuffix .img.sha256,$(platforms)) $(addsuffix .img.xz.sha256,$(platforms))
|
2020-05-04 23:07:01 +01:00
|
|
|
xzimages: $(addsuffix .img.xz,$(platforms))
|
|
|
|
images: $(addsuffix .img,$(platforms))
|
|
|
|
yaml: $(addsuffix .yaml,$(platforms))
|
2019-12-17 20:41:16 +00:00
|
|
|
|
2021-04-24 23:07:01 +01:00
|
|
|
ifeq ($(shell id -u),0)
|
|
|
|
as_root =
|
2021-06-24 19:22:55 +01:00
|
|
|
else ifneq (,$(wildcard /usr/bin/fakemachine))
|
|
|
|
$(warning "This should normally be run as root, but found 'fakemachine', so using that.")
|
2021-04-24 23:07:01 +01:00
|
|
|
as_root = fakemachine -v $(CURDIR) -- env --chdir $(CURDIR)
|
2021-06-24 19:22:55 +01:00
|
|
|
else
|
|
|
|
$(error "This must be run as root")
|
2021-04-24 23:07:01 +01:00
|
|
|
endif
|
|
|
|
|
2021-01-26 06:55:23 +00:00
|
|
|
target_platforms:
|
|
|
|
@echo $(platforms)
|
|
|
|
|
2021-08-28 04:51:05 +01:00
|
|
|
# Generate targets based on all family * release combinations:
|
|
|
|
define dynamic_yaml_target =
|
|
|
|
raspi_$(1)_$(2).yaml: raspi_master.yaml generate-recipe.py
|
|
|
|
raspi_$(1)_$(2).yaml:
|
|
|
|
./generate-recipe.py $(1) $(2)
|
|
|
|
endef
|
2021-08-28 04:52:51 +01:00
|
|
|
$(foreach release,$(BUILD_RELEASES), \
|
|
|
|
$(foreach family,$(BUILD_FAMILIES), \
|
|
|
|
$(eval $(call dynamic_yaml_target,$(family),$(release)))))
|
2021-01-14 06:55:55 +00:00
|
|
|
|
2021-08-28 05:00:09 +01:00
|
|
|
%.img.sha256: %.img
|
2020-04-27 17:59:56 +01:00
|
|
|
echo $@
|
2021-08-28 05:02:43 +01:00
|
|
|
sha256sum $< > $@
|
2020-04-27 17:59:56 +01:00
|
|
|
|
2021-08-23 17:58:32 +01:00
|
|
|
%.img.xz.sha256: %.img.xz
|
2020-04-27 17:59:56 +01:00
|
|
|
echo $@
|
2021-08-28 05:02:43 +01:00
|
|
|
sha256sum $< > $@
|
2020-04-15 04:27:20 +01:00
|
|
|
|
|
|
|
%.img.xz: %.img
|
2021-08-28 05:02:43 +01:00
|
|
|
xz -f -k -z -9 $<
|
2019-12-17 20:41:16 +00:00
|
|
|
|
2021-04-24 23:20:12 +01:00
|
|
|
%.img.bmap: %.img
|
|
|
|
bmaptool create -o $@ $<
|
|
|
|
|
2020-04-14 19:38:14 +01:00
|
|
|
%.img: %.yaml
|
|
|
|
touch $(@:.img=.log)
|
2021-04-24 23:07:01 +01:00
|
|
|
time nice $(as_root) vmdb2 --verbose --rootfs-tarball=$(subst .img,.tar.gz,$@) --output=$@ $(subst .img,.yaml,$@) --log $(subst .img,.log,$@)
|
2020-04-14 19:38:14 +01:00
|
|
|
chmod 0644 $@ $(@,.img=.log)
|
2019-12-17 20:41:16 +00:00
|
|
|
|
|
|
|
_ck_root:
|
|
|
|
[ `whoami` = 'root' ] # Only root can summon vmdb2 ☹
|
|
|
|
|
|
|
|
_clean_yaml:
|
2021-11-10 05:48:29 +00:00
|
|
|
rm -f $(addsuffix .yaml,$(platforms)) raspi_base_buster.yaml raspi_base_bullseye.yaml raspi_base_bookworm.yaml
|
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))
|
2021-04-24 23:20:12 +01:00
|
|
|
_clean_bmaps:
|
|
|
|
rm -f $(addsuffix .img.bmap,$(platforms))
|
2020-04-14 19:38:14 +01:00
|
|
|
_clean_shasums:
|
2021-09-09 00:00:59 +01:00
|
|
|
rm -f $(addsuffix .img.sha256,$(platforms)) $(addsuffix .img.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))
|
2021-04-24 23:20:12 +01:00
|
|
|
clean: _clean_xzimages _clean_images _clean_shasums _clean_yaml _clean_tarballs _clean_logs _clean_bmaps
|
2019-12-17 20:41:16 +00:00
|
|
|
|
|
|
|
.PHONY: _ck_root _build_img clean _clean_images _clean_yaml _clean_tarballs _clean_logs
|