Skip to content
Snippets Groups Projects
Unverified Commit aa847501 authored by Caleb Connolly's avatar Caleb Connolly :recycle: Committed by Oliver Smith
Browse files

build: envkernel: overmount outdir/Makefile to use local include (MR 2504)


the kernel has pending patches in -next which adjust the generated
Makefile in the output directory to include the source tree makefile
with an absolute path, this breaks envkernel which relies on it being a
relative path.

Fix this by mounting our own Makefile instead using the relative path.

Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
parent 932ac187
No related branches found
No related tags found
No related merge requests found
Pipeline #211305 failed
......@@ -119,6 +119,20 @@ def modify_apkbuild(pkgname: str, aport: Path) -> None:
pmb.aportgen.core.rewrite(pkgname, apkbuild_path, fields=fields)
def overmount_makefile(context: Context, kbuild_out: str) -> None:
makefile = context.config.work / "tmp_kernel.mk"
makefile.open("w").write("""
# Automatically generated by pmbootstrap to use relative include paths
include ../Makefile
""")
makefile_target = Chroot.native() / "mnt/linux" / kbuild_out / "Makefile"
logging.info("Overmounting Makefile to use relative include paths")
if not pmb.helpers.mount.ismount(makefile_target):
pmb.helpers.mount.bind_file(makefile, makefile_target)
def run_abuild(
context: Context, pkgname: str, arch: Arch, apkbuild_path: Path, kbuild_out: str
) -> None:
......@@ -141,6 +155,9 @@ def run_abuild(
pmb.helpers.mount.bind(Path("."), chroot / "mnt/linux")
if kbuild_out:
overmount_makefile(context, kbuild_out)
if not os.path.exists(chroot / kbuild_out_source):
raise RuntimeError(
"No '.output' dir found in your kernel source dir. "
......@@ -180,7 +197,7 @@ def run_abuild(
)
# Create symlink from abuild working directory to envkernel build directory
pmb.chroot.root(["ln", "-sf", "/mnt/linux", build_path / "src"])
pmb.chroot.root(["ln", "-sf", kbuild_out_source, build_path / "src"])
cmd: list[PathString] = ["cp", apkbuild_path, chroot / build_path / "APKBUILD"]
pmb.helpers.run.root(cmd)
......
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