pmbootstrap init: kernel selection / remove linux-pmos-lts (#1363)

* As discussed in IRC/matrix, we're removing `linux-postmarketos-lts`
  for now. The kernel isn't used right now, and we save lots of
  maintenance effort with not updating it every week or so.
* new config option `"kernel"` with possible values:
  `"downstream", "mainline", "stable"` (downstream is always
  `linux-$devicename`)
* ask for the kernel during `pmbootstrap init` if the device package
  has kernel subpackages and install it in `_install.py`
* postmarketos-mkinitfs: display note instead of exit with error when
  the `deviceinfo_dtb` file is missing (because we expect it to be
  missing for downstream kernels)
* device-sony-amami:
  * add kernel subpackages for downstream, mainline
  * set `deviceinfo_dtb`
* device-qemu-amd64: add kernel subpackages for stable, lts, mainline
* test cases and test data for new functions
* test case that checks all aports for right usage of the feature:
  * don't mix specifying kernels in depends *and* subpackages
  * 1 kernel in depends is maximum
  * kernel subpackages must have a valid name
  * Test if devices packages reference at least one kernel
* Remove `_build_device_depends_note()` which informs the user that
  `--ignore-depends` can be used with device packages to avoid building
  the kernel. The idea was to make the transition easier after a change
  we did months ago, and now the kernel doesn't always get built before
  building the device package so it's not relevant anymore.
* pmb/chroot/other.py:
  * Add autoinstall=True to kernel_flavors_installed(). When the flag
    is set, the function makes sure that at least one kernel for the
    device is installed.
  * Remove kernel_flavor_autodetect() function, wherever it was used,
    it has been replaced with kernel_flavors_installed()[0].
* pmb.helpers.frontend.py: remove code to install at least one kernel,
  kernel_flavors_installed() takes care of that now.
This commit is contained in:
Oliver Smith
2018-04-03 23:50:09 +00:00
committed by GitHub
parent 0a5bbce93c
commit 63f921fbac
10 changed files with 53 additions and 16989 deletions
+21 -3
View File
@@ -1,14 +1,20 @@
pkgname=device-qemu-amd64
pkgver=1
pkgrel=16
pkgrel=17
pkgdesc="Simulated device in qemu with an x86 platform"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
# NOTE: 'pmbootstrap init' allows you to choose the mesa-dri-* package
depends="postmarketos-base linux-postmarketos-lts"
depends="postmarketos-base"
makedepends=""
subpackages="$pkgname-x11 $pkgname-weston"
subpackages="
$pkgname-x11
$pkgname-weston
$pkgname-kernel-stable:kernel_stable
$pkgname-kernel-mainline:kernel_mainline
"
source="deviceinfo weston.ini"
options="!check"
@@ -29,5 +35,17 @@ weston() {
"$subpkgdir"/etc/xdg/weston/weston.ini
}
kernel_stable() {
pkgdesc="Stable for everyday usage (recommended)"
depends="linux-postmarketos-stable"
mkdir "$subpkgdir"
}
kernel_mainline() {
pkgdesc="Newest kernel features"
depends="linux-postmarketos-mainline"
mkdir "$subpkgdir"
}
sha512sums="eb12ff5fe6fe592661facd3f8c910e00752e963b2092f4d4062c4af67972249233d20d641355e03de17ab537f42617140ccb9c296c2dcfb6077785fa9eeb25fd deviceinfo
df0fe900693e5f176076c59f5379e56aaa96c3df16a4120448f15b71f530170730b43e5fe32733c40c118a00ca3581043231a062a8a1eb0a930bfbfbb6c52a47 weston.ini"
+2 -2
View File
@@ -1,12 +1,12 @@
pkgname=device-qemu-vexpress
pkgver=1
pkgrel=19
pkgrel=20
pkgdesc="Simulated device in qemu with vexpress soc"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
# NOTE: 'pmbootstrap init' allows you to choose the mesa-dri-* package
depends="postmarketos-base linux-postmarketos-lts"
depends="postmarketos-base linux-postmarketos-stable"
makedepends=""
subpackages=""
source="deviceinfo"
+21 -5
View File
@@ -1,14 +1,18 @@
pkgname=device-sony-amami
pkgver=1
pkgrel=19
pkgver=2
pkgrel=0
pkgdesc="Sony Xperia Z1 Compact"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="postmarketos-base linux-sony-amami mkbootimg mdss-fb-init-hack mesa-dri-swrast"
depends="postmarketos-base mkbootimg mdss-fb-init-hack mesa-dri-swrast"
makedepends=""
install=""
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
subpackages="
$pkgname-kernel-downstream:kernel_downstream
$pkgname-kernel-mainline:kernel_mainline
$pkgname-nonfree-firmware:nonfree_firmware
"
source="deviceinfo 90-android-touch-dev.rules"
options="!check"
@@ -19,11 +23,23 @@ package() {
"$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules
}
kernel_downstream() {
pkgdesc="Display and wifi works (see device table for details)"
depends="linux-sony-amami"
mkdir "$subpkgdir"
}
kernel_mainline() {
pkgdesc="For kernel development only (most features aren't working)"
depends="linux-postmarketos-mainline"
mkdir "$subpkgdir"
}
nonfree_firmware() {
pkgdesc="Wifi firmware"
depends="firmware-sony-amami"
mkdir "$subpkgdir"
}
sha512sums="cf674f3fa0506449aacf15c6389c1793d457cdf80e21637580db4f0d8003f49dfeb65e59732dba57d9a1ea474459debae2b19e0a4a12f4b5d4c6bfb9fed7eb34 deviceinfo
sha512sums="e6daf310a259483da1e1e8be66693dea876f8d1fa6db001c37035d913d7de6e5f1be4a40fae7dcaff404d1953b4c5a58b31d8e6b593b72b56b64ba78f859717c deviceinfo
8b6034c0338ab4c7d648f47983aad6da07e427e7dba47baabf85a1b3ddeeda47c8d7fbcd547a302c9a759b2943ee30d3e82c3b368d8582833a058e4671638a9e 90-android-touch-dev.rules"
+1 -1
View File
@@ -7,7 +7,7 @@ deviceinfo_manufacturer="Sony"
deviceinfo_date=""
deviceinfo_keyboard="false"
deviceinfo_nonfree="????"
deviceinfo_dtb=""
deviceinfo_dtb="qcom-msm8974-sony-xperia-amami"
deviceinfo_modules_initfs=""
deviceinfo_external_storage="true"
deviceinfo_flash_method="fastboot"
-198
View File
@@ -1,198 +0,0 @@
_flavor=postmarketos-lts
_config="config-${_flavor}.${CARCH}"
pkgname=linux-${_flavor}
pkgver=4.14.29
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=0
arch="x86_64 armhf aarch64"
pkgdesc="Linux for pmOS supported chipsets (LTS)"
url="https://kernel.org/"
depends=""
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev file"
options="!strip !check !tracedeps"
install=
source="
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$_kernver.tar.xz
config-${_flavor}.armhf
config-${_flavor}.aarch64
config-${_flavor}.x86_64
"
if [ "${pkgver%.0}" = "$pkgver" ]; then
source="$source
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/patch-$pkgver.xz"
fi
subpackages="$pkgname-dev"
license="GPL2"
_abi_release=${pkgver}
_carch=${CARCH}
case "$_carch" in
aarch64*) _carch="arm64" ;;
arm*) _carch="arm" ;;
ppc*) _carch="powerpc" ;;
s390*) _carch="s390" ;;
esac
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
ksrcdir="$srcdir/linux-$_kernver"
prepare() {
local _patch_failed=
cd "$ksrcdir"
if [ "$_kernver" != "$pkgver" ]; then
msg "Applying patch-$pkgver.xz"
unxz -c < "$srcdir"/patch-$pkgver.xz | patch -p1 -N
fi
# first apply patches in specified order
for i in $source; do
case $i in
*.patch)
msg "Applying $i..."
if ! patch -s -p1 -N -i "$srcdir"/$i; then
echo $i >>failed
_patch_failed=1
fi
;;
esac
done
if ! [ -z "$_patch_failed" ]; then
error "The following patches failed:"
cat failed
return 1
fi
mkdir -p "$srcdir"/build
cp -v "$srcdir"/$_config "$srcdir"/build/.config
make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
olddefconfig
}
# this is so we can do: 'abuild menuconfig' to reconfigure kernel
menuconfig() {
cd "$srcdir"/build
make ARCH="$_carch" menuconfig
cp .config "$startdir"/$_config
}
build() {
cd "$srcdir"/build
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
CFLAGS_MODULE=-fno-pic
}
package() {
cd "$srcdir/build/arch/${_carch}/boot"
if [ "$CARCH" == "aarch64" ]; then
install -Dm644 "$srcdir/build/arch/${_carch}/boot/Image" \
"$pkgdir/boot/vmlinuz-$_flavor"
else
install -Dm644 "$srcdir/build/arch/${_carch}/boot/"*zImage \
"$pkgdir/boot/vmlinuz-$_flavor"
fi
install -D "$srcdir/build/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
cd "$srcdir"/build
local _install
case "$CARCH" in
aarch64*|arm*) _install="modules_install dtbs_install" ;;
*) _install="modules_install" ;;
esac
make -j1 $_install \
ARCH="$_carch" \
INSTALL_MOD_PATH="$pkgdir" \
INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb"
}
dev() {
# copy the only the parts that we really need for build 3rd party
# kernel modules and install those as /usr/src/linux-headers,
# simlar to what ubuntu does
#
# this way you dont need to install the 300-400 kernel sources to
# build a tiny kernel module
#
pkgdesc="Headers and script for third party modules for postmarketos kernel"
depends="gmp-dev bash perl"
local dir="$subpkgdir"/usr/src/linux-headers-${_abi_release}
# first we import config, run prepare to set up for building
# external modules, and create the scripts
mkdir -p "$dir"
cp "$srcdir"/$_config "$dir"/.config
make -j1 -C "$srcdir"/linux-$_kernver O="$dir" ARCH="$_carch" HOSTCC="$HOSTCC" \
olddefconfig prepare modules_prepare scripts
# needed for 3rd party modules
# https://bugzilla.kernel.org/show_bug.cgi?id=11143
case "$CARCH" in
ppc*) (cd "$dir" && make arch/powerpc/lib/crtsavres.o);;
esac
# remove the stuff that points to real sources. we want 3rd party
# modules to believe this is the soruces
rm "$dir"/Makefile "$dir"/source
# copy the needed stuff from real sources
#
# this is taken from ubuntu kernel build script
# http://kernel.ubuntu.com/git/ubuntu/ubuntu-zesty.git/tree/debian/rules.d/3-binary-indep.mk
cd "$srcdir"/linux-$_kernver
find . -path './include/*' -prune \
-o -path './scripts/*' -prune -o -type f \
\( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \
-name '*.sh' -o -name '*.pl' -o -name '*.lds' \) \
-print | cpio -pdm "$dir"
cp -a scripts include "$dir"
find $(find arch -name include -type d -print) -type f \
| cpio -pdm "$dir"
install -Dm644 "$srcdir"/build/Module.symvers \
"$dir"/Module.symvers
mkdir -p "$subpkgdir"/lib/modules/${_abi_release}
ln -sf /usr/src/linux-headers-${_abi_release} \
"$subpkgdir"/lib/modules/${_abi_release}/build
# cross-compiling: delete binaries with host arch and replace them with
# symlinks to binaries with the target arch (packaged in kernel-scripts)
if [ -n "$CROSS_COMPILE" ]; then
msg "Symlinking binary scripts..."
depends="$depends kernel-scripts"
cd "$dir/scripts"
local i
for i in $(find . -type f); do
local type="$(file -b --mime-type "$i")"
[ "$type" != "application/x-sharedlib" ] && continue
local native="/usr/bin/kernel-scripts/$(echo "$i" | cut -d '/' -f 2-)"
ln -svf "$native" "$i"
done
fi
}
sha512sums="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8 linux-4.14.tar.xz
7de482169eb64cca001c298091471d803421dfef5835fa9a693840bd96083bdc42bc12a5217ececb5780ac285cf23674f2bd008183e651b81a7fc2882b819f01 config-postmarketos-lts.armhf
f7dcf05c3c3042c6105748bcbe60ff8c02fac91c7de260a51b568c983df7f2a69c2bde6ebc3ddc4b7283e4aba7e1a8b0e9e4baff6ab863553dc3767679f54f62 config-postmarketos-lts.aarch64
d1e6ca8faee80641a2e882b3b9b0009b05a73adee8e939ace17be7879f8a87f4f2e7cb7bbbb9590e9b6c1491ed076505dbef599c0dc9e71fe71a8d451a7b635e config-postmarketos-lts.x86_64
f2e87f9205924097b5aaa39ca6967449fa78a9a13d27fd4edac829cbb411f28881b2dc4fc5f8c270ec8673118bf260f7411646f0900c00f8511283fe0eb3c7e7 patch-4.14.29.xz"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,5 +1,5 @@
pkgname=postmarketos-mkinitfs
pkgver=0.6.2
pkgver=0.6.3
pkgrel=0
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://github.com/postmarketOS"
@@ -25,4 +25,4 @@ package() {
}
sha512sums="a09a48026a5cac308fa54e37c72e89fd7901e749f73720f3e8d3ec11a4d1527dbc1e5011aff53b1beffb6ff444c8df11a56e43d27ac0180ce8ddc79332be1d0d init.sh.in
f45548b295393cb078e4c456acef0eaac11705c4b5bc33981c320580c843231589fdfc78b25e182cd202435381d1be37085df01b6e272eee0af2ca0f89b3b4f5 init_functions.sh
833f8a6c3753da7581fefb56a6a68f61663f2910d6b89b7a9cc3033ac922589b1d07ba246cbcd8e0a99fc8df128f9ae1b1bf2bd8cf3cad65a323cf712c03ae2d mkinitfs.sh"
b80a773efe22a6fe33ffb6f92ff279e425ff7034a4946497a628ea6c4e2300112adcde7d09d790a04b851610d3f17271001b6e3d36ba39321dba69f48b393f89 mkinitfs.sh"
+6 -4
View File
@@ -352,11 +352,13 @@ append_device_tree()
dtb="/usr/share/dtb/${deviceinfo_dtb}.dtb"
kernel="${outfile/initramfs-/vmlinuz-}"
echo "==> kernel: appending device-tree ${deviceinfo_dtb}"
if ! [ -e "$dtb" ]; then
echo "ERROR: File not found: $dtb"
exit 1
if [ -e "$dtb" ]; then
cat "$kernel" "$dtb" > "${kernel}-dtb"
else
echo "NOTE: device tree does not exist, not appending it to the kernel."
echo "This is expected for downstream kernels."
cp "$kernel" "${kernel}-dtb"
fi
cat $kernel $dtb > "${kernel}-dtb"
}
# Create the initramfs-extra archive