motorola-rtwo: back to GKI v4, replace every ramdisk source with pmOS

rtwo is Android 13: the generic first-stage ramdisk lives in init_boot,
not boot.img, and the bootloader always assembles the initramfs from
init_boot + vendor_boot regardless of what boot.img contains. So the
dubai-style monolithic v2 boot.img cannot work here - keep header v4 and
replace boot (kernel), vendor_boot (dtb+cmdline+initramfs) and init_boot
(generic ramdisk) all with pmOS content.

Combine everything learned:
 - header v4, append_dtb off (dtb in vendor_boot)
 - earlycon on the cmdline (Motorola ABL requirement, from dubai)
 - raw Image kernel (stock LineageOS rtwo evidence)
 - base 0 + explicit offsets + os_version/os_patch_level
 - 24 MB zero dtbo (dubai trick)
 - the Sony-Xperia-1-V-modelled minimal .dts (no /memory, no msm-id, no
   speculative regulators)

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:45:30 -03:00
co-authored by Claude Sonnet 5
parent c9eadef4d5
commit 187b52aa12
3 changed files with 20 additions and 20 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
maintainer="snlavaise <snlavaise@gmail.com>"
pkgname=device-motorola-rtwo
pkgver=1
pkgrel=12
pkgrel=13
pkgdesc="Motorola Moto Edge 40 Pro"
url="https://postmarketos.org"
arch="aarch64"
@@ -36,6 +36,6 @@ package() {
}
sha512sums="
9ec843d537c386e5de46b345e70d7b68a3d5b175720b8b3c5731e73f68b3691c2b8aedaed8a90047e246117de46265a57737428b5c75caa94618c8ef4ad5865c deviceinfo
2625f12ae797bf8b2ad03aed507d86cac728e37a202d92ed565900e449f03f4164b5a1e08304916e5e73c5c53338176c2ea0d8251b5f473894637af317519aa3 deviceinfo
c572e21cb0624b554a22a218b0c4faab9b6412654bed6bfef530f3068d076b21c573bd7f4b3ca65f510f8756f636a861191cce925ef49587db7d68d09558826c modules-initfs
"
+13 -14
View File
@@ -8,7 +8,6 @@ deviceinfo_manufacturer="Motorola"
deviceinfo_codename="motorola-rtwo"
deviceinfo_year="2023"
deviceinfo_dtb="qcom/sm8550-motorola-rtwo"
deviceinfo_append_dtb="true"
deviceinfo_arch="aarch64"
# Device related
@@ -20,27 +19,27 @@ deviceinfo_screen_height="2400"
deviceinfo_getty="ttyMSM0;115200"
deviceinfo_no_framebuffer="true"
# Small base initramfs (fits init_boot) + a separate initramfs-extra.
deviceinfo_create_initfs_extra="true"
# 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.
# Bootloader: Android 13 GKI. The kernel goes in boot, the DTB + cmdline +
# initramfs in vendor_boot. init_boot holds the generic (first-stage)
# ramdisk - it MUST be replaced with pmOS's, or the stock AOSP /init runs.
# Lessons folded in from device-motorola-dubai (the closest working
# Motorola mainline port) and the stock LineageOS images.
deviceinfo_flash_method="fastboot"
deviceinfo_flash_fastboot_partition_dtbo="dtbo"
deviceinfo_flash_fastboot_partition_vbmeta="vbmeta"
# 'earlycon' is REQUIRED: the Motorola ABL reboots the phone immediately
# without it (see device-motorola-dubai/kernel-cmdline.conf).
# 'earlycon' is REQUIRED on Motorola - without it the ABL reboots the
# phone immediately (see device-motorola-dubai/kernel-cmdline.conf).
deviceinfo_kernel_cmdline="console=ttyMSM0,115200n8 earlycon"
deviceinfo_generate_bootimg="true"
deviceinfo_header_version="2"
deviceinfo_header_version="4"
deviceinfo_bootimg_qcdt="false"
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"
# Stock uses base 0 (mkbootimg defaults to 0x10000000, dtb ends up outside
# RAM). os_* to satisfy anti-rollback on the boot image.
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-01"
deviceinfo_flash_sparse="true"
# UFS storage
@@ -5,7 +5,7 @@ maintainer="snlavaise <snlavaise@gmail.com>"
_flavor="postmarketos-qcom-sm8550"
pkgname=linux-$_flavor
pkgver=7.2
pkgrel=9
pkgrel=10
pkgdesc="Mainline kernel for Qualcomm SM8550 (Snapdragon 8 Gen 2) + Motorola rtwo"
arch="aarch64"
_carch="arm64"
@@ -74,9 +74,10 @@ build() {
}
package() {
# gzip'd Image for the Android boot.img (like device-motorola-dubai;
# CONFIG_EFI_ZBOOT is off in rtwo.config so Image.gz is produced).
install -Dm644 "$builddir/arch/$_carch/boot/Image.gz" \
# Raw uncompressed Image for the Android boot.img: the stock rtwo
# LineageOS boot.img carries a raw 'MZ' Image (BOARD_KERNEL_IMAGE_NAME
# := Image), and CONFIG_EFI_ZBOOT is off in rtwo.config.
install -Dm644 "$builddir/arch/$_carch/boot/Image" \
"$pkgdir/boot/vmlinuz"
make modules_install dtbs_install \