2020-02-20 20:07:28 +00:00
|
|
|
# Copyright 2020 Oliver Smith
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2017-08-06 12:50:38 +00:00
|
|
|
import multiprocessing
|
2017-05-26 20:08:45 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
#
|
|
|
|
# Exported functions
|
|
|
|
#
|
|
|
|
from pmb.config.load import load
|
|
|
|
from pmb.config.save import save
|
2017-11-19 15:04:08 +00:00
|
|
|
from pmb.config.merge_with_args import merge_with_args
|
2017-05-26 20:08:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Exported variables (internal configuration)
|
|
|
|
#
|
2020-05-10 16:40:53 +00:00
|
|
|
version = "1.19.0"
|
2017-05-26 20:08:45 +00:00
|
|
|
pmb_src = os.path.normpath(os.path.realpath(__file__) + "/../../..")
|
2018-09-17 10:06:57 +00:00
|
|
|
apk_keys_path = pmb_src + "/pmb/data/keys"
|
2017-05-26 20:08:45 +00:00
|
|
|
|
|
|
|
# Update this frequently to prevent a MITM attack with an outdated version
|
2017-06-08 16:02:00 +00:00
|
|
|
# (which may contain a vulnerable apk/libressl, and allows an attacker to
|
2017-05-26 20:08:45 +00:00
|
|
|
# exploit the system!)
|
2020-02-23 02:40:30 +00:00
|
|
|
apk_tools_static_min_version = "2.10.5-r0"
|
2017-05-26 20:08:45 +00:00
|
|
|
|
2018-09-05 05:57:38 +00:00
|
|
|
# postmarketOS aports compatibility (checked against "version" in pmaports.cfg)
|
2020-03-25 12:24:25 +00:00
|
|
|
pmaports_min_version = "6"
|
2018-09-05 05:57:38 +00:00
|
|
|
|
2017-10-12 20:08:10 +00:00
|
|
|
# Version of the work folder (as asked during 'pmbootstrap init'). Increase
|
|
|
|
# this number, whenever migration is required and provide the migration code,
|
|
|
|
# see migrate_work_folder()).
|
2019-12-22 11:11:21 +00:00
|
|
|
work_version = 4
|
2017-10-12 20:08:10 +00:00
|
|
|
|
2019-12-22 09:58:36 +00:00
|
|
|
# Programs that pmbootstrap expects to be available from the host system. Keep
|
|
|
|
# in sync with README.md, and try to keep the list as small as possible. The
|
|
|
|
# idea is to run almost everything in Alpine chroots.
|
2019-12-22 11:11:21 +00:00
|
|
|
required_programs = ["git", "openssl", "ps"]
|
2019-12-22 09:58:36 +00:00
|
|
|
|
2018-12-14 03:07:45 +00:00
|
|
|
# Keys saved in the config file (mostly what we ask in 'pmbootstrap init')
|
2018-03-17 18:41:41 +00:00
|
|
|
config_keys = ["ccache_size", "device", "extra_packages", "hostname", "jobs",
|
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.
2018-04-03 23:50:09 +00:00
|
|
|
"kernel", "keymap", "nonfree_firmware", "nonfree_userland",
|
2020-04-05 02:27:13 +00:00
|
|
|
"ssh_keys", "timezone", "ui", "ui_extras", "user", "work",
|
|
|
|
"aports"]
|
2017-11-19 15:04:08 +00:00
|
|
|
|
2017-05-26 20:08:45 +00:00
|
|
|
# Config file/commandline default values
|
|
|
|
# $WORK gets replaced with the actual value for args.work (which may be
|
2019-06-25 07:18:00 +00:00
|
|
|
# overridden on the commandline)
|
2017-05-26 20:08:45 +00:00
|
|
|
defaults = {
|
|
|
|
"alpine_version": "edge", # alternatively: latest-stable
|
2018-09-05 05:57:38 +00:00
|
|
|
"aports": "$WORK/cache_git/pmaports",
|
2017-12-21 16:42:29 +00:00
|
|
|
"ccache_size": "5G",
|
|
|
|
# aes-xts-plain64 would be better, but this is not supported on LineageOS
|
|
|
|
# kernel configs
|
|
|
|
"cipher": "aes-cbc-plain64",
|
2017-05-26 20:08:45 +00:00
|
|
|
"config": os.path.expanduser("~") + "/.config/pmbootstrap.cfg",
|
2020-03-31 13:06:46 +00:00
|
|
|
"device": "qemu-amd64",
|
2017-08-01 15:31:33 +00:00
|
|
|
"extra_packages": "none",
|
2019-09-18 18:59:14 +00:00
|
|
|
"fork_alpine": False,
|
2018-03-17 18:41:41 +00:00
|
|
|
"hostname": "",
|
2017-12-21 16:42:29 +00:00
|
|
|
# A higher value is typically desired, but this can lead to VERY long open
|
|
|
|
# times on slower devices due to host systems being MUCH faster than the
|
2018-06-30 07:00:48 +00:00
|
|
|
# target device (see issue #429).
|
2017-12-21 16:42:29 +00:00
|
|
|
"iter_time": "200",
|
2017-08-06 12:50:38 +00:00
|
|
|
"jobs": str(multiprocessing.cpu_count() + 1),
|
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.
2018-04-03 23:50:09 +00:00
|
|
|
"kernel": "stable",
|
2017-12-21 16:42:29 +00:00
|
|
|
"keymap": "",
|
2017-05-26 20:08:45 +00:00
|
|
|
"log": "$WORK/log.txt",
|
2017-11-14 19:02:27 +00:00
|
|
|
"mirror_alpine": "http://dl-cdn.alpinelinux.org/alpine/",
|
2019-11-21 20:49:44 +00:00
|
|
|
"mirrors_postmarketos": ["http://postmarketos1.brixit.nl/postmarketos/master"],
|
2018-02-24 21:49:10 +00:00
|
|
|
"nonfree_firmware": True,
|
|
|
|
"nonfree_userland": False,
|
2017-05-26 20:08:45 +00:00
|
|
|
"port_distccd": "33632",
|
2018-04-08 14:12:01 +00:00
|
|
|
"ssh_keys": False,
|
2017-12-21 16:42:29 +00:00
|
|
|
"timezone": "GMT",
|
2017-07-24 20:55:55 +00:00
|
|
|
"ui": "weston",
|
2020-04-05 02:27:13 +00:00
|
|
|
"ui_extras": False,
|
2017-10-12 20:08:10 +00:00
|
|
|
"user": "user",
|
2017-12-21 16:42:29 +00:00
|
|
|
"work": os.path.expanduser("~") + "/.local/var/pmbootstrap",
|
2017-05-26 20:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# CHROOT
|
|
|
|
#
|
|
|
|
|
|
|
|
# Usually the ID for the first user created is 1000. However, we want
|
|
|
|
# pmbootstrap to work even if the 'user' account inside the chroots has
|
|
|
|
# another UID, so we force it to be different.
|
|
|
|
chroot_uid_user = "12345"
|
|
|
|
|
|
|
|
# The PATH variable used inside all chroots
|
|
|
|
chroot_path = ":".join([
|
|
|
|
"/usr/lib/ccache/bin",
|
|
|
|
"/usr/local/sbin",
|
|
|
|
"/usr/local/bin",
|
|
|
|
"/usr/sbin:/usr/bin",
|
|
|
|
"/sbin",
|
|
|
|
"/bin"
|
|
|
|
])
|
|
|
|
|
Debian Jessie/Python 3.4 support for the most part (#6)
* automatically find the chroot binary on Debian, even if it is not
in the user's PATH
* don't use subprocess.run anymore (remove related testcase, that explicitly
checked for subprocess.run usage, and used recursive globbing, another
post 3.4 Python feature, for the checks. A similar case can be added in the
future, but right now it's more important to get Debian 3.4 working and all
PRs are reviewed anyway.)
* pytest fixtures: don't use the newer "yield" feature, as this is only
supported in a newer version of pytest, than provided on Debian Jessie
From manually testing, most stuff works in Debian Jessie. However, the
testsuite does not run through - creating an empty .tar.gz with Python
fails for some reason (this is done in test_apk_static.py).
2017-05-29 18:38:11 +00:00
|
|
|
# The PATH variable used on the host, to find the "chroot" and "sh"
|
|
|
|
# executables. As pmbootstrap runs as user, not as root, the location
|
|
|
|
# for the chroot executable may not be in the PATH (Debian).
|
|
|
|
chroot_host_path = os.environ["PATH"] + ":/usr/sbin/"
|
|
|
|
|
2017-05-26 20:08:45 +00:00
|
|
|
# Folders, that get mounted inside the chroot
|
|
|
|
# $WORK gets replaced with args.work
|
|
|
|
# $ARCH gets replaced with the chroot architecture (eg. x86_64, armhf)
|
|
|
|
chroot_mount_bind = {
|
|
|
|
"/proc": "/proc",
|
|
|
|
"$WORK/cache_apk_$ARCH": "/var/cache/apk",
|
2017-10-12 20:08:10 +00:00
|
|
|
"$WORK/cache_ccache_$ARCH": "/mnt/pmbootstrap-ccache",
|
2017-05-26 20:08:45 +00:00
|
|
|
"$WORK/cache_distfiles": "/var/cache/distfiles",
|
2017-10-12 20:08:10 +00:00
|
|
|
"$WORK/cache_git": "/mnt/pmbootstrap-git",
|
2020-01-02 11:41:01 +00:00
|
|
|
"$WORK/cache_rust": "/mnt/pmbootstrap-rust",
|
2017-10-12 20:08:10 +00:00
|
|
|
"$WORK/config_abuild": "/mnt/pmbootstrap-abuild-config",
|
2017-05-26 20:08:45 +00:00
|
|
|
"$WORK/config_apk_keys": "/etc/apk/keys",
|
2017-10-12 20:08:10 +00:00
|
|
|
"$WORK/packages": "/mnt/pmbootstrap-packages",
|
|
|
|
}
|
|
|
|
|
|
|
|
# Building chroots (all chroots, except for the rootfs_ chroot) get symlinks in
|
|
|
|
# the "pmos" user's home folder pointing to mountfolders from above.
|
2020-01-02 11:41:01 +00:00
|
|
|
# Rust packaging is new and still a bit weird in Alpine and postmarketOS. As of
|
|
|
|
# writing, we only have one package (squeekboard), and use cargo to download
|
|
|
|
# the source of all dependencies at build time and compile it. Usually, this is
|
|
|
|
# a no-go, but at least until this is resolved properly, let's cache the
|
|
|
|
# dependencies and downloads as suggested in "Caching the Cargo home in CI":
|
|
|
|
# https://doc.rust-lang.org/cargo/guide/cargo-home.html
|
2017-10-12 20:08:10 +00:00
|
|
|
chroot_home_symlinks = {
|
|
|
|
"/mnt/pmbootstrap-abuild-config": "/home/pmos/.abuild",
|
|
|
|
"/mnt/pmbootstrap-ccache": "/home/pmos/.ccache",
|
|
|
|
"/mnt/pmbootstrap-packages": "/home/pmos/packages/pmos",
|
2020-01-02 11:41:01 +00:00
|
|
|
"/mnt/pmbootstrap-rust/registry/index": "/home/pmos/.cargo/registry/index",
|
|
|
|
"/mnt/pmbootstrap-rust/registry/cache": "/home/pmos/.cargo/registry/cache",
|
|
|
|
"/mnt/pmbootstrap-rust/git/db": "/home/pmos/.cargo/git/db",
|
2017-05-26 20:08:45 +00:00
|
|
|
}
|
|
|
|
|
2018-04-29 22:17:57 +00:00
|
|
|
# Device nodes to be created in each chroot. Syntax for each entry:
|
|
|
|
# [permissions, type, major, minor, name]
|
2017-05-26 20:08:45 +00:00
|
|
|
chroot_device_nodes = [
|
2018-04-29 22:17:57 +00:00
|
|
|
[666, "c", 1, 3, "null"],
|
2017-05-26 20:08:45 +00:00
|
|
|
[666, "c", 1, 5, "zero"],
|
|
|
|
[666, "c", 1, 7, "full"],
|
|
|
|
[644, "c", 1, 8, "random"],
|
|
|
|
[644, "c", 1, 9, "urandom"],
|
|
|
|
]
|
|
|
|
|
2017-11-19 15:04:08 +00:00
|
|
|
# Age in hours that we keep the APKINDEXes before downloading them again.
|
|
|
|
# You can force-update them with 'pmbootstrap update'.
|
|
|
|
apkindex_retention_time = 4
|
2017-05-26 20:08:45 +00:00
|
|
|
|
2020-02-04 23:18:39 +00:00
|
|
|
|
|
|
|
# When chroot is considered outdated (in seconds)
|
|
|
|
chroot_outdated = 3600 * 24 * 2
|
|
|
|
|
2017-05-26 20:08:45 +00:00
|
|
|
#
|
|
|
|
# BUILD
|
|
|
|
#
|
2018-01-23 00:26:33 +00:00
|
|
|
# Officially supported host/target architectures for postmarketOS. Only
|
2019-06-25 07:18:00 +00:00
|
|
|
# specify architectures supported by Alpine here. For cross-compiling,
|
2018-01-23 00:26:33 +00:00
|
|
|
# we need to generate the "musl-$ARCH", "binutils-$ARCH" and "gcc-$ARCH"
|
|
|
|
# packages (use "pmbootstrap aportgen musl-armhf" etc.).
|
2018-12-12 20:22:27 +00:00
|
|
|
build_device_architectures = ["armhf", "armv7", "aarch64", "x86_64", "x86"]
|
2017-06-15 00:26:32 +00:00
|
|
|
|
2017-06-08 16:02:00 +00:00
|
|
|
# Packages, that will be installed in a chroot before it builds packages
|
2017-05-26 20:08:45 +00:00
|
|
|
# for the first time
|
2019-11-10 10:22:04 +00:00
|
|
|
build_packages = ["abuild", "build-base", "ccache", "git"]
|
2017-05-26 20:08:45 +00:00
|
|
|
|
|
|
|
# fnmatch for supported pkgnames, that can be directly compiled inside
|
|
|
|
# the native chroot and a cross-compiler, without using distcc
|
2019-08-19 11:17:26 +00:00
|
|
|
build_cross_native = ["linux-*", "arch-bin-masquerade"]
|
2017-05-26 20:08:45 +00:00
|
|
|
|
2017-09-18 21:36:54 +00:00
|
|
|
# Necessary kernel config options
|
|
|
|
necessary_kconfig_options = {
|
2019-06-30 13:39:47 +00:00
|
|
|
">=0.0.0": { # all versions
|
|
|
|
"all": { # all arches
|
|
|
|
"ANDROID_PARANOID_NETWORK": False,
|
|
|
|
"BLK_DEV_INITRD": True,
|
2019-11-05 18:48:24 +00:00
|
|
|
"CGROUPS": True,
|
2019-06-30 13:39:47 +00:00
|
|
|
"DEVTMPFS": True,
|
|
|
|
"DM_CRYPT": True,
|
|
|
|
"EXT4_FS": True,
|
|
|
|
"KINETO_GAN": False,
|
|
|
|
"PFT": False,
|
|
|
|
"SYSVIPC": True,
|
|
|
|
"VT": True,
|
|
|
|
"USE_VFB": False,
|
|
|
|
}
|
2018-02-17 13:37:35 +00:00
|
|
|
},
|
2019-06-30 13:39:47 +00:00
|
|
|
">=4.0.0": {
|
|
|
|
"all": {
|
|
|
|
"UEVENT_HELPER": True,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"<5.2.0": {
|
|
|
|
"armhf armv7 x86": {
|
|
|
|
"LBDAF": True
|
|
|
|
}
|
2018-02-17 13:37:35 +00:00
|
|
|
}
|
2017-09-18 21:36:54 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:17:31 +00:00
|
|
|
#
|
|
|
|
# PARSE
|
|
|
|
#
|
|
|
|
|
2020-01-27 23:23:09 +00:00
|
|
|
# Variables belonging to a package or subpackage in APKBUILD files
|
|
|
|
apkbuild_package_attributes = {
|
|
|
|
"pkgdesc": {},
|
|
|
|
"depends": {"array": True},
|
|
|
|
"provides": {"array": True},
|
|
|
|
}
|
|
|
|
|
2017-05-26 20:08:45 +00:00
|
|
|
# Variables in APKBUILD files, that get parsed
|
|
|
|
apkbuild_attributes = {
|
2020-03-07 11:04:27 +00:00
|
|
|
**apkbuild_package_attributes,
|
|
|
|
|
2017-05-26 20:08:45 +00:00
|
|
|
"arch": {"array": True},
|
2017-07-19 19:24:03 +00:00
|
|
|
"depends_dev": {"array": True},
|
2017-05-26 20:08:45 +00:00
|
|
|
"makedepends": {"array": True},
|
2018-06-04 19:07:52 +00:00
|
|
|
"checkdepends": {"array": True},
|
2017-05-26 20:08:45 +00:00
|
|
|
"options": {"array": True},
|
2020-01-27 21:33:06 +00:00
|
|
|
"pkgname": {},
|
|
|
|
"pkgrel": {},
|
|
|
|
"pkgver": {},
|
2020-01-27 23:23:09 +00:00
|
|
|
"subpackages": {},
|
2020-01-27 21:33:06 +00:00
|
|
|
"url": {},
|
2017-05-26 20:08:45 +00:00
|
|
|
|
|
|
|
# cross-compilers
|
|
|
|
"makedepends_build": {"array": True},
|
|
|
|
"makedepends_host": {"array": True},
|
|
|
|
|
|
|
|
# kernels
|
2020-01-27 21:33:06 +00:00
|
|
|
"_flavor": {},
|
|
|
|
"_device": {},
|
|
|
|
"_kernver": {},
|
2020-03-21 08:29:59 +00:00
|
|
|
"_outdir": {},
|
2017-05-26 20:08:45 +00:00
|
|
|
|
|
|
|
# mesa
|
2020-01-27 21:33:06 +00:00
|
|
|
"_llvmver": {},
|
2017-12-11 20:24:30 +00:00
|
|
|
|
|
|
|
# Overridden packages
|
2020-01-27 21:33:06 +00:00
|
|
|
"_pkgver": {},
|
|
|
|
"_pkgname": {},
|
2019-02-09 16:58:54 +00:00
|
|
|
|
|
|
|
# git commit
|
2020-01-27 21:33:06 +00:00
|
|
|
"_commit": {},
|
2019-02-09 16:58:54 +00:00
|
|
|
"source": {"array": True},
|
2017-05-26 20:08:45 +00:00
|
|
|
}
|
|
|
|
|
2020-05-03 09:35:10 +00:00
|
|
|
# Reference: https://postmarketos.org/apkbuild-options
|
|
|
|
apkbuild_custom_valid_options = [
|
|
|
|
"!pmb:crossdirect",
|
|
|
|
"!pmb:kconfig-check",
|
|
|
|
"pmb:cross-native",
|
|
|
|
"pmb:strict",
|
|
|
|
]
|
|
|
|
|
2017-07-10 18:17:31 +00:00
|
|
|
# Variables from deviceinfo. Reference: <https://postmarketos.org/deviceinfo>
|
|
|
|
deviceinfo_attributes = [
|
2018-01-17 17:53:58 +00:00
|
|
|
# general
|
2017-07-10 18:17:31 +00:00
|
|
|
"format_version",
|
|
|
|
"name",
|
|
|
|
"manufacturer",
|
2018-12-25 16:59:18 +00:00
|
|
|
"codename",
|
2020-03-07 14:44:52 +00:00
|
|
|
"year",
|
2017-07-10 18:17:31 +00:00
|
|
|
"dtb",
|
|
|
|
"modules_initfs",
|
|
|
|
"arch",
|
2018-01-17 17:53:58 +00:00
|
|
|
|
|
|
|
# device
|
|
|
|
"keyboard",
|
2018-03-07 22:35:02 +00:00
|
|
|
"external_storage",
|
2018-01-17 17:53:58 +00:00
|
|
|
"screen_width",
|
|
|
|
"screen_height",
|
|
|
|
"dev_touchscreen",
|
|
|
|
"dev_touchscreen_calibration",
|
|
|
|
|
|
|
|
# bootloader
|
|
|
|
"flash_method",
|
2018-05-29 19:33:40 +00:00
|
|
|
"boot_filesystem",
|
2017-07-10 18:17:31 +00:00
|
|
|
|
|
|
|
# flash
|
|
|
|
"flash_heimdall_partition_kernel",
|
2017-09-09 13:53:06 +00:00
|
|
|
"flash_heimdall_partition_initfs",
|
|
|
|
"flash_heimdall_partition_system",
|
2019-01-18 19:01:03 +00:00
|
|
|
"flash_fastboot_partition_kernel",
|
|
|
|
"flash_fastboot_partition_system",
|
2020-03-03 23:51:25 +00:00
|
|
|
"flash_fastboot_partition_vbmeta",
|
2018-01-17 17:53:58 +00:00
|
|
|
"generate_legacy_uboot_initfs",
|
|
|
|
"kernel_cmdline",
|
|
|
|
"generate_bootimg",
|
|
|
|
"bootimg_qcdt",
|
2019-10-25 15:07:08 +00:00
|
|
|
"bootimg_dtb_second",
|
2017-07-10 18:17:31 +00:00
|
|
|
"flash_offset_base",
|
|
|
|
"flash_offset_kernel",
|
|
|
|
"flash_offset_ramdisk",
|
|
|
|
"flash_offset_second",
|
|
|
|
"flash_offset_tags",
|
|
|
|
"flash_pagesize",
|
2018-01-17 17:53:58 +00:00
|
|
|
"flash_fastboot_max_size",
|
2017-08-02 16:21:50 +00:00
|
|
|
"flash_sparse",
|
2018-12-11 01:08:02 +00:00
|
|
|
"rootfs_image_sector_size",
|
2019-01-09 05:42:37 +00:00
|
|
|
"sd_embed_firmware",
|
|
|
|
"sd_embed_firmware_step_size",
|
2019-02-16 19:53:22 +00:00
|
|
|
"partition_blacklist",
|
2020-01-18 21:55:57 +00:00
|
|
|
"boot_part_start",
|
2017-07-10 18:17:31 +00:00
|
|
|
|
|
|
|
# weston
|
|
|
|
"weston_pixman_type",
|
2017-08-19 21:40:20 +00:00
|
|
|
|
|
|
|
# keymaps
|
|
|
|
"keymaps",
|
2017-07-10 18:17:31 +00:00
|
|
|
]
|
|
|
|
|
2017-06-09 17:22:25 +00:00
|
|
|
#
|
|
|
|
# INITFS
|
|
|
|
#
|
|
|
|
initfs_hook_prefix = "postmarketos-mkinitfs-hook-"
|
2017-07-19 18:05:34 +00:00
|
|
|
default_ip = "172.16.42.1"
|
2017-06-09 17:22:25 +00:00
|
|
|
|
|
|
|
|
2017-05-26 20:08:45 +00:00
|
|
|
#
|
|
|
|
# INSTALL
|
|
|
|
#
|
|
|
|
|
|
|
|
# Packages, that will be installed inside the native chroot to perform
|
|
|
|
# the installation to the device.
|
|
|
|
# util-linux: losetup, fallocate
|
2018-05-29 19:33:40 +00:00
|
|
|
install_native_packages = ["cryptsetup", "util-linux", "e2fsprogs", "parted", "dosfstools"]
|
2020-01-20 10:12:10 +00:00
|
|
|
install_device_packages = ["postmarketos-base"]
|
2017-05-26 20:08:45 +00:00
|
|
|
|
2018-04-23 20:52:03 +00:00
|
|
|
# Groups for the default user
|
2019-11-29 06:12:33 +00:00
|
|
|
install_user_groups = ["wheel", "video", "audio", "input", "plugdev", "netdev"]
|
2017-05-26 20:08:45 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# FLASH
|
|
|
|
#
|
|
|
|
|
2019-03-02 18:10:35 +00:00
|
|
|
flash_methods = ["fastboot", "heimdall", "0xffff", "uuu", "none"]
|
2017-11-20 16:40:16 +00:00
|
|
|
|
2017-05-26 20:08:45 +00:00
|
|
|
# These folders will be mounted at the same location into the native
|
|
|
|
# chroot, before the flash programs get started.
|
|
|
|
flash_mount_bind = [
|
|
|
|
"/sys/bus/usb/devices/",
|
2017-08-24 21:07:36 +00:00
|
|
|
"/sys/dev/",
|
2017-05-26 20:08:45 +00:00
|
|
|
"/sys/devices/",
|
|
|
|
"/dev/bus/usb/"
|
|
|
|
]
|
|
|
|
|
2017-07-04 20:47:03 +00:00
|
|
|
"""
|
|
|
|
Flasher abstraction. Allowed variables:
|
|
|
|
|
|
|
|
$BOOT: Path to the /boot partition
|
|
|
|
$FLAVOR: Kernel flavor
|
2020-02-04 10:30:28 +00:00
|
|
|
$IMAGE: Path to the combined boot/rootfs image
|
|
|
|
$IMAGE_SPLIT_BOOT: Path to the (split) boot image
|
|
|
|
$IMAGE_SPLIT_ROOT: Path to the (split) rootfs image
|
2019-01-18 19:01:03 +00:00
|
|
|
$PARTITION_KERNEL: Partition to flash the kernel/boot.img to
|
2018-07-15 21:41:31 +00:00
|
|
|
$PARTITION_SYSTEM: Partition to flash the rootfs to
|
2017-07-04 20:47:03 +00:00
|
|
|
|
2019-09-26 20:32:53 +00:00
|
|
|
Fastboot specific: $KERNEL_CMDLINE
|
2019-01-18 19:01:03 +00:00
|
|
|
Heimdall specific: $PARTITION_INITFS
|
2019-03-02 18:10:35 +00:00
|
|
|
uuu specific: $UUU_SCRIPT
|
2017-07-04 20:47:03 +00:00
|
|
|
"""
|
2017-05-26 20:08:45 +00:00
|
|
|
flashers = {
|
|
|
|
"fastboot": {
|
2020-03-03 23:51:25 +00:00
|
|
|
"depends": ["android-tools", "avbtool"],
|
2020-02-03 18:25:59 +00:00
|
|
|
"actions": {
|
|
|
|
"list_devices": [["fastboot", "devices", "-l"]],
|
|
|
|
"flash_rootfs": [["fastboot", "flash", "$PARTITION_SYSTEM",
|
|
|
|
"$IMAGE"]],
|
|
|
|
"flash_kernel": [["fastboot", "flash", "$PARTITION_KERNEL",
|
|
|
|
"$BOOT/boot.img-$FLAVOR"]],
|
2020-03-03 23:51:25 +00:00
|
|
|
"flash_vbmeta": [
|
|
|
|
# Generate vbmeta image with "disable verification" flag
|
|
|
|
["avbtool", "make_vbmeta_image", "--flags", "2",
|
|
|
|
"--padding_size", "$FLASH_PAGESIZE",
|
|
|
|
"--output", "/vbmeta.img"],
|
|
|
|
["fastboot", "flash", "$PARTITION_VBMETA", "/vbmeta.img"],
|
|
|
|
["rm", "-f", "/vbmeta.img"]
|
|
|
|
],
|
2020-02-03 18:25:59 +00:00
|
|
|
"boot": [["fastboot", "--cmdline", "$KERNEL_CMDLINE",
|
|
|
|
"boot", "$BOOT/boot.img-$FLAVOR"]],
|
2017-07-25 18:56:10 +00:00
|
|
|
},
|
2017-05-26 20:08:45 +00:00
|
|
|
},
|
2020-02-04 10:30:28 +00:00
|
|
|
# Some devices provide Fastboot but using Android boot images is not practical
|
|
|
|
# for them (e.g. because they support booting from FAT32 partitions directly
|
|
|
|
# and/or the Android boot partition is too small). This can be implemented
|
|
|
|
# using --split (separate image files for boot and rootfs).
|
|
|
|
# This flasher allows flashing the split image files using Fastboot.
|
|
|
|
"fastboot-bootpart": {
|
|
|
|
"split": True,
|
|
|
|
"depends": ["android-tools"],
|
|
|
|
"actions": {
|
|
|
|
"list_devices": [["fastboot", "devices", "-l"]],
|
|
|
|
"flash_rootfs": [["fastboot", "flash", "$PARTITION_SYSTEM",
|
|
|
|
"$IMAGE_SPLIT_ROOT"]],
|
|
|
|
"flash_kernel": [["fastboot", "flash", "$PARTITION_KERNEL",
|
|
|
|
"$IMAGE_SPLIT_BOOT"]],
|
|
|
|
# TODO: Add support for boot
|
|
|
|
},
|
|
|
|
},
|
2017-07-25 18:56:10 +00:00
|
|
|
# Some Samsung devices need the initramfs to be baked into the kernel (e.g.
|
|
|
|
# i9070, i9100). We want the initramfs to be generated after the kernel was
|
|
|
|
# built, so we put the real initramfs on another partition (e.g. RECOVERY)
|
|
|
|
# and load it from the initramfs in the kernel. This method is called
|
|
|
|
# "isorec" (isolated recovery), a term coined by Lanchon.
|
|
|
|
"heimdall-isorec": {
|
2017-05-26 20:08:45 +00:00
|
|
|
"depends": ["heimdall"],
|
2020-02-03 18:25:59 +00:00
|
|
|
"actions": {
|
2017-07-25 18:56:10 +00:00
|
|
|
"list_devices": [["heimdall", "detect"]],
|
2018-03-30 01:11:20 +00:00
|
|
|
"flash_rootfs": [
|
2017-07-25 18:56:10 +00:00
|
|
|
["heimdall_wait_for_device.sh"],
|
2017-09-09 13:53:06 +00:00
|
|
|
["heimdall", "flash", "--$PARTITION_SYSTEM", "$IMAGE"]],
|
2017-07-25 18:56:10 +00:00
|
|
|
"flash_kernel": [["heimdall_flash_kernel.sh",
|
|
|
|
"$BOOT/initramfs-$FLAVOR", "$PARTITION_INITFS",
|
|
|
|
"$BOOT/vmlinuz-$FLAVOR", "$PARTITION_KERNEL"]]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
# Some Samsung devices need a 'boot.img' file, just like the one generated
|
|
|
|
# fastboot compatible devices. Example: s7562, n7100
|
|
|
|
"heimdall-bootimg": {
|
|
|
|
"depends": ["heimdall"],
|
2020-02-03 18:25:59 +00:00
|
|
|
"actions": {
|
2017-07-25 18:56:10 +00:00
|
|
|
"list_devices": [["heimdall", "detect"]],
|
2018-03-30 01:11:20 +00:00
|
|
|
"flash_rootfs": [
|
2017-07-25 18:56:10 +00:00
|
|
|
["heimdall_wait_for_device.sh"],
|
2017-09-09 13:53:06 +00:00
|
|
|
["heimdall", "flash", "--$PARTITION_SYSTEM", "$IMAGE"]],
|
2017-07-25 18:56:10 +00:00
|
|
|
"flash_kernel": [
|
|
|
|
["heimdall_wait_for_device.sh"],
|
|
|
|
["heimdall", "flash", "--$PARTITION_KERNEL", "$BOOT/boot.img-$FLAVOR"]],
|
2017-05-26 20:08:45 +00:00
|
|
|
},
|
|
|
|
},
|
2017-08-24 21:07:36 +00:00
|
|
|
"adb": {
|
2020-02-03 18:25:59 +00:00
|
|
|
"depends": ["android-tools"],
|
|
|
|
"actions": {
|
|
|
|
"list_devices": [["adb", "-P", "5038", "devices"]],
|
|
|
|
"sideload": [["echo", "< wait for any device >"],
|
|
|
|
["adb", "-P", "5038", "wait-for-usb-sideload"],
|
|
|
|
["adb", "-P", "5038", "sideload",
|
|
|
|
"$RECOVERY_ZIP"]],
|
|
|
|
}
|
2017-08-24 21:07:36 +00:00
|
|
|
},
|
2019-03-02 18:10:35 +00:00
|
|
|
"uuu": {
|
|
|
|
"depends": ["uuu"],
|
2020-02-03 18:25:59 +00:00
|
|
|
"actions": {
|
2019-03-02 18:10:35 +00:00
|
|
|
"flash_rootfs": [
|
|
|
|
# There's a bug(?) in uuu where it clobbers the path in the cmd
|
|
|
|
# script if the script is not in pwd...
|
|
|
|
["cp", "$UUU_SCRIPT", "./flash_script.lst"],
|
|
|
|
["uuu", "flash_script.lst"],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|
2017-05-26 20:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# GIT
|
|
|
|
#
|
|
|
|
git_repos = {
|
2019-12-22 10:55:21 +00:00
|
|
|
"aports_upstream": "https://gitlab.alpinelinux.org/alpine/aports.git",
|
2018-09-05 05:57:38 +00:00
|
|
|
"pmaports": "https://gitlab.com/postmarketOS/pmaports.git",
|
2017-05-26 20:08:45 +00:00
|
|
|
}
|
2017-10-30 19:56:38 +00:00
|
|
|
|
2020-02-12 21:44:26 +00:00
|
|
|
# When a git repository is considered outdated (in seconds)
|
|
|
|
# (Measuring timestamp of FETCH_HEAD: https://stackoverflow.com/a/9229377)
|
|
|
|
git_repo_outdated = 3600 * 24 * 2
|
2017-10-30 19:56:38 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# APORTGEN
|
|
|
|
#
|
|
|
|
aportgen = {
|
|
|
|
"cross": {
|
2019-03-27 14:24:25 +00:00
|
|
|
"prefixes": ["binutils", "busybox-static", "gcc", "musl", "grub-efi"],
|
2017-10-30 19:56:38 +00:00
|
|
|
"confirm_overwrite": False,
|
|
|
|
},
|
2020-02-26 11:13:26 +00:00
|
|
|
"device/testing": {
|
2017-10-30 19:56:38 +00:00
|
|
|
"prefixes": ["device", "linux"],
|
|
|
|
"confirm_overwrite": True,
|
|
|
|
}
|
|
|
|
}
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
|
pmbootstrap newapkbuild: Properly parse arguments (#1320)
* pmbootstrap newapkbuild: Properly parse arguments
The `pmbootstrap newapkbuild` action wraps Alpine's `newapkbuild`. We
used to directly pass all arguments to `newapkbuild` without verifying
in Python whether they make sense or not. However, as `newpakbuild`
doesn't do strict sanity checks on the arguments, it is easy to end up
with unexpected behavior when using the command for the first time.
For example, `newapkbuild` allows either specifying a PKGNAME or SRCURL
as last parameter, and also allows setting a PKGNAME with the `-n`
parameter. It only makes sense to use that option when passing a
SRCURL.
With this commit, we duplicate the optins that should be passed through
to `newapkbuild` and use argparse to fully sanitize the options and
display a help page (`pmbootstrap newapkbuild -h`) that is consistent
with the other help pages.
Details:
* The `-f` (force) flag does not get passed through anymore. Instead we
use it in Python to skip asking if an existing aport should be
overwritten (the aports are outside of the chroot, so `newapkbuild`
can't handle it in a way that makes sense for pmbootstrap).
* Output of `newapkbuild` gets redirected to the log file now, as we
don't need it to display a help page.
* Don't verify the pkgver while creating the new APKBUILD. When passing
a SRCURL, the pkgver gets extracted from the end of the URL and may
not have a valid format yet (but we want the APKBUILD anyway).
* Stored options passed through in `pmb/config/__init__.py` and use it
in both `pmb/parse/arguments.py` and `pmb/helpers/frontend.py`.
* Only allow `-n` with SRCURL
* The postmarketOS aports folder gets specified with `--folder` now.
That way the generated help page is much closer to the original one
from `newapkbuild`. The default is `main`.
* Made the package type flags (CMake, autotools, ...) exclusive so only
one of them can be specified
2018-03-15 21:42:34 +00:00
|
|
|
#
|
|
|
|
# NEWAPKBUILD
|
|
|
|
# Options passed through to the "newapkbuild" command from Alpine Linux. They
|
|
|
|
# are duplicated here, so we can use Python's argparse for argument parsing and
|
|
|
|
# help page display. The -f (force) flag is not defined here, as we use that in
|
|
|
|
# the Python code only and don't pass it through.
|
|
|
|
#
|
|
|
|
newapkbuild_arguments_strings = [
|
|
|
|
["-n", "pkgname", "set package name (only use with SRCURL)"],
|
|
|
|
["-d", "pkgdesc", "set package description"],
|
|
|
|
["-l", "license", "set package license identifier from"
|
|
|
|
" <https://spdx.org/licenses/>"],
|
|
|
|
["-u", "url", "set package URL"],
|
|
|
|
]
|
|
|
|
newapkbuild_arguments_switches_pkgtypes = [
|
|
|
|
["-a", "autotools", "create autotools package (use ./configure ...)"],
|
|
|
|
["-C", "cmake", "create CMake package (assume cmake/ is there)"],
|
|
|
|
["-m", "meson", "create meson package (assume meson.build is there)"],
|
|
|
|
["-p", "perl", "create perl package (assume Makefile.PL is there)"],
|
|
|
|
["-y", "python", "create python package (assume setup.py is there)"],
|
|
|
|
]
|
|
|
|
newapkbuild_arguments_switches_other = [
|
|
|
|
["-s", "sourceforge", "use sourceforge source URL"],
|
|
|
|
["-c", "copy_samples", "copy a sample init.d, conf.d and install script"],
|
|
|
|
]
|
2019-02-09 16:58:54 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# UPGRADE
|
|
|
|
#
|
|
|
|
# Patterns of package names to ignore for automatic pmaport upgrading ("pmbootstrap aportupgrade --all")
|
|
|
|
upgrade_ignore = ["device-*", "firmware-*", "linux-*", "postmarketos-*", "*-aarch64", "*-armhf", "*-armv7"]
|