summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-standalone-experimental/recipes-core
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@amd.com>2023-01-13 18:20:24 -0800
committerMark Hatle <mark.hatle@amd.com>2023-01-16 07:26:08 -0800
commit94f89efa051df9b1444f2973db55ceb8cd1cc5fc (patch)
tree053f1633b16999b157c86e40631a751333191385 /meta-xilinx-standalone-experimental/recipes-core
parente3e0d0cff038cf9e31e78aaa0944d731078c7546 (diff)
downloadmeta-xilinx-94f89efa051df9b1444f2973db55ceb8cd1cc5fc.tar.gz
meta-xilinx-setup: Rework dt-processor.sh to generate a machine and configs
lop-microblaze-yocto.dts has been modified to generate the file in a slightly different format. There is no need for an intermediate representation for the various microblaze tunings, instead use fixed names for pmc, psm and pmu configurations. dt-processor.sh was reworked to generate a machine.conf file and shrink the amount of information that ends up in the local.conf file. As part of this work the -m option has been renamed to -t. This option is rarely used, so should not impact many users. A new -m option is implemented to allow the user to manually name the generated machine.conf file. Otherwise, it will discover the name from the system device tree using the root 'compatible' object. The tool will also print more useful diagnostics to the screen, this should help ensure that the correct machine is being targeted by the actions and improve early system debuggability. Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Diffstat (limited to 'meta-xilinx-standalone-experimental/recipes-core')
-rw-r--r--meta-xilinx-standalone-experimental/recipes-core/meta/files/README-setup155
-rwxr-xr-xmeta-xilinx-standalone-experimental/recipes-core/meta/files/dt-processor.sh301
2 files changed, 291 insertions, 165 deletions
diff --git a/meta-xilinx-standalone-experimental/recipes-core/meta/files/README-setup b/meta-xilinx-standalone-experimental/recipes-core/meta/files/README-setup
index 4dc5737f..0a5736d8 100644
--- a/meta-xilinx-standalone-experimental/recipes-core/meta/files/README-setup
+++ b/meta-xilinx-standalone-experimental/recipes-core/meta/files/README-setup
@@ -7,19 +7,6 @@ if the setup script changes.
7The steps in this document expect that you have already built the setup 7The steps in this document expect that you have already built the setup
8(meta-xilinx-setup) SDK, and installed it. 8(meta-xilinx-setup) SDK, and installed it.
9 9
10* Configure you local.conf
11
12The following items should be in your conf/local.conf. This ensures that
13the correct configurations are available, and the correct firmware version
14is selected for this workflow.
15
16# Instruct the system to use the decoupling firmware sources,
17# add the following to the conf/local.conf:
18PREFERRED_VERSION_fsbl-firmware = "2023.1_sdt_experimental%"
19PREFERRED_VERSION_pmu-firmware = "2023.1_sdt_experimental%"
20PREFERRED_VERSION_plm-firmware = "2023.1_sdt_experimental%"
21PREFERRED_VERSION_psm-firmware = "2023.1_sdt_experimental%"
22
23* Run the setup script 10* Run the setup script
24 11
25The setup environment should be run in a new shell (not the build shell) 12The setup environment should be run in a new shell (not the build shell)
@@ -28,64 +15,66 @@ to ensure that you do not contaminate the environment for your build.
28We will assume below that the directory "prestep" was used for the SDK, 15We will assume below that the directory "prestep" was used for the SDK,
29however you may use any path you wish. 16however you may use any path you wish.
30 17
31# Source the SDK environment file 18Source the SDK environment file
32. <build>/prestep/environment-setup-x86_64-petalinux-linux 19 $ . <build>/prestep/environment-setup-x86_64-petalinux-linux
33 20
34# Run the script from the same directory as this README 21Run the script from the same directory as this README
35<build>/prestep/dt-processor.sh -c <conf> -s <dtb> -l conf/local.conf 22 $ <build>/prestep/dt-processor.sh -c <conf> -s <dtb> -l conf/local.conf
36 23
37# Note: The -l option will automatically add the necessary parameters to the 24Note: The -l option will automatically add the necessary parameters to the
38# local.conf file. If you need to re-run this comment, you just clear the 25local.conf file. If you need to re-run this comment, you just clear the
39# parameters from the end of the file. Without the -l option the items are 26parameters from the end of the file. Without the -l option the items are
40# printed to the screen and must be manually added to your conf/local.conf 27printed to the screen and must be manually added to your conf/local.conf
41 28
42# For example, zynqmp: 29For example, zynqmp:
43# ./prestep/dt-processor.sh -c conf -s /proj/yocto/zu-sdt/system-top.dts -l conf/local.conf 30 $ ./prestep/dt-processor.sh -c conf -s /proj/yocto/zcu102-sdt/system-top.dts -l conf/local.conf
44# 31
45# The following will be written to the end of the conf/local.conf file 32The following will be written to the end of the conf/local.conf file:
46 33
47# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere 34 # Each multiconfig will define it's own TMPDIR, this is the new default based
48BASE_TMPDIR ?= "${TOPDIR}" 35 # on BASE_TMPDIR for the Linux build
49require conf/cortexa53-zynqmp-linux.conf 36 TMPDIR = "${BASE_TMPDIR}/tmp"
50SYSTEM_DTFILE = "/proj/yocto/zu-sdt/system-top.dts" 37
51BBMULTICONFIG += " cortexa53-0-zynqmp-fsbl-baremetal cortexa53-0-zynqmp-baremetal cortexa53-0-zynqmp-freertos cortexa53-1-zynqmp-baremetal cortexa53-1-zynqmp-freertos cortexa53-2-zynqmp-baremetal cortexa53-2-zynqmp-freertos cortexa53-3-zynqmp-baremetal cortexa53-3-zynqmp-freertos cortexr5-0-zynqmp-fsbl-baremetal cortexr5-0-zynqmp-baremetal cortexr5-0-zynqmp-freertos cortexr5-1-zynqmp-baremetal cortexr5-1-zynqmp-freertos microblaze-0-pmu" 38 # Use the newly generated MACHINE
52FSBL_DEPENDS = "" 39 MACHINE = "xlnx-zynqmp-zcu102-rev1-0"
53FSBL_MCDEPENDS = "mc::cortexa53-0-zynqmp-fsbl-baremetal:fsbl-firmware:do_deploy" 40
54FSBL_DEPLOY_DIR = "${BASE_TMPDIR}/tmp-cortexa53-0-zynqmp-fsbl-baremetal/deploy/images/${MACHINE}" 41 # All of the TMPDIRs must be in a common parent directory. This is defined
55R5FSBL_DEPENDS = "" 42 # as BASE_TMPDIR.
56R5FSBL_MCDEPENDS = "mc::cortexr5-0-zynqmp-fsbl-baremetal:fsbl-firmware:do_deploy" 43 # Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp
57R5FSBL_DEPLOY_DIR = "${BASE_TMPDIR}/tmp-cortexr5-0-zynqmp-fsbl-baremetal/deploy/images/${MACHINE}" 44 BASE_TMPDIR ?= "${TOPDIR}"
58PMU_DEPENDS = "" 45
59PMU_MCDEPENDS = "mc::microblaze-0-pmu:pmu-firmware:do_deploy" 46 # The following is the full set of multiconfigs for this configuration
60PMU_FIRMWARE_DEPLOY_DIR = "${BASE_TMPDIR}/tmp-microblaze-0-pmu/deploy/images/${MACHINE}" 47 # A large list can cause a slow parse.
61 48 BBMULTICONFIG = " cortexa53-0-zynqmp-fsbl-baremetal cortexa53-0-zynqmp-baremetal cortexa53-0-zynqmp-freertos cortexa53-1-zynqmp-baremetal cortexa53-1-zynqmp-freertos cortexa53-2-zynqmp-baremetal cortexa53-2-zynqmp-freertos cortexa53-3-zynqmp-baremetal cortexa53-3-zynqmp-freertos cortexr5-0-zynqmp-fsbl-baremetal cortexr5-0-zynqmp-baremetal cortexr5-0-zynqmp-freertos cortexr5-1-zynqmp-baremetal cortexr5-1-zynqmp-freertos microblaze-0-pmu"
62# 49 # Alternatively trim the list to the minimum
63# OR 50 #BBMULTICONFIG = " cortexa53-0-zynqmp-fsbl-baremetal microblaze-0-pmu"
64# 51
65# Versal: 52
66# ./prestep/dt-processor.sh -c conf -s /proj/yocto/versal-sdt/system-top.dts -l conf/local.conf 53For example, versal:
67# 54 $ ./prestep/dt-processor.sh -c conf -s /proj/yocto/vmk180-sdt/system-top.dts -l conf/local.conf
68# The following will be written to the end of the conf/local.conf file 55
69 56The following will be written to the end of the conf/local.conf file:
70# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere 57
71BASE_TMPDIR ?= "${TOPDIR}" 58 # Each multiconfig will define it's own TMPDIR, this is the new default based
72require conf/cortexa72-versal-linux.conf 59 # on BASE_TMPDIR for the Linux build
73SYSTEM_DTFILE = "/proj/yocto/versal_sdt/system-top.dts" 60 TMPDIR = "${BASE_TMPDIR}/tmp"
74BBMULTICONFIG += " cortexa72-0-versal-baremetal cortexa72-0-versal-freertos cortexa72-1-versal-baremetal cortexa72-1-versal-freertos microblaze-0-pmc microblaze-0-psm cortexr5-0-versal-baremetal cortexr5-0-versal-freertos cortexr5-1-versal-baremetal cortexr5-1-versal-freertos" 61
75PLM_DEPENDS = "" 62 # Use the newly generated MACHINE
76PLM_MCDEPENDS = "mc::microblaze-0-pmc:plm-firmware:do_deploy" 63 MACHINE = "xlnx-versal-vmk180-rev1-1-x-ebm-01-reva"
77PLM_DEPLOY_DIR = "${BASE_TMPDIR}/tmp-microblaze-0-pmc/deploy/images/${MACHINE}" 64
78PSM_DEPENDS = "" 65 # All of the TMPDIRs must be in a common parent directory. This is defined
79PSM_MCDEPENDS = "mc::microblaze-0-psm:psm-firmware:do_deploy" 66 # as BASE_TMPDIR.
80PSM_FIRMWARE_DEPLOY_DIR = "${BASE_TMPDIR}/tmp-microblaze-0-psm/deploy/images/${MACHINE}" 67 # Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp
81PDI_PATH = "/proj/yocto/versal_sdt/project_1.pdi" 68 BASE_TMPDIR ?= "${TOPDIR}"
82 69
83# NOTE: On versal, you MUST specify the PDI file as directed by the instructions. 70 # The following is the full set of multiconfigs for this configuration
84# If the file is not found, it will put in a placeholder such as: 71 # A large list can cause a slow parse.
85PDI_PATH = "__PATH TO PDI FILE HERE__" 72 BBMULTICONFIG = " cortexa72-0-versal-baremetal cortexa72-0-versal-freertos cortexa72-1-versal-baremetal cortexa72-1-versal-freertos microblaze-0-pmc microblaze-0-psm cortexr5-0-versal-baremetal cortexr5-0-versal-freertos cortexr5-1-versal-baremetal cortexr5-1-versal-freertos"
86# This must be set to the path of the PDI file. 73 # Alternatively trim the list to the minimum
87 74 #BBMULTICONFIG = " microblaze-0-pmc microblaze-0-psm"
88# _EXIT THE NEW SHELL_ return the build environment 75
76
77You can now EXIT THE NEW SHELL return the build environment for the remaining steps.
89 78
90* Bitbake Performance Note 79* Bitbake Performance Note
91 80
@@ -93,25 +82,21 @@ Each BBMULTICONFIG value requires all of the recipes to be parsed for that
93configuration. Thus each multiconfig will add more parsing time. A long list 82configuration. Thus each multiconfig will add more parsing time. A long list
94can lead to a very slow parse (many minutes). To speed up parsing, it is 83can lead to a very slow parse (many minutes). To speed up parsing, it is
95suggested that you trim this down to only the configurations you require. 84suggested that you trim this down to only the configurations you require.
96Below is the minimum BBMULTICONFIG required: 85A minimum configuration is included with the generated configuration.
97
98zynqmp:
99BBMULTICONFIG += " cortexa53-0-zynqmp-fsbl-baremetal microblaze-0-pmu"
100
101versal:
102BBMULTICONFIG += " microblaze-0-pmc microblaze-0-psm"
103 86
104* Build your project 87* Build your project
88
105You should now be able to build your project normally. See the Yocto Project 89You should now be able to build your project normally. See the Yocto Project
106documentation if you have questions on how to work with the multiconfig 90documentation if you have questions on how to work with the multiconfig
107recipes. The following is a simple build for testing. 91recipes. The following is a simple build for testing.
108 92
109# In the original build shell 93In the original build shell
110# Build your Linux sytem: 94Build your Linux sytem:
111bitbake petalinux-image-minimal 95 $ bitbake petalinux-image-minimal
96
97The output will be in tmp/deploy/images/...
112 98
113# The output will be in tmp/deploy/images/... 99If the system is QEMU capable execute QEMU using:
100 $ runqemu nographic slirp core-image-minimal
114 101
115# If the system is QEMU capable execute QEMU using: 102To terminate qemu, usually the command is ctrl-a x
116runqemu nographic slirp core-image-minimal
117# To terminate qemu, usually the command is ctrl-a x
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 e51095f6..faaff808 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
@@ -38,7 +38,8 @@ $0
38 -d <domain_file> Path to domain file (.yml/.dts) 38 -d <domain_file> Path to domain file (.yml/.dts)
39 [-o <overlay_dtb>] Generate overlay dts 39 [-o <overlay_dtb>] Generate overlay dts
40 [-e <external_fpga>] Apply a partial overlay 40 [-e <external_fpga>] Apply a partial overlay
41 [-m <machine>] zynqmp or versal 41 [-m <machine_conf>] The name of the machine .conf to generate
42 [-t <machine>] Machine type: zynqmp or versal (usually auto detected)
42 [-p <psu_init_path>] Path to psu_init files, defaults to system_dtb path 43 [-p <psu_init_path>] Path to psu_init files, defaults to system_dtb path
43 [-i <pdu_path>] Path to the pdi file 44 [-i <pdu_path>] Path to the pdi file
44 [-l <config_file>] write local.conf changes to this file 45 [-l <config_file>] write local.conf changes to this file
@@ -58,7 +59,8 @@ parse_args() {
58 o) overlay_dtb=$OPTARG ;; 59 o) overlay_dtb=$OPTARG ;;
59 d) domain_file=$OPTARG ;; 60 d) domain_file=$OPTARG ;;
60 e) external_fpga=$OPTARG ;; 61 e) external_fpga=$OPTARG ;;
61 m) machine=$OPTARG ;; 62 m) mach_conf=$OPTARG ; mach_conf=${mach_conf%%.conf} ;;
63 t) machine=$OPTARG ;;
62 p) psu_init_path=$OPTARG ;; 64 p) psu_init_path=$OPTARG ;;
63 i) pdi_path=$OPTARG ;; 65 i) pdi_path=$OPTARG ;;
64 l) localconf=$OPTARG ;; 66 l) localconf=$OPTARG ;;
@@ -103,7 +105,7 @@ detect_machine() {
103 105
104 # Machine not provided and we cannot identify.. 106 # Machine not provided and we cannot identify..
105 [ -z ${machine} ] && \ 107 [ -z ${machine} ] && \
106 error "Unable to autodetect machine type, use -m to specify the machine." 108 error "Unable to autodetect machine type, use -t to specify the machine."
107 109
108 case ${machine} in 110 case ${machine} in
109 zynqmp | versal) : ;; 111 zynqmp | versal) : ;;
@@ -111,13 +113,29 @@ detect_machine() {
111 esac 113 esac
112} 114}
113 115
116dump_cpus() {
117 prefix="$1"
118 while read -r cpu core domain cpu_name os_hint; do
119 case ${cpu} in
120 \#*) ;;
121 \[*) ;;
122 pmu-microblaze) echo "${prefix}zynqmp-pmu ${cpu_name}" ;;
123 pmc-microblaze) echo "${prefix}versal-plm ${cpu_name}" ;;
124 psm-microblaze) echo "${prefix}versal-psm ${cpu_name}" ;;
125 xlnx,microblaze) echo "${prefix}microblaze ${core} ${cpu_name}";;
126 arm,*) echo "${prefix}${cpu/,/ } ${core} ${cpu_name}";;
127 *) echo "${prefix}${cpu} ${core} ${cpu_name}";;
128 esac
129 done <${cpulist}
130}
131
114cortex_a53_linux() { 132cortex_a53_linux() {
115 info "cortex-a53 for Linux [ $1 ]" 133 info "cortex-a53 for Linux [ $1 ]"
116 134
117 if [ "$1" = "None" ]; then 135 if [ "$1" = "None" ]; then
118 dtb_file="cortexa53-${machine}-linux.dtb" 136 dtb_file="cortexa53-${machine}-linux.dtb"
119 dts_file="cortexa53-${machine}-linux.dts" 137 dts_file="cortexa53-${machine}-linux.dts"
120 system_conf=conf/cortexa53-${machine}-linux.conf 138 system_conf=${dtb_file}
121 conf_file=cortexa53-${machine}-linux.conf 139 conf_file=cortexa53-${machine}-linux.conf
122 else 140 else
123 dtb_file="cortexa53-${machine}-$1-linux.dtb" 141 dtb_file="cortexa53-${machine}-$1-linux.dtb"
@@ -166,19 +184,15 @@ cortex_a53_linux() {
166 rm -f pl.dtsi lop-a53-imux.dts.dtb lop-domain-linux-a53.dts.dtb 184 rm -f pl.dtsi lop-a53-imux.dts.dtb lop-domain-linux-a53.dts.dtb
167 ) 185 )
168 186
187 if [ "$1" = "None" ]; then
188 return $?
189 fi
190
191 ## Generate a multiconfig
169 cat <<EOF >"${conf_file}" 192 cat <<EOF >"${conf_file}"
170CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 193CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
171CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
172 194
173MACHINE = "${machine}-generic" 195TMPDIR = "\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}"
174# We don't want the kernel to build us a device-tree
175KERNEL_DEVICETREE:${machine}-generic = ""
176# We need u-boot to use the one we passed in
177DEVICE_TREE_NAME:pn-u-boot-xlnx-scr = "\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}"
178# Update bootbin to use proper device tree
179BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}"
180# Remap boot files to ensure the right device tree is listed first
181IMAGE_BOOT_FILES = "devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))} \${@get_default_image_boot_files(d)}"
182EOF 196EOF
183} 197}
184 198
@@ -205,6 +219,7 @@ cortex_a53_baremetal() {
205 if [ "$1" = "fsbl" ]; then 219 if [ "$1" = "fsbl" ]; then
206 fsbl_mcdepends="mc::${dtb_file%%.dtb}:fsbl-firmware:do_deploy" 220 fsbl_mcdepends="mc::${dtb_file%%.dtb}:fsbl-firmware:do_deploy"
207 fsbl_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" 221 fsbl_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}"
222 multiconf_min="${multiconf_min} cortexa53-$2-${machine}${suffix}-baremetal"
208 a53_fsbl_done=1 223 a53_fsbl_done=1
209 fi 224 fi
210 225
@@ -251,7 +266,6 @@ EOF
251 fi 266 fi
252 cat <<EOF >>"${conf_file}" 267 cat <<EOF >>"${conf_file}"
253CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 268CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
254CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
255 269
256ESW_MACHINE = "$3" 270ESW_MACHINE = "$3"
257DEFAULTTUNE = "cortexa53" 271DEFAULTTUNE = "cortexa53"
@@ -309,7 +323,6 @@ cortex_a53_freertos() {
309 323
310 cat <<EOF >"${conf_file}" 324 cat <<EOF >"${conf_file}"
311CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 325CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
312CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
313 326
314ESW_MACHINE = "$3" 327ESW_MACHINE = "$3"
315DEFAULTTUNE = "cortexa53" 328DEFAULTTUNE = "cortexa53"
@@ -333,7 +346,7 @@ cortex_a72_linux() {
333 # Find the first file ending in .pdi 346 # Find the first file ending in .pdi
334 full_pdi_path=$(ls ${pdi_path}/*.pdi 2>/dev/null | head -n 1) 347 full_pdi_path=$(ls ${pdi_path}/*.pdi 2>/dev/null | head -n 1)
335 if [ -z "${full_pdi_path}" ]; then 348 if [ -z "${full_pdi_path}" ]; then
336 warn "Warning: Unable to find a pdi file in ${pdi_path}" 349 error "Unable to find a pdi file in ${pdi_path}, use the -i option to point to the directory containing a .pdi file"
337 full_pdi_path="__PATH TO PDI FILE HERE__" 350 full_pdi_path="__PATH TO PDI FILE HERE__"
338 elif [ "${full_pdi_path}" != "$(ls ${pdi_path}/*.pdi 2>/dev/null)" ]; then 351 elif [ "${full_pdi_path}" != "$(ls ${pdi_path}/*.pdi 2>/dev/null)" ]; then
339 warn "Warning: multiple PDI files found, using first found $(basename ${full_pdi_path})." 352 warn "Warning: multiple PDI files found, using first found $(basename ${full_pdi_path})."
@@ -342,7 +355,7 @@ cortex_a72_linux() {
342 if [ "$1" = "None" ]; then 355 if [ "$1" = "None" ]; then
343 dtb_file="cortexa72-${machine}-linux.dtb" 356 dtb_file="cortexa72-${machine}-linux.dtb"
344 dts_file="cortexa72-${machine}-linux.dts" 357 dts_file="cortexa72-${machine}-linux.dts"
345 system_conf=conf/cortexa72-${machine}-linux.conf 358 system_conf=${dtb_file}
346 conf_file=cortexa72-${machine}-linux.conf 359 conf_file=cortexa72-${machine}-linux.conf
347 else 360 else
348 dtb_file="cortexa72-${machine}-$1-linux.dtb" 361 dtb_file="cortexa72-${machine}-$1-linux.dtb"
@@ -392,19 +405,15 @@ cortex_a72_linux() {
392 rm -f pl.dtsi lop-a72-imux.dts.dtb lop-domain-a72.dts.dtb 405 rm -f pl.dtsi lop-a72-imux.dts.dtb lop-domain-a72.dts.dtb
393 ) 406 )
394 407
408 if [ "$1" = "None" ]; then
409 return $?
410 fi
411
412 ## Generate a multiconfig
395 cat <<EOF >"${conf_file}" 413 cat <<EOF >"${conf_file}"
396CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 414CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
397CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
398 415
399MACHINE = "${machine}-generic" 416TMPDIR = "\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}"
400# We don't want the kernel to build us a device-tree
401KERNEL_DEVICETREE:${machine}-generic = ""
402# We need u-boot to use the one we passed in
403DEVICE_TREE_NAME:pn-u-boot-xlnx-scr = "\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}"
404# Update bootbin to use proper device tree
405BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}"
406# Remap boot files to ensure the right device tree is listed first
407IMAGE_BOOT_FILES = "devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))} \${@get_default_image_boot_files(d)}"
408EOF 417EOF
409} 418}
410 419
@@ -448,7 +457,6 @@ cortex_a72_baremetal() {
448 457
449 cat <<EOF >"${conf_file}" 458 cat <<EOF >"${conf_file}"
450CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 459CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
451CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
452 460
453ESW_MACHINE = "$3" 461ESW_MACHINE = "$3"
454DEFAULTTUNE = "cortexa72" 462DEFAULTTUNE = "cortexa72"
@@ -506,7 +514,6 @@ cortex_a72_freertos() {
506 514
507 cat <<EOF >"${conf_file}" 515 cat <<EOF >"${conf_file}"
508CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 516CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
509CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
510 517
511ESW_MACHINE = "$3" 518ESW_MACHINE = "$3"
512DEFAULTTUNE = "cortexa72" 519DEFAULTTUNE = "cortexa72"
@@ -593,7 +600,6 @@ EOF
593 fi 600 fi
594 cat <<EOF >>"${conf_file}" 601 cat <<EOF >>"${conf_file}"
595CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 602CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
596CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
597 603
598ESW_MACHINE = "$3" 604ESW_MACHINE = "$3"
599DEFAULTTUNE = "cortexr5" 605DEFAULTTUNE = "cortexr5"
@@ -651,7 +657,6 @@ cortex_r5_freertos() {
651 657
652 cat <<EOF >"${conf_file}" 658 cat <<EOF >"${conf_file}"
653CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 659CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
654CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
655 660
656ESW_MACHINE = "$3" 661ESW_MACHINE = "$3"
657DEFAULTTUNE = "cortexr5" 662DEFAULTTUNE = "cortexr5"
@@ -676,12 +681,15 @@ process_microblaze() {
676 681
677 info "Generating microblaze processor tunes" 682 info "Generating microblaze processor tunes"
678 683
684 mkdir -p machine/include
679 ( 685 (
680 cd dtb || error "Unable to cd to dtb dir" 686 cd dtb || error "Unable to cd to dtb dir"
681 LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-microblaze-yocto.dts" "${system_dtb}" \ 687 LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-microblaze-yocto.dts" "${system_dtb}" \
682 || error "lopper failed" 688 || error "lopper failed"
683 rm -f lop-microblaze-yocto.dts.dtb 689 rm -f lop-microblaze-yocto.dts.dtb
684 ) >microblaze.conf 690 ) >machine/include/${mach_conf}-microblaze.inc
691
692 echo "require conf/machine/include/xilinx-microblaze.inc" >> machine/include/${mach_conf}-microblaze.inc
685 693
686 microblaze_done=1 694 microblaze_done=1
687} 695}
@@ -694,6 +702,7 @@ pmu-microblaze() {
694 702
695 dtb_file="microblaze-0-pmu.dtb" 703 dtb_file="microblaze-0-pmu.dtb"
696 multiconf="${multiconf} microblaze-0-pmu" 704 multiconf="${multiconf} microblaze-0-pmu"
705 multiconf_min="${multiconf_min} microblaze-0-pmu"
697 conf_file="multiconfig/microblaze-0-pmu.conf" 706 conf_file="multiconfig/microblaze-0-pmu.conf"
698 libxil="multiconfig/includes/microblaze-pmu-libxil.conf" 707 libxil="multiconfig/includes/microblaze-pmu-libxil.conf"
699 distro="multiconfig/includes/microblaze-pmu-distro.conf" 708 distro="multiconfig/includes/microblaze-pmu-distro.conf"
@@ -721,13 +730,10 @@ pmu-microblaze() {
721 730
722 cat <<EOF >"${conf_file}" 731 cat <<EOF >"${conf_file}"
723CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 732CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
724CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
725 733
726ESW_MACHINE = "$1" 734ESW_MACHINE = "$1"
727 735
728require conf/microblaze.conf 736DEFAULTTUNE = "microblaze-pmu"
729DEFAULTTUNE = "microblaze"
730TUNE_FEATURES:tune-microblaze:forcevariable = "\${TUNE_FEATURES:tune-pmu-microblaze}"
731 737
732TARGET_CFLAGS += "-DPSU_PMU=1U" 738TARGET_CFLAGS += "-DPSU_PMU=1U"
733 739
@@ -752,6 +758,7 @@ pmc-microblaze() {
752 758
753 dtb_file="microblaze-0-pmc.dtb" 759 dtb_file="microblaze-0-pmc.dtb"
754 multiconf="${multiconf} microblaze-0-pmc" 760 multiconf="${multiconf} microblaze-0-pmc"
761 multiconf_min="${multiconf_min} microblaze-0-pmc"
755 conf_file="multiconfig/microblaze-0-pmc.conf" 762 conf_file="multiconfig/microblaze-0-pmc.conf"
756 libxil="multiconfig/includes/microblaze-pmc-libxil.conf" 763 libxil="multiconfig/includes/microblaze-pmc-libxil.conf"
757 distro="multiconfig/includes/microblaze-pmc-distro.conf" 764 distro="multiconfig/includes/microblaze-pmc-distro.conf"
@@ -779,13 +786,10 @@ pmc-microblaze() {
779 786
780 cat <<EOF >"${conf_file}" 787 cat <<EOF >"${conf_file}"
781CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 788CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
782CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
783 789
784ESW_MACHINE = "$1" 790ESW_MACHINE = "$1"
785 791
786require conf/microblaze.conf 792DEFAULTTUNE = "microblaze-pmc"
787DEFAULTTUNE = "microblaze"
788TUNE_FEATURES:tune-microblaze:forcevariable = "\${TUNE_FEATURES:tune-pmc-microblaze}"
789 793
790TARGET_CFLAGS += "-DVERSAL_PLM=1" 794TARGET_CFLAGS += "-DVERSAL_PLM=1"
791 795
@@ -810,6 +814,7 @@ psm-microblaze() {
810 814
811 dtb_file="microblaze-0-psm.dtb" 815 dtb_file="microblaze-0-psm.dtb"
812 multiconf="${multiconf} microblaze-0-psm" 816 multiconf="${multiconf} microblaze-0-psm"
817 multiconf_min="${multiconf_min} microblaze-0-psm"
813 conf_file="multiconfig/microblaze-0-psm.conf" 818 conf_file="multiconfig/microblaze-0-psm.conf"
814 libxil="multiconfig/includes/microblaze-psm-libxil.conf" 819 libxil="multiconfig/includes/microblaze-psm-libxil.conf"
815 distro="multiconfig/includes/microblaze-psm-distro.conf" 820 distro="multiconfig/includes/microblaze-psm-distro.conf"
@@ -837,13 +842,10 @@ psm-microblaze() {
837 842
838 cat <<EOF >"${conf_file}" 843 cat <<EOF >"${conf_file}"
839CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" 844CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}"
840CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
841 845
842ESW_MACHINE = "$1" 846ESW_MACHINE = "$1"
843 847
844require conf/microblaze.conf 848DEFAULTTUNE = "microblaze-psm"
845DEFAULTTUNE = "microblaze"
846TUNE_FEATURES:tune-microblaze:forcevariable = "\${TUNE_FEATURES:tune-psm-microblaze}"
847 849
848TARGET_CFLAGS += "-DVERSAL_psm=1" 850TARGET_CFLAGS += "-DVERSAL_psm=1"
849 851
@@ -860,9 +862,137 @@ SKIP_META_TPM_SANITY_CHECK = "1"
860EOF 862EOF
861} 863}
862 864
863parse_cpus() { 865generate_machine() {
864 info "Generating configuration..." 866 info "Generating machine conf file"
867 conf_file="machine/${mach_conf}.conf"
868 mkdir -p machine
869 # Generate header
870 cat <<EOF >"${conf_file}"
871#@TYPE: Machine
872#@NAME: ${mach_conf}
873#@DESCRIPTION: ${model}
874
875#### Preamble
876MACHINEOVERRIDES =. "\${@['', '${mach_conf}:']['${mach_conf}' != '\${MACHINE}']}"
877#### Regular settings follow
878
879EOF
880
881 if [ "${machine}" == "zynqmp" ]; then
882 cat <<EOF >>"${conf_file}"
883TUNEFILE[microblaze-pmu] = "conf/machine/include/${mach_conf}-microblaze.inc"
884EOF
885 elif [ "${machine}" == "versal" ]; then
886 cat <<EOF >>"${conf_file}"
887TUNEFILE[microblaze-pmc] = "conf/machine/include/${mach_conf}-microblaze.inc"
888TUNEFILE[microblaze-psm] = "conf/machine/include/${mach_conf}-microblaze.inc"
889EOF
890 fi
891
892 sysdt_path=$(dirname ${system_dtb})
893 sysdt_base=$(basename ${system_dtb})
894 cat <<EOF >>"${conf_file}"
895
896# Set the default (linux) domain device tree
897CONFIG_DTFILE ?= "\${TOPDIR}/conf/dtb/${system_conf}"
898CONFIG_DTFILE[vardepsexclude] += "TOPDIR"
899
900require conf/machine/${machine}-generic.conf
901
902# System Device Tree does not use HDF_MACHINE
903HDF_MACHINE = ""
904
905# Set the system device trees
906SYSTEM_DTFILE_DIR = "${sysdt_path}"
907SYSTEM_DTFILE = "\${SYSTEM_DTFILE_DIR}/${sysdt_base}"
908SYSTEM_DTFILE[vardepsexclude] += "SYSTEM_DTFILE_DIR"
865 909
910EOF
911
912 if [ -n "${fsbl_mcdepends}" ]; then
913 cat <<EOF >>"${conf_file}"
914# First Stage Boot Loader
915FSBL_DEPENDS = ""
916FSBL_MCDEPENDS = "${fsbl_mcdepends}"
917FSBL_DEPLOY_DIR = "${fsbl_deploy_dir}"
918
919EOF
920 fi
921 if [ -n "${r5fsbl_mcdepends}" ]; then
922 cat <<EOF >>"${conf_file}"
923# Cortex-R5 First Stage Boot Loader
924R5FSBL_DEPENDS = ""
925R5FSBL_MCDEPENDS = "${r5fsbl_mcdepends}"
926R5FSBL_DEPLOY_DIR = "${r5fsbl_deploy_dir}"
927
928EOF
929 fi
930 if [ -n "${pmu_mcdepends}" ]; then
931 cat <<EOF >>"${conf_file}"
932# PMU Firware
933PMU_DEPENDS = ""
934PMU_MCDEPENDS = "${pmu_mcdepends}"
935PMU_FIRMWARE_DEPLOY_DIR = "${pmu_firmware_deploy_dir}"
936
937EOF
938 fi
939 if [ -n "${plm_mcdepends}" ]; then
940 cat <<EOF >>"${conf_file}"
941# Platform Loader and Manager
942PLM_DEPENDS = ""
943PLM_MCDEPENDS = "${plm_mcdepends}"
944PLM_DEPLOY_DIR = "${plm_deploy_dir}"
945
946EOF
947 fi
948 if [ -n "${psm_mcdepends}" ]; then
949 cat <<EOF >>"${conf_file}"
950# PSM Firmware
951PSM_DEPENDS = ""
952PSM_MCDEPENDS = "${psm_mcdepends}"
953PSM_FIRMWARE_DEPLOY_DIR = "${psm_firmware_deploy_dir}"
954
955EOF
956 fi
957
958 if [ -n "${full_pdi_path}" ]; then
959 pdi_path_dir=$(dirname ${full_pdi_path})
960 pdi_path_base=$(basename ${full_pdi_path})
961 cat <<EOF >>"${conf_file}"
962# Versal PDI
963PDI_PATH_DIR = "${pdi_path_dir}"
964PDI_PATH = "\${PDI_PATH_DIR}/${pdi_path_base}"
965PDI_PATH[vardepsexclude] += "PDI_PATH_DIR"
966
967EOF
968 fi
969
970 cat <<EOF >>"${conf_file}"
971# Enable the correct version of the firmware components
972PREFERRED_VERSION_fsbl-firmware = "2023.1_sdt_experimental%"
973PREFERRED_VERSION_pmu-firmware = "2023.1_sdt_experimental%"
974PREFERRED_VERSION_plm-firmware = "2023.1_sdt_experimental%"
975PREFERRED_VERSION_psm-firmware = "2023.1_sdt_experimental%"
976
977# Exclude BASE_TMPDIR from hash calculations
978BB_HASHEXCLUDE_COMMON:append = " BASE_TMPDIR"
979
980# We don't want the kernel to build us a device-tree
981KERNEL_DEVICETREE:example-sdt = ""
982# We need u-boot to use the one we passed in
983DEVICE_TREE_NAME:pn-u-boot-xlnx-scr = "\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}"
984# Update bootbin to use proper device tree
985BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}"
986# Remap boot files to ensure the right device tree is listed first
987IMAGE_BOOT_FILES =+ "devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}"
988
989#### No additional settings should be after the Postamble
990#### Postamble
991PACKAGE_EXTRA_ARCHS:append = "\${@['', ' ${mach_conf//-/_}']['${mach_conf}' != "\${MACHINE}"]}"
992EOF
993}
994
995parse_cpus() {
866 gen_linux_dtb="None" 996 gen_linux_dtb="None"
867 while read -r cpu core domain cpu_name os_hint; do 997 while read -r cpu core domain cpu_name os_hint; do
868 # Skip commented lines and WARNINGs 998 # Skip commented lines and WARNINGs
@@ -976,38 +1106,26 @@ parse_cpus() {
976} 1106}
977 1107
978gen_local_conf() { 1108gen_local_conf() {
979 echo "# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere" >> $1 1109 cat << EOF >> $1
980 echo "BASE_TMPDIR ?= \"\${TOPDIR}\"" >> $1 1110
981 [ -n "${system_conf}" ] && echo "require ${system_conf}" >> $1 1111# Each multiconfig will define it's own TMPDIR, this is the new default based
982 echo "SYSTEM_DTFILE = \"${system_dtb}\"" >> $1 1112# on BASE_TMPDIR for the Linux build
983 echo "BBMULTICONFIG += \"${multiconf}\"" >> $1 1113TMPDIR = "\${BASE_TMPDIR}/tmp"
984 if [ -n "${fsbl_mcdepends}" ]; then 1114
985 echo "FSBL_DEPENDS = \"\"" >> $1 1115# Use the newly generated MACHINE
986 echo "FSBL_MCDEPENDS = \"${fsbl_mcdepends}\"" >> $1 1116MACHINE = "${mach_conf}"
987 echo "FSBL_DEPLOY_DIR = \"${fsbl_deploy_dir}\"" >> $1 1117
988 fi 1118# All of the TMPDIRs must be in a common parent directory. This is defined
989 if [ -n "${r5fsbl_mcdepends}" ]; then 1119# as BASE_TMPDIR.
990 echo "R5FSBL_DEPENDS = \"\"" >> $1 1120# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp
991 echo "R5FSBL_MCDEPENDS = \"${r5fsbl_mcdepends}\"" >> $1 1121BASE_TMPDIR ?= "\${TOPDIR}"
992 echo "R5FSBL_DEPLOY_DIR = \"${r5fsbl_deploy_dir}\"" >> $1 1122
993 fi 1123# The following is the full set of multiconfigs for this configuration
994 if [ -n "${pmu_mcdepends}" ]; then 1124# A large list can cause a slow parse.
995 echo "PMU_DEPENDS = \"\"" >> $1 1125BBMULTICONFIG = "${multiconf}"
996 echo "PMU_MCDEPENDS = \"${pmu_mcdepends}\"" >> $1 1126# Alternatively trim the list to the minimum
997 echo "PMU_FIRMWARE_DEPLOY_DIR = \"${pmu_firmware_deploy_dir}\"" >> $1 1127#BBMULTICONFIG = "${multiconf_min}"
998 fi 1128EOF
999 if [ -n "${plm_mcdepends}" ]; then
1000 echo "PLM_DEPENDS = \"\"" >> $1
1001 echo "PLM_MCDEPENDS = \"${plm_mcdepends}\"" >> $1
1002 echo "PLM_DEPLOY_DIR = \"${plm_deploy_dir}\"" >> $1
1003 fi
1004 if [ -n "${psm_mcdepends}" ]; then
1005 echo "PSM_DEPENDS = \"\"" >> $1
1006 echo "PSM_MCDEPENDS = \"${psm_mcdepends}\"" >> $1
1007 echo "PSM_FIRMWARE_DEPLOY_DIR = \"${psm_firmware_deploy_dir}\"" >> $1
1008 fi
1009 [ "${machine}" = "versal" ] && echo "PDI_PATH = \"${full_pdi_path}\"" >> $1
1010 echo
1011} 1129}
1012 1130
1013gen_petalinux_conf() { 1131gen_petalinux_conf() {
@@ -1036,9 +1154,21 @@ multiconf=""
1036cpulist=$(mktemp) 1154cpulist=$(mktemp)
1037 1155
1038priordir=$(pwd) 1156priordir=$(pwd)
1039# Generate CPU list
1040cd "${config_dir}" || exit 1157cd "${config_dir}" || exit
1041mkdir -p dtb multiconfig/includes 1158mkdir -p dtb multiconfig/includes
1159# Get mach_conf name and model name
1160(
1161 cd dtb || error "Unable to cd to dtb dir"
1162 LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-machine-name.dts" "${system_dtb}" \
1163 /dev/null > ${cpulist} || error "lopper failed"
1164 rm -f "lop-machine-name.dts.dtb"
1165)
1166read local_mach_conf model < ${cpulist}
1167if [ -z "${mach_conf}" ]; then
1168 mach_conf=${local_mach_conf}
1169fi
1170
1171# Generate CPU list
1042( 1172(
1043 cd dtb || error "Unable to cd to dtb dir" 1173 cd dtb || error "Unable to cd to dtb dir"
1044 LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-xilinx-id-cpus.dts" "${system_dtb}" \ 1174 LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-xilinx-id-cpus.dts" "${system_dtb}" \
@@ -1048,8 +1178,19 @@ mkdir -p dtb multiconfig/includes
1048 1178
1049detect_machine 1179detect_machine
1050 1180
1181echo "System Configuration:"
1182echo "MODEL = \"${model}\""
1183echo "MACHINE = \"${mach_conf}\""
1184echo "SOC_FAMILY = \"${machine}\""
1185echo "CPUs:"
1186dump_cpus " = "
1187echo
1188
1189info "Generating configuration..."
1051parse_cpus 1190parse_cpus
1052 1191
1192generate_machine
1193
1053cd ${priordir} 1194cd ${priordir}
1054if [ -z "${localconf}" ]; then 1195if [ -z "${localconf}" ]; then
1055 echo 1196 echo