motorola-rtwo: raw Image + empty dtbo for the Motorola bootloader

From the stock LineageOS images:
- boot.img carries a raw uncompressed arm64 Image (MZ header), not
  Image.gz. Install arch/arm64/boot/Image as vmlinuz.
- dtbo.img is an 8-entry overlay table; the bootloader applies overlay
  #7 (androidboot.dtbo_idx=7, 87 fragments) onto the base DTB by
  phandle. Against our mainline DTB that produces a corrupt merged tree
  -> instant panic. Ship an empty dtbo (0 entries) to flash to dtbo_b,
  and set deviceinfo_flash_fastboot_partition_dtbo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QF5HebjUsRaxbW4cBX6HJP
This commit is contained in:
2026-09-08 21:28:13 -03:00
co-authored by Claude Sonnet 5
parent 7bbebae156
commit 34600bc55e
4 changed files with 19 additions and 10 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
maintainer="snlavaise <snlavaise@gmail.com>" maintainer="snlavaise <snlavaise@gmail.com>"
pkgname=device-motorola-rtwo pkgname=device-motorola-rtwo
pkgver=1 pkgver=1
pkgrel=6 pkgrel=7
pkgdesc="Motorola Moto Edge 40 Pro" pkgdesc="Motorola Moto Edge 40 Pro"
url="https://postmarketos.org" url="https://postmarketos.org"
arch="aarch64" arch="aarch64"
@@ -36,6 +36,6 @@ package() {
} }
sha512sums=" sha512sums="
5731bcab1f4b4625b39a72f560be249fb3a89c55d84f81fa983313ab722eacf62ceb427e20833b7f8e7f5399c051d2185db82b1d5ed8b33b850b795127b3eb91 deviceinfo e66050dc46b1933b4e3bf7d4918e72ed68218015cc714615b26801030c3f9b481815eba0a01c9795a479353511cb7928d1f1cb0b3dc1b3817ca4c7cd5f1f8301 deviceinfo
c572e21cb0624b554a22a218b0c4faab9b6412654bed6bfef530f3068d076b21c573bd7f4b3ca65f510f8756f636a861191cce925ef49587db7d68d09558826c modules-initfs c572e21cb0624b554a22a218b0c4faab9b6412654bed6bfef530f3068d076b21c573bd7f4b3ca65f510f8756f636a861191cce925ef49587db7d68d09558826c modules-initfs
" "
@@ -30,6 +30,7 @@ deviceinfo_create_initfs_extra="true"
# Bootloader related # Bootloader related
deviceinfo_flash_method="fastboot" deviceinfo_flash_method="fastboot"
deviceinfo_flash_fastboot_partition_dtbo="dtbo"
deviceinfo_kernel_cmdline="console=tty0 console=ttyMSM0,115200n8 earlycon clk_ignore_unused pd_ignore_unused ignore_loglevel" deviceinfo_kernel_cmdline="console=tty0 console=ttyMSM0,115200n8 earlycon clk_ignore_unused pd_ignore_unused ignore_loglevel"
deviceinfo_generate_bootimg="true" deviceinfo_generate_bootimg="true"
# The Motorola bootloader places the DTB / kernel at the addresses in the # The Motorola bootloader places the DTB / kernel at the addresses in the
@@ -5,7 +5,7 @@ maintainer="snlavaise <snlavaise@gmail.com>"
_flavor="postmarketos-qcom-sm8550" _flavor="postmarketos-qcom-sm8550"
pkgname=linux-$_flavor pkgname=linux-$_flavor
pkgver=7.2 pkgver=7.2
pkgrel=2 pkgrel=3
pkgdesc="Mainline kernel for Qualcomm SM8550 (Snapdragon 8 Gen 2) + Motorola rtwo" pkgdesc="Mainline kernel for Qualcomm SM8550 (Snapdragon 8 Gen 2) + Motorola rtwo"
arch="aarch64" arch="aarch64"
_carch="arm64" _carch="arm64"
@@ -74,12 +74,20 @@ build() {
} }
package() { package() {
# The Motorola bootloader wants a plain gzip'd arm64 Image in the # The Motorola bootloader boots a *raw* uncompressed arm64 Image
# Android boot.img, NOT the EFI ZBOOT blob (vmlinuz.efi). CONFIG_EFI_ZBOOT # (BOARD_KERNEL_IMAGE_NAME := Image); Image.gz / vmlinuz.efi make it
# is disabled in rtwo.config so Image.gz is what gets built. # reset in <2s. CONFIG_EFI_ZBOOT is off in rtwo.config.
install -Dm644 "$builddir/arch/$_carch/boot/Image.gz" \ install -Dm644 "$builddir/arch/$_carch/boot/Image" \
"$pkgdir/boot/vmlinuz" "$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 \ make modules_install dtbs_install \
ARCH="$_carch" \ ARCH="$_carch" \
LLVM=1 \ LLVM=1 \
@@ -98,6 +106,6 @@ package() {
sha512sums=" sha512sums="
52d5aa7f94f6aa6141debf4ceb4fc7a2e75505a7cd38b8854e501be83c2b57863020f463f2fdb2fc93667e6cfe13274d077e5207a611e4797bd9404ee0e64c58 linux-postmarketos-qcom-sm8550-7.2.tar.gz 52d5aa7f94f6aa6141debf4ceb4fc7a2e75505a7cd38b8854e501be83c2b57863020f463f2fdb2fc93667e6cfe13274d077e5207a611e4797bd9404ee0e64c58 linux-postmarketos-qcom-sm8550-7.2.tar.gz
f9ae52489f6b9e6fef64952943cd09732a5bef90a0e8765db03c256483028368687d6d5a1d80dd813a513e7e80d91f8b47f49b91cff67266b76f1d6275a7fea0 config-motorola-rtwo.aarch64 f9ae52489f6b9e6fef64952943cd09732a5bef90a0e8765db03c256483028368687d6d5a1d80dd813a513e7e80d91f8b47f49b91cff67266b76f1d6275a7fea0 config-motorola-rtwo.aarch64
ca36b981736b94d93120bea60d84614a5f943b0577a87ce0c650a7c065dc8b8b889eeee766b8fb941e15af4db5d426583d2d85e3e243faf89aa9cac472f78388 rtwo.config 53441c23146d76bb0eaa358a25f6cce4f21740cfb65b755df52bbb218daf2cda30b3d80fa6ca4e283ea1afe2b0fa708307b678b421898100710b8fb99b08d6c5 rtwo.config
e1633eb9a356de1e46c430fe2eb2c5d77ddeb9301f8cf9c95df3ae180d581a57ede0906aeddc0bcc15b95931c0dd40565930a1e1b72bfb540e5a99bcb9865e58 sm8550-motorola-rtwo.dts e1633eb9a356de1e46c430fe2eb2c5d77ddeb9301f8cf9c95df3ae180d581a57ede0906aeddc0bcc15b95931c0dd40565930a1e1b72bfb540e5a99bcb9865e58 sm8550-motorola-rtwo.dts
" "
@@ -30,8 +30,8 @@ CONFIG_MAGIC_SYSRQ=y
CONFIG_LOG_BUF_SHIFT=18 CONFIG_LOG_BUF_SHIFT=18
# --- kernel image format ---------------------------------------------- # --- kernel image format ----------------------------------------------
# The Motorola bootloader executes a plain gzip'd Image from the Android # The Motorola bootloader executes a raw uncompressed arm64 Image from the
# boot.img; the EFI ZBOOT self-decompressor makes it reboot instantly. # Android boot.img; EFI ZBOOT self-decompression makes it reboot instantly.
# CONFIG_EFI_ZBOOT is not set # CONFIG_EFI_ZBOOT is not set
# --- build size / speed: device kernel, not the generic arm64 one ------ # --- build size / speed: device kernel, not the generic arm64 one ------