From b2139012aa8aad5927edbda4f678430f3c99c755 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Tue, 2 May 2023 12:08:31 +0200 Subject: [PATCH] dag to keep mirrors in sync --- mirrors/Make.config | 19 ++++++++++++++ mirrors/Make.init | 15 +++++++++++ mirrors/Makefile | 32 +++++++++++++++++++++++ mirrors/tftp/Make.config | 4 +++ mirrors/tftp/Makefile | 12 +++++++++ mirrors/tftp/kitchen/Make.config | 6 +++++ mirrors/tftp/kitchen/Makefile | 45 ++++++++++++++++++++++++++++++++ mirrors/tftp/kitchen/config.txt | 4 +++ 8 files changed, 137 insertions(+) create mode 100644 mirrors/Make.config create mode 100644 mirrors/Make.init create mode 100644 mirrors/Makefile create mode 100644 mirrors/tftp/Make.config create mode 100644 mirrors/tftp/Makefile create mode 100644 mirrors/tftp/kitchen/Make.config create mode 100644 mirrors/tftp/kitchen/Makefile create mode 100644 mirrors/tftp/kitchen/config.txt diff --git a/mirrors/Make.config b/mirrors/Make.config new file mode 100644 index 0000000..d35f26d --- /dev/null +++ b/mirrors/Make.config @@ -0,0 +1,19 @@ +################################################################################ + +MIRRORS_PATH = /mnt/mirrors + +################################################################################ + +ALPINE_VERSIONS = v3.17 +ALPINE_ARCHS = aarch64 +ALPINE_SUBFOLDERS = main community releases +ALPINE_DEST = $(MIRRORS_PATH)/alpine +ALPINE_URL=rsync://rsync.alpinelinux.org + +################################################################################ + +RPI_FIRMWARE_DEST = $(MIRRORS_PATH)/raspberrypi/firmware + +################################################################################ + +# vi: ft=make diff --git a/mirrors/Make.init b/mirrors/Make.init new file mode 100644 index 0000000..f5d6fb7 --- /dev/null +++ b/mirrors/Make.init @@ -0,0 +1,15 @@ +include Make.config + +################################################################################ + +ALPINE_FOLDERS := $(foreach version,$(ALPINE_VERSIONS), \ + $(foreach repo,$(ALPINE_SUBFOLDERS), \ + $(foreach arch,$(ALPINE_ARCHS), \ + $(ALPINE_DEST)/$(version)/$(repo)/$(arch) \ + ) \ + ) \ +) + +################################################################################ + +# vi: ft=make diff --git a/mirrors/Makefile b/mirrors/Makefile new file mode 100644 index 0000000..846f5ee --- /dev/null +++ b/mirrors/Makefile @@ -0,0 +1,32 @@ +include Make.config +include Make.init + +################################################################################ + +all: alpine rpi_firmware tftp +.PHONY: all alpine force rpi_firwmare tftp + +################################################################################ + +alpine: $(ALPINE_FOLDERS) + +RSYNC_ARGS=--archive --update --hard-links --delete --delete-after --delay-updates --timeout=600 --progress + +$(ALPINE_DEST)/%: force + @mkdir -p $(@D) + @echo $@ + @rsync $(RSYNC_ARGS) $(ALPINE_URL)/alpine/$* $(@D) + +################################################################################ + +rpi_firmware: + git -C $(RPI_FIRMWARE_DEST) pull + +################################################################################ + +tftp: + make -C tftp + +################################################################################ + +# vi: ft=make diff --git a/mirrors/tftp/Make.config b/mirrors/tftp/Make.config new file mode 100644 index 0000000..44d82ed --- /dev/null +++ b/mirrors/tftp/Make.config @@ -0,0 +1,4 @@ +PXE_URL = http://netboot.monotremata.xyz +TFTP_DIR = /srv/tftp + +# vi: ft=make diff --git a/mirrors/tftp/Makefile b/mirrors/tftp/Makefile new file mode 100644 index 0000000..9b8a060 --- /dev/null +++ b/mirrors/tftp/Makefile @@ -0,0 +1,12 @@ +include ../Make.config +include Make.config + +all: $(TFTP_DIR)/bootcode.bin kitchen + +.PHONY: kitchen + +$(TFTP_DIR)/bootcode.bin: $(RPI_FIRMWARE_DEST)/boot/bootcode.bin + install --mode=644 $< $@ + +kitchen: + make -C kitchen diff --git a/mirrors/tftp/kitchen/Make.config b/mirrors/tftp/kitchen/Make.config new file mode 100644 index 0000000..9107104 --- /dev/null +++ b/mirrors/tftp/kitchen/Make.config @@ -0,0 +1,6 @@ +ARCH = aarch64 +ALPINE_VERSION = v3.17 +ALPINE_REVISION = 3.17.3 +SERIAL_NO = 1385d29c + +# vi: ft=make diff --git a/mirrors/tftp/kitchen/Makefile b/mirrors/tftp/kitchen/Makefile new file mode 100644 index 0000000..6e45feb --- /dev/null +++ b/mirrors/tftp/kitchen/Makefile @@ -0,0 +1,45 @@ +include ../../Make.config +include ../Make.config +include Make.config + +RPI=rpi + +RPI_BOOT_PATH = $(RPI_FIRMWARE_DEST)/boot + +ALPINE_FILES_PATH = alpine/$(ALPINE_VERSION) +NETBOOT_FILES_PATH = $(ALPINE_FILES_PATH)/releases/$(ARCH)/netboot-$(ALPINE_REVISION) + +ALPINE_REPO = $(PXE_URL)/$(ALPINE_FILES_PATH)/main/$(ARCH) +MODLOOP = $(PXE_URL)/$(NETBOOT_FILES_PATH)/modloop-$(RPI) + +DEST_DIR = $(TFTP_DIR)/$(SERIAL_NO) + +all: $(DEST_DIR)/fixup.dat $(DEST_DIR)/start.elf $(DEST_DIR)/bcm2710-rpi-3-b-plus.dtb $(DEST_DIR)/initramfs-rpi $(DEST_DIR)/vmlinuz-rpi $(DEST_DIR)/config.txt $(DEST_DIR)/cmdline.txt + +$(DEST_DIR)/fixup.dat: $(RPI_BOOT_PATH)/fixup.dat + mkdir -p $(@D) + install --mode=644 $< $@ + +$(DEST_DIR)/start.elf: $(RPI_BOOT_PATH)/start.elf + mkdir -p $(@D) + install --mode=644 $^ $@ + +$(DEST_DIR)/bcm2710-rpi-3-b-plus.dtb: $(RPI_BOOT_PATH)/bcm2710-rpi-3-b-plus.dtb + mkdir -p $(@D) + install --mode=644 $^ $@ + +$(DEST_DIR)/initramfs-rpi: $(MIRRORS_PATH)/$(NETBOOT_FILES_PATH)/initramfs-rpi + mkdir -p $(@D) + install --mode=644 $^ $@ + +$(DEST_DIR)/vmlinuz-rpi: $(MIRRORS_PATH)/$(NETBOOT_FILES_PATH)/vmlinuz-rpi + mkdir -p $(@D) + install --mode=644 $^ $@ + +$(DEST_DIR)/cmdline.txt: + mkdir -p $(@D) + echo "modules=loop,squashfs console=ttyAMA0,115200 ip=dhcp alpine_repo=$(ALPINE_REPO) modloop=$(MODLOOP)" > $@ + +$(DEST_DIR)/config.txt: config.txt + mkdir -p $(@D) + install --mode=644 $^ $@ diff --git a/mirrors/tftp/kitchen/config.txt b/mirrors/tftp/kitchen/config.txt new file mode 100644 index 0000000..985beea --- /dev/null +++ b/mirrors/tftp/kitchen/config.txt @@ -0,0 +1,4 @@ +[pi3+] +kernel=vmlinuz-rpi +initramfs initramfs-rpi +arm_64bit=1