From ce9763708c76dd155b97d84723df329fe4ba8019 Mon Sep 17 00:00:00 2001 From: snlavaise Date: Tue, 8 Sep 2026 22:13:55 -0300 Subject: [PATCH] linux-postmarketos-qcom-sm8550: dtbo with a no-op overlay, not empty A zero-entry DT table (32 bytes) fails Motorola's fastboot pre-flash validation. Build a real no-op overlay with the kernel's dtc, wrap it in a 1-entry DT table padded to 4 KB. Still applies nothing to the base DTB. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01QF5HebjUsRaxbW4cBX6HJP --- .../linux-postmarketos-qcom-sm8550/APKBUILD | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/device/testing/linux-postmarketos-qcom-sm8550/APKBUILD b/device/testing/linux-postmarketos-qcom-sm8550/APKBUILD index 666be99bc..ed23f410b 100644 --- a/device/testing/linux-postmarketos-qcom-sm8550/APKBUILD +++ b/device/testing/linux-postmarketos-qcom-sm8550/APKBUILD @@ -5,7 +5,7 @@ maintainer="snlavaise " _flavor="postmarketos-qcom-sm8550" pkgname=linux-$_flavor pkgver=7.2 -pkgrel=3 +pkgrel=4 pkgdesc="Mainline kernel for Qualcomm SM8550 (Snapdragon 8 Gen 2) + Motorola rtwo" arch="aarch64" _carch="arm64" @@ -80,14 +80,6 @@ package() { install -Dm644 "$builddir/arch/$_carch/boot/Image" \ "$pkgdir/boot/vmlinuz" - # Empty Android DT-overlay table (magic d7b7ab1e, 0 entries). The - # bootloader would otherwise apply the stock kalama dtbo overlay onto - # our mainline base DTB - the phandles don't match, the merged DTB is - # corrupt and the kernel panics. Flash this to the dtbo partition. - mkdir -p "$pkgdir"/boot - printf '\xd7\xb7\xab\x1e\x00\x00\x00\x20\x00\x00\x00\x20\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x08\x00\x00\x00\x00\x00' \ - > "$pkgdir"/boot/dtbo.img - make modules_install dtbs_install \ ARCH="$_carch" \ LLVM=1 \ @@ -95,6 +87,27 @@ package() { INSTALL_MOD_STRIP=1 \ INSTALL_DTBS_PATH="$pkgdir"/boot/dtbs + # Android DT-overlay image with a single no-op overlay. The bootloader + # would otherwise apply the stock kalama dtbo overlay onto our mainline + # base DTB - the phandles don't match, the merged tree is corrupt and + # the kernel panics. A no-op overlay keeps the base DTB intact. (A + # zero-entry table fails Motorola's pre-flash validation.) + mkdir -p "$pkgdir"/boot + printf '/dts-v1/;\n/plugin/;\n/ { };\n' > "$srcdir"/empty-overlay.dts + scripts/dtc/dtc -@ -O dtb -o "$srcdir"/empty.dtbo "$srcdir"/empty-overlay.dts + python3 - "$srcdir/empty.dtbo" "$pkgdir/boot/dtbo.img" <<-'EOF' + import struct, sys + fdt = open(sys.argv[1], "rb").read() + hdr_sz = ent_sz = 32 + ent_off = hdr_sz + ent_sz + hdr = struct.pack(">IIIIIIII", 0xd7b7ab1e, ent_off + len(fdt), + hdr_sz, ent_sz, 1, hdr_sz, 2048, 0) + ent = struct.pack(">IIIIIIII", len(fdt), ent_off, 0, 0, 0, 0, 0, 0) + blob = hdr + ent + fdt + blob += b"\x00" * ((4096 - len(blob) % 4096) % 4096) + open(sys.argv[2], "wb").write(blob) + EOF + rm -f "$pkgdir"/usr/lib/modules/*/build "$pkgdir"/usr/lib/modules/*/source install -Dm644 "$builddir"/include/config/kernel.release \