From daf6c890b2ff011d1f65c8034cf53a48a5495a5f 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: Fri, 15 Nov 2019 00:00:00 +0000 Subject: [PATCH] Don't copy static userland builds into out_rootfs_overlay by default. I was doing that by mistake too often. To force it, use --copy-overlay. This mechanism might also be useful for future userland content. --- README.adoc | 2 +- build-userland | 13 +------------ common.py | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/README.adoc b/README.adoc index fcedd1e..871943e 100644 --- a/README.adoc +++ b/README.adoc @@ -11124,7 +11124,7 @@ xdg-open bst_vs_heap_vs_hashmap.tmp.png The parameters `heap_zoom_max` and `hashmap_zoom_max` are chosen manually interactively to best showcase the regions of interest in those plots. -First we build the benchmark with <> enabled, and then we run it and extract the stats: +To benchmark on gem5, we first build the benchmark with <> enabled, and then we run it and extract the stats: .... ./build-userland \ diff --git a/build-userland b/build-userland index 5f7b338..edeb140 100755 --- a/build-userland +++ b/build-userland @@ -23,17 +23,6 @@ Build our compiled userland examples. self._add_argument('--ccflags') self._add_argument('--force-rebuild') self._add_argument('--optimization-level') - self.add_argument( - '--out-rootfs-overlay-dir-prefix', - default='', - help='''\ -Place the output files inside the image within this additional prefix. -This is mostly useful to place different versions of binaries with different -build parameters inside image to compare them. See: -* https://cirosantilli.com/linux-kernel-module-cheat#update-the-toolchain -* https://cirosantilli.com/linux-kernel-module-cheat#out_rootfs_overlay_dir -''' - ) self.add_argument( 'targets', default=[], @@ -96,7 +85,7 @@ Default: build all examples that have their package dependencies met, e.g.: exit_status = self._handle_thread_pool_errors(my_thread_pool) if exit_status != 0: return exit_status - if not self.env['in_tree']: + if self.env['copy_overlay']: self.sh.copy_dir_if_update( srcdir=build_dir, destdir=os.path.join( diff --git a/common.py b/common.py index 05679f3..5f780d0 100644 --- a/common.py +++ b/common.py @@ -489,6 +489,28 @@ https://cirosantilli.com/linux-kernel-module-cheat#gem5-arm-platforms ) # Userland. + self.add_argument( + '--copy-overlay', + default=True, + help='''\ +Copy userland build outputs to the overlay directory which will be put inside +the image. If not given explicitly, this is disabled automatically when certain +options are given, for example --static, since users don't usually want +static executables to be placed in the final image, but rather only for +user mode simulations in simulators that don't support dynamic linking like gem5. +''' + ) + self.add_argument( + '--out-rootfs-overlay-dir-prefix', + default='', + help='''\ +Place the output files of userland build outputs inside the image within this +additional prefix. This is mostly useful to place different versions of binaries +with different build parameters inside image to compare them. See: +* https://cirosantilli.com/linux-kernel-module-cheat#update-the-toolchain +* https://cirosantilli.com/linux-kernel-module-cheat#out_rootfs_overlay_dir +''' + ) self.add_argument( '--package', action='append', @@ -924,6 +946,10 @@ Incompatible archs are skipped. env['initarg'] = 'init' env['quit_init'] = '{}={}'.format(env['initarg'], env['userland_quit_cmd']) + if not env['_args_given']['copy_overlay']: + if self.env['in_tree'] or self.env['static']: + env['copy_overlay'] = False + # Userland env['userland_source_arch_arch_dir'] = join(env['userland_source_arch_dir'], env['arch']) if env['in_tree']: