pmb/aportgen/linux.py: add different QCDT implementations (MR 1992)

Adds QCDT templates for Spreadtrum and Exynos SoCs
When "pmbootstrap init" is executed, after the boot image analysis,
if the device is QCDT, then the user is asked about the SoC vendor.
Example:
[HH:MM:SS] SoC vendor (spreadtrum/exynos/other) [other]: exynos
After that, the corresponding template is picked.
This commit is contained in:
HenriDellal 2020-11-19 05:57:37 +03:00 committed by Oliver Smith
parent 5ff0bbe4b2
commit 6793612a7e
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -12,16 +12,40 @@ def generate_apkbuild(args, pkgname, deviceinfo, patches):
makedepends = "bash bc bison devicepkg-dev flex openssl-dev perl"
build = """
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${{CC:-gcc}}" \\
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS\""""
package = """
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir\""""
if deviceinfo["bootimg_qcdt"] == "true":
build += """\n
# Master DTB (deviceinfo_bootimg_qcdt)"""
vendors = ["spreadtrum", "exynos", "other"]
soc_vendor = pmb.helpers.cli.ask(args, "SoC vendor", vendors,
vendors[-1], complete=vendors)
if soc_vendor == "spreadtrum":
makedepends += " dtbtool-sprd"
build += """
dtbTool-sprd -p scripts/dtc/ \\
-o "$_outdir/arch/$_carch/boot"/dt.img \\
"$_outdir/arch/$_carch/boot/dts/\""""
elif soc_vendor == "exynos":
codename = "-".join(pkgname.split("-")[2:])
makedepends += " dtbtool-exynos"
build += f"""
dtbTool-exynos -o "$_outdir/arch/$_carch/boot"/dt.img \\
$(find "$_outdir/arch/$_carch/boot/dts/" -name *{codename}*.dtb)"""
else:
makedepends += " dtbtool"
package += """\n
# Master DTB (deviceinfo_bootimg_qcdt)
dtbTool -p scripts/dtc/ -o "$_outdir/arch/$_carch/boot"/dt.img "$_outdir/arch/$_carch/boot/"
install -Dm644 "$_outdir/arch/$_carch/boot"/dt.img "$pkgdir"/boot/dt.img"""
build += """
dtbTool -p scripts/dtc/ -o "$_outdir/arch/$_carch/boot"/dt.img \\
"$_outdir/arch/$_carch/boot/\""""
package += """
install -Dm644 "$_outdir/arch/$_carch/boot"/dt.img \\
"$pkgdir"/boot/dt.img"""
patches = ("\n" + " " * 12).join(patches)
content = f"""\
@ -57,10 +81,7 @@ def generate_apkbuild(args, pkgname, deviceinfo, patches):
. downstreamkernel_prepare
}}
build() {{
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${{CC:-gcc}}" \\
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
build() {{{build}
}}
package() {{{package}