Close #554: kernel config checking (#589)

* Check kernel config
* Allow specifying multiple kernel packages, and also no packages
  which defaults to scanning all kernel configs (it is super fast
  anyway)
* Add the check to Travis CI
* Adjust existing kernel configs, so they pass the kconfig_check.
(We've had to put in a lot of defaults in the aarch64
linux-postmarketos configs, that's why the diff is a bit unclean.)
* Increase modified kernel pkgrels
This commit is contained in:
Attila Szöllősi 2017-09-18 23:36:54 +02:00 committed by Oliver Smith
parent 7349874925
commit ae6a58b6ed
14 changed files with 353 additions and 91 deletions

View File

@ -11,6 +11,7 @@ install: "pip install flake8"
script:
- test/static_code_analysis.sh
- yes "" | ./pmbootstrap.py init
- ./pmbootstrap.py kconfig_check
- test/check_checksums.py
notifications:
- email: false

View File

@ -20,7 +20,7 @@ case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=2
pkgrel=3
arch="armhf"
pkgdesc="HTC Desire kernel from spezi77"
url="https://github.com/spezi77/android_kernel_htc_qsd8k_3.0"
@ -105,5 +105,5 @@ package() {
}
sha512sums="94929945d6fcb4428f320325ced207a9888cd758357766ef914c4ca2d5cea4b9cced77275463dac316591ba942e6e1514fec8c1f8e11c8324155116785ffb277 linux-htc-bravo-4bc19919f805777947c243e6c2ed41ece530488b.tar.gz
27ec53afdd9898495ae296b8e98b05401aae3a0bf390ba276f6a878d6bf1ccf3f59da78a5ee50ba4ee0744e4768f71aab53b782511c4f8ad22fefc821a2c815c config-htc-bravo.armhf
c8305bade000d45743e5dc0965a31a0d9fcd2c1c19afecf5cf047ce7e065fed3679d5044d8544b3bd1656b62fd177136dd6b7aa1c48406b62c539dc8d429559e config-htc-bravo.armhf
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h"

View File

@ -1245,7 +1245,7 @@ CONFIG_MD=y
# CONFIG_BLK_DEV_MD is not set
CONFIG_BLK_DEV_DM=y
# CONFIG_DM_DEBUG is not set
# CONFIG_DM_CRYPT is not set
CONFIG_DM_CRYPT=y
# CONFIG_DM_SNAPSHOT is not set
# CONFIG_DM_MIRROR is not set
# CONFIG_DM_RAID is not set

View File

@ -20,7 +20,7 @@ case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=0
pkgrel=1
arch="aarch64"
pkgdesc="LineageOS kernel for Nexus 6P Angler"
url="https://github.com/LineageOS/android_kernel_huawei_angler"
@ -104,6 +104,6 @@ package() {
}
sha512sums="de3f5ab1c6609b94d416b0eebd5ae948698f0f6ec81e84fbee152df7c2778d8df94cec43b5abca583fe5977bb28037b3b6d2c3ff652a50493a1f24da31dadd7f linux-huawei-angler-04d1557af1259b211609fa41adbe852b5f9cf2da.tar.gz
ca281ff4a694725ebb1a8bad597220d3d74cf40d1037f69236ed3ece58c5246264b9ea7e0e1e46046d8597a4c6582bf24c972990461ab15b0b426606d3aaab9f config-huawei-angler.aarch64
15889af8af37cca20a4c98234e44b9e5a1df77004a625c69f8377202227175f221a576006249d0e743d1dfb1a7fc010372e0032bb364d58ed93eff9f06574190 config-huawei-angler.aarch64
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch"

View File

@ -1530,7 +1530,12 @@ CONFIG_FINGERPRINT_FPC=y
# Character devices
#
CONFIG_TTY=y
# CONFIG_VT is not set
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_VT_CONSOLE_SLEEP=y
CONFIG_HW_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not set
CONFIG_UNIX98_PTYS=y
# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
# CONFIG_LEGACY_PTYS is not set
@ -2382,6 +2387,14 @@ CONFIG_FB_MSM_MDSS_WRITEBACK=y
# CONFIG_EXYNOS_VIDEO is not set
# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
# CONFIG_ADF is not set
#
# Console display driver support
#
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
CONFIG_DUMMY_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE is not set
# CONFIG_LOGO is not set
# CONFIG_FB_SSD1307 is not set
CONFIG_SOUND=y
@ -3129,6 +3142,7 @@ CONFIG_STAGING=y
#
# Speakup console speech
#
# CONFIG_SPEAKUP is not set
# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set
# CONFIG_STAGING_MEDIA is not set

View File

@ -18,7 +18,7 @@ case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=1
pkgrel=2
arch="all"
pkgdesc="Mainline Linux for pmOS supported chipsets (OMAP)"
@ -190,7 +190,7 @@ dev() {
sha512sums="a557c2f0303ae618910b7106ff63d9978afddf470f03cb72aa748213e099a0ecd5f3119aea6cbd7b61df30ca6ef3ec57044d524b7babbaabddf8b08b8bafa7d2 linux-4.13.tar.xz
03407ddd93db7188928ff7f689dff01afaa0119655e311440a8a286907d8f27bf058487b8f859a588f7f06bda98abe24998fc580f917df2f96f9b661905a54ce config-postmarketos.armhf
d97c84ad303e2dc5cc65703ddf6f749c7ea005d4fc191a3d197b56ab81150499328665de1ccbd8c467e1409151a37a47a9efcb0588c2c759cf9498361b5134db config-postmarketos.aarch64
d41363bc6b9878db95b44eb326f9fd0ea89b6f3364ff0e883a5142cfa2937e6b77e9b185c046cbd2c5d4e2f696349839836740f8dee6bd649ef995cbd756e08a config-postmarketos.aarch64
8d3ea9743190680036d938a9d8ce8602f453152c69404741c70f1584075c111ba120d986b712fc509bbbe7882204292527738de9f03cf871c4911fff80a58d13 config-postmarketos.x86_64
17c48bb7b4218297bd2be6faa5b6570ce1560a33385237a9962c0884d782c9a722a25a30077b6721d2943a9b98c29dcad6adfef718b0163c559c19a79519319b 0001-rx51-drm-regression-workaround.patch
2b9cc6f24c2792b619189c81d8960d6f5dd622f767d6645208c59f3f38c00db5bdfb0d1fbbfa717bea7fd86067921cf07109c9a7a1001ce7a915bfa2a6a2c03e patch-4.13.2.xz"

File diff suppressed because it is too large Load Diff

View File

@ -72,3 +72,6 @@ def menuconfig(args, pkgname, arch):
target = aport + "/" + config
pmb.helpers.run.user(args, ["cp", source, target])
pmb.build.checksum(args, pkgname)
# Check config
pmb.parse.kconfig.check(args, apkbuild["_flavor"], details=True)

View File

@ -130,6 +130,14 @@ build_packages = ["abuild", "build-base", "ccache"]
# the native chroot and a cross-compiler, without using distcc
build_cross_native = ["linux-*"]
# Necessary kernel config options
necessary_kconfig_options = {
"DEVTMPFS": True,
"DEVTMPFS_MOUNT": False,
"DM_CRYPT": True,
"VT": True,
}
#
# PARSE

View File

@ -27,6 +27,7 @@ import pmb.chroot.initfs
import pmb.chroot.other
import pmb.export.frontend
import pmb.helpers.frontend
import pmb.parse.kconfig
def kernel(args):
@ -34,6 +35,9 @@ def kernel(args):
flavor = pmb.helpers.frontend._parse_flavor(args)
pmb.chroot.initfs.build(args, flavor, "rootfs_" + args.device)
# Check kernel config
pmb.parse.kconfig.check(args, flavor)
# Generate the paths and run the flasher
if args.action_flasher == "boot":
logging.info("(native) boot " + flavor + " kernel")

View File

@ -19,8 +19,10 @@ You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import logging
import glob
import json
import logging
import os
import sys
import pmb.aportgen
@ -150,6 +152,25 @@ def menuconfig(args):
pmb.build.menuconfig(args, args.package, args.deviceinfo["arch"])
def kconfig_check(args):
# Default to all kernel packages
packages = args.packages
if not packages:
for aport in glob.glob(args.aports + "/*/linux-*"):
packages.append(os.path.basename(aport).split("linux-")[1])
# Iterate over all kernels
error = False
packages.sort()
for package in packages:
if not pmb.parse.kconfig.check(args, package, details=True):
error = True
# At least one failure
if error:
raise RuntimeError("kconfig_check failed!")
def parse_apkbuild(args):
aport = pmb.build.other.find_aport(args, args.package)
path = aport + "/APKBUILD"

View File

@ -20,4 +20,5 @@ from pmb.parse.arguments import arguments
from pmb.parse.apkbuild import apkbuild
from pmb.parse.binfmt_info import binfmt_info
from pmb.parse.deviceinfo import deviceinfo
from pmb.parse.kconfig import check
import pmb.parse.arch

View File

@ -249,6 +249,12 @@ def arguments():
for action in [checksum, build, aportgen]:
action.add_argument("packages", nargs="+")
# Action: kconfig_check
kconfig_check = sub.add_parser("kconfig_check", help="check, whether all"
" the necessary options are"
" enabled/disabled in the kernel config")
kconfig_check.add_argument("packages", nargs="*")
# Action: challenge
challenge = sub.add_parser("challenge",
help="verify, that all files in an apk can be"

82
pmb/parse/kconfig.py Normal file
View File

@ -0,0 +1,82 @@
"""
Copyright 2017 Attila Szollosi
This file is part of pmbootstrap.
pmbootstrap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
pmbootstrap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import glob
import logging
import re
import os
import pmb.build
import pmb.config
def is_set(config, option):
"""
Check, whether a boolean or tristate option is enabled
either as builtin or module.
"""
return re.search("^CONFIG_" + option + "=[ym]", config, re.M) is not None
def check(args, pkgname, details=False):
"""
Check for necessary kernel config options.
:returns: True when the check was successful, False otherwise
"""
# Pkgname: allow omitting "linux-" prefix
if pkgname.startswith("linux-"):
flavor = pkgname.split("linux-")[1]
logging.info("PROTIP: You can simply do 'pmbootstrap kconfig_check " +
flavor + "'")
else:
flavor = pkgname
# Read all kernel configs in the aport
ret = True
aport = pmb.build.find_aport(args, "linux-" + flavor)
for config_path in glob.glob(aport + "/config-*"):
logging.debug("Check kconfig: " + config_path)
with open(config_path) as handle:
config = handle.read()
# Loop trough necessary config options, and print a warning,
# if any is missing
path = "linux-" + flavor + "/" + os.path.basename(config_path)
for key, value in pmb.config.necessary_kconfig_options.items():
if value not in [True, False]:
raise RuntimeError("kconfig check code can only handle"
" True/False right now, given value '" +
str(value) + "' is not supported. If you"
" need this, please open an issue.")
if value != is_set(config, key):
ret = False
if details:
should = "should" if value else "should *not*"
link = ("https://wiki.postmarketos.org/wiki/"
"Kernel_configuration#CONFIG_" + key)
logging.info("WARNING: " + path + ": CONFIG_" + key + " " +
should + " be set. See <" + link +
"> for details.")
else:
logging.warning("WARNING: " + path + " isn't configured"
" properly for postmarketOS, run"
" 'pmbootstrap kconfig_check' for"
" details!")
break
return ret