diff options
author | John Toomey <john.toomey@xilinx.com> | 2021-10-26 18:11:49 +0100 |
---|---|---|
committer | Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> | 2021-11-02 00:34:46 -0700 |
commit | cc249f8c8a22fe284bfa8f02244810063dbbdd60 (patch) | |
tree | 1340950d103d8af3a97c4b1a3118a548847815ad /meta-xilinx-standalone-experimental/recipes-core | |
parent | caf9a0ccd25773c5a0eee128b5ac9fb68505e4da (diff) | |
download | meta-xilinx-cc249f8c8a22fe284bfa8f02244810063dbbdd60.tar.gz |
dt-processor.sh: Refactor and domain file support
Refactor for maintainability and code reuse
- Add missing copyright/license and description
- Implement getopts for command line arg parsing
- Add proper help function and additional comments
- Add error/warn/info functions and clean up output
- Fix variable quoting and wrap lines to 100 chars
- Fix code duplication and remove redundancy
- Simplify the parse_cpus() function for readability
- Add missing error checking
Add support for a domain file (.yml or .dts)
- Add new optional -d <domain_file> flag to getopts
- Change lopper.py args in each function when a domain file is passed
Signed-off-by: John Toomey <jtoomey@xilinx.com>
Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Diffstat (limited to 'meta-xilinx-standalone-experimental/recipes-core')
-rwxr-xr-x | meta-xilinx-standalone-experimental/recipes-core/meta/files/dt-processor.sh | 963 |
1 files changed, 545 insertions, 418 deletions
diff --git a/meta-xilinx-standalone-experimental/recipes-core/meta/files/dt-processor.sh b/meta-xilinx-standalone-experimental/recipes-core/meta/files/dt-processor.sh index 917ce91f..6c560ac1 100755 --- a/meta-xilinx-standalone-experimental/recipes-core/meta/files/dt-processor.sh +++ b/meta-xilinx-standalone-experimental/recipes-core/meta/files/dt-processor.sh | |||
@@ -1,102 +1,132 @@ | |||
1 | #! /bin/bash | 1 | #! /bin/bash |
2 | 2 | ||
3 | if [ $# -lt 2 ]; then | 3 | # Copyright (c) 2021 Xilinx Inc |
4 | echo "Usage:" | 4 | # |
5 | echo " $0 <conf_dir> <system_dtb> [<overlay_dtb>] [<external_fpga>] [<machine_type>]" | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
6 | echo | 6 | # of this software and associated documentation files (the "Software"), to deal |
7 | echo " conf_dir - location for the build conf directory" | 7 | # in the Software without restriction, including without limitation the rights |
8 | echo " system_dtb - Full patch to the system dtb" | 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
9 | echo " overlay_dtb - To generate overlay dts" | 9 | # copies of the Software, and to permit persons to whom the Software is |
10 | echo " external_fpga - Flag to apply partial overlay" | 10 | # furnished to do so, subject to the following conditions: |
11 | echo " machine_type - zynq, zynqmp or versal" | 11 | # |
12 | echo | 12 | # The above copyright notice and this permission notice shall be included in |
13 | exit 1 | 13 | # all copies or substantial portions of the Software. |
14 | fi | 14 | # |
15 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
16 | if [ ! -f $1/local.conf ]; then | 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17 | echo "$1 does not look like a conf directory." | 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
18 | exit 1 | 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19 | fi | 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
20 | conf_dir=$1 | 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
21 | 21 | # THE SOFTWARE. | |
22 | if [ ! -f $2 ]; then | 22 | |
23 | echo "Unable to find $2." >&2 | 23 | # This script configures the Yocto Project build system for use with the System |
24 | exit 1 | 24 | # Device Tree workflow when building for a Xilinx FPGA, such as the ZynqMP or |
25 | fi | 25 | # Versal. |
26 | dtb=$2 | 26 | |
27 | 27 | error() { echo "ERROR: $1" >&2; exit 1; } | |
28 | # Default is no overlay | 28 | |
29 | overlay_dtb=false | 29 | warn() { echo "WARNING: $1"; } |
30 | external_fpga=false | 30 | |
31 | if [ ! -f $3 ]; then | 31 | info() { echo "INFO: $1"; } |
32 | if [ ! -f $4 ]; then | 32 | |
33 | overlay_dtb=true | 33 | usage() { |
34 | external_fpga=true | 34 | cat <<EOF |
35 | machine=$5 | 35 | $0 |
36 | else | 36 | -c <config_dir> Location of the build conf directory |
37 | overlay_dtb=true | 37 | -s <system_dtb> Full path to system DTB |
38 | machine=$4 | 38 | -d <domain_file> Full path to domain file (.yml/.dts) |
39 | fi | 39 | [-o <overlay_dtb>] Generate overlay dts |
40 | else | 40 | [-e <external_fpga>] Apply a partial overlay |
41 | # We'll autodetect if blank (later) | 41 | [-m <machine>] zynqmp or versal |
42 | machine=$3 | ||
43 | fi | ||
44 | |||
45 | lopper=$(which lopper.py) | ||
46 | 42 | ||
47 | if [ -z "$lopper" ]; then | 43 | EOF |
48 | echo "Unable to find lopper.py, did you source the prestep environment file?" >&2 | 44 | exit |
49 | exit 1 | 45 | } |
50 | fi | ||
51 | 46 | ||
52 | lops_dir=$(dirname $(dirname $lopper))/share/lopper/lops | 47 | parse_args() { |
53 | embeddedsw=$(dirname $(dirname $lopper))/share/embeddedsw | 48 | [ $# -eq 0 ] && usage |
49 | |||
50 | while getopts ":c:s:d:o:e:m:h" opt; do | ||
51 | case ${opt} in | ||
52 | c) config_dir=$OPTARG ;; | ||
53 | s) system_dtb=$OPTARG ;; | ||
54 | o) overlay_dtb=$OPTARG ;; | ||
55 | d) domain_file=$OPTARG ;; | ||
56 | e) external_fpga=$OPTARG ;; | ||
57 | m) machine=$OPTARG ;; | ||
58 | h) usage ;; | ||
59 | :) error "Missing argument for -$OPTARG" ;; | ||
60 | \?) error "Invalid option -$OPTARG" | ||
61 | esac | ||
62 | done | ||
54 | 63 | ||
55 | system_conf="" | 64 | [ -f "${config_dir}/local.conf" ] || error "Invalid config dir: ${config_dir}" |
56 | multiconf="" | 65 | [ -f "${system_dtb}" ] || error "Unable to find: ${system_dtb}" |
66 | } | ||
57 | 67 | ||
58 | detect_machine() { | 68 | detect_machine() { |
59 | # Lets identify the system type first. We can use PSM/PMC/PMU for this... | 69 | if [ -z "${machine}" ]; then |
60 | while read cpu domain os_hint ; do | 70 | # Identify the system type first using PSM/PMC/PMU |
61 | case ${cpu} in | 71 | while read -r cpu domain os_hint; do |
62 | pmu-microblaze) | 72 | case ${cpu} in |
63 | machine="zynqmp" | 73 | pmu-microblaze) |
64 | return | 74 | machine="zynqmp" ;; |
65 | ;; | 75 | pmc-microblaze | psm-microblaze) |
66 | pmc-microblaze | psm-microblaze) | 76 | machine="versal" ;; |
67 | machine="versal" | 77 | esac |
68 | return | 78 | done <cpu-list.tmp |
69 | ;; | 79 | fi |
70 | esac | 80 | |
71 | done < cpu-list.tmp | 81 | # Machine not provided and we cannot identify.. |
72 | echo "ERROR: Unable to auto-detect the machine type." | 82 | [ -z ${machine} ] && \ |
73 | exit 1 | 83 | error "Unable to autodetect machine type, use -m to specify the machine." |
84 | |||
85 | case ${machine} in | ||
86 | zynqmp | versal) : ;; | ||
87 | *) error "Invalid machine type ${machine}; please choose zynqmp or versal" | ||
88 | esac | ||
74 | } | 89 | } |
75 | 90 | ||
76 | cortex_a53_linux() { | 91 | cortex_a53_linux() { |
77 | if [ $1 = "None" ]; then | 92 | info "coretex-a53 for Linux [ $1 ]" |
93 | |||
94 | if [ "$1" = "None" ]; then | ||
78 | dtb_file="cortexa53-${machine}-linux.dtb" | 95 | dtb_file="cortexa53-${machine}-linux.dtb" |
79 | system_conf=conf/cortexa53-${machine}-linux.conf | 96 | system_conf=conf/cortexa53-${machine}-linux.conf |
80 | conf_file=cortexa53-${machine}-linux.conf | 97 | conf_file=cortexa53-${machine}-linux.conf |
81 | else | 98 | else |
82 | dtb_file="cortexa53-${machine}-${1}-linux.dtb" | 99 | dtb_file="cortexa53-${machine}-$1-linux.dtb" |
83 | multiconf="${multiconf} cortexa53-${machine}-linux" | 100 | multiconf="${multiconf} cortexa53-${machine}-linux" |
84 | conf_file=multiconfig/cortexa53-${machine}-${1}-linux.conf | 101 | conf_file=multiconfig/cortexa53-${machine}-$1-linux.conf |
85 | fi | 102 | fi |
86 | 103 | ||
87 | mkdir -p dtb | ||
88 | # Check if it is overlay dts otherwise just create linux dtb | 104 | # Check if it is overlay dts otherwise just create linux dtb |
89 | if [ ${overlay_dtb} = "true" ]; then | 105 | ( |
90 | if [ ${external_fpga} = "true" ]; then | 106 | cd dtb || error "Unable to cd to dtb dir" |
91 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f ${dtb} -- xlnx_overlay_dt ${machine} full; dtc -q -O dtb -o pl.dtbo -b 0 -@ pl.dtsi && rm -f pl.dtsi) | 107 | if [ "${overlay_dtb}" = "true" ]; then |
108 | if [ "${external_fpga}" = "true" ]; then | ||
109 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dtb}" -- xlnx_overlay_dt ${machine} full \ | ||
110 | || error "lopper.py failed" | ||
111 | else | ||
112 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} "${system_dtb}" -- xlnx_overlay_dt ${machine} partial \ | ||
113 | || error "lopper.py failed" | ||
114 | fi | ||
115 | dtc -q -O dtb -o pl.dtbo -b 0 -@ pl.dtsi || error "dtc failed" | ||
116 | elif [ -n "${domain_file}" ]; then | ||
117 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --permissive --enhanced -x '*.yaml' \ | ||
118 | -i "${domain_file}" -i "${lops_dir}/lop-a53-imux.dts" \ | ||
119 | -i "${lops_dir}/lop-domain-linux-a53.dts" "${system_dtb}" "${dtb_file}" \ | ||
120 | || error "lopper.py failed" | ||
92 | else | 121 | else |
93 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py ${dtb} -- xlnx_overlay_dt ${machine} partial ; dtc -q -O dtb -o pl.dtbo -b 0 -@ pl.dtsi && rm -f pl.dtsi) | 122 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a53-imux.dts" \ |
123 | -i "${lops_dir}/lop-domain-linux-a53.dts" "${system_dtb}" "${dtb_file}" \ | ||
124 | || error "lopper.py failed" | ||
94 | fi | 125 | fi |
95 | else | 126 | rm -f pl.dtsi lop-a53-imux.dts.dtb lop-domain-linux-a53.dts.dtb |
96 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f --enhanced -i ${lops_dir}/lop-a53-imux.dts -i ${lops_dir}/lop-domain-linux-a53.dts ${dtb} ${dtb_file} && rm -f lop-a53-imux.dts.dtb lop-domain-linux-a53.dts.dtb) | 127 | ) |
97 | fi | ||
98 | 128 | ||
99 | cat << EOF > ${conf_file} | 129 | cat <<EOF >"${conf_file}" |
100 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 130 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
101 | MACHINE = "${machine}-generic" | 131 | MACHINE = "${machine}-generic" |
102 | # Override the SYSTEM_DTFILE for Linux builds | 132 | # Override the SYSTEM_DTFILE for Linux builds |
@@ -104,7 +134,7 @@ SYSTEM_DTFILE_linux = "\${CONFIG_DTFILE}" | |||
104 | # We don't want the kernel to build us a device-tree | 134 | # We don't want the kernel to build us a device-tree |
105 | KERNEL_DEVICETREE_${machine}-generic = "" | 135 | KERNEL_DEVICETREE_${machine}-generic = "" |
106 | # We need u-boot to use the one we passed in | 136 | # We need u-boot to use the one we passed in |
107 | DEVICE_TREE_NAME:pn-u-boot-zynq-scr = "\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" | 137 | DEVICE_TREE_NAME_pn-u-boot-zynq-scr = "\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" |
108 | # Update bootbin to use proper device tree | 138 | # Update bootbin to use proper device tree |
109 | BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" | 139 | BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" |
110 | # Remap boot files to ensure the right device tree is listed first | 140 | # Remap boot files to ensure the right device tree is listed first |
@@ -112,51 +142,67 @@ IMAGE_BOOT_FILES = "devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))} | |||
112 | EOF | 142 | EOF |
113 | } | 143 | } |
114 | 144 | ||
115 | fsbl_done=0 | 145 | a53_fsbl_done=0 |
116 | cortex_a53_baremetal() { | 146 | cortex_a53_baremetal() { |
117 | if [ $1 = "fsbl" -a $fsbl_done != 0 ]; then | 147 | if [ "$1" = "fsbl" ]; then |
118 | return | 148 | [ ${a53_fsbl_done} = 1 ] && return |
119 | elif [ $1 = "fsbl" ] ; then | 149 | info "coretex-a53 FSBL baremetal configuration" |
120 | echo "Building FSBL baremetal configuration" | ||
121 | fsbl_done=1 | ||
122 | fi | ||
123 | if [ $1 = "None" ]; then | ||
124 | dtb_file="cortexa53-${machine}-baremetal.dtb" | ||
125 | multiconf="${multiconf} cortexa53-${machine}-baremetal" | ||
126 | conf_file="multiconfig/cortexa53-${machine}-baremetal.conf" | ||
127 | libxil="multiconfig/includes/cortexa53-${machine}-libxil.conf" | ||
128 | distro="multiconfig/includes/cortexa53-${machine}-distro.conf" | ||
129 | yocto_distro="xilinx-standalone-nolto" | ||
130 | else | 150 | else |
131 | dtb_file="cortexa53-${machine}-${1}-baremetal.dtb" | 151 | info "coretex-a53 for baremetal [ $1 ]" |
132 | multiconf="${multiconf} cortexa53-${machine}-${1}-baremetal" | ||
133 | conf_file="multiconfig/cortexa53-${machine}-${1}-baremetal.conf" | ||
134 | libxil="multiconfig/includes/cortexa53-${machine}-${1}-libxil.conf" | ||
135 | distro="multiconfig/includes/cortexa53-${machine}-${1}-distro.conf" | ||
136 | yocto_distro="xilinx-standalone" | ||
137 | fi | 152 | fi |
138 | if [ $1 = "fsbl" ]; then | 153 | |
154 | suffix=""; lto="-nolto" | ||
155 | if [ "$1" != "None" ]; then | ||
156 | suffix="-$1"; lto="" | ||
157 | fi | ||
158 | |||
159 | dtb_file="cortexa53-${machine}${suffix}-baremetal.dtb" | ||
160 | multiconf="${multiconf} cortexa53-${machine}${suffix}-baremetal" | ||
161 | conf_file="multiconfig/cortexa53-${machine}${suffix}-baremetal.conf" | ||
162 | libxil="multiconfig/includes/cortexa53-${machine}${suffix}-libxil.conf" | ||
163 | distro="multiconfig/includes/cortexa53-${machine}${suffix}-distro.conf" | ||
164 | yocto_distro="xilinx-standalone${lto}" | ||
165 | if [ "$1" = "fsbl" ]; then | ||
139 | fsbl_mcdepends="mc::${dtb_file%%.dtb}:fsbl-firmware:do_deploy" | 166 | fsbl_mcdepends="mc::${dtb_file%%.dtb}:fsbl-firmware:do_deploy" |
140 | fsbl_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" | 167 | fsbl_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" |
168 | a53_fsbl_done=1 | ||
141 | fi | 169 | fi |
142 | 170 | ||
143 | # Build device tree | 171 | # Build device tree |
144 | mkdir -p dtb | 172 | ( |
145 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f --enhanced -i ${lops_dir}/lop-a53-imux.dts ${dtb} ${dtb_file} && rm -f lop-a53-imux.dts.dtb) | 173 | cd dtb || error "Unable to cd to dtb dir" |
174 | if [ -n "${domain_file}" ]; then | ||
175 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --permissive --enhanced -x '*.yaml' \ | ||
176 | -i "${domain_file}" -i "${lops_dir}/lop-a53-imux.dts" "${system_dtb}" "${dtb_file}" \ | ||
177 | || error "lopper.py failed" | ||
178 | else | ||
179 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a53-imux.dts" \ | ||
180 | "${system_dtb}" "${dtb_file}" || error "lopper.py failed" | ||
181 | fi | ||
182 | rm -f lop-a53-imux.dts.dtb | ||
183 | ) | ||
146 | 184 | ||
147 | # Build baremetal multiconfig | 185 | # Build baremetal multiconfig |
148 | mkdir -p multiconfig/includes | 186 | if [ -n "${domain_file}" ]; then |
149 | lopper.py -f ${dtb} -- baremetaldrvlist_xlnx cortexa53-${machine} $embeddedsw | 187 | ${lopper} -f --permissive --enhanced -x '*.yaml' -i "${domain_file}" "${system_dtb}" \ |
150 | mv libxil.conf ${libxil} | 188 | -- baremetaldrvlist_xlnx cortexa53-${machine} "${embeddedsw}" \ |
151 | mv distro.conf ${distro} | 189 | || error "lopper.py failed" |
152 | cat << EOF > ${conf_file} | 190 | else |
191 | ${lopper} -f "${system_dtb}" -- baremetaldrvlist_xlnx cortexa53-${machine} "${embeddedsw}" \ | ||
192 | || error "lopper.py failed" | ||
193 | fi | ||
194 | |||
195 | mv libxil.conf "${libxil}" | ||
196 | mv distro.conf "${distro}" | ||
197 | |||
198 | cat <<EOF >"${conf_file}" | ||
153 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 199 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
154 | ESW_MACHINE = "cortexa53-${machine}" | 200 | ESW_MACHINE = "cortexa53-${machine}" |
155 | DEFAULTTUNE = "cortexa53" | 201 | DEFAULTTUNE = "cortexa53" |
156 | 202 | ||
157 | TMPDIR = "\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}" | 203 | TMPDIR = "\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}" |
158 | 204 | ||
159 | DISTRO = "$yocto_distro" | 205 | DISTRO = "${yocto_distro}" |
160 | 206 | ||
161 | LIBXIL_CONFIG = "conf/${libxil}" | 207 | LIBXIL_CONFIG = "conf/${libxil}" |
162 | require conf/${distro} | 208 | require conf/${distro} |
@@ -164,30 +210,44 @@ EOF | |||
164 | } | 210 | } |
165 | 211 | ||
166 | cortex_a53_freertos() { | 212 | cortex_a53_freertos() { |
167 | if [ $1 = "None" ]; then | 213 | info "coretex-a53 for FreeRTOS [ $1 ]" |
168 | dtb_file="cortexa53-${machine}-freertos.dtb" | 214 | |
169 | multiconf="${multiconf} cortexa53-${machine}-freertos" | 215 | suffix="" |
170 | conf_file="multiconfig/cortexa53-${machine}-freertos.conf" | 216 | [ "$1" != "None" ] && suffix="-$1" |
171 | libxil="multiconfig/includes/cortexa53-${machine}-libxil.conf" | 217 | |
172 | distro="multiconfig/includes/cortexa53-${machine}-distro.conf" | 218 | dtb_file="cortexa53-${machine}${suffix}-freertos.dtb" |
173 | else | 219 | multiconf="${multiconf} cortexa53-${machine}${suffix}-freertos" |
174 | dtb_file="cortexa53-${machine}-${1}-freertos.dtb" | 220 | conf_file="multiconfig/cortexa53-${machine}${suffix}-freertos.conf" |
175 | multiconf="${multiconf} cortexa53-${machine}-${1}-freertos" | 221 | libxil="multiconfig/includes/cortexa53-${machine}${suffix}-libxil.conf" |
176 | conf_file="multiconfig/cortexa53-${machine}-${1}-freertos.conf" | 222 | distro="multiconfig/includes/cortexa53-${machine}${suffix}-distro.conf" |
177 | libxil="multiconfig/includes/cortexa53-${machine}-${1}-libxil.conf" | ||
178 | distro="multiconfig/includes/cortexa53-${machine}-${1}-distro.conf" | ||
179 | fi | ||
180 | 223 | ||
181 | # Build device tree | 224 | # Build device tree |
182 | mkdir -p dtb | 225 | ( |
183 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f --enhanced -i ${lops_dir}/lop-a53-imux.dts ${dtb} ${dtb_file} && rm -f lop-a53-imux.dts.dtb) | 226 | cd dtb || error "Unable to cd to dtb dir" |
227 | if [ -n "${domain_file}" ]; then | ||
228 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --permissive --enhanced -x '*.yaml' \ | ||
229 | -i "${domain_file}" -i "${lops_dir}/lop-a53-imux.dts" "${system_dtb}" "${dtb_file}" \ | ||
230 | || error "lopper.py failed" | ||
231 | else | ||
232 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a53-imux.dts" \ | ||
233 | "${system_dtb}" "${dtb_file}" || error "lopper.py failed" | ||
234 | fi | ||
235 | rm -f lop-a53-imux.dts.dtb | ||
236 | ) | ||
184 | 237 | ||
185 | # Build baremetal multiconfig | 238 | # Build baremetal multiconfig |
186 | mkdir -p multiconfig/includes | 239 | if [ -n "${domain_file}" ]; then |
187 | lopper.py -f ${dtb} -- baremetaldrvlist_xlnx cortexa53-${machine} $embeddedsw | 240 | ${lopper} -f --permissive --enhanced -x '*.yaml' -i "${domain_file}" "${system_dtb}" \ |
188 | mv libxil.conf ${libxil} | 241 | -- baremetaldrvlist_xlnx cortexa53-${machine} "${embeddedsw}" || error "lopper.py failed" |
189 | mv distro.conf ${distro} | 242 | else |
190 | cat << EOF > ${conf_file} | 243 | ${lopper} -f "${system_dtb}" -- baremetaldrvlist_xlnx cortexa53-${machine} "${embeddedsw}" \ |
244 | || error "lopper.py failed" | ||
245 | fi | ||
246 | |||
247 | mv libxil.conf "${libxil}" | ||
248 | mv distro.conf "${distro}" | ||
249 | |||
250 | cat <<EOF >"${conf_file}" | ||
191 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 251 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
192 | ESW_MACHINE = "cortexa53-${machine}" | 252 | ESW_MACHINE = "cortexa53-${machine}" |
193 | DEFAULTTUNE = "cortexa53" | 253 | DEFAULTTUNE = "cortexa53" |
@@ -202,32 +262,46 @@ EOF | |||
202 | } | 262 | } |
203 | 263 | ||
204 | cortex_a72_linux() { | 264 | cortex_a72_linux() { |
205 | if [ $1 = "None" ]; then | 265 | info "coretex-a72 for Linux [ $1 ]" |
266 | |||
267 | if [ "$1" = "None" ]; then | ||
206 | dtb_file="cortexa72-${machine}-linux.dtb" | 268 | dtb_file="cortexa72-${machine}-linux.dtb" |
207 | system_conf=conf/cortexa72-${machine}-linux.conf | 269 | system_conf=conf/cortexa72-${machine}-linux.conf |
208 | conf_file=cortexa72-${machine}-linux.conf | 270 | conf_file=cortexa72-${machine}-linux.conf |
209 | else | 271 | else |
210 | dtb_file="cortexa72-${machine}-${1}-linux.dtb" | 272 | dtb_file="cortexa72-${machine}-$1-linux.dtb" |
211 | multiconf="${multiconf} cortexa72-${machine}-linux" | 273 | multiconf="${multiconf} cortexa72-${machine}-linux" |
212 | conf_file=multiconfig/cortexa72-${machine}-${1}-linux.conf | 274 | conf_file=multiconfig/cortexa72-${machine}-$1-linux.conf |
213 | fi | 275 | fi |
214 | 276 | ||
215 | mkdir -p dtb | 277 | ( |
216 | # Check if it is overlay dts otherwise just create linux dtb | 278 | cd dtb || error "Unable to cd to dtb dir" |
217 | if [ ${overlay_dtb} = "true" ]; then | 279 | # Check if it is overlay dts otherwise just create linux dtb |
218 | # As there is no partial support on Versal, As per fpga manager implementatin there is a flag "external_fpga" which says | 280 | if [ "${overlay_dtb}" = "true" ]; then |
219 | # apply overlay without loading the bit file. | 281 | # As there is no partial support on Versal, As per fpga manager implementatin there is |
220 | if [ ${external_fpga} = "true" ]; then | 282 | # a flag "external_fpga" which says apply overlay without loading the bit file. |
221 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f ${dtb} -- xlnx_overlay_dt ${machine} full external_fpga ; dtc -q -O dtb -o pl.dtbo -b 0 -@ pl.dtsi && rm -f pl.dtsi) | 283 | if [ "${external_fpga}" = "true" ]; then |
284 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dtb}" -- xlnx_overlay_dt \ | ||
285 | ${machine} full external_fpga || error "lopper.py failed" | ||
286 | else | ||
287 | # If there is no external_fpga flag, then the default is full | ||
288 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} "${system_dtb}" -- xlnx_overlay_dt \ | ||
289 | ${machine} full || error "lopper.py failed" | ||
290 | fi | ||
291 | dtc -q -O dtb -o pl.dtbo -b 0 -@ pl.dtsi || error "dtc failed" | ||
292 | elif [ -n "${domain_file}" ]; then | ||
293 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --permissive --enhanced -x '*.yaml' \ | ||
294 | -i "${domain_file}" -i "${lops_dir}/lop-a72-imux.dts" \ | ||
295 | -i "${lops_dir}/lop-domain-a72.dts" "${system_dtb}" "${dtb_file}" \ | ||
296 | || error "lopper.py failed" | ||
222 | else | 297 | else |
223 | # If there is no external_fpga flag, then the default is full | 298 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a72-imux.dts" \ |
224 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py ${dtb} -- xlnx_overlay_dt ${machine} full ; dtc -q -O dtb -o pl.dtbo -b 0 -@ pl.dtsi && rm -f pl.dtsi) | 299 | -i "${lops_dir}/lop-domain-a72.dts" "${system_dtb}" "${dtb_file}" || error "lopper.py failed" |
225 | fi | 300 | fi |
226 | else | 301 | rm -f pl.dtsi lop-a72-imux.dts.dtb lop-domain-a72.dts.dtb |
227 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f --enhanced -i ${lops_dir}/lop-a72-imux.dts -i ${lops_dir}/lop-domain-a72.dts ${dtb} ${dtb_file} && rm -f lop-a72-imux.dts.dtb lop-domain-a72.dts.dtb) | 302 | ) |
228 | fi | ||
229 | 303 | ||
230 | cat << EOF > ${conf_file} | 304 | cat <<EOF >"${conf_file}" |
231 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 305 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
232 | MACHINE = "${machine}-generic" | 306 | MACHINE = "${machine}-generic" |
233 | # Override the SYSTEM_DTFILE for Linux builds | 307 | # Override the SYSTEM_DTFILE for Linux builds |
@@ -235,7 +309,7 @@ SYSTEM_DTFILE_linux = "\${CONFIG_DTFILE}" | |||
235 | # We don't want the kernel to build us a device-tree | 309 | # We don't want the kernel to build us a device-tree |
236 | KERNEL_DEVICETREE_${machine}-generic = "" | 310 | KERNEL_DEVICETREE_${machine}-generic = "" |
237 | # We need u-boot to use the one we passed in | 311 | # We need u-boot to use the one we passed in |
238 | DEVICE_TREE_NAME:pn-u-boot-zynq-scr = "\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" | 312 | DEVICE_TREE_NAME_pn-u-boot-zynq-scr = "\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" |
239 | # Update bootbin to use proper device tree | 313 | # Update bootbin to use proper device tree |
240 | BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" | 314 | BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" |
241 | # Remap boot files to ensure the right device tree is listed first | 315 | # Remap boot files to ensure the right device tree is listed first |
@@ -244,30 +318,44 @@ EOF | |||
244 | } | 318 | } |
245 | 319 | ||
246 | cortex_a72_baremetal() { | 320 | cortex_a72_baremetal() { |
247 | if [ $1 = "None" ]; then | 321 | info "coretex-a72 for baremetal [ $1 ]" |
248 | dtb_file="cortexa72-${machine}-baremetal.dtb" | 322 | |
249 | multiconf="${multiconf} cortexa72-${machine}-baremetal" | 323 | suffix="" |
250 | conf_file="multiconfig/cortexa72-${machine}-baremetal.conf" | 324 | [ "$1" != "None" ] && suffix="-$1" |
251 | libxil="multiconfig/includes/cortexa72-${machine}-libxil.conf" | 325 | |
252 | distro="multiconfig/includes/cortexa72-${machine}-distro.conf" | 326 | dtb_file="cortexa72-${machine}${suffix}-baremetal.dtb" |
253 | else | 327 | multiconf="${multiconf} cortexa72-${machine}${suffix}-baremetal" |
254 | dtb_file="cortexa72-${machine}-${1}-baremetal.dtb" | 328 | conf_file="multiconfig/cortexa72-${machine}${suffix}-baremetal.conf" |
255 | multiconf="${multiconf} cortexa72-${machine}-${1}-baremetal" | 329 | libxil="multiconfig/includes/cortexa72-${machine}${suffix}-libxil.conf" |
256 | conf_file="multiconfig/cortexa72-${machine}-${1}-baremetal.conf" | 330 | distro="multiconfig/includes/cortexa72-${machine}${suffix}-distro.conf" |
257 | libxil="multiconfig/includes/cortexa72-${machine}-${1}-libxil.conf" | ||
258 | distro="multiconfig/includes/cortexa72-${machine}-${1}-distro.conf" | ||
259 | fi | ||
260 | 331 | ||
261 | # Build device tree | 332 | # Build device tree |
262 | mkdir -p dtb | 333 | ( |
263 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f --enhanced -i ${lops_dir}/lop-a72-imux.dts ${dtb} ${dtb_file} && rm -f lop-a72-imux.dts.dtb) | 334 | cd dtb || error "Unable to cd to dtb dir" |
335 | if [ -n "${domain_file}" ]; then | ||
336 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --permissive --enhanced -x '*.yaml' \ | ||
337 | -i "${domain_file}" -i "${lops_dir}/lop-a72-imux.dts" "${system_dtb}" "${dtb_file}" \ | ||
338 | || error "lopper.py failed" | ||
339 | else | ||
340 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a72-imux.dts" \ | ||
341 | "${system_dtb}" "${dtb_file}" || error "lopper.py failed" | ||
342 | fi | ||
343 | rm -f lop-a72-imux.dts.dtb | ||
344 | ) | ||
264 | 345 | ||
265 | # Build baremetal multiconfig | 346 | # Build baremetal multiconfig |
266 | mkdir -p multiconfig/includes | 347 | if [ -n "${domain_file}" ]; then |
267 | lopper.py -f ${dtb} -- baremetaldrvlist_xlnx cortexa72-${machine} $embeddedsw | 348 | ${lopper} -f --permissive --enhanced -x '*.yaml' -i "${domain_file}" "${system_dtb}" \ |
268 | mv libxil.conf ${libxil} | 349 | -- baremetaldrvlist_xlnx cortexa72-${machine} "${embeddedsw}" || error "lopper.py failed" |
269 | mv distro.conf ${distro} | 350 | else |
270 | cat << EOF > ${conf_file} | 351 | ${lopper} -f "${system_dtb}" -- baremetaldrvlist_xlnx cortexa72-${machine} "${embeddedsw}" \ |
352 | || error "lopper.py failed" | ||
353 | fi | ||
354 | |||
355 | mv libxil.conf "${libxil}" | ||
356 | mv distro.conf "${distro}" | ||
357 | |||
358 | cat <<EOF >"${conf_file}" | ||
271 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 359 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
272 | ESW_MACHINE = "cortexa72-${machine}" | 360 | ESW_MACHINE = "cortexa72-${machine}" |
273 | DEFAULTTUNE = "cortexa72" | 361 | DEFAULTTUNE = "cortexa72" |
@@ -282,30 +370,44 @@ EOF | |||
282 | } | 370 | } |
283 | 371 | ||
284 | cortex_a72_freertos() { | 372 | cortex_a72_freertos() { |
285 | if [ $1 = "None" ]; then | 373 | info "coretex-a72 for FreeRTOS [ $1 ]" |
286 | dtb_file="cortexa72-${machine}-freertos.dtb" | 374 | |
287 | multiconf="${multiconf} cortexa72-${machine}-freertos" | 375 | suffix="" |
288 | conf_file="multiconfig/cortexa72-${machine}-freertos.conf" | 376 | [ "$1" != "None" ] && suffix="-$1" |
289 | libxil="multiconfig/includes/cortexa72-${machine}-libxil.conf" | 377 | |
290 | distro="multiconfig/includes/cortexa72-${machine}-distro.conf" | 378 | dtb_file="cortexa72-${machine}${suffix}-freertos.dtb" |
291 | else | 379 | multiconf="${multiconf} cortexa72-${machine}${suffix}-freertos" |
292 | dtb_file="cortexa72-${machine}-${1}-freertos.dtb" | 380 | conf_file="multiconfig/cortexa72-${machine}${suffix}-freertos.conf" |
293 | multiconf="${multiconf} cortexa72-${machine}-${1}-freertos" | 381 | libxil="multiconfig/includes/cortexa72-${machine}${suffix}-libxil.conf" |
294 | conf_file="multiconfig/cortexa72-${machine}-${1}-freertos.conf" | 382 | distro="multiconfig/includes/cortexa72-${machine}${suffix}-distro.conf" |
295 | libxil="multiconfig/includes/cortexa72-${machine}-${1}-libxil.conf" | ||
296 | distro="multiconfig/includes/cortexa72-${machine}-${1}-distro.conf" | ||
297 | fi | ||
298 | 383 | ||
299 | # Build device tree | 384 | # Build device tree |
300 | mkdir -p dtb | 385 | ( |
301 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f --enhanced -i ${lops_dir}/lop-a72-imux.dts ${dtb} ${dtb_file} && rm -f lop-a72-imux.dts.dtb) | 386 | cd dtb || error "Unable to cd to dtb dir" |
387 | if [ -n "${domain_file}" ]; then | ||
388 | LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f --permissive --enhanced -x '*.yaml' \ | ||
389 | -i "${domain_file}" -i "${lops_dir}/lop-a72-imux.dts" "${system_dtb}" "${dtb_file}" \ | ||
390 | || error "lopper.py failed" | ||
391 | else | ||
392 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a72-imux.dts" \ | ||
393 | "${system_dtb}" "${dtb_file}" || error "lopper.py failed" | ||
394 | fi | ||
395 | rm -f lop-a72-imux.dts.dtb | ||
396 | ) | ||
302 | 397 | ||
303 | # Build baremetal multiconfig | 398 | # Build baremetal multiconfig |
304 | mkdir -p multiconfig/includes | 399 | if [ -n "${domain_file}" ]; then |
305 | lopper.py -f ${dtb} -- baremetaldrvlist_xlnx cortexa72-${machine} $embeddedsw | 400 | ${lopper} -f --permissive --enhanced -x '*.yaml' -i "${domain_file}" "${system_dtb}" \ |
306 | mv libxil.conf ${libxil} | 401 | -- baremetaldrvlist_xlnx cortexa72-${machine} "${embeddedsw}" || error "lopper.py failed" |
307 | mv distro.conf ${distro} | 402 | else |
308 | cat << EOF > ${conf_file} | 403 | ${lopper} -f "${system_dtb}" -- baremetaldrvlist_xlnx cortexa72-${machine} "${embeddedsw}" \ |
404 | || error "lopper.py failed" | ||
405 | fi | ||
406 | |||
407 | mv libxil.conf "${libxil}" | ||
408 | mv distro.conf "${distro}" | ||
409 | |||
410 | cat <<EOF >"${conf_file}" | ||
309 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 411 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
310 | ESW_MACHINE = "cortexa72-${machine}" | 412 | ESW_MACHINE = "cortexa72-${machine}" |
311 | DEFAULTTUNE = "cortexa72" | 413 | DEFAULTTUNE = "cortexa72" |
@@ -321,43 +423,47 @@ EOF | |||
321 | 423 | ||
322 | r5_fsbl_done=0 | 424 | r5_fsbl_done=0 |
323 | cortex_r5_baremetal() { | 425 | cortex_r5_baremetal() { |
324 | if [ $1 = "fsbl" -a $r5_fsbl_done != 0 ]; then | 426 | if [ "$1" = "fsbl" ]; then |
325 | return | 427 | [ ${r5_fsbl_done} = 1 ] && return |
326 | elif [ $1 = "fsbl" ] ; then | 428 | info "coretex-r5 FSBL baremetal configuration" |
327 | echo "Building R5 FSBL baremetal configuration" | 429 | else |
328 | r5_fsbl_done=1 | 430 | info "coretex-r5 for baremetal [ $1 ]" |
329 | fi | 431 | fi |
330 | 432 | ||
331 | if [ $1 = "None" ]; then | 433 | suffix=""; lto="-nolto" |
332 | dtb_file="cortexr5-${machine}-baremetal.dtb" | 434 | if [ "$1" != "None" ]; then |
333 | multiconf="${multiconf} cortexr5-${machine}-baremetal" | 435 | suffix="-$1"; lto="" |
334 | conf_file="multiconfig/cortexr5-${machine}-baremetal.conf" | ||
335 | libxil="multiconfig/includes/cortexr5-${machine}-libxil.conf" | ||
336 | distro="multiconfig/includes/cortexr5-${machine}-distro.conf" | ||
337 | yocto_distro="xilinx-standalone-nolto" | ||
338 | else | ||
339 | dtb_file="cortexr5-${machine}-${1}-baremetal.dtb" | ||
340 | multiconf="${multiconf} cortexr5-${machine}-${1}-baremetal" | ||
341 | conf_file="multiconfig/cortexr5-${machine}-${1}-baremetal.conf" | ||
342 | libxil="multiconfig/includes/cortexr5-${machine}-${1}-libxil.conf" | ||
343 | distro="multiconfig/includes/cortexr5-${machine}-${1}-distro.conf" | ||
344 | yocto_distro="xilinx-standalone" | ||
345 | fi | 436 | fi |
346 | 437 | ||
347 | if [ $1 = "fsbl" ]; then | 438 | dtb_file="cortexr5-${machine}${suffix}-baremetal.dtb" |
439 | multiconf="${multiconf} cortexr5-${machine}${suffix}-baremetal" | ||
440 | conf_file="multiconfig/cortexr5-${machine}${suffix}-baremetal.conf" | ||
441 | libxil="multiconfig/includes/cortexr5-${machine}${suffix}-libxil.conf" | ||
442 | distro="multiconfig/includes/cortexr5-${machine}${suffix}-distro.conf" | ||
443 | yocto_distro="xilinx-standalone${lto}" | ||
444 | |||
445 | if [ "$1" = "fsbl" ]; then | ||
348 | r5fsbl_mcdepends="mc::${dtb_file%%.dtb}:fsbl-firmware:do_deploy" | 446 | r5fsbl_mcdepends="mc::${dtb_file%%.dtb}:fsbl-firmware:do_deploy" |
349 | r5fsbl_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" | 447 | r5fsbl_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" |
448 | r5_fsbl_done=1 | ||
350 | fi | 449 | fi |
450 | |||
351 | # Build device tree | 451 | # Build device tree |
352 | mkdir -p dtb | 452 | ( |
353 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f --enhanced -i ${lops_dir}/lop-r5-imux.dts ${dtb} ${dtb_file} && rm -f lop-r5-imux.dts.dtb) | 453 | cd dtb || error "Unable to cd to dtb dir" |
454 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-r5-imux.dts" \ | ||
455 | "${system_dtb}" "${dtb_file}" || error "lopper.py failed" | ||
456 | rm -f lop-r5-imux.dts.dtb | ||
457 | ) | ||
354 | 458 | ||
355 | # Build baremetal multiconfig | 459 | # Build baremetal multiconfig |
356 | mkdir -p multiconfig/includes | 460 | ${lopper} -f "${system_dtb}" -- baremetaldrvlist_xlnx cortexr5-${machine} "${embeddedsw}" \ |
357 | lopper.py -f ${dtb} -- baremetaldrvlist_xlnx cortexr5-${machine} $embeddedsw | 461 | || error "lopper.py failed" |
358 | mv libxil.conf ${libxil} | 462 | |
359 | mv distro.conf ${distro} | 463 | mv libxil.conf "${libxil}" |
360 | cat << EOF > ${conf_file} | 464 | mv distro.conf "${distro}" |
465 | |||
466 | cat <<EOF >"${conf_file}" | ||
361 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 467 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
362 | ESW_MACHINE = "cortexr5-${machine}" | 468 | ESW_MACHINE = "cortexr5-${machine}" |
363 | DEFAULTTUNE = "cortexr5f" | 469 | DEFAULTTUNE = "cortexr5f" |
@@ -372,30 +478,44 @@ EOF | |||
372 | } | 478 | } |
373 | 479 | ||
374 | cortex_r5_freertos() { | 480 | cortex_r5_freertos() { |
375 | if [ $1 = "None" ]; then | 481 | info "coretex-r5 for FreeRTOS [ $1 ]" |
376 | dtb_file="cortexr5-${machine}-freertos.dtb" | 482 | |
377 | multiconf="${multiconf} cortexr5-${machine}-freertos" | 483 | suffix="" |
378 | conf_file="multiconfig/cortexr5-${machine}-freertos.conf" | 484 | [ "$1" != "None" ] && suffix="-$1" |
379 | libxil="multiconfig/includes/cortexr5-${machine}-libxil.conf" | 485 | |
380 | distro="multiconfig/includes/cortexr5-${machine}-distro.conf" | 486 | dtb_file="cortexr5-${machine}${suffix}-freertos.dtb" |
381 | else | 487 | multiconf="${multiconf} cortexr5-${machine}${suffix}-freertos" |
382 | dtb_file="cortexr5-${machine}-${1}-freertos.dtb" | 488 | conf_file="multiconfig/cortexr5-${machine}${suffix}-freertos.conf" |
383 | multiconf="${multiconf} cortexr5-${machine}-${1}-freertos" | 489 | libxil="multiconfig/includes/cortexr5-${machine}${suffix}-libxil.conf" |
384 | conf_file="multiconfig/cortexr5-${machine}-${1}-freertos.conf" | 490 | distro="multiconfig/includes/cortexr5-${machine}${suffix}-distro.conf" |
385 | libxil="multiconfig/includes/cortexr5-${machine}-${1}-libxil.conf" | ||
386 | distro="multiconfig/includes/cortexr5-${machine}-${1}-distro.conf" | ||
387 | fi | ||
388 | 491 | ||
389 | # Build device tree | 492 | # Build device tree |
390 | mkdir -p dtb | 493 | ( |
391 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f --enhanced -i ${lops_dir}/lop-r5-imux.dts ${dtb} ${dtb_file} && rm -f lop-r5-imux.dts.dtb) | 494 | cd dtb || error "Unable to cd to dtb dir" |
495 | if [ -n "$domain_file" ]; then | ||
496 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --permissive --enhanced -x '*.yaml' \ | ||
497 | -i "${domain_file}" -i "${lops_dir}/lop-r5-imux.dts" "${system_dtb}" "${dtb_file}" \ | ||
498 | || error "lopper.py failed" | ||
499 | else | ||
500 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-r5-imux.dts" \ | ||
501 | "${system_dtb}" "${dtb_file}" || error "lopper.py failed" | ||
502 | fi | ||
503 | rm -f lop-r5-imux.dts.dtb | ||
504 | ) | ||
392 | 505 | ||
393 | # Build baremetal multiconfig | 506 | # Build baremetal multiconfig |
394 | mkdir -p multiconfig/includes | 507 | if [ -n "${domain_file}" ]; then |
395 | lopper.py -f ${dtb} -- baremetaldrvlist_xlnx cortexr5-${machine} $embeddedsw | 508 | ${lopper} -f --permissive --enhanced -x '*.yaml' -i "${domain_file}" "${system_dtb}" \ |
396 | mv libxil.conf ${libxil} | 509 | -- baremetaldrvlist_xlnx coretexr5-${machine} "${embeddedsw}" || error "lopper.py failed" |
397 | mv distro.conf ${distro} | 510 | else |
398 | cat << EOF > ${conf_file} | 511 | ${lopper} -f "${system_dtb}" -- baremetaldrvlist_xlnx cortexr5-${machine} "${embeddedsw}" \ |
512 | || error "lopper.py failed" | ||
513 | fi | ||
514 | |||
515 | mv libxil.conf "${libxil}" | ||
516 | mv distro.conf "${distro}" | ||
517 | |||
518 | cat <<EOF >"${conf_file}" | ||
399 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 519 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
400 | ESW_MACHINE = "cortexr5-${machine}" | 520 | ESW_MACHINE = "cortexr5-${machine}" |
401 | DEFAULTTUNE = "cortexr5f" | 521 | DEFAULTTUNE = "cortexr5f" |
@@ -411,21 +531,27 @@ EOF | |||
411 | 531 | ||
412 | # Generate microblaze tunings | 532 | # Generate microblaze tunings |
413 | microblaze_done=0 | 533 | microblaze_done=0 |
414 | # Generate microblaze tunings | 534 | process_microblaze() { |
415 | microblaze_done=0 | 535 | [ ${microblaze_done} = 1 ] && return |
416 | process:microblaze() { | 536 | |
417 | if [ ${microblaze_done} = 0 ]; then | 537 | info "Generating microblaze processor tunes" |
418 | echo -n "Generating microblaze processor tunes..." | 538 | |
419 | # Process microblaze | 539 | ( |
420 | mkdir -p dtb | 540 | cd dtb || error "Unable to cd to dtb dir" |
421 | (cd dtb ; lopper.py -f --enhanced -i ${lops_dir}/lop-microblaze-yocto.dts ${dtb} && rm -f lop-microblaze-yocto.dts.dtb) > microblaze.conf | 541 | ${lopper} -f --enhanced -i "${lops_dir}/lop-microblaze-yocto.dts" "${system_dtb}" \ |
422 | microblaze_done=1 | 542 | || error "lopper.py failed" |
423 | echo "...done" | 543 | rm -f lop-microblaze-yocto.dts.dtb |
424 | fi | 544 | ) >microblaze.conf |
545 | |||
546 | microblaze_done=1 | ||
425 | } | 547 | } |
426 | 548 | ||
427 | # pmu-microblaze is ALWAYS baremetal, no domain | 549 | # pmu-microblaze is ALWAYS baremetal, no domain |
428 | pmu-microblaze() { | 550 | pmu-microblaze() { |
551 | info "Microblaze ZynqMP PMU" | ||
552 | |||
553 | process_microblaze | ||
554 | |||
429 | dtb_file="microblaze-pmu.dtb" | 555 | dtb_file="microblaze-pmu.dtb" |
430 | multiconf="${multiconf} microblaze-pmu" | 556 | multiconf="${multiconf} microblaze-pmu" |
431 | conf_file="multiconfig/microblaze-pmu.conf" | 557 | conf_file="multiconfig/microblaze-pmu.conf" |
@@ -436,21 +562,30 @@ pmu-microblaze() { | |||
436 | pmu_firmware_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" | 562 | pmu_firmware_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" |
437 | 563 | ||
438 | # Build device tree | 564 | # Build device tree |
439 | mkdir -p dtb | 565 | ( |
440 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f ${dtb} ${dtb_file}) | 566 | cd dtb || error "Unable to cd to dtb dir" |
567 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dtb}" "${dtb_file}" || error "lopper.py failed" | ||
568 | ) | ||
441 | 569 | ||
442 | # Build baremetal multiconfig | 570 | # Build baremetal multiconfig |
443 | mkdir -p multiconfig/includes | 571 | if [ -n "${domain_file}" ]; then |
444 | lopper.py -f ${dtb} -- baremetaldrvlist_xlnx microblaze-pmu $embeddedsw | 572 | ${lopper} -f --permissive --enhanced -x '*.yaml' -i "${domain_file}" "${system_dtb}" \ |
445 | mv libxil.conf ${libxil} | 573 | -- baremetaldrvlist_xlnx microblaze-pmu "${embeddedsw}" || error "lopper.py failed" |
446 | mv distro.conf ${distro} | 574 | else |
447 | cat << EOF > ${conf_file} | 575 | ${lopper} -f "${system_dtb}" -- baremetaldrvlist_xlnx microblaze-pmu "${embeddedsw}" \ |
576 | || error "lopper.py failed" | ||
577 | fi | ||
578 | |||
579 | mv libxil.conf "${libxil}" | ||
580 | mv distro.conf "${distro}" | ||
581 | |||
582 | cat <<EOF >"${conf_file}" | ||
448 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 583 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
449 | ESW_MACHINE = "microblaze-pmu" | 584 | ESW_MACHINE = "microblaze-pmu" |
450 | 585 | ||
451 | require conf/microblaze.conf | 586 | require conf/microblaze.conf |
452 | DEFAULTTUNE = "microblaze" | 587 | DEFAULTTUNE = "microblaze" |
453 | TUNE_FEATURES:tune-microblaze:forcevariable = "\${TUNE_FEATURES_tune-pmu-microblaze}" | 588 | TUNE_FEATURES_tune-microblaze_forcevariable = "\${TUNE_FEATURES_tune-pmu-microblaze}" |
454 | 589 | ||
455 | TARGET_CFLAGS += "-DPSU_PMU=1U" | 590 | TARGET_CFLAGS += "-DPSU_PMU=1U" |
456 | 591 | ||
@@ -465,6 +600,10 @@ EOF | |||
465 | 600 | ||
466 | # pmc-microblaze is ALWAYS baremetal, no domain | 601 | # pmc-microblaze is ALWAYS baremetal, no domain |
467 | pmc-microblaze() { | 602 | pmc-microblaze() { |
603 | info "Microblaze Versal PMC" | ||
604 | |||
605 | process_microblaze | ||
606 | |||
468 | dtb_file="microblaze-pmc.dtb" | 607 | dtb_file="microblaze-pmc.dtb" |
469 | multiconf="${multiconf} microblaze-pmc" | 608 | multiconf="${multiconf} microblaze-pmc" |
470 | conf_file="multiconfig/microblaze-pmc.conf" | 609 | conf_file="multiconfig/microblaze-pmc.conf" |
@@ -475,21 +614,30 @@ pmc-microblaze() { | |||
475 | plm_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" | 614 | plm_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" |
476 | 615 | ||
477 | # Build device tree | 616 | # Build device tree |
478 | mkdir -p dtb | 617 | ( |
479 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f ${dtb} ${dtb_file}) | 618 | cd dtb || error "Unable to cd to dtb dir" |
619 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dtb}" "${dtb_file}" || error "lopper.py failed" | ||
620 | ) | ||
480 | 621 | ||
481 | # Build baremetal multiconfig | 622 | # Build baremetal multiconfig |
482 | mkdir -p multiconfig/includes | 623 | if [ -n "${domain_file}" ]; then |
483 | lopper.py -f ${dtb} -- baremetaldrvlist_xlnx microblaze-plm $embeddedsw | 624 | ${lopper} -f --permissive --enhanced -x '*.yaml' -i "${domain_file}" "${system_dtb}" \ |
484 | mv libxil.conf ${libxil} | 625 | -- baremetaldrvlist_xlnx microblaze-plm "${embeddedsw}" || error "lopper.py failed" |
485 | mv distro.conf ${distro} | 626 | else |
486 | cat << EOF > ${conf_file} | 627 | ${lopper} -f "${system_dtb}" -- baremetaldrvlist_xlnx microblaze-plm "${embeddedsw}" \ |
628 | || error "lopper.py failed" | ||
629 | fi | ||
630 | |||
631 | mv libxil.conf "${libxil}" | ||
632 | mv distro.conf "${distro}" | ||
633 | |||
634 | cat <<EOF >"${conf_file}" | ||
487 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 635 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
488 | ESW_MACHINE = "microblaze-plm" | 636 | ESW_MACHINE = "microblaze-plm" |
489 | 637 | ||
490 | require conf/microblaze.conf | 638 | require conf/microblaze.conf |
491 | DEFAULTTUNE = "microblaze" | 639 | DEFAULTTUNE = "microblaze" |
492 | TUNE_FEATURES:tune-microblaze:forcevariable = "\${TUNE_FEATURES_tune-pmc-microblaze}" | 640 | TUNE_FEATURES_tune-microblaze_forcevariable = "\${TUNE_FEATURES_tune-pmc-microblaze}" |
493 | 641 | ||
494 | TARGET_CFLAGS += "-DVERSAL_PLM=1" | 642 | TARGET_CFLAGS += "-DVERSAL_PLM=1" |
495 | 643 | ||
@@ -504,6 +652,10 @@ EOF | |||
504 | 652 | ||
505 | # psm-microblaze is ALWAYS baremetal, no domain | 653 | # psm-microblaze is ALWAYS baremetal, no domain |
506 | psm-microblaze() { | 654 | psm-microblaze() { |
655 | info "Microblaze Versal PSM" | ||
656 | |||
657 | process_microblaze | ||
658 | |||
507 | dtb_file="microblaze-psm.dtb" | 659 | dtb_file="microblaze-psm.dtb" |
508 | multiconf="${multiconf} microblaze-psm" | 660 | multiconf="${multiconf} microblaze-psm" |
509 | conf_file="multiconfig/microblaze-psm.conf" | 661 | conf_file="multiconfig/microblaze-psm.conf" |
@@ -514,21 +666,30 @@ psm-microblaze() { | |||
514 | psm_firmware_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" | 666 | psm_firmware_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" |
515 | 667 | ||
516 | # Build device tree | 668 | # Build device tree |
517 | mkdir -p dtb | 669 | ( |
518 | (cd dtb ; LOPPER_DTC_FLAGS="-b 0 -@" lopper.py -f ${dtb} ${dtb_file}) | 670 | cd dtb || error "Unable to cd to dtb dir" |
671 | LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dtb}" "${dtb_file}" || error "lopper.py failed" | ||
672 | ) | ||
519 | 673 | ||
520 | # Build baremetal multiconfig | 674 | # Build baremetal multiconfig |
521 | mkdir -p multiconfig/includes | 675 | if [ -n "${domain_file}" ]; then |
522 | lopper.py -f ${dtb} -- baremetaldrvlist_xlnx microblaze-psm $embeddedsw | 676 | ${lopper} -f --permissive --enhanced -x '*.yaml' -i "${domain_file}" "${system_dtb}" \ |
523 | mv libxil.conf ${libxil} | 677 | -- baremetaldrvlist_xlnx microblaze-psm "${embeddedsw}" || error "lopper.py failed" |
524 | mv distro.conf ${distro} | 678 | else |
525 | cat << EOF > ${conf_file} | 679 | ${lopper} -f "${system_dtb}" -- baremetaldrvlist_xlnx microblaze-psm "${embeddedsw}" \ |
680 | || error "lopper.py failed" | ||
681 | fi | ||
682 | |||
683 | mv libxil.conf "${libxil}" | ||
684 | mv distro.conf "${distro}" | ||
685 | |||
686 | cat <<EOF >"${conf_file}" | ||
526 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" | 687 | CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" |
527 | ESW_MACHINE = "microblaze-psm" | 688 | ESW_MACHINE = "microblaze-psm" |
528 | 689 | ||
529 | require conf/microblaze.conf | 690 | require conf/microblaze.conf |
530 | DEFAULTTUNE = "microblaze" | 691 | DEFAULTTUNE = "microblaze" |
531 | TUNE_FEATURES:tune-microblaze:forcevariable = "\${TUNE_FEATURES_tune-psm-microblaze}" | 692 | TUNE_FEATURES_tune-microblaze_forcevariable = "\${TUNE_FEATURES_tune-psm-microblaze}" |
532 | 693 | ||
533 | TARGET_CFLAGS += "-DVERSAL_psm=1" | 694 | TARGET_CFLAGS += "-DVERSAL_psm=1" |
534 | 695 | ||
@@ -542,204 +703,170 @@ EOF | |||
542 | } | 703 | } |
543 | 704 | ||
544 | parse_cpus() { | 705 | parse_cpus() { |
545 | while read cpu domain os_hint ; do | 706 | info "Generating configuration..." |
707 | |||
708 | while read -r cpu domain os_hint; do | ||
709 | |||
710 | # Skip commented lines and WARNINGs | ||
546 | case ${cpu} in | 711 | case ${cpu} in |
547 | \#* | \[WARNING\]:) continue ;; | 712 | \#* | \[WARNING\]:) continue ;; |
548 | esac | 713 | esac |
549 | if [ ${domain} != "None" ]; then | 714 | |
550 | echo "Warning: Domains are not yet supported, the generated DTB may be incorrect. ${domain}" | ||
551 | fi | ||
552 | case ${cpu} in | 715 | case ${cpu} in |
716 | |||
553 | arm,cortex-a53) | 717 | arm,cortex-a53) |
554 | # We need a base cortex_a53_baremetl for the FSBL | 718 | # We need a base cortex_a53_baremetal for the FSBL |
555 | cortex_a53_baremetal fsbl | 719 | cortex_a53_baremetal fsbl |
556 | if [ ${os_hint} == "None" ]; then | 720 | if [ "${os_hint}" == "None" ]; then |
557 | echo "cortex-a53 for Linux" | 721 | cortex_a53_linux "${domain}" |
558 | cortex_a53_linux ${domain} | 722 | cortex_a53_baremetal "${domain}" |
559 | echo "cortex-a53 for Baremetal" | 723 | cortex_a53_freertos "${domain}" |
560 | cortex_a53_baremetal ${domain} | ||
561 | echo "cortex-a53 for Freertos" | ||
562 | cortex_a53_freertos ${domain} | ||
563 | else | 724 | else |
564 | case ${os_hint} in | 725 | case "${os_hint}" in |
565 | linux*) | 726 | linux*) |
566 | echo "cortex-a53 for Linux ${domain}" | 727 | cortex_a53_linux "${domain}" ;; |
567 | cortex_a53_linux ${domain} | ||
568 | ;; | ||
569 | baremetal*) | 728 | baremetal*) |
570 | echo "cortex-a53 for Baremetal ${domain}" | 729 | cortex_a53_baremetal "${domain}" ;; |
571 | cortex_a53_baremetal ${domain} | ||
572 | ;; | ||
573 | freertos*) | 730 | freertos*) |
574 | echo "cortex-a53 for Freertos ${domain}" | 731 | cortex_a53_freertos "${domain}" ;; |
575 | cortex_a53_freertos ${domain} | ||
576 | ;; | ||
577 | *) | 732 | *) |
578 | echo "Warning: cortex-a53 for unknown OS (${os_hint}), parsing baremetal. ${domain}" | 733 | warn "cortex-a53 for unknown OS (${os_hint}), parsing baremetal. ${domain}" |
579 | cortex_a53_baremetal ${domain} | 734 | cortex_a53_baremetal "${domain}" |
580 | ;; | ||
581 | esac | 735 | esac |
582 | fi | 736 | fi |
583 | ;; | 737 | ;; |
738 | |||
584 | arm,cortex-a72) | 739 | arm,cortex-a72) |
585 | if [ ${os_hint} == "None" ]; then | 740 | if [ "${os_hint}" == "None" ]; then |
586 | echo "cortex-a72 for Linux" | 741 | cortex_a72_linux "${domain}" |
587 | cortex_a72_linux ${domain} | 742 | cortex_a72_baremetal "${domain}" |
588 | echo "cortex-a72 for Baremetal" | 743 | cortex_a72_freertos "${domain}" |
589 | cortex_a72_baremetal ${domain} | ||
590 | echo "cortex-a72 for Freertos" | ||
591 | cortex_a72_freertos ${domain} | ||
592 | else | 744 | else |
593 | case ${os_hint} in | 745 | case "${os_hint}" in |
594 | linux*) | 746 | linux*) |
595 | echo "cortex-a72 for Linux ${domain}" | 747 | cortex_a72_linux "${domain}" ;; |
596 | cortex_a72_linux ${domain} | ||
597 | ;; | ||
598 | baremetal*) | 748 | baremetal*) |
599 | echo "cortex-a72 for Baremetal ${domain}" | 749 | cortex_a72_baremetal "${domain}" ;; |
600 | cortex_a72_baremetal ${domain} | ||
601 | ;; | ||
602 | freertos*) | 750 | freertos*) |
603 | echo "cortex-a72 for Freertos ${domain}" | 751 | cortex_a72_freertos "${domain}" ;; |
604 | cortex_a72_freertos ${domain} | ||
605 | ;; | ||
606 | *) | 752 | *) |
607 | echo "Warning: cortex-a72 for unknown OS (${os_hint}), parsing baremetal. ${domain}" | 753 | warn "cortex-a72 for unknown OS (${os_hint}), parsing baremetal. ${domain}" |
608 | cortex_a72_baremetal ${domain} | 754 | cortex_a72_baremetal "${domain}" |
609 | ;; | ||
610 | esac | 755 | esac |
611 | fi | 756 | fi |
612 | ;; | 757 | ;; |
758 | |||
613 | arm,cortex-r5) | 759 | arm,cortex-r5) |
614 | if [ ${os_hint} == "None" ]; then | 760 | if [ "${os_hint}" == "None" ]; then |
615 | if [ "${machine}" = "zynqmp" ]; then | 761 | # We need a base cortex_r5_baremetal for the FSBL for ZynqMP platform |
616 | # We need a base cortex_r5_baremetal for the FSBL for ZynqMP platform | 762 | [ "${machine}" = "zynqmp" ] && cortex_r5_baremetal fsbl |
617 | cortex_r5_baremetal fsbl | 763 | cortex_r5_baremetal "${domain}" |
618 | fi | 764 | cortex_r5_freertos "${domain}" |
619 | echo "cortex-r5 for Baremetal" | 765 | else |
620 | cortex_r5_baremetal ${domain} | 766 | case "${os_hint}" in |
621 | echo "cortex-r5 for Freertos" | ||
622 | cortex_r5_freertos ${domain} | ||
623 | else | ||
624 | case ${os_hint} in | ||
625 | baremetal*) | 767 | baremetal*) |
626 | echo "cortex-r5 for Baremetal ${domain}" | 768 | cortex_r5_baremetal "${domain}" ;; |
627 | cortex_r5_baremetal ${domain} | ||
628 | ;; | ||
629 | freertos*) | 769 | freertos*) |
630 | echo "cortex-r5 for Freertos ${domain}" | 770 | cortex_r5_freertos "${domain}" ;; |
631 | cortex_r5_freertos ${domain} | ||
632 | ;; | ||
633 | *) | 771 | *) |
634 | echo "Warning: cortex-r5 for unknown OS (${os_hint}), parsing baremetal. ${domain}" | 772 | warn "cortex-r5 for unknown OS (${os_hint}), parsing baremetal. ${domain}" |
635 | cortex_r5_baremetal ${domain} | 773 | cortex_r5_baremetal "${domain}" |
636 | ;; | ||
637 | esac | 774 | esac |
638 | fi | 775 | fi |
639 | ;; | 776 | ;; |
777 | |||
640 | xlnx,microblaze) | 778 | xlnx,microblaze) |
641 | process:microblaze | 779 | process_microblaze |
642 | case ${os_hint} in | 780 | case "${os_hint}" in |
643 | None | baremetal*) | 781 | None | baremetal*) |
644 | echo "Warning: Microblaze for Baremetal ${domain} not yet implemented" | 782 | warn "Microblaze for Baremetal ${domain} not yet implemented" ;; |
645 | ;; | ||
646 | Linux) | 783 | Linux) |
647 | echo "Warning: Microblaze for Linux ${domain} not yet implemented" | 784 | warn "Microblaze for Linux ${domain} not yet implemented" ;; |
648 | ;; | ||
649 | *) | 785 | *) |
650 | echo "Warning: Microblaze for unknown OS (${os_hint}), not yet implemented. ${domain}" | 786 | warn "Microblaze for unknown OS (${os_hint}), not yet implemented. ${domain}" ;; |
651 | ;; | ||
652 | esac | 787 | esac |
653 | ;; | 788 | ;; |
789 | |||
654 | pmu-microblaze) | 790 | pmu-microblaze) |
655 | process:microblaze | 791 | pmu-microblaze ;; |
656 | echo "Microblaze ZynqMP pmu" | 792 | |
657 | pmu-microblaze | ||
658 | ;; | ||
659 | pmc-microblaze) | 793 | pmc-microblaze) |
660 | process:microblaze | 794 | pmc-microblaze ;; |
661 | echo "Microblaze Versal pmc" | 795 | |
662 | pmc-microblaze | ||
663 | ;; | ||
664 | psm-microblaze) | 796 | psm-microblaze) |
665 | process:microblaze | 797 | psm-microblaze ;; |
666 | echo "Microblaze Versal psm" | 798 | |
667 | psm-microblaze | ||
668 | ;; | ||
669 | *) | 799 | *) |
670 | echo "Unknown CPU ${cpu}" | 800 | warn "Unknown CPU ${cpu}" |
671 | ;; | 801 | |
672 | esac | 802 | esac |
673 | done < cpu-list.tmp | 803 | done <cpu-list.tmp |
804 | } | ||
805 | |||
806 | gen_local_conf() { | ||
807 | echo | ||
808 | echo "To enable this, add the following to your local.conf:" | ||
809 | echo | ||
810 | echo "# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere" | ||
811 | echo "BASE_TMPDIR = \"${TOPDIR}\"" | ||
812 | [ -n "${system_conf}" ] && echo "require ${system_conf}" | ||
813 | echo "SYSTEM_DTFILE = \"${system_dtb}\"" | ||
814 | echo "BBMULTICONFIG += \"${multiconf}\"" | ||
815 | if [ -n "${fsbl_mcdepends}" ]; then | ||
816 | echo "FSBL_DEPENDS = \"\"" | ||
817 | echo "FSBL_MCDEPENDS = \"${fsbl_mcdepends}\"" | ||
818 | echo "FSBL_DEPLOY_DIR = \"${fsbl_deploy_dir}\"" | ||
819 | fi | ||
820 | if [ -n "${r5fsbl_mcdepends}" ]; then | ||
821 | echo "R5FSBL_DEPENDS = \"\"" | ||
822 | echo "R5FSBL_MCDEPENDS = \"${r5fsbl_mcdepends}\"" | ||
823 | echo "R5FSBL_DEPLOY_DIR = \"${r5fsbl_deploy_dir}\"" | ||
824 | fi | ||
825 | if [ -n "${pmu_mcdepends}" ]; then | ||
826 | echo "PMU_DEPENDS = \"\"" | ||
827 | echo "PMU_MCDEPENDS = \"${pmu_mcdepends}\"" | ||
828 | echo "PMU_FIRMWARE_DEPLOY_DIR = \"${pmu_firmware_deploy_dir}\"" | ||
829 | fi | ||
830 | if [ -n "${plm_mcdepends}" ]; then | ||
831 | echo "PLM_DEPENDS = \"\"" | ||
832 | echo "PLM_MCDEPENDS = \"${plm_mcdepends}\"" | ||
833 | echo "PLM_DEPLOY_DIR = \"${plm_deploy_dir}\"" | ||
834 | fi | ||
835 | if [ -n "${psm_mcdepends}" ]; then | ||
836 | echo "PSM_DEPENDS = \"\"" | ||
837 | echo "PSM_MCDEPENDS = \"${psm_mcdepends}\"" | ||
838 | echo "PSM_FIRMWARE_DEPLOY_DIR = \"${psm_firmware_deploy_dir}\"" | ||
839 | fi | ||
840 | [ "${machine}" = "versal" ] && echo "PDI_PATH = \"__PATH TO PDI FILE HERE__\"" | ||
841 | echo | ||
674 | } | 842 | } |
675 | 843 | ||
844 | parse_args "$@" | ||
845 | |||
846 | lopper=$(command -v lopper.py) | ||
847 | lopper_dir=$(dirname "${lopper}") | ||
848 | lops_dir=$(dirname "${lopper_dir}")/share/lopper/lops | ||
849 | embeddedsw=$(dirname "${lopper_dir}")/share/embeddedsw | ||
850 | system_conf="" | ||
851 | multiconf="" | ||
852 | |||
853 | [ -z "${lopper}" ] && error "Unable to find lopper.py, please source the prestep environment" | ||
854 | |||
676 | # Generate CPU list | 855 | # Generate CPU list |
677 | cd ${conf_dir} | 856 | cd "${config_dir}" || exit |
678 | mkdir -p dtb | 857 | mkdir -p dtb multiconfig/includes |
679 | (cd dtb ; lopper.py -f --enhanced -i ${lops_dir}/lop-xilinx-id-cpus.dts ${dtb} /dev/null && rm -f lop-xilinx-id-cpus.dts.dtb) > cpu-list.tmp | 858 | ( |
680 | 859 | cd dtb || error "Unable to cd to dtb dir" | |
681 | if [ -z ${machine} ]; then | 860 | ${lopper} -f --enhanced -i "${lops_dir}/lop-xilinx-id-cpus.dts" "${system_dtb}" \ |
682 | detect_machine | 861 | /dev/null >"../cpu-list.tmp" || error "lopper.py failed" |
683 | echo "Autodetected machine ${machine}" | 862 | rm -f "lop-xilinx-id-cpus.dts.dtb" |
684 | else | 863 | ) |
685 | echo "Machine ${machine}" | 864 | |
686 | fi | 865 | detect_machine |
687 | |||
688 | case ${machine} in | ||
689 | zynqmp | versal) : ;; | ||
690 | *) | ||
691 | echo "ERROR: Unknown machine type ${machine}" | ||
692 | exit 1 | ||
693 | ;; | ||
694 | esac | ||
695 | |||
696 | echo | ||
697 | echo "Generating configuration..." | ||
698 | 866 | ||
699 | parse_cpus | 867 | parse_cpus |
700 | 868 | ||
701 | echo "...done" | 869 | gen_local_conf |
702 | echo | ||
703 | echo | ||
704 | 870 | ||
705 | # Cleanup our temp file | 871 | # Cleanup our temp file |
706 | rm cpu-list.tmp | 872 | rm cpu-list.tmp |
707 | |||
708 | echo "To enable this, add the following to your local.conf:" | ||
709 | echo | ||
710 | echo '# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere' | ||
711 | echo 'BASE_TMPDIR = "${TOPDIR}"' | ||
712 | if [ -n "${system_conf}" ]; then | ||
713 | echo "require ${system_conf}" | ||
714 | fi | ||
715 | echo 'SYSTEM_DTFILE = "'${dtb}'"' | ||
716 | echo 'BBMULTICONFIG += "'${multiconf}'"' | ||
717 | if [ -n "${fsbl_mcdepends}" ]; then | ||
718 | echo 'FSBL_DEPENDS = ""' | ||
719 | echo 'FSBL_MCDEPENDS = "'${fsbl_mcdepends}'"' | ||
720 | echo 'FSBL_DEPLOY_DIR = "'${fsbl_deploy_dir}'"' | ||
721 | fi | ||
722 | if [ -n "${r5fsbl_mcdepends}" ]; then | ||
723 | echo 'R5FSBL_DEPENDS = ""' | ||
724 | echo 'R5FSBL_MCDEPENDS = "'${r5fsbl_mcdepends}'"' | ||
725 | echo 'R5FSBL_DEPLOY_DIR = "'${r5fsbl_deploy_dir}'"' | ||
726 | fi | ||
727 | if [ -n "${pmu_mcdepends}" ]; then | ||
728 | echo 'PMU_DEPENDS = ""' | ||
729 | echo 'PMU_MCDEPENDS = "'${pmu_mcdepends}'"' | ||
730 | echo 'PMU_FIRMWARE_DEPLOY_DIR = "'${pmu_firmware_deploy_dir}'"' | ||
731 | fi | ||
732 | if [ -n "${plm_mcdepends}" ]; then | ||
733 | echo 'PLM_DEPENDS = ""' | ||
734 | echo 'PLM_MCDEPENDS = "'${plm_mcdepends}'"' | ||
735 | echo 'PLM_DEPLOY_DIR = "'${plm_deploy_dir}'"' | ||
736 | fi | ||
737 | if [ -n "${psm_mcdepends}" ]; then | ||
738 | echo 'PSM_DEPENDS = ""' | ||
739 | echo 'PSM_MCDEPENDS = "'${psm_mcdepends}'"' | ||
740 | echo 'PSM_FIRMWARE_DEPLOY_DIR = "'${psm_firmware_deploy_dir}'"' | ||
741 | fi | ||
742 | if [ "${machine}" = "versal" ]; then | ||
743 | echo 'PDI_PATH = "__PATH TO PDI FILE HERE__"' | ||
744 | fi | ||
745 | echo | ||