gem5: possible to edit python in tree, factor arm and aarch64 build

readme: stress kills gem5, some gem5 builds much slower than others
This commit is contained in:
Ciro Santilli
2018-05-01 23:26:03 +01:00
parent 533fe808b6
commit b992163d4e
8 changed files with 53 additions and 34 deletions

View File

@@ -3,7 +3,8 @@ set -eu
arch=x86_64
cross_compile=
j=
while getopts a:c:j: OPT; do
outdir=./
while getopts a:c:j:o: OPT; do
case "$OPT" in
a)
arch="$OPTARG"
@@ -14,20 +15,22 @@ while getopts a:c:j: OPT; do
j)
j="$OPTARG"
;;
o)
outdir="$OPTARG"
;;
esac
done
shift "$(($OPTIND - 1))"
if [ -z "$j" ]; then
j="$(nproc)"
fi
top="$(cd $(dirname "$0") && pwd)"
system_dir="${top}/system"
system_dir="${outdir}/system"
binaries_dir="${system_dir}/binaries"
disks_dir="${system_dir}/disks"
mkdir -p "$binaries_dir" "$disks_dir"
cd "${top}/gem5"
cd "gem5"
if [ "$arch" = x86_64 ]; then
scons -j "$j" --ignore-style build/X86/gem5.opt
scons -j "$j" --ignore-style "${outdir}/build/X86/gem5.opt"
f="${disks_dir}/linux-bigswap2.img"
dd if=/dev/zero of="$f" bs=1024 count=65536
mkswap "$f"
@@ -35,8 +38,10 @@ if [ "$arch" = x86_64 ]; then
# I'm not even joking. No one has ever built x86 gem5 without the magic dist dir present.
touch "${binaries_dir}/x86_64-vmlinux-2.6.22.9"
elif [ "$arch" = arm ] || [ "$arch" = aarch64 ]; then
scons -j "$j" --ignore-style build/ARM/gem5.opt
scons -j "$j" --ignore-style "${outdir}/build/ARM/gem5.opt"
make -C ./system/arm/dt/
mkdir -p "${outdir}/system/arm/dt"
cp ./system/arm/dt/*.dtb "${outdir}/system/arm/dt"
# TODO use the buildroot cross compiler here, and remove the dependencies from configure.
make -C ./system/arm/simple_bootloader/ $cross_compile
cp ./system/arm/simple_bootloader/boot_emm.arm "$binaries_dir"

View File

@@ -16,7 +16,10 @@ endif
define GEM5_BUILD_CMDS
# Cannot pass "-c '$(TARGET_CROSS)'" here because the ARM build uses aarch64 for the bootloader...
cd '$(@D)' && ./build -a '$(ARCH)' -j '$(BR2_JLEVEL)'
cd '$(GEM5_SITE)' && ./build -a '$(ARCH)' -j '$(BR2_JLEVEL)' -o '$(GEM5_SITE)/../out/common/gem5'
# This would build inside the buildroot directory as a more normal package.
#cd '$(@D)' && ./build -a '$(ARCH)' -j '$(BR2_JLEVEL)'
# TODO cannot use TARGET_CONFIGURE_OPTS here because it overrides the CFLAGS on m5,
# which have an include. We should patch gem5 to add a += instead of = there.
cd '$(@D)/gem5/util/m5' && $(MAKE) -f 'Makefile.$(ARCH_MAKE)' CC='$(TARGET_CC)' LD='$(TARGET_LD)'