summaryrefslogtreecommitdiffstats
path: root/bsp/meta-arm/meta-arm-bsp/recipes-devtools
diff options
context:
space:
mode:
Diffstat (limited to 'bsp/meta-arm/meta-arm-bsp/recipes-devtools')
-rw-r--r--bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/files/start-gem5.sh39
-rw-r--r--bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-bootloader.inc28
-rw-r--r--bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-bootloader_git.bb18
-rw-r--r--bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-dtb.bb30
-rw-r--r--bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-native.inc42
-rw-r--r--bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-native_git.bb26
-rw-r--r--bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-native.inc61
7 files changed, 244 insertions, 0 deletions
diff --git a/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/files/start-gem5.sh b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/files/start-gem5.sh
new file mode 100644
index 00000000..4edc0e51
--- /dev/null
+++ b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/files/start-gem5.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# Get parameters from bitbake configuration
+
+source <(bitbake -e gem5-aarch64-native | grep \
+ -e "^STAGING_.*_NATIVE=" \
+ -e "^DEPLOY_DIR.*=" \
+ -e "^GEM5_RUN.*=")
+
+export M5_PATH="${DEPLOY_DIR_IMAGE}"
+
+args=""
+
+if [ -n "${GEM5_RUN_KERNEL}" ]; then
+ kernfile=$(readlink -f ${DEPLOY_DIR_IMAGE}/${GEM5_RUN_KERNEL})
+ args="$args --kernel=$kernfile"
+fi
+
+if [ -n "${GEM5_RUN_DISK}" ]; then
+ diskfile=$(readlink -f ${DEPLOY_DIR_IMAGE}/${GEM5_RUN_DISK})
+ args="$args --disk-image=$diskfile"
+fi
+
+if [ -n "${GEM5_RUN_DTB}" ]; then
+ dtbfile=$(readlink -f ${DEPLOY_DIR_IMAGE}/${GEM5_RUN_DTB})
+ args="$args --dtb=$dtbfile"
+fi
+
+if [ -n "${GEM5_RUN_CMDLINE}" ]; then
+ args="$args --command-line='${GEM5_RUN_CMDLINE}'"
+fi
+
+if [ -n "${GEM5_RUN_EXTRA}" ]; then
+ args="$args ${GEM5_RUN_EXTRA}"
+fi
+
+${STAGING_BINDIR_NATIVE}/${GEM5_RUN_CONFIG} \
+ ${STAGING_DATADIR_NATIVE}/gem5/${GEM5_RUN_PROFILE} ${args} "$@"
+
diff --git a/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-bootloader.inc b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-bootloader.inc
new file mode 100644
index 00000000..4c479f5d
--- /dev/null
+++ b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-bootloader.inc
@@ -0,0 +1,28 @@
+# Build instructions for gem5 custom bootloader
+
+SUMMARY = "Gem5 AARCH64 boot loader"
+LICENSE = "BSD"
+
+inherit deploy
+
+PROVIDES = "virtual/gem5-bootloader"
+
+COMPATIBLE_MACHINE = "gem5-arm64"
+
+# no configure step
+do_configure[noexec] = "1"
+
+# no install
+do_install[noexec] = "1"
+
+do_compile() {
+ oe_runmake -C system/arm/aarch64_bootloader all CROSS_COMPILE=${TARGET_PREFIX}
+}
+
+do_deploy() {
+ oe_runmake -C system/arm/aarch64_bootloader install \
+ CROSS_COMPILE=${TARGET_PREFIX} DESTDIR=${DEPLOYDIR}/binaries
+}
+
+addtask deploy before do_build after do_compile
+
diff --git a/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-bootloader_git.bb b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-bootloader_git.bb
new file mode 100644
index 00000000..a3ab5aa7
--- /dev/null
+++ b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-bootloader_git.bb
@@ -0,0 +1,18 @@
+# gem5 custom bootloader
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=2d9514d69d8abf88b6e9125e759bf0ab \
+ file://LICENSE;md5=a585e2893cee63d16a1d8bc16c6297ec"
+
+# The recipe is currently using a version in the release staging branch of gem5
+# until version 20 is released
+SRC_URI = "git://gem5.googlesource.com/public/gem5;protocol=https;branch=release-staging-v20.0.0.0"
+
+PV = "git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+SRCREV = "0bc5d77ed27e0765953d93c2376a4b4aea675a01"
+
+BPN = "gem5-aarch64-bootloader"
+
+require gem5-aarch64-bootloader.inc
diff --git a/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-dtb.bb b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-dtb.bb
new file mode 100644
index 00000000..b97a1b28
--- /dev/null
+++ b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-dtb.bb
@@ -0,0 +1,30 @@
+# Use gem5 executable to produce a dtb
+
+LICENSE = "MIT"
+
+inherit deploy
+
+DEPENDS = "gem5-aarch64-native"
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ # generate a dtb using gem5
+ gem5.opt \
+ ${STAGING_DATADIR_NATIVE}/gem5/configs/example/arm/baremetal.py \
+ --dtb-gen
+
+ if [ ! -f m5out/system.dtb ]; then
+ echo "No dtb generated !!!"
+ exit 1
+ fi
+}
+
+do_install[noexec] = "1"
+
+do_deploy() {
+ install --d ${DEPLOYDIR}
+ cp m5out/system.dtb ${DEPLOYDIR}/gem5-aarch64.dtb
+}
+addtask deploy before do_build after do_compile
+
diff --git a/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-native.inc b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-native.inc
new file mode 100644
index 00000000..898fa23c
--- /dev/null
+++ b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-native.inc
@@ -0,0 +1,42 @@
+# gem5 aarch64 specific configuration
+
+# Build arm64 gem5
+GEM5_BUILD_CONFIGS ?= "build/ARM/gem5.opt build/ARM/gem5.fast \
+ build/ARM/gem5.debug"
+
+SRC_URI += "file://start-gem5.sh"
+
+inherit deploy
+
+# Parameters for the start script
+
+GEM5_RUN_CONFIG ?= "gem5.fast"
+
+# Linux kernel file to boot
+GEM5_RUN_KERNEL ?= "vmlinux"
+
+# Disk Image to use
+GEM5_RUN_DISK ?= "*-${MACHINE}.ext4"
+
+# DTB to use
+GEM5_RUN_DTB ?= "${@os.path.basename(d.getVar('KERNEL_DEVICETREE'))}"
+
+# Linux command line to pass
+GEM5_RUN_CMDLINE ?= "--command-line='earlyprintk=pl011,0x1c090000 \
+ console=ttyAMA0 rw mem=512MB root=/dev/sda rootwait'"
+
+# Extra arguments to pass to gem5
+GEM5_RUN_EXTRA ?= "--mem-size=512MB -n 4 --machine-type=VExpress_GEM5_V2"
+
+#This is required so that our binaries are in the sysroot. We need this
+# to have both gem5 required libraries and gem5 in the same sysroot.
+addtask addto_recipe_sysroot after do_populate_sysroot before do_build
+
+do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_TOOLS}"
+do_deploy() {
+ install -d ${DEPLOYDIR}
+
+ install -m 755 ${WORKDIR}/start-gem5.sh ${DEPLOYDIR}/.
+}
+addtask deploy before do_build after do_compile
+
diff --git a/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-native_git.bb b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-native_git.bb
new file mode 100644
index 00000000..d36f24fe
--- /dev/null
+++ b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-aarch64-native_git.bb
@@ -0,0 +1,26 @@
+# gem5 simulator source and checksum information
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=2d9514d69d8abf88b6e9125e759bf0ab \
+ file://LICENSE;md5=a585e2893cee63d16a1d8bc16c6297ec"
+
+# The recipe is currently using a version in the release staging branch of gem5
+# until version 20 is released
+SRC_URI = "git://gem5.googlesource.com/public/gem5;protocol=https;branch=release-staging-v20.0.0.0"
+
+PV = "git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+SRCREV = "0bc5d77ed27e0765953d93c2376a4b4aea675a01"
+
+BPN = "gem5-aarch64-native"
+
+require gem5-aarch64-native.inc
+require gem5-native.inc
+
+do_compile_prepend() {
+ # Gem5 expect to have python in the path (can be python2 or 3)
+ # Create a link named python to python3
+ real=$(which ${PYTHON})
+ ln -snf $real $(dirname $real)/python
+}
diff --git a/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-native.inc b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-native.inc
new file mode 100644
index 00000000..429e18ce
--- /dev/null
+++ b/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/gem5-native.inc
@@ -0,0 +1,61 @@
+# gem5 platform independent build information
+
+SUMMARY = "A modular platform for computer-system architecture research"
+HOMEPAGE = "http://gem5.org"
+LICENSE = "BSD & MIT & LGPLv2.1"
+
+# Gem5 build and run parameter
+
+# What gem5 binary are we building
+GEM5_BUILD_CONFIGS ?= "build/X86/gem5.opt"
+
+# Scons build arguments
+GEM5_SCONS_ARGS ?= "-j ${BB_NUMBER_THREADS} CC=${BUILD_CC} CXX=${BUILD_CXX} \
+ AS=${BUILD_AS} AR=${BUILD_AR} ${GEM5_BUILD_CONFIGS} \
+ PYTHON_CONFIG=python3-config"
+
+# Default profile to run
+GEM5_RUN_PROFILE ?= "configs/example/fs.py"
+
+# We are building a native package and we need to use scons
+inherit native scons
+
+# the build is using several tools:
+# python3: scons and six
+# google protobuf
+# pkgconfig
+# hdf5
+DEPENDS += "python3-six-native protobuf-native hdf5-native pkgconfig-native \
+ boost-native libpng-native"
+
+EXTRA_OESCONS = "${GEM5_SCONS_ARGS}"
+
+do_compile_prepend() {
+ # We need to use the proper native libraries when executing
+ # compiled applications
+ export LD_LIBRARY_PATH="${STAGING_LIBDIR_NATIVE}"
+}
+
+do_install() {
+
+ install -d ${D}${datadir}/gem5
+ cp -a --no-preserve=ownership -rf configs ${D}${datadir}/gem5/.
+
+ for f in ${GEM5_BUILD_CONFIGS}; do
+ destname=$(basename $f)
+ install -d ${D}${bindir}
+ install -m 755 $f ${D}${bindir}/$destname.real
+ cat <<EOF > ${D}${bindir}/$destname
+#!/bin/bash
+basedir=\$(cd \$(dirname \$0)/../../; pwd)
+export LD_LIBRARY_PATH="\$basedir/lib:\$basedir/usr/lib"
+\$basedir/usr/bin/$destname.real "\$@"
+EOF
+ chmod a+x ${D}${bindir}/$destname
+ done
+}
+
+FILES_${PN} = "${datadir}/gem5/* ${bindir}/*"
+INSANE_SKIP_${PN} += "already-stripped"
+RDEPENDS_${PN} += "python3-native hdf5-native protobuf-native libpng-native"
+