From 215984802b9f74b724b0395e5235356b32a2bb5a Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Tue, 8 Mar 2022 13:20:24 -0800 Subject: fsbl-firmware: Move to explicit psu_init settings The location for psu_init is now explicitly set. If the psu_init files are not available, a warning will be presented to the user. Signed-off-by: Mark Hatle --- .../embeddedsw/fsbl-firmware_git.bbappend | 32 +++++++++---------- .../recipes-core/meta/files/dt-processor.sh | 37 ++++++++++++++++++++-- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/fsbl-firmware_git.bbappend b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/fsbl-firmware_git.bbappend index 32174711..056ad990 100644 --- a/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/fsbl-firmware_git.bbappend +++ b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/fsbl-firmware_git.bbappend @@ -15,23 +15,23 @@ ESW_COMPONENT_SRC:zynqmp = "/lib/sw_apps/zynqmp_fsbl/src" DEPENDS += "xilstandalone xiltimer xilffs xilsecure xilpm" -do_copy_psu_init[depends] += "device-tree:do_deploy" -python do_copy_psu_init() { - import glob, subprocess, os - - system_dt = d.getVar('SYSTEM_DTFILE') - src_dir = glob.glob(d.getVar('OECMAKE_SOURCEPATH')) - psu_init_src = os.path.dirname(system_dt) - src_file = psu_init_src + str("/psu_init.c") - hdr_file = psu_init_src + str("/psu_init.h") - if os.path.exists(src_file): - command = ["install"] + ["-m"] + ["0755"] + [src_file] + [src_dir[0]] - subprocess.run(command, check = True) - command = ["install"] + ["-m"] + ["0755"] + [hdr_file] + [src_dir[0]] - subprocess.run(command, check = True) +python() { + psu_init_path = d.getVar('PSU_INIT_PATH') + if not psu_init_path: + psu_init_path = os.path.dirname(d.getVar('SYSTEM_DTFILE')) + + psu_init_c = os.path.join(psu_init_path, 'psu_init.c') + psu_init_h = os.path.join(psu_init_path, 'psu_init.h') + + if os.path.exists(psu_init_c): + d.appendVar('SRC_URI', ' file://%s' % psu_init_c) + else: + bb.warn("Unable to find %s, using default version" % psu_init_c) + if os.path.exists(psu_init_h): + d.appendVar('SRC_URI', ' file://%s' % psu_init_h) + else: + bb.warn("Unable to find %s, using default version" % psu_init_h) } -addtask do_copy_psu_init before do_configure after do_prepare_recipe_sysroot -do_prepare_recipe_sysroot[rdeptask] = "do_unpack" do_install() { : 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 d7c37173..e44f1e83 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 @@ -39,6 +39,7 @@ $0 [-o ] Generate overlay dts [-e ] Apply a partial overlay [-m ] zynqmp or versal + [-p ] Path to psu_init files, defaults to system_dtb path [-l ] write local.conf changes to this file EOF @@ -56,6 +57,7 @@ parse_args() { d) domain_file=$OPTARG ;; e) external_fpga=$OPTARG ;; m) machine=$OPTARG ;; + p) psu_init_path=$OPTARG ;; l) localconf=$OPTARG ;; h) usage ;; :) error "Missing argument for -$OPTARG" ;; @@ -65,6 +67,9 @@ parse_args() { [ -f "${config_dir}/local.conf" ] || error "Invalid config dir: ${config_dir}" [ -f "${system_dtb}" ] || error "Unable to find: ${system_dtb}" + if [ -z "$psu_init_path" ]; then + psu_init_path=$(dirname ${system_dtb}) + fi } detect_machine() { @@ -195,7 +200,21 @@ cortex_a53_baremetal() { mv libxil.conf "${libxil}" mv distro.conf "${distro}" - cat <"${conf_file}" + if [ "$1" = "fsbl" ]; then + if [ ! -e "${psu_init_path}/psu_init.c" ]; then + warn "Warning: Unable to find psu_init.c in ${psu_init_path}" + fi + if [ ! -e "${psu_init_path}/psu_init.h" ]; then + warn "Warning: Unable to find psu_init.h in ${psu_init_path}" + fi + + cat <"${conf_file}" +PSU_INIT_PATH = "${psu_init_path}" +EOF + else + cat /dev/null >"${conf_file}" + fi + cat <>"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" ESW_MACHINE = "cortexa53-${machine}" DEFAULTTUNE = "cortexa53" @@ -472,7 +491,21 @@ cortex_r5_baremetal() { mv libxil.conf "${libxil}" mv distro.conf "${distro}" - cat <"${conf_file}" + if [ "$1" = "fsbl" ]; then + if [ ! -e "${psu_init_path}/psu_init.c" ]; then + warn "Warning: Unable to find psu_init.c in ${psu_init_path}" + fi + if [ ! -e "${psu_init_path}/psu_init.h" ]; then + warn "Warning: Unable to find psu_init.h in ${psu_init_path}" + fi + + cat <"${conf_file}" +PSU_INIT_PATH = "${psu_init_path}" +EOF + else + cat /dev/null >"${conf_file}" + fi + cat <>"${conf_file}" CONFIG_DTFILE = "\${TOPDIR}/conf/dtb/${dtb_file}" ESW_MACHINE = "cortexr5-${machine}" DEFAULTTUNE = "cortexr5" -- cgit v1.2.3-54-g00ecf