Build Linux and the Linux driver out of tree
Linux and the Hafnium module have been built inside their source tree so
far. The targets have a hardcoded toolchain but they get built multiple
times, once for each toolchain defined in GN. This can cause the build
to fail when two instances attempt to compile the same file at the same
time. Refactor the build scripts to compile the kernel and the module
in the out/ directory of each corresponding toolchain.
This cleans up the build files a bit but also introduces a new problem.
Out-of-tree kernel modules do not support building out of their folder.
This patch avoids that by copying the source files into
`target_out_dir`.
Test: kokoro/ubuntu/build.sh
Change-Id: I6fc10ebd9623f5f82dd086447b80d935c490765e
diff --git a/build/make.py b/build/make.py
index d4cc0d8..75f0b7b 100644
--- a/build/make.py
+++ b/build/make.py
@@ -26,8 +26,8 @@
def Main():
parser = argparse.ArgumentParser()
parser.add_argument("--directory", required=True)
- parser.add_argument("--out_file", required=True)
- parser.add_argument("--copy_out_file", required=True)
+ parser.add_argument("--copy_out_file", nargs=2,
+ help="Copy file after building. Takes two params: <src> <dest>")
args, make_args = parser.parse_known_args()
os.chdir(args.directory)
@@ -36,7 +36,8 @@
if status != 0:
return status
- shutil.copyfile(args.out_file, args.copy_out_file)
+ if args.copy_out_file is not None:
+ shutil.copyfile(args.copy_out_file[0], args.copy_out_file[1])
return 0