From 2cfb389c5a0179d363261bace9001fdbf3bc7b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Tue, 29 Oct 2019 00:00:00 +0000 Subject: [PATCH] dhrystone: fix build, overlay directory was not being created --- README.adoc | 2 ++ build-dhrystone | 2 +- shell_helpers.py | 18 ++++++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/README.adoc b/README.adoc index c8cef05..c2fba55 100644 --- a/README.adoc +++ b/README.adoc @@ -11028,6 +11028,8 @@ TODO automate run more nicely. Build for <> execution and run it in baremetal QEMU: .... +# Build our Newlib stubs. +./build-baremetal --arch aarch64 ./build-dhrystone --arch aarch64 --mode baremetal ./run --arch aarch64 --baremetal "$(./getvar baremetal_build_dir)/submodules/dhrystone/dhrystone" .... diff --git a/build-dhrystone b/build-dhrystone index 7dbd404..aa82891 100755 --- a/build-dhrystone +++ b/build-dhrystone @@ -51,7 +51,7 @@ https://cirosantilli.com/linux-kernel-module-cheat#dhrystone if ret == 0 and self.env['mode'] == 'userland': self.sh.copy_file_if_update( os.path.join(build_dir, 'dhrystone'), - os.path.join(self.env['out_rootfs_overlay_lkmc_dir'], self.root_relpath), + os.path.join(self.env['out_rootfs_overlay_lkmc_dir'], self.root_relpath, 'dhrystone'), ) return ret diff --git a/shell_helpers.py b/shell_helpers.py index 2217dc3..66cae43 100644 --- a/shell_helpers.py +++ b/shell_helpers.py @@ -162,14 +162,15 @@ class ShellHelpers: ending = last_newline + ';' return newline_separator.join(out) + ending - def copy_file_if_update(self, src, dest): - if os.path.isdir(dest): - dest = os.path.join(dest, os.path.basename(src)) + def copy_file_if_update(self, src, destfile): + if os.path.isdir(destfile): + destfile = os.path.join(destfile, os.path.basename(src)) + self.mkdir_p(os.path.dirname(destfile)) if ( - not os.path.exists(dest) or \ - os.path.getmtime(src) > os.path.getmtime(dest) + not os.path.exists(destfile) or \ + os.path.getmtime(src) > os.path.getmtime(destfile) ): - self.cp(src, dest) + self.cp(src, destfile) def copy_dir_if_update_non_recursive( self, @@ -221,6 +222,11 @@ class ShellHelpers: else: shutil.copy2(src, dest) + def mkdir_p(self, d): + self.print_cmd(['mkdir', d, LF]) + if not self.dry_run: + os.makedirs(d, exist_ok=True) + def mv(self, src, dest, **kwargs): self.print_cmd(['mv', src, dest]) if not self.dry_run: