From 94f89efa051df9b1444f2973db55ceb8cd1cc5fc Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Fri, 13 Jan 2023 18:20:24 -0800 Subject: 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 --- .../recipes-core/meta/files/README-setup | 155 +++++------ .../recipes-core/meta/files/dt-processor.sh | 301 +++++++++++++++------ 2 files changed, 291 insertions(+), 165 deletions(-) (limited to 'meta-xilinx-standalone-experimental') 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. The steps in this document expect that you have already built the setup (meta-xilinx-setup) SDK, and installed it. -* Configure you local.conf - -The following items should be in your conf/local.conf. This ensures that -the correct configurations are available, and the correct firmware version -is selected for this workflow. - -# Instruct the system to use the decoupling firmware sources, -# add the following to the conf/local.conf: -PREFERRED_VERSION_fsbl-firmware = "2023.1_sdt_experimental%" -PREFERRED_VERSION_pmu-firmware = "2023.1_sdt_experimental%" -PREFERRED_VERSION_plm-firmware = "2023.1_sdt_experimental%" -PREFERRED_VERSION_psm-firmware = "2023.1_sdt_experimental%" - * Run the setup script The 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. We will assume below that the directory "prestep" was used for the SDK, however you may use any path you wish. -# Source the SDK environment file -. /prestep/environment-setup-x86_64-petalinux-linux - -# Run the script from the same directory as this README -/prestep/dt-processor.sh -c -s -l conf/local.conf - -# Note: The -l option will automatically add the necessary parameters to the -# local.conf file. If you need to re-run this comment, you just clear the -# parameters from the end of the file. Without the -l option the items are -# printed to the screen and must be manually added to your conf/local.conf - -# For example, zynqmp: -# ./prestep/dt-processor.sh -c conf -s /proj/yocto/zu-sdt/system-top.dts -l conf/local.conf -# -# The following will be written to the end of the conf/local.conf file - -# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere -BASE_TMPDIR ?= "${TOPDIR}" -require conf/cortexa53-zynqmp-linux.conf -SYSTEM_DTFILE = "/proj/yocto/zu-sdt/system-top.dts" -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" -FSBL_DEPENDS = "" -FSBL_MCDEPENDS = "mc::cortexa53-0-zynqmp-fsbl-baremetal:fsbl-firmware:do_deploy" -FSBL_DEPLOY_DIR = "${BASE_TMPDIR}/tmp-cortexa53-0-zynqmp-fsbl-baremetal/deploy/images/${MACHINE}" -R5FSBL_DEPENDS = "" -R5FSBL_MCDEPENDS = "mc::cortexr5-0-zynqmp-fsbl-baremetal:fsbl-firmware:do_deploy" -R5FSBL_DEPLOY_DIR = "${BASE_TMPDIR}/tmp-cortexr5-0-zynqmp-fsbl-baremetal/deploy/images/${MACHINE}" -PMU_DEPENDS = "" -PMU_MCDEPENDS = "mc::microblaze-0-pmu:pmu-firmware:do_deploy" -PMU_FIRMWARE_DEPLOY_DIR = "${BASE_TMPDIR}/tmp-microblaze-0-pmu/deploy/images/${MACHINE}" - -# -# OR -# -# Versal: -# ./prestep/dt-processor.sh -c conf -s /proj/yocto/versal-sdt/system-top.dts -l conf/local.conf -# -# The following will be written to the end of the conf/local.conf file - -# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere -BASE_TMPDIR ?= "${TOPDIR}" -require conf/cortexa72-versal-linux.conf -SYSTEM_DTFILE = "/proj/yocto/versal_sdt/system-top.dts" -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" -PLM_DEPENDS = "" -PLM_MCDEPENDS = "mc::microblaze-0-pmc:plm-firmware:do_deploy" -PLM_DEPLOY_DIR = "${BASE_TMPDIR}/tmp-microblaze-0-pmc/deploy/images/${MACHINE}" -PSM_DEPENDS = "" -PSM_MCDEPENDS = "mc::microblaze-0-psm:psm-firmware:do_deploy" -PSM_FIRMWARE_DEPLOY_DIR = "${BASE_TMPDIR}/tmp-microblaze-0-psm/deploy/images/${MACHINE}" -PDI_PATH = "/proj/yocto/versal_sdt/project_1.pdi" - -# NOTE: On versal, you MUST specify the PDI file as directed by the instructions. -# If the file is not found, it will put in a placeholder such as: -PDI_PATH = "__PATH TO PDI FILE HERE__" -# This must be set to the path of the PDI file. - -# _EXIT THE NEW SHELL_ return the build environment +Source the SDK environment file + $ . /prestep/environment-setup-x86_64-petalinux-linux + +Run the script from the same directory as this README + $ /prestep/dt-processor.sh -c -s -l conf/local.conf + +Note: The -l option will automatically add the necessary parameters to the +local.conf file. If you need to re-run this comment, you just clear the +parameters from the end of the file. Without the -l option the items are +printed to the screen and must be manually added to your conf/local.conf + +For example, zynqmp: + $ ./prestep/dt-processor.sh -c conf -s /proj/yocto/zcu102-sdt/system-top.dts -l conf/local.conf + +The following will be written to the end of the conf/local.conf file: + + # Each multiconfig will define it's own TMPDIR, this is the new default based + # on BASE_TMPDIR for the Linux build + TMPDIR = "${BASE_TMPDIR}/tmp" + + # Use the newly generated MACHINE + MACHINE = "xlnx-zynqmp-zcu102-rev1-0" + + # All of the TMPDIRs must be in a common parent directory. This is defined + # as BASE_TMPDIR. + # Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp + BASE_TMPDIR ?= "${TOPDIR}" + + # The following is the full set of multiconfigs for this configuration + # A large list can cause a slow parse. + 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" + # Alternatively trim the list to the minimum + #BBMULTICONFIG = " cortexa53-0-zynqmp-fsbl-baremetal microblaze-0-pmu" + + +For example, versal: + $ ./prestep/dt-processor.sh -c conf -s /proj/yocto/vmk180-sdt/system-top.dts -l conf/local.conf + +The following will be written to the end of the conf/local.conf file: + + # Each multiconfig will define it's own TMPDIR, this is the new default based + # on BASE_TMPDIR for the Linux build + TMPDIR = "${BASE_TMPDIR}/tmp" + + # Use the newly generated MACHINE + MACHINE = "xlnx-versal-vmk180-rev1-1-x-ebm-01-reva" + + # All of the TMPDIRs must be in a common parent directory. This is defined + # as BASE_TMPDIR. + # Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp + BASE_TMPDIR ?= "${TOPDIR}" + + # The following is the full set of multiconfigs for this configuration + # A large list can cause a slow parse. + 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" + # Alternatively trim the list to the minimum + #BBMULTICONFIG = " microblaze-0-pmc microblaze-0-psm" + + +You can now EXIT THE NEW SHELL return the build environment for the remaining steps. * Bitbake Performance Note @@ -93,25 +82,21 @@ Each BBMULTICONFIG value requires all of the recipes to be parsed for that configuration. Thus each multiconfig will add more parsing time. A long list can lead to a very slow parse (many minutes). To speed up parsing, it is suggested that you trim this down to only the configurations you require. -Below is the minimum BBMULTICONFIG required: - -zynqmp: -BBMULTICONFIG += " cortexa53-0-zynqmp-fsbl-baremetal microblaze-0-pmu" - -versal: -BBMULTICONFIG += " microblaze-0-pmc microblaze-0-psm" +A minimum configuration is included with the generated configuration. * Build your project + You should now be able to build your project normally. See the Yocto Project documentation if you have questions on how to work with the multiconfig recipes. The following is a simple build for testing. -# In the original build shell -# Build your Linux sytem: -bitbake petalinux-image-minimal +In the original build shell +Build your Linux sytem: + $ bitbake petalinux-image-minimal + +The output will be in tmp/deploy/images/... -# The output will be in tmp/deploy/images/... +If the system is QEMU capable execute QEMU using: + $ runqemu nographic slirp core-image-minimal -# If the system is QEMU capable execute QEMU using: -runqemu nographic slirp core-image-minimal -# To terminate qemu, usually the command is ctrl-a x +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 -d Path to domain file (.yml/.dts) [-o ] Generate overlay dts [-e ] Apply a partial overlay - [-m ] zynqmp or versal + [-m ] The name of the machine .conf to generate + [-t ] Machine type: zynqmp or versal (usually auto detected) [-p ] Path to psu_init files, defaults to system_dtb path [-i ] Path to the pdi file [-l ] write local.conf changes to this file @@ -58,7 +59,8 @@ parse_args() { o) overlay_dtb=$OPTARG ;; d) domain_file=$OPTARG ;; e) external_fpga=$OPTARG ;; - m) machine=$OPTARG ;; + m) mach_conf=$OPTARG ; mach_conf=${mach_conf%%.conf} ;; + t) machine=$OPTARG ;; p) psu_init_path=$OPTARG ;; i) pdi_path=$OPTARG ;; l) localconf=$OPTARG ;; @@ -103,7 +105,7 @@ detect_machine() { # Machine not provided and we cannot identify.. [ -z ${machine} ] && \ - error "Unable to autodetect machine type, use -m to specify the machine." + error "Unable to autodetect machine type, use -t to specify the machine." case ${machine} in zynqmp | versal) : ;; @@ -111,13 +113,29 @@ detect_machine() { esac } +dump_cpus() { + prefix="$1" + while read -r cpu core domain cpu_name os_hint; do + case ${cpu} in + \#*) ;; + \[*) ;; + pmu-microblaze) echo "${prefix}zynqmp-pmu ${cpu_name}" ;; + pmc-microblaze) echo "${prefix}versal-plm ${cpu_name}" ;; + psm-microblaze) echo "${prefix}versal-psm ${cpu_name}" ;; + xlnx,microblaze) echo "${prefix}microblaze ${core} ${cpu_name}";; + arm,*) echo "${prefix}${cpu/,/ } ${core} ${cpu_name}";; + *) echo "${prefix}${cpu} ${core} ${cpu_name}";; + esac + done <${cpulist} +} + cortex_a53_linux() { info "cortex-a53 for Linux [ $1 ]" if [ "$1" = "None" ]; then dtb_file="cortexa53-${machine}-linux.dtb" dts_file="cortexa53-${machine}-linux.dts" - system_conf=conf/cortexa53-${machine}-linux.conf + system_conf=${dtb_file} conf_file=cortexa53-${machine}-linux.conf else dtb_file="cortexa53-${machine}-$1-linux.dtb" @@ -166,19 +184,15 @@ cortex_a53_linux() { rm -f pl.dtsi lop-a53-imux.dts.dtb lop-domain-linux-a53.dts.dtb ) + if [ "$1" = "None" ]; then + return $? + fi + + ## Generate a multiconfig cat <"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" -MACHINE = "${machine}-generic" -# We don't want the kernel to build us a device-tree -KERNEL_DEVICETREE:${machine}-generic = "" -# We need u-boot to use the one we passed in -DEVICE_TREE_NAME:pn-u-boot-xlnx-scr = "\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" -# Update bootbin to use proper device tree -BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" -# Remap boot files to ensure the right device tree is listed first -IMAGE_BOOT_FILES = "devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))} \${@get_default_image_boot_files(d)}" +TMPDIR = "\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}" EOF } @@ -205,6 +219,7 @@ cortex_a53_baremetal() { if [ "$1" = "fsbl" ]; then fsbl_mcdepends="mc::${dtb_file%%.dtb}:fsbl-firmware:do_deploy" fsbl_deploy_dir="\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}/deploy/images/\${MACHINE}" + multiconf_min="${multiconf_min} cortexa53-$2-${machine}${suffix}-baremetal" a53_fsbl_done=1 fi @@ -251,7 +266,6 @@ EOF fi cat <>"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" ESW_MACHINE = "$3" DEFAULTTUNE = "cortexa53" @@ -309,7 +323,6 @@ cortex_a53_freertos() { cat <"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" ESW_MACHINE = "$3" DEFAULTTUNE = "cortexa53" @@ -333,7 +346,7 @@ cortex_a72_linux() { # Find the first file ending in .pdi full_pdi_path=$(ls ${pdi_path}/*.pdi 2>/dev/null | head -n 1) if [ -z "${full_pdi_path}" ]; then - warn "Warning: Unable to find a pdi file in ${pdi_path}" + error "Unable to find a pdi file in ${pdi_path}, use the -i option to point to the directory containing a .pdi file" full_pdi_path="__PATH TO PDI FILE HERE__" elif [ "${full_pdi_path}" != "$(ls ${pdi_path}/*.pdi 2>/dev/null)" ]; then warn "Warning: multiple PDI files found, using first found $(basename ${full_pdi_path})." @@ -342,7 +355,7 @@ cortex_a72_linux() { if [ "$1" = "None" ]; then dtb_file="cortexa72-${machine}-linux.dtb" dts_file="cortexa72-${machine}-linux.dts" - system_conf=conf/cortexa72-${machine}-linux.conf + system_conf=${dtb_file} conf_file=cortexa72-${machine}-linux.conf else dtb_file="cortexa72-${machine}-$1-linux.dtb" @@ -392,19 +405,15 @@ cortex_a72_linux() { rm -f pl.dtsi lop-a72-imux.dts.dtb lop-domain-a72.dts.dtb ) + if [ "$1" = "None" ]; then + return $? + fi + + ## Generate a multiconfig cat <"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" -MACHINE = "${machine}-generic" -# We don't want the kernel to build us a device-tree -KERNEL_DEVICETREE:${machine}-generic = "" -# We need u-boot to use the one we passed in -DEVICE_TREE_NAME:pn-u-boot-xlnx-scr = "\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" -# Update bootbin to use proper device tree -BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" -# Remap boot files to ensure the right device tree is listed first -IMAGE_BOOT_FILES = "devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))} \${@get_default_image_boot_files(d)}" +TMPDIR = "\${BASE_TMPDIR}/tmp-${dtb_file%%.dtb}" EOF } @@ -448,7 +457,6 @@ cortex_a72_baremetal() { cat <"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" ESW_MACHINE = "$3" DEFAULTTUNE = "cortexa72" @@ -506,7 +514,6 @@ cortex_a72_freertos() { cat <"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" ESW_MACHINE = "$3" DEFAULTTUNE = "cortexa72" @@ -593,7 +600,6 @@ EOF fi cat <>"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" ESW_MACHINE = "$3" DEFAULTTUNE = "cortexr5" @@ -651,7 +657,6 @@ cortex_r5_freertos() { cat <"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" ESW_MACHINE = "$3" DEFAULTTUNE = "cortexr5" @@ -676,12 +681,15 @@ process_microblaze() { info "Generating microblaze processor tunes" + mkdir -p machine/include ( cd dtb || error "Unable to cd to dtb dir" LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-microblaze-yocto.dts" "${system_dtb}" \ || error "lopper failed" rm -f lop-microblaze-yocto.dts.dtb - ) >microblaze.conf + ) >machine/include/${mach_conf}-microblaze.inc + + echo "require conf/machine/include/xilinx-microblaze.inc" >> machine/include/${mach_conf}-microblaze.inc microblaze_done=1 } @@ -694,6 +702,7 @@ pmu-microblaze() { dtb_file="microblaze-0-pmu.dtb" multiconf="${multiconf} microblaze-0-pmu" + multiconf_min="${multiconf_min} microblaze-0-pmu" conf_file="multiconfig/microblaze-0-pmu.conf" libxil="multiconfig/includes/microblaze-pmu-libxil.conf" distro="multiconfig/includes/microblaze-pmu-distro.conf" @@ -721,13 +730,10 @@ pmu-microblaze() { cat <"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" ESW_MACHINE = "$1" -require conf/microblaze.conf -DEFAULTTUNE = "microblaze" -TUNE_FEATURES:tune-microblaze:forcevariable = "\${TUNE_FEATURES:tune-pmu-microblaze}" +DEFAULTTUNE = "microblaze-pmu" TARGET_CFLAGS += "-DPSU_PMU=1U" @@ -752,6 +758,7 @@ pmc-microblaze() { dtb_file="microblaze-0-pmc.dtb" multiconf="${multiconf} microblaze-0-pmc" + multiconf_min="${multiconf_min} microblaze-0-pmc" conf_file="multiconfig/microblaze-0-pmc.conf" libxil="multiconfig/includes/microblaze-pmc-libxil.conf" distro="multiconfig/includes/microblaze-pmc-distro.conf" @@ -779,13 +786,10 @@ pmc-microblaze() { cat <"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" ESW_MACHINE = "$1" -require conf/microblaze.conf -DEFAULTTUNE = "microblaze" -TUNE_FEATURES:tune-microblaze:forcevariable = "\${TUNE_FEATURES:tune-pmc-microblaze}" +DEFAULTTUNE = "microblaze-pmc" TARGET_CFLAGS += "-DVERSAL_PLM=1" @@ -810,6 +814,7 @@ psm-microblaze() { dtb_file="microblaze-0-psm.dtb" multiconf="${multiconf} microblaze-0-psm" + multiconf_min="${multiconf_min} microblaze-0-psm" conf_file="multiconfig/microblaze-0-psm.conf" libxil="multiconfig/includes/microblaze-psm-libxil.conf" distro="multiconfig/includes/microblaze-psm-distro.conf" @@ -837,13 +842,10 @@ psm-microblaze() { cat <"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" -CONFIG_DTFILE[vardepsexclude] += "TOPDIR" ESW_MACHINE = "$1" -require conf/microblaze.conf -DEFAULTTUNE = "microblaze" -TUNE_FEATURES:tune-microblaze:forcevariable = "\${TUNE_FEATURES:tune-psm-microblaze}" +DEFAULTTUNE = "microblaze-psm" TARGET_CFLAGS += "-DVERSAL_psm=1" @@ -860,9 +862,137 @@ SKIP_META_TPM_SANITY_CHECK = "1" EOF } -parse_cpus() { - info "Generating configuration..." +generate_machine() { + info "Generating machine conf file" + conf_file="machine/${mach_conf}.conf" + mkdir -p machine + # Generate header + cat <"${conf_file}" +#@TYPE: Machine +#@NAME: ${mach_conf} +#@DESCRIPTION: ${model} + +#### Preamble +MACHINEOVERRIDES =. "\${@['', '${mach_conf}:']['${mach_conf}' != '\${MACHINE}']}" +#### Regular settings follow + +EOF + + if [ "${machine}" == "zynqmp" ]; then + cat <>"${conf_file}" +TUNEFILE[microblaze-pmu] = "conf/machine/include/${mach_conf}-microblaze.inc" +EOF + elif [ "${machine}" == "versal" ]; then + cat <>"${conf_file}" +TUNEFILE[microblaze-pmc] = "conf/machine/include/${mach_conf}-microblaze.inc" +TUNEFILE[microblaze-psm] = "conf/machine/include/${mach_conf}-microblaze.inc" +EOF + fi + + sysdt_path=$(dirname ${system_dtb}) + sysdt_base=$(basename ${system_dtb}) + cat <>"${conf_file}" + +# Set the default (linux) domain device tree +CONFIG_DTFILE ?= "\${TOPDIR}/conf/dtb/${system_conf}" +CONFIG_DTFILE[vardepsexclude] += "TOPDIR" + +require conf/machine/${machine}-generic.conf + +# System Device Tree does not use HDF_MACHINE +HDF_MACHINE = "" + +# Set the system device trees +SYSTEM_DTFILE_DIR = "${sysdt_path}" +SYSTEM_DTFILE = "\${SYSTEM_DTFILE_DIR}/${sysdt_base}" +SYSTEM_DTFILE[vardepsexclude] += "SYSTEM_DTFILE_DIR" +EOF + + if [ -n "${fsbl_mcdepends}" ]; then + cat <>"${conf_file}" +# First Stage Boot Loader +FSBL_DEPENDS = "" +FSBL_MCDEPENDS = "${fsbl_mcdepends}" +FSBL_DEPLOY_DIR = "${fsbl_deploy_dir}" + +EOF + fi + if [ -n "${r5fsbl_mcdepends}" ]; then + cat <>"${conf_file}" +# Cortex-R5 First Stage Boot Loader +R5FSBL_DEPENDS = "" +R5FSBL_MCDEPENDS = "${r5fsbl_mcdepends}" +R5FSBL_DEPLOY_DIR = "${r5fsbl_deploy_dir}" + +EOF + fi + if [ -n "${pmu_mcdepends}" ]; then + cat <>"${conf_file}" +# PMU Firware +PMU_DEPENDS = "" +PMU_MCDEPENDS = "${pmu_mcdepends}" +PMU_FIRMWARE_DEPLOY_DIR = "${pmu_firmware_deploy_dir}" + +EOF + fi + if [ -n "${plm_mcdepends}" ]; then + cat <>"${conf_file}" +# Platform Loader and Manager +PLM_DEPENDS = "" +PLM_MCDEPENDS = "${plm_mcdepends}" +PLM_DEPLOY_DIR = "${plm_deploy_dir}" + +EOF + fi + if [ -n "${psm_mcdepends}" ]; then + cat <>"${conf_file}" +# PSM Firmware +PSM_DEPENDS = "" +PSM_MCDEPENDS = "${psm_mcdepends}" +PSM_FIRMWARE_DEPLOY_DIR = "${psm_firmware_deploy_dir}" + +EOF + fi + + if [ -n "${full_pdi_path}" ]; then + pdi_path_dir=$(dirname ${full_pdi_path}) + pdi_path_base=$(basename ${full_pdi_path}) + cat <>"${conf_file}" +# Versal PDI +PDI_PATH_DIR = "${pdi_path_dir}" +PDI_PATH = "\${PDI_PATH_DIR}/${pdi_path_base}" +PDI_PATH[vardepsexclude] += "PDI_PATH_DIR" + +EOF + fi + + cat <>"${conf_file}" +# Enable the correct version of the firmware components +PREFERRED_VERSION_fsbl-firmware = "2023.1_sdt_experimental%" +PREFERRED_VERSION_pmu-firmware = "2023.1_sdt_experimental%" +PREFERRED_VERSION_plm-firmware = "2023.1_sdt_experimental%" +PREFERRED_VERSION_psm-firmware = "2023.1_sdt_experimental%" + +# Exclude BASE_TMPDIR from hash calculations +BB_HASHEXCLUDE_COMMON:append = " BASE_TMPDIR" + +# We don't want the kernel to build us a device-tree +KERNEL_DEVICETREE:example-sdt = "" +# We need u-boot to use the one we passed in +DEVICE_TREE_NAME:pn-u-boot-xlnx-scr = "\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" +# Update bootbin to use proper device tree +BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" +# Remap boot files to ensure the right device tree is listed first +IMAGE_BOOT_FILES =+ "devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE'))}" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "\${@['', ' ${mach_conf//-/_}']['${mach_conf}' != "\${MACHINE}"]}" +EOF +} + +parse_cpus() { gen_linux_dtb="None" while read -r cpu core domain cpu_name os_hint; do # Skip commented lines and WARNINGs @@ -976,38 +1106,26 @@ parse_cpus() { } gen_local_conf() { - echo "# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere" >> $1 - echo "BASE_TMPDIR ?= \"\${TOPDIR}\"" >> $1 - [ -n "${system_conf}" ] && echo "require ${system_conf}" >> $1 - echo "SYSTEM_DTFILE = \"${system_dtb}\"" >> $1 - echo "BBMULTICONFIG += \"${multiconf}\"" >> $1 - if [ -n "${fsbl_mcdepends}" ]; then - echo "FSBL_DEPENDS = \"\"" >> $1 - echo "FSBL_MCDEPENDS = \"${fsbl_mcdepends}\"" >> $1 - echo "FSBL_DEPLOY_DIR = \"${fsbl_deploy_dir}\"" >> $1 - fi - if [ -n "${r5fsbl_mcdepends}" ]; then - echo "R5FSBL_DEPENDS = \"\"" >> $1 - echo "R5FSBL_MCDEPENDS = \"${r5fsbl_mcdepends}\"" >> $1 - echo "R5FSBL_DEPLOY_DIR = \"${r5fsbl_deploy_dir}\"" >> $1 - fi - if [ -n "${pmu_mcdepends}" ]; then - echo "PMU_DEPENDS = \"\"" >> $1 - echo "PMU_MCDEPENDS = \"${pmu_mcdepends}\"" >> $1 - echo "PMU_FIRMWARE_DEPLOY_DIR = \"${pmu_firmware_deploy_dir}\"" >> $1 - fi - if [ -n "${plm_mcdepends}" ]; then - echo "PLM_DEPENDS = \"\"" >> $1 - echo "PLM_MCDEPENDS = \"${plm_mcdepends}\"" >> $1 - echo "PLM_DEPLOY_DIR = \"${plm_deploy_dir}\"" >> $1 - fi - if [ -n "${psm_mcdepends}" ]; then - echo "PSM_DEPENDS = \"\"" >> $1 - echo "PSM_MCDEPENDS = \"${psm_mcdepends}\"" >> $1 - echo "PSM_FIRMWARE_DEPLOY_DIR = \"${psm_firmware_deploy_dir}\"" >> $1 - fi - [ "${machine}" = "versal" ] && echo "PDI_PATH = \"${full_pdi_path}\"" >> $1 - echo + cat << EOF >> $1 + +# Each multiconfig will define it's own TMPDIR, this is the new default based +# on BASE_TMPDIR for the Linux build +TMPDIR = "\${BASE_TMPDIR}/tmp" + +# Use the newly generated MACHINE +MACHINE = "${mach_conf}" + +# All of the TMPDIRs must be in a common parent directory. This is defined +# as BASE_TMPDIR. +# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp +BASE_TMPDIR ?= "\${TOPDIR}" + +# The following is the full set of multiconfigs for this configuration +# A large list can cause a slow parse. +BBMULTICONFIG = "${multiconf}" +# Alternatively trim the list to the minimum +#BBMULTICONFIG = "${multiconf_min}" +EOF } gen_petalinux_conf() { @@ -1036,9 +1154,21 @@ multiconf="" cpulist=$(mktemp) priordir=$(pwd) -# Generate CPU list cd "${config_dir}" || exit mkdir -p dtb multiconfig/includes +# Get mach_conf name and model name +( + cd dtb || error "Unable to cd to dtb dir" + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-machine-name.dts" "${system_dtb}" \ + /dev/null > ${cpulist} || error "lopper failed" + rm -f "lop-machine-name.dts.dtb" +) +read local_mach_conf model < ${cpulist} +if [ -z "${mach_conf}" ]; then + mach_conf=${local_mach_conf} +fi + +# Generate CPU list ( cd dtb || error "Unable to cd to dtb dir" 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 detect_machine +echo "System Configuration:" +echo "MODEL = \"${model}\"" +echo "MACHINE = \"${mach_conf}\"" +echo "SOC_FAMILY = \"${machine}\"" +echo "CPUs:" +dump_cpus " = " +echo + +info "Generating configuration..." parse_cpus +generate_machine + cd ${priordir} if [ -z "${localconf}" ]; then echo -- cgit v1.2.3-54-g00ecf