diff --git a/README.md b/README.md index 2b6f8d5..f19fc97 100644 --- a/README.md +++ b/README.md @@ -120,12 +120,12 @@ Output subdirectory doesn't exist, create it Copy kconfig to output subdirectory as ".config" Going to save build log to "build_log.txt" in output subdirectory Create additional arguments for cross-compilation: ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -Run the container: bash ./run_container.sh gcc-8 /home/a13x/linux/linux /home/a13x/linux/build_out/experiment__aarch64__gcc-8 make O=~/out/ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j5 2>&1 | tee ~/out/build_log.txt +Run the container: bash ./run_container.sh gcc-8 /home/a13x/linux/linux /home/a13x/linux/build_out/experiment__aarch64__gcc-8 make O=~/out/ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j5 2>&1 Hey, we gonna use sudo for running docker Starting "kernel-build-container:gcc-8" Source code directory "/home/a13x/linux/linux" is mounted at "~/src" Build output directory "/home/a13x/linux/build_out/experiment__aarch64__gcc-8" is mounted at "~/out" - Gonna run "make O=~/out/ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j5 2>&1 | tee ~/out/build_log.txt" + Gonna run "make O=~/out/ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j5 2>&1" make[1]: Entering directory '/home/a13x/out' GEN Makefile diff --git a/make_linux.py b/make_linux.py index b6a0d2b..0fbbb8b 100755 --- a/make_linux.py +++ b/make_linux.py @@ -43,8 +43,9 @@ def build_kernel(arch, kconfig, src, out, compiler, make_args): print('Copy kconfig to output subdirectory as ".config"') shutil.copyfile(kconfig, out_subdir + '/.config') - build_log = 'build_log.txt' - print('Going to save build log to "{}" in output subdirectory'.format(build_log)) + build_log = out_subdir + '/build_log.txt' + print('Going to save build log to "build_log.txt" in output subdirectory') + build_log_fd = open(build_log, "w") run_container_cmd = ['bash', './run_container.sh', compiler, src, out_subdir, '-n', 'make', 'O=~/out/'] @@ -55,16 +56,18 @@ def build_kernel(arch, kconfig, src, out, compiler, make_args): run_container_cmd.extend(make_args) - run_container_cmd.extend(['2>&1', '|', 'tee', '~/out/' + build_log]) + run_container_cmd.extend(['2>&1']) print('Run the container: {}'.format(' '.join(run_container_cmd))) with subprocess.Popen(run_container_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, bufsize=1) as process: for line in process.stdout: print(' {}'.format(line), end='\r') + build_log_fd.write(line) return_code = process.wait() print('Running the container returned {}'.format(return_code)) - print('See build log: {}'.format(out_subdir + '/' + build_log)) + print('See build log: {}'.format(build_log)) + build_log_fd.close() def build_kernels(arch, kconfig, src, out, compilers, make_args):