Compare commits

..

No commits in common. "8c7e99acd942bcda8563cad4eac03961a322a3da" and "2e39912790e54bb18acd4fe25dbd017052ef5aff" have entirely different histories.

13 changed files with 25 additions and 229 deletions

View File

@ -260,7 +260,7 @@ set_alias_pmbroot_kernelroot() {
cross_compiler_version() {
if [ "$need_cross_compiler" = 1 ]; then
"$pmbootstrap" chroot --user -- "${cross_compiler}gcc" --version \
pmbootstrap chroot --user -- "${cross_compiler}gcc" --version \
2> /dev/null | grep "^.*gcc " | \
awk -F'[()]' '{ print $1 "("$2")" }'
else

View File

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

View File

@ -17,7 +17,7 @@ from pmb.config.sudo import which_sudo
#
# Exported variables (internal configuration)
#
version = "1.43.1"
version = "1.42.0"
pmb_src = os.path.normpath(os.path.realpath(__file__) + "/../../..")
apk_keys_path = pmb_src + "/pmb/data/keys"
arch_native = pmb.parse.arch.alpine_native()
@ -27,11 +27,11 @@ arch_native = pmb.parse.arch.alpine_native()
# Update this frequently to prevent a MITM attack with an outdated version
# (which may contain a vulnerable apk/openssl, and allows an attacker to
# exploit the system!)
apk_tools_min_version = {"edge": "2.12.9-r3",
apk_tools_min_version = {"edge": "2.12.9-r1",
"v3.15": "2.12.7-r3",
"v3.14": "2.12.7-r0",
"v3.13": "2.12.7-r0",
"v3.12": "2.10.8-r1"}
"v3.12": "2.10.8-r0"}
# postmarketOS aports compatibility (checked against "version" in pmaports.cfg)
pmaports_min_version = "7"
@ -336,6 +336,7 @@ necessary_kconfig_options_anbox = {
"SQUASHFS_XZ": True,
"SQUASHFS_XATTR": True,
"TMPFS_XATTR": True,
"ASHMEM": True,
"ANDROID_BINDER_IPC": True,
"ANDROID_BINDERFS": False,
"ANDROID_BINDER_DEVICES": ["binder", "hwbinder"],
@ -361,11 +362,6 @@ necessary_kconfig_options_anbox = {
"PSI": True, # required by userspace OOM killer in Waydroid
"PSI_DEFAULT_DISABLED": False,
}
},
"<5.18_rc1": { # option has been dropped
"all": {
"ASHMEM": True,
}
}
}
@ -585,22 +581,6 @@ 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
#
@ -731,7 +711,6 @@ deviceinfo_attributes = [
"flash_pagesize",
"flash_fastboot_max_size",
"flash_sparse",
"flash_sparse_samsung_format",
"rootfs_image_sector_size",
"sd_embed_firmware",
"sd_embed_firmware_step_size",
@ -902,10 +881,7 @@ flashers = {
"--padding_size", "$FLASH_PAGESIZE",
"--output", "/vbmeta.img"],
["heimdall", "flash", "--$PARTITION_VBMETA", "/vbmeta.img"],
["rm", "-f", "/vbmeta.img"]],
"flash_lk2nd": [
["heimdall_wait_for_device.sh"],
["heimdall", "flash", "--$PARTITION_KERNEL", "$BOOT/lk2nd.img"]]
["rm", "-f", "/vbmeta.img"]]
},
},
"adb": {

View File

@ -384,7 +384,6 @@ def kconfig(args):
containers=args.containers,
zram=args.zram,
netboot=args.netboot,
uefi=args.uefi,
details=True):
logging.info("kconfig check succeeded!")
return
@ -421,7 +420,6 @@ 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

View File

