diff --git a/pmb/build/menuconfig.py b/pmb/build/menuconfig.py index 1caca557..da9e4c24 100644 --- a/pmb/build/menuconfig.py +++ b/pmb/build/menuconfig.py @@ -158,4 +158,5 @@ def menuconfig(args, pkgname, use_oldconfig): force_containers_check=False, force_zram_check=False, force_netboot_check=False, + force_uefi_check=False, details=True) diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index 399f73b2..97fa673f 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -581,6 +581,22 @@ necessary_kconfig_options_netboot = { }, } +# Necessary UEFI boot config options +necessary_kconfig_options_uefi = { + ">=0.0.0": { # all versions + "all": { # all arches + "EFI_STUB": True, + "EFI": True, + "DMI": True, + "EFI_ESRT": True, + "EFI_VARS_PSTORE": True, + "EFI_PARAMS_FROM_FDT": True, + "EFI_RUNTIME_WRAPPERS": True, + "EFI_GENERIC_STUB": True, + } + }, +} + # # PARSE # diff --git a/pmb/helpers/frontend.py b/pmb/helpers/frontend.py index 2f15b136..32d297a7 100644 --- a/pmb/helpers/frontend.py +++ b/pmb/helpers/frontend.py @@ -384,6 +384,7 @@ def kconfig(args): containers=args.containers, zram=args.zram, netboot=args.netboot, + uefi=args.uefi, details=True): logging.info("kconfig check succeeded!") return @@ -420,6 +421,7 @@ def kconfig(args): force_containers_check=args.containers, force_zram_check=args.zram, force_netboot_check=args.netboot, + force_uefi_check=args.uefi, details=True): error = True diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index 42e8970c..7d571c12 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -477,7 +477,9 @@ def arguments_kconfig(subparser): 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") + " options needed for netbooting too") + check.add_argument("--uefi", action="store_true", help="check" + " options needed for uefi too") add_kernel_arg(check) # "pmbootstrap kconfig edit" diff --git a/pmb/parse/kconfig.py b/pmb/parse/kconfig.py index 760164a2..0c187f66 100644 --- a/pmb/parse/kconfig.py +++ b/pmb/parse/kconfig.py @@ -92,6 +92,7 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver, containers=False, zram=False, netboot=False, + uefi=False, details=False): logging.debug(f"Check kconfig: {config_path}") with open(config_path) as handle: @@ -113,6 +114,8 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver, components["zram"] = pmb.config.necessary_kconfig_options_zram if netboot: components["netboot"] = pmb.config.necessary_kconfig_options_netboot + if uefi: + components["uefi"] = pmb.config.necessary_kconfig_options_uefi results = [check_config_options_set(config, config_path_pretty, config_arch, options, component, @@ -163,6 +166,7 @@ def check(args, pkgname, force_containers_check=False, force_zram_check=False, force_netboot_check=False, + force_uefi_check=False, details=False): """ Check for necessary kernel config options in a package. @@ -194,6 +198,8 @@ def check(args, pkgname, "pmb:kconfigcheck-zram" in apkbuild["options"]) check_netboot = force_netboot_check or ( "pmb:kconfigcheck-netboot" in apkbuild["options"]) + check_uefi = force_uefi_check or ( + "pmb:kconfigcheck-uefi" 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 @@ -208,6 +214,7 @@ def check(args, pkgname, containers=check_containers, zram=check_zram, netboot=check_netboot, + uefi=check_uefi, details=details) return ret @@ -245,7 +252,8 @@ def extract_version(config_file): def check_file(config_file, anbox=False, nftables=False, - containers=False, zram=False, netboot=False, details=False): + containers=False, zram=False, netboot=False, uefi=False, + details=False): """ Check for necessary kernel config options in a kconfig file. @@ -261,4 +269,5 @@ def check_file(config_file, anbox=False, nftables=False, containers=containers, zram=zram, netboot=netboot, + uefi=uefi, details=details) diff --git a/test/test_kconfig_check.py b/test/test_kconfig_check.py index d66be62c..116c9768 100644 --- a/test/test_kconfig_check.py +++ b/test/test_kconfig_check.py @@ -38,6 +38,10 @@ def test_kconfig_check(args): nftables=True) assert pmb.parse.kconfig.check_file(dir + "good-zram", zram=True) + assert pmb.parse.kconfig.check_file(dir + "good-uefi", + uefi=True) + assert not pmb.parse.kconfig.check_file(dir + "bad-uefi", + uefi=True) # tests on real devices # *** do not add more of these! *** diff --git a/test/testdata/kconfig_check/bad-uefi b/test/testdata/kconfig_check/bad-uefi new file mode 100644 index 00000000..e2f0f2da --- /dev/null +++ b/test/testdata/kconfig_check/bad-uefi @@ -0,0 +1,58 @@ +# +# 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)" +# needed for bubblewrap +CONFIG_USER_NS=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_CGROUPS=y +CONFIG_DEVTMPFS=y +CONFIG_DM_CRYPT=y +CONFIG_INPUT_EVDEV=y +CONFIG_SYSVIPC=y +CONFIG_VT=y +CONFIG_UEVENT_HELPER=y +CONFIG_LBDAF=y +CONFIG_CRYPTO_AES=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_EFI=n +CONFIG_EFI_STUB=n +CONFIG_DMI=n +CONFIG_EFI_ESRT=n +CONFIG_EFI_VARS_PSTORE=n +CONFIG_EFI_PARAMS_FROM_FDT=n +CONFIG_EFI_RUNTIME_WRAPPERS=n +CONFIG_EFI_GENERIC_STUB=n diff --git a/test/testdata/kconfig_check/good-uefi b/test/testdata/kconfig_check/good-uefi new file mode 100644 index 00000000..a7df17aa --- /dev/null +++ b/test/testdata/kconfig_check/good-uefi @@ -0,0 +1,58 @@ +# +# 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)" +# needed for bubblewrap +CONFIG_USER_NS=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_CGROUPS=y +CONFIG_DEVTMPFS=y +CONFIG_DM_CRYPT=y +CONFIG_INPUT_EVDEV=y +CONFIG_SYSVIPC=y +CONFIG_VT=y +CONFIG_UEVENT_HELPER=y +CONFIG_LBDAF=y +CONFIG_CRYPTO_AES=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_EFI=y +CONFIG_EFI_STUB=y +CONFIG_DMI=y +CONFIG_EFI_ESRT=y +CONFIG_EFI_VARS_PSTORE=y +CONFIG_EFI_PARAMS_FROM_FDT=y +CONFIG_EFI_RUNTIME_WRAPPERS=y +CONFIG_EFI_GENERIC_STUB=y