From 232aa4cf51234218c3bb9b01e2b874513677daa8 Mon Sep 17 00:00:00 2001 From: Michal Orzel Date: Tue, 13 Sep 2022 14:09:18 +0200 Subject: Add support for lopper to generate partial dts Currently ImageBuilder can compile and merge partial dts obtained from a repository specified using PASSTHROUGH_DTS_REPO. With the recent changes done in the lopper, we can use it to generate partial dts automatically (to some extent as this is still an early support). Introduce LOPPER_PATH option to specify a path to a lopper.py script, the main script in the Lopper repository, that if set, will invoke lopper to generate partial dts for the passthrough devices specified in DOMU_PASSTHROUGH_PATHS. Introduce LOPPER_CMD option to specify custom command line arguments (if needed) for lopper's extract assist. Example usage: LOPPER_PATH="/home/user/lopper/lopper.py" DOMU_PASSTHROUGH_PATHS[0]="/axi/spi@ff0f0000 /axi/serial@ff010000" Signed-off-by: Michal Orzel Reviewed-by: Stefano Stabellini --- scripts/uboot-script-gen | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'scripts/uboot-script-gen') diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen index 02f3309..a5b4972 100755 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -1135,10 +1135,28 @@ fi # tftp or move the files to a partition cd "$uboot_dir" -if test "$PASSTHROUGH_DTS_REPO" +# If both PASSTHROUGH_DTS_REPO and LOPPER_PATH options are specified, +# the former takes precedence because the partial device trees are already +# created (probably tested), hence the reliability is higher than using lopper. +if test "$PASSTHROUGH_DTS_REPO" || test "$LOPPER_PATH" then output_dir=`mktemp -d "partial-dtbs-XXX"` - compile_merge_partial_dts $output_dir "$PASSTHROUGH_DTS_REPO" + if test "$PASSTHROUGH_DTS_REPO" + then + compile_merge_partial_dts $output_dir "$PASSTHROUGH_DTS_REPO" + else + if test -z "$LOPPER_CMD" + then + # Default for ZynqMP MPSoC. + # The following command instructs lopper's extract assist to always + # include zynqmp-firmware node (as it contains e.g. clock-controller + # required by most of the devices) in the extracted tree structure + # and to drop nodes/properties during the extraction process that + # are not needed. + LOPPER_CMD="-i zynqmp-firmware -x interrupt-controller -x pinctrl -x power-domains -x resets -x current-speed" + fi + compile_merge_partial_dts $output_dir + fi if test $? -ne 0 then # Remove the output dir holding the partial dtbs in case of any error -- cgit v1.2.3