Files
pmaports-rtwo/device/testing/linux-postmarketos-qcom-sm8550/APKBUILD
T
snlavaiseandClaude Sonnet 5 a5ae1ad9b8 device-motorola-rtwo: new device (Motorola Moto Edge 40 Pro), WIP
Bring-up for the Motorola Moto Edge 40 Pro (codename "rtwo", SM8550 /
Snapdragon 8 Gen 2).

New linux-postmarketos-qcom-sm8550 aport:
 - Built from the postmarketOS soc/qcom-sm8550 tree (branch bringup,
   6.13-rc3, commit 22591bbc).
 - Kernel config is generated at build time from the in-tree upstream
   defconfig plus the repo's pmos.config and devices.config fragments.
 - Ships a WIP sm8550-motorola-rtwo.dts: SoC + PMICs + the sm8550-mtp
   regulator tree, UART7 debug console, USB in high-speed peripheral mode,
   UFS and SD card. Display panel, touchscreen, modem, WiFi/BT, GPU zap
   shader and reserved-memory carveouts still need to be described from
   Motorola's downstream sources.

device-motorola-rtwo:
 - deviceinfo completed from bootimg analysis of the stock boot.img:
   Android boot header v4, 4096-byte pages, no qcdt, fastboot flashing.
   Added screen geometry, UFS sector size and a serial getty; framebuffer
   disabled until the panel works.
 - Depends on the new kernel, soc-qcom and mkbootimg.

Both packages still need 'pmbootstrap checksum' for the kernel tarball and
a real boot test; see the TODO comments in the APKBUILDs and the .dts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QF5HebjUsRaxbW4cBX6HJP
2026-09-08 13:35:56 -03:00

109 lines
3.4 KiB
Bash

# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/defconfig (+ pmos.config, devices.config)
maintainer="snlavaise <snlavaise@gmail.com>"
_flavor="postmarketos-qcom-sm8550"
pkgname=linux-$_flavor
pkgver=6.13_rc3
pkgrel=0
pkgdesc="Mainline kernel fork for Qualcomm SM8550 (Snapdragon 8 Gen 2) devices"
arch="aarch64"
_carch="arm64"
url="https://gitlab.postmarketos.org/soc/qcom-sm8550/linux"
license="GPL-2.0-only"
options="
!check
!strip
!tracedeps
pmb:cross-native
pmb:kconfigcheck-community
pmb:kconfigcheck-uefi
"
makedepends="
bash
bison
clang
elfutils-dev
findutils
flex
linux-headers
lld
llvm
openssl-dev
pahole
perl
postmarketos-installkernel
python3
zstd
"
# Source: snapshot of the postmarketOS SM8550 bring-up tree (branch: bringup).
# Bump _commit to move forward; then run 'pmbootstrap checksum linux-postmarketos-qcom-sm8550'.
_commit="22591bbc21da5cc0c6e37503b77bd2d852fe241c"
source="
$pkgname-$_commit.tar.gz::https://gitlab.postmarketos.org/soc/qcom-sm8550/linux/-/archive/$_commit/linux-$_commit.tar.gz
sm8550-motorola-rtwo.dts
"
builddir="$srcdir/linux-$_commit"
prepare() {
default_prepare
# The Motorola rtwo (Moto Edge 40 Pro) device tree is not upstream yet, so
# drop it into the tree and register it in the Makefile before configuring.
local _dtsdir="$builddir/arch/$_carch/boot/dts/qcom"
cp "$srcdir/sm8550-motorola-rtwo.dts" "$_dtsdir/sm8550-motorola-rtwo.dts"
if ! grep -q "sm8550-motorola-rtwo.dtb" "$_dtsdir/Makefile"; then
sed -i '/sm8550-mtp\.dtb/a dtb-$(CONFIG_ARCH_QCOM) += sm8550-motorola-rtwo.dtb' \
"$_dtsdir/Makefile"
fi
# Generate .config from the in-tree upstream defconfig plus the postmarketOS
# and device config fragments shipped by the kernel repo.
# To "freeze" this config: build once, copy "$builddir"/.config to
# config-$_flavor.$CARCH, add it to source= and switch prepare() to a plain
# 'cp "$srcdir/config-$_flavor.$CARCH" .config' (like the other qcom kernels).
make ARCH="$_carch" LLVM=1 HOSTLDFLAGS="-fuse-ld=lld" \
defconfig pmos.config devices.config
}
build() {
unset LDFLAGS
make ARCH="$_carch" LLVM=1 HOSTLDFLAGS="-fuse-ld=lld" \
KBUILD_BUILD_VERSION="$((pkgrel + 1))-$_flavor"
}
package() {
mkdir -p "$pkgdir"/boot
if [ -e "$builddir/arch/$_carch/boot/vmlinuz.efi" ]; then
# ZBOOT EFI decompressor for EFI booting
install -Dm644 "$builddir/arch/$_carch/boot/vmlinuz.efi" \
"$pkgdir/boot/linux.efi"
# gzip'd image for Android boot.img compatibility
install -Dm644 "$builddir/arch/$_carch/boot/vmlinuz" \
"$pkgdir/boot/vmlinuz"
else
echo "WARNING: CONFIG_EFI_ZBOOT not enabled!"
install -Dm644 "$builddir/arch/$_carch/boot/Image.gz" \
"$pkgdir/boot/vmlinuz"
fi
make modules_install dtbs_install \
ARCH="$_carch" \
LLVM=1 \
INSTALL_PATH="$pkgdir"/boot \
INSTALL_MOD_PATH="$pkgdir"/usr \
INSTALL_MOD_STRIP=1 \
INSTALL_DTBS_PATH="$pkgdir"/boot/dtbs
rm -f "$pkgdir"/usr/lib/modules/*/build "$pkgdir"/usr/lib/modules/*/source
install -D "$builddir"/include/config/kernel.release \
"$pkgdir"/usr/share/kernel/"$_flavor"/kernel.release
}
# The kernel tarball checksum is filled in by
# 'pmbootstrap checksum linux-postmarketos-qcom-sm8550' (it downloads ~250 MB).
sha512sums="
ed1e3a57c30dff3f40026c2e318965fa7f62dfb0eef428ee0354341137bffde324f93cf5a500619e476e44ac616351ac9cafec6dc3ecefa69b68f24b9c94bbb2 sm8550-motorola-rtwo.dts
"