PR #1363 will make it possible to choose between upstream (official kernel.org ones, possibly slightly patched) and downstream kernels (the Android kernel forks) for devices.
As @drebrez and @z3ntu pointed out, we will need different values for the deviceinfo variables for upstream kernels.
but in the subpackage installation just remove all the other lines and rename the variable to deviceinfo_kernel_cmdline?
That way we can have a common logic between all the APKBUILDs
I would recommend to name the suffix upstream instead of mainline though, because we have linux-postmarketos-mainline, linux-postmarketos-stable etc. We could implement the logic to create the kernel-specific deviceinfo file in the devicepkg-dev package we already have and use.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items 0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items 0
Link issues together to show that they're related.
Learn more.
So as I understand it, the devicepkg-dev script should go through all deviceinfo lines, remove the suffix from the correct kernel config variables and remove (or leave - doesn't really matter) the others?
@z3ntu right, that was the idea, and do it for every kernel_* subpackage to remove the suffix of that subpackage.
This is to avoid changing everywhere in the code to use one variable instead of the other.
In this way it will always be the same variable, and it gets solved at packaging level.
@ollieparanoid while adding the downstream/mainline choice for the samsung klte kernel I noticed that the downstream uses deviceinfo_bootimg_qcdt="true" but the mainline kernel works with the dtb appended to the kernel itself (zImage-dtb).
Should we just consider that every mainline kernel doesn't need the qcdt and just remove that line? (or set to false)
I'm working on this since for the samsung-klte I need 2 different cmdline for downstream and mainline.
Now that #1474 is merged and we properly install the device kernel subpackage I have another issue:
Currently the deviceinfo is installed with the device package during the devicepkg_package $startdir $pkgname of the devicepkg-dev.
The devicepkg_package function also install other stuff, so we can not remove it from the base package.
If we add both the variables (deviceinfo_kernel_cmdline_mainline/downstream) in the deviceinfo should we still install it in the base package?
I was thinking about updating the devicepkg_package script to install the deviceinfo file only if it contains the exact variable deviceinfo_kernel_cmdline (to not break other devices), and add a new devicepkg_subpackage script (or with a different name) that will install the deviceinfo with the proper replace of the variables.
What you think @ollieparanoid ?
If we add both the variables (deviceinfo_kernel_cmdline_mainline/downstream) in the deviceinfo should we still install it in the base package?
I think we should not, as this would lead to a conflict between the device package and its kernel subpackages.
I was thinking about updating the devicepkg_package script to install the deviceinfo file only if it contains the exact variable deviceinfo_kernel_cmdline (to not break other devices), and add a new devicepkg_subpackage script (or with a different name) that will install the deviceinfo with the proper replace of the variables.
I like the idea! Though checking for deviceinfo_kernel_cmdline does not seem to be that obvious from a user's perspective (what if another variable needs to be changed between upstream and downstream, but kernel_cmdline is the same for whichever reason?).
Here's a proof of concept for a slightly modified version that always installs the deviceinfo file, but the subpackage then clears it from the package in case it will get installed in the kernel subpackages. (this workflow is used commonly in APKBUILDs: run make install to $pkgdir, then move the dev, doc, ... files to their own subpackages afterwards.)
# Reference: <https://postmarketos.org/devicepkg>pkgname="device-test-test"pkgdesc="test"pkgver=0.1pkgrel=0url="https://postmarketos.org"license="MIT"arch="noarch"options="!check"depends=""makedepends="devicepkg-dev"source="deviceinfo"subpackages="$pkgname-kernel-downstream:kernel_downstream$pkgname-kernel-mainline:kernel_mainline"build(){ devicepkg_build $startdir$pkgname}# this would be part of devicepkg-devdevicepkg_subpackage_kernel(){startdir=$1pkgname=$2subpkgname=$3if[-z"$startdir"]||[-z"$pkgname"]||[-z"$subpkgname"];thenecho"ERROR: missing argument!"echo"Please call devicepkg_subpackage_kernel() with \$startdir \$pkgname \$subpkgname as arguments."exit 1fisrcdir="$startdir/src"pkgdir="$startdir/pkg/$pkgname"subpkgdir="$startdir/pkg/$subpkgname"if[-e"$pkgdir/etc/deviceinfo"];thenrm-v"$pkgdir/etc/deviceinfo"fi# TODO: find out the kernel from the subpkgname# TODO: install adjusted deviceinfo (from $srcdir/deviceinfo) to subpackagemkdir-p"$subpkgdir"}package(){ devicepkg_package $startdir$pkgname}kernel_mainline(){ devicepkg_subpackage_kernel $startdir$pkgname$subpkgname}kernel_downstream(){ devicepkg_subpackage_kernel $startdir$pkgname$subpkgname}sha512sums="62c7e7c0b6c7fc54d67883c6b948ce4ecfbab1031e2bb28274429e08eba004aed9bdd39c6cd38b75a6ebb75e2e9fed21265f92e2a97dacb9b34c28d6c9542a16 deviceinfo"
EDIT: I wrote this before realizing you've already made a PR. I'm curious what you think of it anyway.