Skip to content
Snippets Groups Projects
Commit 16c55eb4 authored by Anri Dellal's avatar Anri Dellal
Browse files

WIP: Add support for multiple arches (untested)

parent 55303c77
No related branches found
No related tags found
No related merge requests found
......@@ -62,17 +62,23 @@ def get_outputdir(args, pkgname, apkbuild):
ret = pmb.chroot.user(args, ["sh", "-c", cmd],
"native", "/home/pmos/build",
output_return=True).rstrip()
if os.path.exists(f"{chroot}{ret}/.config"):
logging.info(f"DEBUG: {apkbuild['_kconfig_name']} "
f"arch:{apkbuild['arch'][0]}")
if (os.path.exists(f"{chroot}{ret}/.config") or
os.path.exists(f"{chroot}{ret}/{apkbuild['_kconfig_name']}."
f"{apkbuild['arch'][0]}")):
return ret
# Some Mediatek kernels use a 'kernel' subdirectory
if os.path.exists(f"{chroot}{ret}/kernel/.config"):
return os.path.join(ret, "kernel")
# Out-of-tree builds ($_outdir)
if (os.path.exists(f"{chroot}{ret}/{apkbuild['_outdir']}/.config") or
os.path.exists(f"{chroot}{ret}/{apkbuild['_outdir']}/"
f"{apkbuild['_kconfig_name']}.diff")):
return os.path.join(ret, apkbuild["_outdir"])
outdir = apkbuild['_outdir']
if (os.path.exists(f"{chroot}{ret}/outdir/.config") or
os.path.exists(f"{chroot}{ret}/outdir/"
f"{apkbuild['_kconfig_name']}."
f"{apkbuild['arch'][0]}")):
return os.path.join(ret, outdir)
# Not found
raise RuntimeError("Could not find the kernel config. Consider making a"
......@@ -130,7 +136,7 @@ def menuconfig(args, pkgname):
outputdir = get_outputdir(args, pkgname, apkbuild)
arch_kernel = pmb.parse.arch.alpine_to_kernel(arch)
kconfig_name = apkbuild["_kconfig_name"]
kconfig_diff = f"{kconfig_name}.diff"
kconfig_diff = f"{kconfig_name}.{arch_kernel}"
# Run make menuconfig
logging.info(f"(native) make {kopt}")
......
......@@ -128,35 +128,43 @@ def check(args, pkgname, force_anbox_check=False, details=False):
("pmb:kconfigcheck-anbox" in apkbuild["options"]))
kconfig_name = apkbuild["_kconfig_name"]
config_arch = None
paths = None
if kconfig_name:
# setup chroot
config_arch = apkbuild["arch"][0]
pmb.build.init(args)
depends = apkbuild["makedepends"]
depends += ["diffconfig", "mergeconfig"]
paths = []
# setup chroot
pmb.build.init(args)
pmb.chroot.apk.install(args, depends)
pmb.build.copy_to_buildpath(args, f"linux-{flavor}")
logging.info("(native) extract kernel source")
pmb.chroot.user(args, ["abuild", "unpack"], "native",
"/home/pmos/build")
logging.info("(native) apply patches")
pmb.chroot.user(args, ["abuild", "prepare"], "native",
"/home/pmos/build", output="interactive",
env={"CARCH": config_arch})
outputdir = pmb.build.menuconfig.get_outputdir(args,
f"linux-{flavor}",
apkbuild)
paths = [f"{args.work}/chroot_native{outputdir}/.config"]
for arch in apkbuild["arch"]:
pmb.chroot.user(args, ["abuild", "prepare"], "native",
"/home/pmos/build", output="interactive",
env={"CARCH": arch})
outputdir = pmb.build.menuconfig.get_outputdir(args,
f"linux-{flavor}",
apkbuild)
cfg_filename = f"{kconfig_name}.{arch}"
pmb.chroot.user(args, ["cp", ".config", f"/tmp/{cfg_filename}"],
"native", outputdir)
paths += [f"{args.work}/chroot_native/tmp/{cfg_filename}"]
pmb.chroot.user(args, ["make", "clean"], "native",
f'/home/pmos/build/src/{apkbuild["builddir"]}')
else:
paths = glob.glob(f"{aport}/config-*")
for config_path in paths:
# The architecture of the config is in the name, so it just needs to be
# extracted
if not kconfig_name:
config_arch = os.path.basename(config_path).split(".")[1]
config_path_pretty = f"linux-{flavor}/{os.path.basename(config_path)}"
config_arch = os.path.basename(config_path).split(".")[1]
if kconfig_name:
config_path_pretty = f"{aport}/{kconfig_name}.{config_arch}"
else:
config_path_pretty = f"linux-{flavor}/" \
f"{os.path.basename(config_path)}"
ret &= check_config(config_path, config_path_pretty, config_arch,
pkgver, details=details)
if check_anbox:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment