forked from Mirror/pmbootstrap
kconfig check: add support for checking zram options (MR 2075)
Device kernels that enable zram support can use `pmb:kconfigcheck-zram` to protect against kconfig regressions that disable support for zram.
This commit is contained in:
parent
687807fa73
commit
6afd35eb11
7 changed files with 87 additions and 3 deletions
|
@ -154,4 +154,5 @@ def menuconfig(args, pkgname):
|
|||
pmb.parse.kconfig.check(args, apkbuild["_flavor"], force_anbox_check=False,
|
||||
force_nftables_check=False,
|
||||
force_containers_check=False,
|
||||
force_zram_check=False,
|
||||
details=True)
|
||||
|
|
|
@ -434,6 +434,17 @@ necessary_kconfig_options_containers = {
|
|||
},
|
||||
}
|
||||
|
||||
necessary_kconfig_options_zram = {
|
||||
">=3.14.0": { # zram support introduced here
|
||||
"all": { # all arches
|
||||
"ZSMALLOC_STAT": True,
|
||||
"ZRAM_MEMORY_TRACKING": True,
|
||||
"CRYPTO_LZ4": True,
|
||||
"LZ4_COMPRESS": True,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
#
|
||||
# PARSE
|
||||
#
|
||||
|
|
|
@ -377,6 +377,7 @@ def kconfig(args):
|
|||
anbox=args.anbox,
|
||||
nftables=args.nftables,
|
||||
containers=args.containers,
|
||||
zram=args.zram,
|
||||
details=True):
|
||||
logging.info("kconfig check succeeded!")
|
||||
return
|
||||
|
@ -409,6 +410,7 @@ def kconfig(args):
|
|||
force_anbox_check=args.anbox,
|
||||
force_nftables_check=args.nftables,
|
||||
force_containers_check=args.containers,
|
||||
force_zram_check=args.zram,
|
||||
details=True):
|
||||
error = True
|
||||
|
||||
|
|
|
@ -441,6 +441,8 @@ def arguments_kconfig(subparser):
|
|||
" options needed for nftables too")
|
||||
check.add_argument("--containers", action="store_true",
|
||||
help="check options needed for containers too")
|
||||
check.add_argument("--zram", action="store_true", help="check"
|
||||
" options needed for zram support too")
|
||||
check_package = check.add_argument("package", default="", nargs='?')
|
||||
if argcomplete:
|
||||
check_package.completer = kernel_completer
|
||||
|
|
|
@ -65,7 +65,8 @@ def check_option(component, details, config, config_path_pretty, option,
|
|||
|
||||
|
||||
def check_config(config_path, config_path_pretty, config_arch, pkgver,
|
||||
anbox=False, nftables=False, containers=False, details=False):
|
||||
anbox=False, nftables=False, containers=False, zram=False,
|
||||
details=False):
|
||||
logging.debug(f"Check kconfig: {config_path}")
|
||||
with open(config_path) as handle:
|
||||
config = handle.read()
|
||||
|
@ -78,6 +79,8 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver,
|
|||
if containers:
|
||||
components["containers"] = \
|
||||
pmb.config.necessary_kconfig_options_containers
|
||||
if zram:
|
||||
components["zram"] = pmb.config.necessary_kconfig_options_zram
|
||||
|
||||
results = [check_config_options_set(config, config_path_pretty,
|
||||
config_arch, options, component,
|
||||
|
@ -121,7 +124,7 @@ def check_config_options_set(config, config_path_pretty, config_arch, options,
|
|||
|
||||
|
||||
def check(args, pkgname, force_anbox_check=False, force_nftables_check=False,
|
||||
force_containers_check=False, details=False):
|
||||
force_containers_check=False, force_zram_check=False, details=False):
|
||||
"""
|
||||
Check for necessary kernel config options in a package.
|
||||
|
||||
|
@ -146,6 +149,8 @@ def check(args, pkgname, force_anbox_check=False, force_nftables_check=False,
|
|||
"pmb:kconfigcheck-nftables" in apkbuild["options"])
|
||||
check_containers = force_containers_check or (
|
||||
"pmb:kconfigcheck-containers" in apkbuild["options"])
|
||||
check_zram = force_zram_check or (
|
||||
"pmb:kconfigcheck-zram" in apkbuild["options"])
|
||||
for config_path in glob.glob(aport + "/config-*"):
|
||||
# The architecture of the config is in the name, so it just needs to be
|
||||
# extracted
|
||||
|
@ -156,6 +161,7 @@ def check(args, pkgname, force_anbox_check=False, force_nftables_check=False,
|
|||
anbox=check_anbox,
|
||||
nftables=check_nftables,
|
||||
containers=check_containers,
|
||||
zram=check_zram,
|
||||
details=details)
|
||||
return ret
|
||||
|
||||
|
@ -193,7 +199,7 @@ def extract_version(config_file):
|
|||
|
||||
|
||||
def check_file(args, config_file, anbox=False, nftables=False,
|
||||
containers=False, details=False):
|
||||
containers=False, zram=False, details=False):
|
||||
"""
|
||||
Check for necessary kernel config options in a kconfig file.
|
||||
|
||||
|
@ -207,4 +213,5 @@ def check_file(args, config_file, anbox=False, nftables=False,
|
|||
anbox=anbox,
|
||||
nftables=nftables,
|
||||
containers=containers,
|
||||
zram=zram,
|
||||
details=details)
|
||||
|
|
|
@ -36,6 +36,8 @@ def test_kconfig_check(args):
|
|||
nftables=True)
|
||||
assert not pmb.parse.kconfig.check_file(args, dir + "bad-nftables",
|
||||
nftables=True)
|
||||
assert pmb.parse.kconfig.check_file(args, dir + "good-zram",
|
||||
zram=True)
|
||||
|
||||
# tests on real devices
|
||||
|
||||
|
@ -49,3 +51,6 @@ def test_kconfig_check(args):
|
|||
# testing the force param: nokia-n900 will never have anbox support
|
||||
assert not pmb.parse.kconfig.check(args, "nokia-n900",
|
||||
force_anbox_check=True)
|
||||
|
||||
# supports zram (with pmb:kconfigcheck-zram), nftables
|
||||
assert pmb.parse.kconfig.check(args, "linux-purism-librem5")
|
||||
|
|
56
test/testdata/kconfig_check/good-zram
vendored
Normal file
56
test/testdata/kconfig_check/good-zram
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/arm64 5.12.2 Kernel Configuration
|
||||
#
|
||||
CONFIG_CC_VERSION_TEXT="aarch64-alpine-linux-musl-gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424"
|
||||
CONFIG_CC_IS_GCC=y
|
||||
CONFIG_GCC_VERSION=100301
|
||||
CONFIG_CLANG_VERSION=0
|
||||
CONFIG_LD_IS_BFD=y
|
||||
CONFIG_LD_VERSION=23502
|
||||
CONFIG_LLD_VERSION=0
|
||||
CONFIG_CC_HAS_ASM_GOTO=y
|
||||
CONFIG_CC_HAS_ASM_INLINE=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
CONFIG_BUILDTIME_TABLE_SORT=y
|
||||
CONFIG_THREAD_INFO_IN_TASK=y
|
||||
|
||||
#
|
||||
# General setup
|
||||
#
|
||||
CONFIG_LOCALVERSION="-zram-good"
|
||||
CONFIG_BUILD_SALT=""
|
||||
CONFIG_HAVE_KERNEL_GZIP=y
|
||||
CONFIG_HAVE_KERNEL_LZO=y
|
||||
CONFIG_KERNEL_GZIP=y
|
||||
# CONFIG_KERNEL_LZMA is not set
|
||||
CONFIG_DEFAULT_HOSTNAME="(none)"
|
||||
CONFIG_SWAP=y
|
||||
# needed for bubblewrap
|
||||
CONFIG_USER_NS=y
|
||||
CONFIG_BLK_DEV_INITRD=y
|
||||
CONFIG_CGROUPS=y
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_DM_CRYPT=y
|
||||
CONFIG_SYSVIPC=y
|
||||
CONFIG_VT=y
|
||||
CONFIG_UEVENT_HELPER=y
|
||||
CONFIG_LBDAF=y
|
||||
CONFIG_CRYPTO_XTS=y
|
||||
CONFIG_TMPFS_POSIX_ACL=y
|
||||
### here's one explicitely disabled:
|
||||
# ANDROID_PARANOID_NETWORK is not set
|
||||
### here's one set to module:
|
||||
CONFIG_EXT4_FS=m
|
||||
### here's a line set to no:
|
||||
CONFIG_KINETO_GAN=n
|
||||
|
||||
# the required options
|
||||
#
|
||||
CONFIG_ZSMALLOC=y
|
||||
CONFIG_ZSMALLOC_STAT=y
|
||||
CONFIG_ZRAM=m
|
||||
CONFIG_ZRAM_WRITEBACK=y
|
||||
CONFIG_ZRAM_MEMORY_TRACKING=y
|
||||
CONFIG_CRYPTO_LZ4=y
|
||||
CONFIG_LZ4_COMPRESS=y
|
Loading…
Add table
Add a link
Reference in a new issue