From 4601aff344ef0557a1e2d58b2108c871e1029ddc Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Tue, 10 Apr 2018 23:24:42 +0100 Subject: [PATCH] zip-img: create, zips all QEMU images build-all: make gem5 rebuild optional rootfs_post_image_script: prevent qemu-img from generating trace files --- README.adoc | 6 ++++-- build-all | 13 ++++++++++++- common | 1 + rootfs_post_image_script | 4 +++- zip-img | 12 ++++++++++++ 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100755 zip-img diff --git a/README.adoc b/README.adoc index 9645f36..2a2362d 100644 --- a/README.adoc +++ b/README.adoc @@ -3872,10 +3872,11 @@ cat ./out/arm/run.sh Next, you will also want to give the relevant images to save them time. Zip the images with: .... -zip -r images.zip out/arm/buildroot/images +./build-all -G +./zip-img .... -and then upload that somewhere, e.g. GitHub release assets as in https://github.com/cirosantilli/linux-kernel-module-cheat/releases/tag/test-replay-arm +and then upload the `out/images-*.zip` file somewhere, e.g. GitHub release assets as in https://github.com/cirosantilli/linux-kernel-module-cheat/releases/tag/test-replay-arm Finally, do a clone of the relevant repository out of tree and reproduce the bug there, to be 100% sure that it is an actual upstream bug, and to provide developers with the cleanest possible commands. For example as was done in this QEMU bug report: https://bugs.launchpad.net/qemu/+bug/1762179 @@ -3999,6 +4000,7 @@ BR2_TARGET_ROOTFS_EXT2=n ' >>.config make olddefconfig time env -u LD_LIBRARY_PATH make BR2_JLEVEL="$(nproc)" +ls -l output/images .... Time: 11 minutes, 7 with full ccache hits. Breakdown: 47% GCC, 15% Linux kernel, 9% uclibc, 5% host-binutils. Conclusions: diff --git a/build-all b/build-all index 703b5eb..bde125e 100755 --- a/build-all +++ b/build-all @@ -4,7 +4,18 @@ set -eux # Will take forever from a clean repo, this is most useful # after pulling the repository to do an incremental build # then quickly test out all the setups. +gem5=true +while getopts G OPT; do + case "$OPT" in + G) + gem5=false + ;; + esac +done +shift "$(($OPTIND - 1))" for arch in x86_64 arm aarch64; do ./build -a "$arch" -klq - ./build -a "$arch" -g -Gkl + if "$gem5"; then + ./build -a "$arch" -g -Gkl + fi done diff --git a/common b/common index 376e1a0..3f10f92 100644 --- a/common +++ b/common @@ -10,6 +10,7 @@ set_common_vars() { out_arch_dir="${out_dir}/${arch_dir}" buildroot_out_dir="${out_arch_dir}/buildroot" build_dir="${buildroot_out_dir}/build" + images_dir="${buildroot_out_dir}/images" host_dir="${buildroot_out_dir}/host" gem5_out_dir="${out_arch_dir}/gem5" m5out_dir="${gem5_out_dir}/m5out" diff --git a/rootfs_post_image_script b/rootfs_post_image_script index 282c129..4f28436 100755 --- a/rootfs_post_image_script +++ b/rootfs_post_image_script @@ -4,5 +4,7 @@ cd "$images_dir" f=rootfs.ext2 exe="${HOST_DIR}/bin/qemu-img" if [ -f "$exe" ] && [ -f "$f" ]; then - "$exe" convert -f raw -O qcow2 "$f" "${f}.qcow2" + # TODO why does qemu-img produce traces? + # http://lists.nongnu.org/archive/html/qemu-discuss/2018-04/msg00019.html + "$exe" -T "pr_manager_run,file=/dev/null" convert -f raw -O qcow2 "$f" "${f}.qcow2" fi diff --git a/zip-img b/zip-img new file mode 100755 index 0000000..a64c69e --- /dev/null +++ b/zip-img @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -eu +# Ideally should be obtained from common. +# But the paths there are absolute, and get recorded by in zip. +# and generating relative paths seems hard: +# https://stackoverflow.com/questions/2564634/convert-absolute-path-into-relative-path-given-a-current-directory-using-bash +sha="$(git log -1 --format="%H")" +for arch in x86_64 arm aarch64; do + img_dir="out/${arch}/buildroot/images" + rm -f "${img_dir}/rootfs.ext2" + zip -r "out/images-${sha}.zip" "${img_dir}" +done