diff mbox series

[5/7] atp: separate recipe for gem5 models

Message ID 20221121154352.5061-5-jon.mason@arm.com
State New
Headers show
Series [1/7] atp: fix failing test_readme | expand

Commit Message

Jon Mason Nov. 21, 2022, 3:43 p.m. UTC
From: Adrián Herrera Arcila <adrian.herrera@arm.com>

Previously, meta-atp extended the original gem5 recipe to add the ATP
Engine models; the .bbappend was complex, because it pulled from two
sources, and it was not possible to make machine-based overrides, as it
is a native recipe.

To solve this, we use the recent EXTRAS feature to add the gem5 models
from a different recipe.

Signed-off-by: Adrián Herrera Arcila <adrian.herrera@arm.com>
---
 meta-atp/conf/machine/gem5-atp-arm64.conf     |  4 ++++
 meta-atp/documentation/gem5-atp-arm64.md      |  2 +-
 .../atp/atp-gem5-native_3.1.bb                | 24 +++++++++++++++++++
 .../atp-gem5}/start-gem5-atp.sh               |  0
 .../gem5/gem5-aarch64-native_20.bbappend      | 24 -------------------
 5 files changed, 29 insertions(+), 25 deletions(-)
 create mode 100644 meta-atp/recipes-devtools/atp/atp-gem5-native_3.1.bb
 rename meta-atp/recipes-devtools/{gem5/gem5-aarch64-native => atp/atp-gem5}/start-gem5-atp.sh (100%)
 delete mode 100644 meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend
diff mbox series

Patch

diff --git a/meta-atp/conf/machine/gem5-atp-arm64.conf b/meta-atp/conf/machine/gem5-atp-arm64.conf
index 4d0adac8..6e6d49a9 100644
--- a/meta-atp/conf/machine/gem5-atp-arm64.conf
+++ b/meta-atp/conf/machine/gem5-atp-arm64.conf
@@ -9,3 +9,7 @@  EXTRA_IMAGEDEPENDS += "gem5-m5term-native"
 MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-atp atp-uapi gem5-m5readfile"
 # Optionally provide ATP kernel tests
 MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "atp-test"
+
+# Use ATP Engine gem5 models in gem5 build
+DEPENDS:append:pn-gem5-aarch64-native = " atp-gem5-native"
+GEM5_EXTRAS:pn-gem5-aarch64-native = "${STAGING_DATADIR_NATIVE}/atp"
diff --git a/meta-atp/documentation/gem5-atp-arm64.md b/meta-atp/documentation/gem5-atp-arm64.md
index 39f2f3b0..018f374c 100644
--- a/meta-atp/documentation/gem5-atp-arm64.md
+++ b/meta-atp/documentation/gem5-atp-arm64.md
@@ -13,7 +13,7 @@  The resulting gem5 native executable contains the AMBA ATP Engine. The resulting
 Users should run the environment as follows:
 
 ```bash
-./tmp/deploy/tools/start-gem5-atp.sh
+oe-run-native atp-gem5-native start-gem5-atp.sh
 ```
 
 This script launches a fast simulation to fast-forward Linux boot. Once Linux boot is completed, the fast simulation switches into a detailed simulation for the final usable environment. Users can connect and interact with the environment as follows:
diff --git a/meta-atp/recipes-devtools/atp/atp-gem5-native_3.1.bb b/meta-atp/recipes-devtools/atp/atp-gem5-native_3.1.bb
new file mode 100644
index 00000000..634c9b11
--- /dev/null
+++ b/meta-atp/recipes-devtools/atp/atp-gem5-native_3.1.bb
@@ -0,0 +1,24 @@ 
+require atp-source_3.1.inc
+inherit native
+
+SUMMARY = "AMBA ATP Engine gem5 models"
+
+S = "${WORKDIR}/git"
+SRC_URI = "${ATP_SRC} file://start-gem5-atp.sh"
+
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+do_install() {
+    install -d ${D}${datadir}/gem5/configs ${D}${datadir}/atp ${D}${bindir}
+
+    # baremetal_atp.py machine configuration and sample stream.atp file
+    install ${S}/gem5/baremetal_atp.py ${S}/configs/stream.atp ${D}${datadir}/gem5/configs
+    # ATP Engine sources for gem5 to use
+    install ${S}/SConscript ${S}/*.hh ${S}/*.cc ${D}${datadir}/atp
+    cp -RL ${S}/gem5 ${S}/proto ${D}${datadir}/atp
+
+    install ${WORKDIR}/start-gem5-atp.sh ${D}${bindir}
+}
+
+addtask addto_recipe_sysroot after do_populate_sysroot before do_build
diff --git a/meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh b/meta-atp/recipes-devtools/atp/atp-gem5/start-gem5-atp.sh
similarity index 100%
rename from meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh
rename to meta-atp/recipes-devtools/atp/atp-gem5/start-gem5-atp.sh
diff --git a/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend b/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend
deleted file mode 100644
index 6607f0f8..00000000
--- a/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend
+++ /dev/null
@@ -1,24 +0,0 @@ 
-require recipes-devtools/atp/atp-source_3.1.inc
-
-FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
-
-SRC_URI += "${ATP_SRC};destsuffix=git/atp;name=atp \
-            file://start-gem5-atp.sh"
-SRCREV_FORMAT = "gem5_atp"
-SRCREV_atp = "${ATP_REV}"
-LICENSE += "& ${ATP_LIC}"
-LIC_FILES_CHKSUM += "file://atp/LICENSE;md5=${ATP_LIC_MD5}"
-
-EXTRA_OESCONS += "EXTRAS=${S}/atp"
-
-do_install:append() {
-    # baremetal_atp.py machine configuration and sample stream.atp file
-    install -m 644 ${B}/atp/gem5/baremetal_atp.py \
-                   ${B}/atp/configs/stream.atp \
-                   ${D}${datadir}/gem5/configs
-}
-
-do_deploy:append() {
-    # start-gem5-atp.sh launch script
-    install -m 755 ${WORKDIR}/start-gem5-atp.sh ${DEPLOYDIR}
-}