@ -714,19 +714,6 @@ def install_system_image(args, size_reserve, suffix, step, steps,
pmb.chroot.user(args, ["mv", "-f", sys_image_sparse, sys_image],
working_dir="/home/pmos/rootfs/")
# patch sparse image for Samsung devices if specified
samsungify_strategy = args.deviceinfo["flash_sparse_samsung_format"]
if samsungify_strategy:
logging.info("(native) convert sparse image into Samsung's sparse image format")
pmb.chroot.apk.install(args, ["sm-sparse-image-tool"])
sys_image = f"{args.device}.img"
sys_image_patched = f"{args.device}-patched.img"
pmb.chroot.user(args, ["sm_sparse_image_tool", "samsungify", "--strategy",
samsungify_strategy, sys_image, sys_image_patched],
working_dir="/home/pmos/rootfs/")
pmb.chroot.user(args, ["mv", "-f", sys_image_patched, sys_image],
working_dir="/home/pmos/rootfs/")
def print_flash_info(args):
""" Print flashing information, based on the deviceinfo data and the
@ -803,7 +790,7 @@ def print_flash_info(args):
if "flash_lk2nd" in flasher_actions and \
os.path.exists(args.work + "/chroot_rootfs_" + args.device +
"/boot/lk2nd.img"):
logging.info("* Your device supports and may even require"
logging.info(" * Your device supports and may even require"
" flashing lk2nd. You should flash it before"
" flashing anything else. Use 'pmbootstrap flasher"
" flash_lk2nd' to do that.")
@ -995,14 +982,7 @@ def create_device_rootfs(args, step, steps):
setup_keymap(args)
# Set timezone
arch = args.deviceinfo["arch"]
package = pmb.helpers.package.get(args, "alpine-conf", arch)
version = package["version"].split("-r")[0]
if not pmb.parse.version.check_string(version, ">=3.14.0"):
pmb.chroot.root(args, ["setup-timezone", "-z", args.timezone], suffix)
else:
pmb.chroot.root(args, ["setup-timezone", args.timezone], suffix)
pmb.chroot.root(args, ["setup-timezone", "-z", args.timezone], suffix)
# Set locale
if locale_is_set:

View File

@ -19,27 +19,23 @@ def partitions_mount(args, layout, sdcard):
img_path = "/home/pmos/rootfs/" + args.device + ".img"
prefix = pmb.install.losetup.device_by_back_file(args, img_path)
partition_prefix = None
tries = 20
# Devices ending with a number have a "p" before the partition number,
# /dev/sda1 has no "p", but /dev/mmcblk0p1 has. See add_partition() in
# block/partitions/core.c of linux.git.
partition_prefix = prefix
if str.isdigit(prefix[-1:]):
partition_prefix = f"{prefix}p"
found = False
for i in range(tries):
if os.path.exists(f"{partition_prefix}1"):
found = True
for symbol in ["p", ""]:
if os.path.exists(prefix + symbol + "1"):
partition_prefix = symbol
if partition_prefix is not None:
break
logging.debug(f"NOTE: ({i + 1}/{tries}) failed to find the install "
"partition. Retrying...")
time.sleep(0.1)
if not found:
raise RuntimeError(f"Unable to find the first partition of {prefix}, "
f"expected it to be at {partition_prefix}1!")
if partition_prefix is None:
raise RuntimeError("Unable to find the partition prefix,"
" expected the first partition of " +
prefix + " to be located at " + prefix +
"1 or " + prefix + "p1!")
partitions = [layout["boot"], layout["root"]]
@ -47,7 +43,7 @@ def partitions_mount(args, layout, sdcard):
partitions += [layout["kernel"]]
for i in partitions:
source = f"{partition_prefix}{i}"
source = prefix + partition_prefix + str(i)
target = args.work + "/chroot_native/dev/installp" + str(i)
pmb.helpers.mount.bind_file(args, source, target)

View File

@ -477,9 +477,7 @@ 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 netbooting too")
check.add_argument("--uefi", action="store_true", help="check"
" options needed for uefi too")
" options needed for netboooting too")
add_kernel_arg(check)
# "pmbootstrap kconfig edit"

View File

@ -144,11 +144,6 @@ def recurse(args, pkgnames, suffix="native"):
# Nothing found
if not package:
if is_conflict:
# This package was probably dropped from the repos, so we don't
# care if it doesn't exist since it's a conflicting depend that
# wouldn't be installed anyways.
continue
source = 'world'
if pkgname_depend in required_by:
source = ', '.join(required_by[pkgname_depend])

View File

@ -92,7 +92,6 @@ 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:
@ -114,8 +113,6 @@ 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,
@ -166,7 +163,6 @@ 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.
@ -198,23 +194,10 @@ 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
config_name = os.path.basename(config_path)
config_name_split = config_name.split(".")
if len(config_name_split) != 2:
raise RuntimeError(f"{config_name} is not a valid kernel config "
"name. Ensure that the _config property in your "
"kernel APKBUILD has a . before the "
"architecture name, e.g. .aarch64 or .armv7, "
"and that there is no excess punctuation "
"elsewhere in the name.")
config_arch = config_name_split[1]
config_arch = os.path.basename(config_path).split(".")[1]
config_path_pretty = f"linux-{flavor}/{os.path.basename(config_path)}"
ret &= check_config(config_path, config_path_pretty, config_arch,
pkgver,
@ -225,7 +208,6 @@ def check(args, pkgname,
containers=check_containers,
zram=check_zram,
netboot=check_netboot,
uefi=check_uefi,
details=details)
return ret
@ -263,8 +245,7 @@ def extract_version(config_file):
def check_file(config_file, anbox=False, nftables=False,
containers=False, zram=False, netboot=False, uefi=False,
details=False):
containers=False, zram=False, netboot=False, details=False):
"""
Check for necessary kernel config options in a kconfig file.
@ -273,12 +254,11 @@ def check_file(config_file, anbox=False, nftables=False,
arch = extract_arch(config_file)
version = extract_version(config_file)
logging.debug(f"Check kconfig: parsed arch={arch}, version={version} from "
f"file: {config_file}")
"file: {config_file}")
return check_config(config_file, config_file, arch, version,
anbox=anbox,
nftables=nftables,
containers=containers,
zram=zram,
netboot=netboot,
uefi=uefi,
details=details)

View File

@ -38,15 +38,8 @@ 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! ***
# moving forward, tests in pmbootstrap.git should become more/completely
# independent of the currently checked out pmaports.git (#2105)
# it's a postmarketOS device, it will have the required options, and
# supports nftables (with pmb:kconfigcheck-nftables)

View File

@ -146,16 +146,13 @@ def test_recurse(args, monkeypatch):
depends = {
"test": ["libtest", "so:libtest.so.1"],
"libtest": ["libtest_depend"],
"libtest_depend": ["!libtest_conflict", "!libtest_conflict_missing"],
"libtest_depend": ["!libtest_conflict"],
"libtest_conflict": [],
"so:libtest.so.1": ["libtest_depend"],
}
def package_from_index(args, pkgname, install, aport, suffix):
if pkgname in depends:
return {"pkgname": pkgname, "depends": depends[pkgname]}
else:
return None
return {"pkgname": pkgname, "depends": depends[pkgname]}
monkeypatch.setattr(pmb.parse.depends, "package_from_index",
package_from_index)

View File

@ -1,58 +0,0 @@
#
# 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

View File

@ -1,58 +0,0 @@
#
# 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