From 7a97449c5e24a3513a9205d22ba42dba158701b4 Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Mon, 8 Jan 2024 17:17:03 -0500 Subject: [PATCH 1/9] CI: Install depthcharge-tools --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f712a5d..26815ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | dnf5 update -y - dnf5 install -y git make gcc ccache flex bison elfutils-devel parted vboot-utils golang xz bc tar openssl-devel + dnf5 install -y git make gcc ccache flex bison elfutils-devel parted vboot-utils golang xz bc tar openssl-devel depthcharge-tools - uses: actions/checkout@v3 with: From d36a58c594e4d36076527adb2dad0ae62bc5f831 Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Mon, 8 Jan 2024 17:48:41 -0500 Subject: [PATCH 2/9] Makefile: Build arm64 images properly --- Makefile | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 24fe5e4..67a9e4c 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,10 @@ IMG_A64=$(project_name)-a64.bin .PHONY: usage +ifeq ($(shell uname -m), x86_64) + CROSS=aarch64-linux-gnu- +endif + usage: @echo "usage: make [x86_64|arm64]" @@ -44,6 +48,7 @@ $(KPART_X64): $(BZIMAGE_X64) $(BZIMAGE_X64): $(INITFSZ_X64) cp $(CONFDIR)/$(CONFIG_X64) kernel/.config + make -C kernel olddefconfig make -C kernel cp kernel/arch/x86/boot/bzImage $(WORKDIR)/$(BZIMAGE_X64) @@ -66,15 +71,22 @@ $(IMG_A64): $(KPART_A64) @echo 'Build complete! Resulting file saved as "$(IMG_A64)" in "images" directory.' $(KPART_A64): $(BZIMAGE_A64) - echo $(project_name) > $(TMPFILE) - futility vbutil_kernel --pack $(WORKDIR)/$(KPART_A64) --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --keyblock /usr/share/vboot/devkeys/kernel.keyblock --config $(TMPFILE) --bootloader $(TMPFILE) --vmlinuz $(WORKDIR)/$(BZIMAGE_A64) --version 1 --arch arm64 + depthchargectl build -v \ + --board arm64-generic \ + --kernel $(WORKDIR)/$(BZIMAGE_A64) \ + --fdtdir $(WORKDIR)/dtbs \ + --root none \ + --kernel-cmdline "loglevel=7 console=ttyS0,115200 console=tty0" \ + --output $(WORKDIR)/$(KPART_A64) mkdir -p $(OUTPUTDIR) cp $(WORKDIR)/$(KPART_A64) $(OUTPUTDIR)/$(KPART_A64) @echo 'Kernel partition binary saved as "$(KPART_A64)" in "images" directory.' $(BZIMAGE_A64): $(INITFSZ_A64) cp $(CONFDIR)/$(CONFIG_A64) kernel/.config - [ $(shell uname -m) = x86_64 ] && ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -C kernel || make -C kernel + CROSS_COMPILE=$(CROSS) ARCH=arm64 make -C kernel olddefconfig + CROSS_COMPILE=$(CROSS) ARCH=arm64 make -C kernel + CROSS_COMPILE=$(CROSS) ARCH=arm64 make -C kernel dtbs_install INSTALL_DTBS_PATH=../$(WORKDIR)/dtbs cp kernel/arch/arm64/boot/Image.gz $(WORKDIR)/$(BZIMAGE_A64) $(INITFSZ_A64): $(INITFS_A64) From 456aba014db05cbaf7b6785de909ac1e93ace5b6 Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Wed, 10 Jan 2024 15:23:58 -0500 Subject: [PATCH 3/9] Makefile: Remove debugging cmdline from arm64 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 67a9e4c..ea29f68 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ $(KPART_A64): $(BZIMAGE_A64) --kernel $(WORKDIR)/$(BZIMAGE_A64) \ --fdtdir $(WORKDIR)/dtbs \ --root none \ - --kernel-cmdline "loglevel=7 console=ttyS0,115200 console=tty0" \ + --kernel-cmdline "" \ --output $(WORKDIR)/$(KPART_A64) mkdir -p $(OUTPUTDIR) cp $(WORKDIR)/$(KPART_A64) $(OUTPUTDIR)/$(KPART_A64) From f99a517233c8e69a61385eaff050b292ee953e1f Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Wed, 10 Jan 2024 15:24:55 -0500 Subject: [PATCH 4/9] CI: Install depthcharge-tools with pip --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26815ea..932757e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,8 @@ jobs: - name: Install dependencies run: | dnf5 update -y - dnf5 install -y git make gcc ccache flex bison elfutils-devel parted vboot-utils golang xz bc tar openssl-devel depthcharge-tools + dnf5 install -y git make gcc ccache flex bison elfutils-devel parted vboot-utils golang xz bc tar openssl-devel python3-pip + pip3 install depthcharge-tools - uses: actions/checkout@v3 with: From 04a1751ba57ab4b7412b0358804cfde2de183761 Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Wed, 10 Jan 2024 15:31:33 -0500 Subject: [PATCH 5/9] Makefile: Set console=tty0 on arm64 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ea29f68..d2eda09 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ $(KPART_A64): $(BZIMAGE_A64) --kernel $(WORKDIR)/$(BZIMAGE_A64) \ --fdtdir $(WORKDIR)/dtbs \ --root none \ - --kernel-cmdline "" \ + --kernel-cmdline "console=tty0" \ --output $(WORKDIR)/$(KPART_A64) mkdir -p $(OUTPUTDIR) cp $(WORKDIR)/$(KPART_A64) $(OUTPUTDIR)/$(KPART_A64) From 7aff97dbde34954fb01bc2b55133150dedb66edc Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Sun, 21 Jan 2024 17:25:39 -0500 Subject: [PATCH 6/9] arm64: create 64MB kernel partition --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d2eda09..8510543 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ arm64: $(IMG_A64) $(IMG_A64): $(KPART_A64) fallocate -l 18M $(WORKDIR)/$(IMG_A64) parted $(WORKDIR)/$(IMG_A64) mklabel gpt --script - cgpt add -i 1 -t kernel -b 2048 -s 32767 -P 15 -T 1 -S 1 $(WORKDIR)/$(IMG_A64) + cgpt add -i 1 -t kernel -b 2048 -s 131068 -P 15 -T 1 -S 1 $(WORKDIR)/$(IMG_A64) dd if=$(WORKDIR)/$(KPART_A64) of=$(WORKDIR)/$(IMG_A64) bs=512 seek=2048 conv=notrunc cp $(WORKDIR)/$(IMG_A64) $(OUTPUTDIR)/$(IMG_A64) @echo 'Build complete! Resulting file saved as "$(IMG_A64)" in "images" directory.' From 1773c5ef0027c60425978e8d39f8c6b649adcd8c Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Sun, 21 Jan 2024 17:44:12 -0500 Subject: [PATCH 7/9] arm64: (properly) create 64MB kernel partition --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8510543..5a0d6c2 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ $(INITFS_X64): # Use 'make arm64' to build ARM64 (cross-compiling is supported). arm64: $(IMG_A64) $(IMG_A64): $(KPART_A64) - fallocate -l 18M $(WORKDIR)/$(IMG_A64) + fallocate -l 65M $(WORKDIR)/$(IMG_A64) parted $(WORKDIR)/$(IMG_A64) mklabel gpt --script cgpt add -i 1 -t kernel -b 2048 -s 131068 -P 15 -T 1 -S 1 $(WORKDIR)/$(IMG_A64) dd if=$(WORKDIR)/$(KPART_A64) of=$(WORKDIR)/$(IMG_A64) bs=512 seek=2048 conv=notrunc From 7d8a611ef4c2ed5c02a99e6b9c9265645e1c7550 Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Sun, 21 Jan 2024 17:45:51 -0500 Subject: [PATCH 8/9] arm64: cgpt is annoying --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5a0d6c2..2e21d40 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ $(INITFS_X64): # Use 'make arm64' to build ARM64 (cross-compiling is supported). arm64: $(IMG_A64) $(IMG_A64): $(KPART_A64) - fallocate -l 65M $(WORKDIR)/$(IMG_A64) + fallocate -l 69M $(WORKDIR)/$(IMG_A64) parted $(WORKDIR)/$(IMG_A64) mklabel gpt --script cgpt add -i 1 -t kernel -b 2048 -s 131068 -P 15 -T 1 -S 1 $(WORKDIR)/$(IMG_A64) dd if=$(WORKDIR)/$(KPART_A64) of=$(WORKDIR)/$(IMG_A64) bs=512 seek=2048 conv=notrunc From 897d2a005d2efc328001a23aa60a404542322830 Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Sun, 21 Jan 2024 18:32:15 -0500 Subject: [PATCH 9/9] CI: install uboot-tools --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 932757e..5dca53f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | dnf5 update -y - dnf5 install -y git make gcc ccache flex bison elfutils-devel parted vboot-utils golang xz bc tar openssl-devel python3-pip + dnf5 install -y git make gcc ccache flex bison elfutils-devel parted vboot-utils golang xz bc tar openssl-devel python3-pip uboot-tools pip3 install depthcharge-tools - uses: actions/checkout@v3