summaryrefslogtreecommitdiffstats
path: root/bsp/meta-arm/meta-arm-bsp/recipes-devtools/gem5/files/start-gem5.sh
blob: 4edc0e5140b006daf6d02db3c5c184c23f994637 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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} "$@"