From 6e15dcb60e8d0ecd5196ba3f28babd8795149a81 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Fri, 2 Mar 2018 08:26:38 +0000 Subject: [PATCH] Start sketching parsec buildroot package --- .gitmodules | 3 +++ README.adoc | 23 ++++++++++++++-------- build | 29 ++++++++++++++++------------ buildroot_config_fragment | 9 +++++++-- buildroot_override | 1 + configure | 9 +++++---- gem5/Config.in | 5 ++++- parsec-benchmark/Config.in | 16 +++++++++++++++ parsec-benchmark/external.desc | 1 + parsec-benchmark/external.mk | 23 ++++++++++++++++++++++ parsec-benchmark/parsec-benchmark | 1 + parsec => parsec-benchmark/parsec.sh | 0 12 files changed, 93 insertions(+), 27 deletions(-) create mode 100644 parsec-benchmark/Config.in create mode 100644 parsec-benchmark/external.desc create mode 100644 parsec-benchmark/external.mk create mode 160000 parsec-benchmark/parsec-benchmark rename parsec => parsec-benchmark/parsec.sh (100%) diff --git a/.gitmodules b/.gitmodules index 8dd0a80..5da02ec 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,3 +11,6 @@ [submodule "gem5/gem5"] path = gem5/gem5 url = https://gem5.googlesource.com/public/gem5 +[submodule "parsec-benchmark/parsec-benchmark"] + path = parsec-benchmark/parsec-benchmark + url = https://github.com/cirosantilli/parsec-benchmark diff --git a/README.adoc b/README.adoc index 6a8236b..e0c594b 100644 --- a/README.adoc +++ b/README.adoc @@ -76,29 +76,36 @@ git ls-files | grep modulename === Rebuild -If you make changes to the kernel modules or most configurations tracked on this repository, you can just use again: +After making changes to a package, you must explicitly tell it to be rebuilt. + +For example, you you modify the kernel modules, you must rebuild with: .... -./build -./run +./build -k .... -and the modified files will be rebuilt. +which is just an alias for: -If you change any package besides `kernel_module`, you must also request those packages to be reconfigured or rebuilt with extra targets, e.g.: +.... +./build -t kernel_module-reconfigure +.... + +where `kernel_module` is the name of out Buildroot package that contains the kernel modules. + +Other important targets are: .... ./build -t linux-reconfigure -t host-qemu-reconfigure .... -Those aren't turned on by default because they take quite a few seconds. - -Linux and QEMU rebuilds are so common that we have dedicated shortcut flags for them: +which are aliased respectively to: .... ./build -l -q .... +We don't rebuild by default because, even with `make` incremental rebuilds, the timestamp check takes a few annoying seconds. + === Clean the build You did something crazy, and nothing seems to work anymore? diff --git a/build b/build index 13e9d0f..8dd2797 100755 --- a/build +++ b/build @@ -19,6 +19,9 @@ while getopts 'a:gj:lp:qSt:v' OPT; do j) j="$OPTARG" ;; + l) + extra_targets="$extra_args kernel_module-reconfigure" + ;; l) extra_targets="$extra_args linux-reconfigure" ;; @@ -64,14 +67,15 @@ if "$gem5"; then post_script_args="$post_script_args -n" fi +rootdir="$(pwd)" cd kernel_module ./make-host.sh -j "$j" clean -cd ../buildroot -for p in $(find '../buildroot_patches/' -maxdepth 1 -name '*.patch' -print); do +cd "$rootdir/buildroot" +for p in $(find "${rootdir}/buildroot_patches/" -maxdepth 1 -name '*.patch' -print); do patch -N -r - -p 1 <"$p" || : done outdir="output.${arch_dir}~" -make O="$outdir" BR2_EXTERNAL="$(pwd)/../kernel_module:$(pwd)/../gem5" "$defconfig" +make O="$outdir" BR2_EXTERNAL="${rootdir}/kernel_module:${rootdir}/gem5:${rootdir}/parsec" "$defconfig" # TODO Can't get rid of this for now. # http://stackoverflow.com/questions/44078245/is-it-possible-to-use-config-fragments-with-buildroots-config cat ../buildroot_config_fragment >> "${outdir}/.config" @@ -101,20 +105,21 @@ make O="$outdir" olddefconfig # # Even if were an autotools package, there is no general way currently to pass extra configs to it: # https://stackoverflow.com/questions/44341188/how-to-pass-extra-custom-configure-autotools-options-to-a-buildroot-package/44341225#44341225 -time \ +cmd="time \ env \ -u LD_LIBRARY_PATH \ make \ - O="$outdir" \ - BR2_JLEVEL="$j" \ - BR2_PACKAGE_GEM5="$("$gem5" && echo y || echo n)" \ - BR2_ROOTFS_POST_SCRIPT_ARGS="$post_script_args" \ - HOST_QEMU_OPTS="--enable-debug --extra-cflags='-DDEBUG_PL061=1' --enable-trace-backends=simple $qemu_sdl" \ - V="$v" \ - kernel_module-rebuild \ + O='$outdir' \ + BR2_JLEVEL='$j' \ + BR2_PACKAGE_GEM5='$("$gem5" && echo y || echo n)' \ + BR2_ROOTFS_POST_SCRIPT_ARGS='$post_script_args' \ + HOST_QEMU_OPTS='--enable-debug --extra-cflags=-DDEBUG_PL061=1 --enable-trace-backends=simple $qemu_sdl' \ + V='$v' \ $extra_targets \ all \ -; +" +echo "$cmd" | tee "${rootdir}/build.log" +eval "$cmd" cd .. if "$gem5"; then ./build-gem5 -a "$arch" diff --git a/buildroot_config_fragment b/buildroot_config_fragment index 1107574..efe0020 100644 --- a/buildroot_config_fragment +++ b/buildroot_config_fragment @@ -1,11 +1,16 @@ -BR2_ENABLE_LOCALE=y +# Custom packages +BR2_PACKAGE_KERNEL_MODULE=y +BR2_PACKAGE_PARSEC=y +BR2_PACKAGE_PARSEC_BUILD_LIST="splash2" +# Required for parsec. +BR2_TARGET_ROOTFS_EXT2_SIZE="1G" + BR2_GCC_ENABLE_GRAPHITE=y BR2_GCC_ENABLE_LTO=y BR2_GCC_ENABLE_OPENMP=y BR2_GLOBAL_PATCH_DIR="../global_patch_dir" BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="../busybox_config_fragment" BR2_PACKAGE_DHRYSTONE=y -BR2_PACKAGE_KERNEL_MODULE=y BR2_PACKAGE_OVERRIDE_FILE="../buildroot_override" # For qemu-ga on guest. TODO: do something with it, and document it. BR2_PACKAGE_QEMU=y diff --git a/buildroot_override b/buildroot_override index cf57077..2d6e4e0 100644 --- a/buildroot_override +++ b/buildroot_override @@ -1,3 +1,4 @@ HOST_QEMU_OVERRIDE_SRCDIR = ../qemu LINUX_OVERRIDE_SRCDIR = ../linux +PARSEC_OVERRIDE_SRCDIR = ../parsec-benchmark/parsec-benchmark QEMU_OVERRIDE_SRCDIR = ../qemu diff --git a/configure b/configure index 85a0e27..bac177d 100755 --- a/configure +++ b/configure @@ -12,19 +12,20 @@ while getopts t OPT; do done shift $(($OPTIND - 1)) +submodules='buildroot linux qemu gem5/gem5' ( set -e - # Shallow clonning saves a considerable ammount of time, specially because of the linux kernel. - # However, git submodules are buggy as usual, and this is the best way i've found to get it done: + # Shallow cloning saves a considerable amount of time, specially because of the linux kernel. + # However, git submodules are buggy as usual, and this is the best way I've found to get it done: # https://stackoverflow.com/questions/2144406/git-shallow-submodules/47374702#47374702 # In particular: # - `shallow = true` on the submodule has no effect for the non default educational branches of our submodules # - QEMU's submodules point to commits that are neither under branches nor tags, and so `--shallow-submodules` fails - git submodule update --depth 1 --jobs 4 --init + git submodule update --depth 1 --jobs 4 --init -- $submodules cd qemu git submodule update --init ) & -wait $! || git submodule update --init +wait $! || git submodule update --init -- $submodules pkgs="\ automake \ diff --git a/gem5/Config.in b/gem5/Config.in index 7cc3c3b..0508e89 100644 --- a/gem5/Config.in +++ b/gem5/Config.in @@ -1,4 +1,7 @@ config BR2_PACKAGE_GEM5 bool "gem5" help - GEM5 + gem5 system simulator. Only builds the m5 guest instrumentation + tool for now, not the simulator itself. + + http://gem5.org diff --git a/parsec-benchmark/Config.in b/parsec-benchmark/Config.in new file mode 100644 index 0000000..6e47215 --- /dev/null +++ b/parsec-benchmark/Config.in @@ -0,0 +1,16 @@ +config BR2_PACKAGE_PARSEC + bool "PARSEC" + help + Parsec system benchmark. + + http://parsec.cs.princeton.edu/ + +if BR2_PACKAGE_PARSEC + +config BR2_PACKAGE_PARSEC_BUILD_LIST + string "build_list" + default all + help + Space separated list of parsec packages to build. + +endif diff --git a/parsec-benchmark/external.desc b/parsec-benchmark/external.desc new file mode 100644 index 0000000..38ffebd --- /dev/null +++ b/parsec-benchmark/external.desc @@ -0,0 +1 @@ +name: PARSEC diff --git a/parsec-benchmark/external.mk b/parsec-benchmark/external.mk new file mode 100644 index 0000000..b150747 --- /dev/null +++ b/parsec-benchmark/external.mk @@ -0,0 +1,23 @@ +################################################################################ +# +# PARSEC +# +################################################################################ + +PARSEC_VERSION = master +PARSEC_SITE = git@github.com:cirosantilli/parsec-benchmark.git +PARSEC_SITE_METHOD = git + +define PARSEC_BUILD_CMDS + cd $(@D) && . env.sh && for pkg in $(BR2_PACKAGE_PARSEC_BUILD_LIST); do parsecmgmt -a build -p $$pkg; done + #cd '$(@D)/gem5/util/m5' && $(MAKE) -f 'Makefile.$(ARCH_MAKE)' CC='$(TARGET_CC)' LD='$(TARGET_LD)' +endef + +define PARSEC_INSTALL_TARGET_CMDS + # This is a bit coarse and makes the image huge with useless source code, + # and input files, but I don't feel like creating per-package installs. + # And it doesn't matter much for simulators anyways. + rsync -av '$(@D)/' '$(TARGET_DIR)/parsec' +endef + +$(eval $(generic-package)) diff --git a/parsec-benchmark/parsec-benchmark b/parsec-benchmark/parsec-benchmark new file mode 160000 index 0000000..7ce7fde --- /dev/null +++ b/parsec-benchmark/parsec-benchmark @@ -0,0 +1 @@ +Subproject commit 7ce7fde92365248beafdbe6b94468a04a17b9c2d diff --git a/parsec b/parsec-benchmark/parsec.sh similarity index 100% rename from parsec rename to parsec-benchmark/parsec.sh