motorola-rtwo: switch to the device-motorola-dubai boot recipe

device-motorola-dubai (Motorola Edge 30, SM7325) is the closest working
Motorola mainline pmOS port. Match it:
 - header_version 2 + append_dtb=true: one monolithic boot.img with the
   DTB glued to the kernel, flashed to 'boot'. No vendor_boot / init_boot
   / GKI ramdisk layering.
 - 'earlycon' back on the cmdline - dubai's kernel-cmdline.conf says the
   Motorola ABL reboots the phone immediately WITHOUT it. This matches
   our exact <2s symptom; removing it earlier was the wrong call.
 - explicit flash_offset_* (base 0, dtb 0x1f00000, ...) and
   --os_patch_level, as dubai sets them.
 - dtbo.img = 24 MB of zeros (full partition), dubai's trick to make the
   bootloader skip overlay application.
 - kernel: gzip'd Image again (dubai uses gz, not raw).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QF5HebjUsRaxbW4cBX6HJP
This commit is contained in:
2026-09-09 00:41:35 -03:00
co-authored by Claude Sonnet 5
parent 35df152310
commit c9eadef4d5
3 changed files with 26 additions and 41 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=11 pkgrel=12
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="
1493ab4b2572a0245a189d3c8e1a53130cad87d999eb20e6d674d6aea4530b527f3478491ff1247adbd78b84e38eb3c7f404cafad1640726eeb21983aed613c6 deviceinfo 9ec843d537c386e5de46b345e70d7b68a3d5b175720b8b3c5731e73f68b3691c2b8aedaed8a90047e246117de46265a57737428b5c75caa94618c8ef4ad5865c deviceinfo
c572e21cb0624b554a22a218b0c4faab9b6412654bed6bfef530f3068d076b21c573bd7f4b3ca65f510f8756f636a861191cce925ef49587db7d68d09558826c modules-initfs c572e21cb0624b554a22a218b0c4faab9b6412654bed6bfef530f3068d076b21c573bd7f4b3ca65f510f8756f636a861191cce925ef49587db7d68d09558826c modules-initfs
" "
+15 -15
View File
@@ -8,6 +8,7 @@ deviceinfo_manufacturer="Motorola"
deviceinfo_codename="motorola-rtwo" deviceinfo_codename="motorola-rtwo"
deviceinfo_year="2023" deviceinfo_year="2023"
deviceinfo_dtb="qcom/sm8550-motorola-rtwo" deviceinfo_dtb="qcom/sm8550-motorola-rtwo"
deviceinfo_append_dtb="true"
deviceinfo_arch="aarch64" deviceinfo_arch="aarch64"
# Device related # Device related
@@ -17,30 +18,29 @@ deviceinfo_external_storage="true"
deviceinfo_screen_width="1080" deviceinfo_screen_width="1080"
deviceinfo_screen_height="2400" deviceinfo_screen_height="2400"
deviceinfo_getty="ttyMSM0;115200" deviceinfo_getty="ttyMSM0;115200"
# The DTS ships a simple-framebuffer pointing at the bootloader's continuous
# splash buffer, so there should be an early console on the panel. If the
# screen stays black, set this to "true" (and fix the framebuffer@ node).
# There is no DRM/mdss yet, so no mode setting / backlight control.
deviceinfo_no_framebuffer="true" deviceinfo_no_framebuffer="true"
# Split the initramfs: a small base archive (fits in init_boot, 8 MB) plus a
# separate initramfs-extra loaded from the rootfs later.
deviceinfo_create_initfs_extra="true" deviceinfo_create_initfs_extra="true"
# Bootloader related # Bootloader related. Modelled on device-motorola-dubai (Motorola Edge 30,
# the closest working Motorola mainline port): monolithic header v2 boot.img
# with the DTB appended to the kernel, flashed to the boot partition.
deviceinfo_flash_method="fastboot" deviceinfo_flash_method="fastboot"
deviceinfo_flash_fastboot_partition_dtbo="dtbo" deviceinfo_flash_fastboot_partition_dtbo="dtbo"
deviceinfo_flash_fastboot_partition_vbmeta="vbmeta" deviceinfo_flash_fastboot_partition_vbmeta="vbmeta"
deviceinfo_kernel_cmdline="console=ttyMSM0,115200n8 ignore_loglevel" # 'earlycon' is REQUIRED: the Motorola ABL reboots the phone immediately
# without it (see device-motorola-dubai/kernel-cmdline.conf).
deviceinfo_kernel_cmdline="console=ttyMSM0,115200n8 earlycon"
deviceinfo_generate_bootimg="true" deviceinfo_generate_bootimg="true"
# The Motorola bootloader places the DTB / kernel at the addresses in the deviceinfo_header_version="2"
# vendor_boot header. mkbootimg defaults to base 0x10000000 (dtb ends up at
# 0x11f00000, outside RAM) - stock uses base 0. Force the stock layout.
deviceinfo_bootimg_custom_args="--base 0x00000000 --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --dtb_offset 0x01f00000 --os_version 16.0.0 --os_patch_level 2026-08"
deviceinfo_bootimg_qcdt="false"
deviceinfo_header_version="4"
deviceinfo_flash_pagesize="4096" deviceinfo_flash_pagesize="4096"
deviceinfo_flash_offset_base="0x00000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00000000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_offset_dtb="0x01f00000"
deviceinfo_bootimg_custom_args="--os_patch_level 2026-08-01"
deviceinfo_flash_sparse="true" deviceinfo_flash_sparse="true"
# UFS storage # UFS storage
@@ -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=8 pkgrel=9
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,10 +74,9 @@ build() {
} }
package() { package() {
# The Motorola bootloader boots a *raw* uncompressed arm64 Image # gzip'd Image for the Android boot.img (like device-motorola-dubai;
# (BOARD_KERNEL_IMAGE_NAME := Image); Image.gz / vmlinuz.efi make it # CONFIG_EFI_ZBOOT is off in rtwo.config so Image.gz is produced).
# 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"
make modules_install dtbs_install \ make modules_install dtbs_install \
@@ -87,26 +86,12 @@ package() {
INSTALL_MOD_STRIP=1 \ INSTALL_MOD_STRIP=1 \
INSTALL_DTBS_PATH="$pkgdir"/boot/dtbs INSTALL_DTBS_PATH="$pkgdir"/boot/dtbs
# Android DT-overlay image with a single no-op overlay. The bootloader # All-zero dtbo image (full partition size), same trick as
# would otherwise apply the stock kalama dtbo overlay onto our mainline # device-motorola-dubai: the bootloader finds no valid DT-overlay
# base DTB - the phandles don't match, the merged tree is corrupt and # table magic and applies nothing, so the stock kalama overlay does
# the kernel panics. A no-op overlay keeps the base DTB intact. (A # not get merged onto our mainline base DTB.
# zero-entry table fails Motorola's pre-flash validation.)
mkdir -p "$pkgdir"/boot mkdir -p "$pkgdir"/boot
printf '/dts-v1/;\n/plugin/;\n/ { };\n' > "$srcdir"/empty-overlay.dts dd if=/dev/zero of="$pkgdir/boot/dtbo.img" bs=1M count=24 status=none
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 rm -f "$pkgdir"/usr/lib/modules/*/build "$pkgdir"/usr/lib/modules/*/source