pmbootstrap: add qcdt generation to the linux aportgen APKBUILDs (#1125)

* pmbootstrap: __config_.py - update the deviceinfo_attributes table

Add missing attributes:
 * "screen_width"
 * "screen_height"
 * "dev_touchscreen"
 * "dev_touchscreen_calibration"
 * "dev_keyboard"
 * "bootimg_qcdt"

Reorder the list to correspond to pmb/aportgen/device.py

Add a comment in the aforementioned file to avoid forgetting to update
this list.

Signed-off-by: Mayeul Cantan <mayeul.cantan@gmail.com>

* pmbootstrap: add qcdt generation to the linux aportgen APKBUILDs

This checks the next box in #688
When the device has bootimg_qcdt set to true, the following is done to
the linux APKBUILD:

 * Add dtbtool to makedepends
 * Call dtbTool during build() to generate dt.img
 * Add the generated dt.img in the package's boot/dt.img

Signed-off-by: Mayeul Cantan <mayeul.cantan@gmail.com>
This commit is contained in:
Mayeul Cantan 2018-01-17 18:53:58 +01:00 committed by Oliver Smith
parent 8373294266
commit 00aa65f2d0
3 changed files with 68 additions and 38 deletions

View File

@ -121,6 +121,7 @@ def generate_deviceinfo_fastboot_content(args, bootimg=None):
def generate_deviceinfo(args, pkgname, name, manufacturer, arch, has_keyboard,
has_external_storage, flash_method, bootimg=None):
# Note: New variables must be added to pmb/config/__init__.py as well
content = """\
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.

View File

@ -22,23 +22,62 @@ import pmb.parse.apkindex
import pmb.parse.arch
def generate_apkbuild(args, pkgname, name, arch):
def generate_apkbuild(args, pkgname, deviceinfo):
device = "-".join(pkgname.split("-")[1:])
carch = pmb.parse.arch.alpine_to_kernel(arch)
carch = pmb.parse.arch.alpine_to_kernel(deviceinfo["arch"])
makedepends = "perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev"
package = """
# kernel.release
install -D "$builddir/include/config/kernel.release" \\
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
# zImage (find the right one)
cd "$builddir/arch/$_carch/boot"
_target="$pkgdir/boot/vmlinuz-$_flavor"
for _zimg in zImage-dtb Image.gz-dtb *zImage Image; do
[ -e "$_zimg" ] || continue
msg "zImage found: $_zimg"
install -Dm644 "$_zimg" "$_target"
break
done
if ! [ -e "$_target" ]; then
error "Could not find zImage in $PWD!"
return 1
fi"""
build = """
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \\
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS\""""
if deviceinfo["bootimg_qcdt"] == "true":
makedepends += " dtbtool"
build += """\n
# Generate master DTB (deviceinfo_bootimg_qcdt)
dtbTool -s 2048 -p "scripts/dtc/" -o "arch/""" + carch + "/boot/dt.img\" \"arch/" + carch + "/boot/\""
package += """\n
# Master DTB (deviceinfo_bootimg_qcdt)
install -Dm644 "$builddir/arch/""" + carch + """/boot/dt.img" \\
"$pkgdir/boot/dt.img\""""
content = """\
# Kernel config based on: arch/""" + carch + """/configs/(CHANGEME!)
pkgname=\"""" + pkgname + """\"
pkgver=3.x.x
pkgrel=0
pkgdesc=\"""" + name + """ kernel fork\"
arch=\"""" + arch + """\"
pkgdesc=\"""" + deviceinfo["name"] + """ kernel fork\"
arch=\"""" + deviceinfo["arch"] + """\"
_carch=\"""" + carch + """\"
_flavor=\"""" + device + """\"
url="https://kernel.org"
license="GPL2"
options="!strip !check !tracedeps"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev"
makedepends=\"""" + makedepends + """\"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
@ -78,30 +117,10 @@ def generate_apkbuild(args, pkgname, name, arch):
cp .config "$startdir"/$_config
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \\
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
build() {""" + build + """
}
package() {
# kernel.release
install -D "$builddir/include/config/kernel.release" \\
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
# zImage (find the right one)
cd "$builddir/arch/$_carch/boot"
_target="$pkgdir/boot/vmlinuz-$_flavor"
for _zimg in zImage-dtb Image.gz-dtb *zImage Image; do
[ -e "$_zimg" ] || continue
msg "zImage found: $_zimg"
install -Dm644 "$_zimg" "$_target"
break
done
if ! [ -e "$_target" ]; then
error "Could not find zImage in $PWD!"
return 1
fi
package() {""" + package + """
}
sha512sums="(run 'pmbootstrap checksum """ + pkgname + """' to fill)"
@ -126,4 +145,4 @@ def generate(args, pkgname):
"/device/linux-lg-mako/" + file,
args.work + "/aportgen/"])
generate_apkbuild(args, pkgname, deviceinfo["name"], deviceinfo["arch"])
generate_apkbuild(args, pkgname, deviceinfo)

View File

@ -206,36 +206,46 @@ apkbuild_attributes = {
# Variables from deviceinfo. Reference: <https://postmarketos.org/deviceinfo>
deviceinfo_attributes = [
# device
# general
"format_version",
"name",
"manufacturer",
"date",
"keyboard",
"nonfree",
"dtb",
"modules_initfs",
"external_disk",
"external_disk_install",
"flash_method",
"arch",
"nonfree",
# device
"keyboard",
"external_disk",
"screen_width",
"screen_height",
"dev_touchscreen",
"dev_touchscreen_calibration",
"dev_keyboard",
# bootloader
"flash_method",
# flash
"generate_bootimg",
"generate_legacy_uboot_initfs",
"flash_heimdall_partition_kernel",
"flash_heimdall_partition_initfs",
"flash_heimdall_partition_system",
"flash_fastboot_max_size",
"flash_fastboot_vendor_id",
"generate_legacy_uboot_initfs",
"kernel_cmdline",
"generate_bootimg",
"bootimg_qcdt",
"flash_offset_base",
"flash_offset_kernel",
"flash_offset_ramdisk",
"flash_offset_second",
"flash_offset_tags",
"flash_pagesize",
"flash_fastboot_max_size",
"flash_fastboot_vendor_id",
"flash_sparse",
"kernel_cmdline",
# weston
"weston_pixman_type",