pmbootstrap kconfig check: add netboot check (MR 2064)

Allow checking for the necessary kernel option for netboot.

Co-authored-by: Luca Weiss <luca@z3ntu.xyz>
This commit is contained in:
Mark Hargreaves 2021-07-01 18:32:13 +03:00 committed by Oliver Smith
parent 47539f1bef
commit ff0942b12d
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 23 additions and 1 deletions

View file

@ -157,4 +157,5 @@ def menuconfig(args, pkgname, use_oldconfig):
force_nftables_check=False,
force_containers_check=False,
force_zram_check=False,
force_netboot_check=False,
details=True)

View file

@ -563,6 +563,15 @@ necessary_kconfig_options_zram = {
},
}
# Necessary netboot kernel config options
necessary_kconfig_options_netboot = {
">=0.0.0": { # all versions
"all": { # all arches
"BLK_DEV_NBD": True,
}
},
}
#
# PARSE
#

View file

@ -379,6 +379,7 @@ def kconfig(args):
nftables=args.nftables,
containers=args.containers,
zram=args.zram,
netboot=args.netboot,
details=True):
logging.info("kconfig check succeeded!")
return
@ -414,6 +415,7 @@ def kconfig(args):
force_nftables_check=args.nftables,
force_containers_check=args.containers,
force_zram_check=args.zram,
force_netboot_check=args.netboot,
details=True):
error = True

View file

@ -456,6 +456,8 @@ def arguments_kconfig(subparser):
help="check options needed for containers too")
check.add_argument("--zram", action="store_true", help="check"
" options needed for zram support too")
check.add_argument("--netboot", action="store_true", help="check"
" options needed for netboooting too")
add_kernel_arg(check)
# "pmbootstrap kconfig edit"

View file

@ -91,6 +91,7 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver,
nftables=False,
containers=False,
zram=False,
netboot=False,
details=False):
logging.debug(f"Check kconfig: {config_path}")
with open(config_path) as handle:
@ -110,6 +111,8 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver,
pmb.config.necessary_kconfig_options_containers
if zram:
components["zram"] = pmb.config.necessary_kconfig_options_zram
if netboot:
components["netboot"] = pmb.config.necessary_kconfig_options_netboot
results = [check_config_options_set(config, config_path_pretty,
config_arch, options, component,
@ -159,6 +162,7 @@ def check(args, pkgname,
force_nftables_check=False,
force_containers_check=False,
force_zram_check=False,
force_netboot_check=False,
details=False):
"""
Check for necessary kernel config options in a package.
@ -188,6 +192,8 @@ def check(args, pkgname,
"pmb:kconfigcheck-containers" in apkbuild["options"])
check_zram = force_zram_check or (
"pmb:kconfigcheck-zram" in apkbuild["options"])
check_netboot = force_netboot_check or (
"pmb:kconfigcheck-netboot" 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
@ -201,6 +207,7 @@ def check(args, pkgname,
nftables=check_nftables,
containers=check_containers,
zram=check_zram,
netboot=check_netboot,
details=details)
return ret
@ -238,7 +245,7 @@ def extract_version(config_file):
def check_file(config_file, anbox=False, nftables=False,
containers=False, zram=False, details=False):
containers=False, zram=False, netboot=False, details=False):
"""
Check for necessary kernel config options in a kconfig file.
@ -253,4 +260,5 @@ def check_file(config_file, anbox=False, nftables=False,
nftables=nftables,
containers=containers,
zram=zram,
netboot=netboot,
details=details)