From dab07510cf2f3e6942060b9801f24531ecdaf6cd Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Mon, 4 May 2020 18:18:58 -0400 Subject: [PATCH 1/8] Clean up the .xz.sha256 sums that are created during build --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ccf4c42..3c3c290 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ _clean_images: _clean_xzimages: rm -f raspi_0w.img.xz raspi_2.img.xz raspi_3.img.xz _clean_shasums: - rm -f raspi_0w.sha256 raspi_2.sha256 raspi_3.sha256 + rm -f raspi_0w.sha256 raspi_2.sha256 raspi_3.sha256 raspi_0w.xz.sha256 raspi_2.xz.sha256 raspi_3.xz.sha256 _clean_logs: rm -f raspi_0w.log raspi_2.log raspi_3.log _clean_tarballs: From 5507be93ef065f5b68aeef60af8dd67a38f42b63 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Mon, 4 May 2020 18:07:01 -0400 Subject: [PATCH 2/8] Makefile: use variables for platforms instead of repeating platform numbers 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. --- Makefile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 3c3c290..cfcedef 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,14 @@ all: shasums -shasums: raspi_0w.sha256 raspi_2.sha256 raspi_3.sha256 raspi_0w.xz.sha256 raspi_2.xz.sha256 raspi_3.xz.sha256 -xzimages: raspi_0w.img.xz raspi_2.img.xz raspi_3.img.xz -images: raspi_0w.img raspi_2.img raspi_3.img -yaml: raspi_0w.yaml raspi_2.yaml raspi_3.yaml +# 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/" | \ @@ -49,17 +54,17 @@ _ck_root: [ `whoami` = 'root' ] # Only root can summon vmdb2 ☹ _clean_yaml: - rm -f raspi_0w.yaml raspi_2.yaml raspi_3.yaml + rm -f $(addsuffix .yaml,$(platforms)) _clean_images: - rm -f raspi_0w.img raspi_2.img raspi_3.img + rm -f $(addsuffix .img,$(platforms)) _clean_xzimages: - rm -f raspi_0w.img.xz raspi_2.img.xz raspi_3.img.xz + rm -f $(addsuffix .img.xz,$(platforms)) _clean_shasums: - rm -f raspi_0w.sha256 raspi_2.sha256 raspi_3.sha256 raspi_0w.xz.sha256 raspi_2.xz.sha256 raspi_3.xz.sha256 + rm -f $(addsuffix .sha256,$(platforms)) $(addsuffix .xz.sha256,$(platforms)) _clean_logs: - rm -f raspi_0w.log raspi_2.log raspi_3.log + rm -f $(addsuffix .log,$(platforms)) _clean_tarballs: - rm -f raspi_0w.tar.gz raspi_2.tar.gz raspi_3.tar.gz + 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 From 91a45af6be59d6f1bcfbc18de1e368adbeb560fb Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Mon, 4 May 2020 22:34:43 -0400 Subject: [PATCH 3/8] fix minor typo in documentation The images that are created are raspi_3.img, not raspi3.img. Minor, but might as well fix it while I'm here. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e740943..3e1c7a0 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ important parts of your system. Double check it's the correct device!), copy the image onto the SD card: ```shell -sudo dd if=raspi3.img of=/dev/mmcblk0 bs=64k oflag=dsync status=progress +sudo dd if=raspi_3.img of=/dev/mmcblk0 bs=64k oflag=dsync status=progress ``` Then, plug the SD card into the Raspberry Pi, and power it up. From 462abf1d43ca3c9037f9fc8a3a36674082dc2d0a Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Sun, 10 May 2020 19:53:22 -0400 Subject: [PATCH 4/8] Generate a raspi_4.yaml This allows you to run "make raspi_4.img" and create a raspberry pi 4 image. It doesn't yet add pi 4 to the list of images that are autobuilt. We're pulling the latest kernel and raspi3-firmware in order to get pi4 support (which was added in Linux 5.5). We're also working around a bug where cma= stops the 5.6 kernel from booting (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=951744#10). This is based on Lucas Nussbaum's initial yaml. --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index cfcedef..7759f17 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,17 @@ raspi_3.yaml: raspi_master.yaml sed "s/__OTHER_APT_ENABLE__//" |\ sed "s/__HOST__/rpi3/" > $@ +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/" | \ + sed "s/__EXTRA_PKGS__/- firmware-brcm80211/" | \ + 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/" > $@ + %.sha256: %.img.xz echo $@ sha256sum $(@:sha256=img) > $@ From 6aed835e6c147addc6638e797e0bb117b62f6bcb Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Fri, 26 Jun 2020 01:40:08 -0400 Subject: [PATCH 5/8] networking: don't fail if we can't restore firewall tables I'm not sure if this happens on all images, but on a pi 4 networking fails to initialize because there's no /etc/iptables/rules.v4. That doesn't seem right, so let's ignore errors and allow networking. --- eth0 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth0 b/eth0 index 8732488..adc5227 100644 --- a/eth0 +++ b/eth0 @@ -2,5 +2,5 @@ auto eth0 # TODO: switch back to iptables-persistent once it re-enters testing iface eth0 inet dhcp - pre-up iptables-restore < /etc/iptables/rules.v4 - pre-up ip6tables-restore < /etc/iptables/rules.v6 + pre-up iptables-restore < /etc/iptables/rules.v4 || true + pre-up ip6tables-restore < /etc/iptables/rules.v6 || true From 3995159864f50e1288b9a43f7d513ad0d0d93918 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Fri, 26 Jun 2020 02:30:05 -0400 Subject: [PATCH 6/8] pi4: add a hack to make wifi work on the pi4 The broadcom wifi driver needs NVRAM data in order to work. Manually grab upstream's board-specific NVRAM file for now, until we can get it added to the firmware-brcm80211 package. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 7759f17..7dd13fc 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ raspi_4.yaml: raspi_master.yaml sed "s/__EXTRA_PKGS__/- firmware-brcm80211/" | \ 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#hostname\"#hostname\"\n wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt -P \"\\\$${ROOT?}/lib/firmware/brcm\"#" |\ sed "s/__HOST__/rpi4/" > $@ %.sha256: %.img.xz From 6213e3d35aa03259e502a3272fe3c6d1915f05d2 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 30 Jun 2020 18:06:30 +0900 Subject: [PATCH 7/8] gitignore: Add raspi_4.yaml Signed-off-by: Nobuhiro Iwamatsu --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e160c08..94bde07 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ raspi*.sha256 raspi_0w.yaml raspi_2.yaml raspi_3.yaml +raspi_4.yaml From a8fc785c774e15e9ded46a1a0ba74bcbf34f6191 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 30 Jun 2020 18:09:14 +0900 Subject: [PATCH 8/8] Makefile: Add Rpi 4 to build target Signed-off-by: Nobuhiro Iwamatsu --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7dd13fc..e30aa97 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ 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 +BUILD_PLATFORMS := 0w 2 3 4 platforms := $(addprefix raspi_,$(BUILD_PLATFORMS)) shasums: $(addsuffix .sha256,$(platforms)) $(addsuffix .xz.sha256,$(platforms))