aboutsummaryrefslogtreecommitdiff
path: root/scripts/common
Commit message (Collapse)AuthorAgeFilesLines
* Add support for lopper to generate partial dtsMichal Orzel2022-12-091-18/+59
| | | | | | | | | | | | | | | | | | | | | | 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 <michal.orzel@amd.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
* Refactor sanity_check_partial_dtsMichal Orzel2022-12-091-5/+6
| | | | | | | | | | | | | | | | Currently function sanity_check_partial_dts from scripts/common takes three arguments where the last two (repo, dir) are used always in conjuction to form a path to a directory storing partial dts. Modify the function to take only two arguments where the second one is to be a path to a directory storing partial dts. This will help reusing this function in the future to perform sanity checks on partial dts that do not originate from a repository. Modify compile_merge_partial_dts to take this change into account. Signed-off-by: Michal Orzel <michal.orzel@amd.com> Reviewed-by: Ayan Kumar Halder <ayankuma@amd.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
* scripts/common: Introduce phandle_next and get_next_phandle()Michal Orzel2022-09-071-0/+11
| | | | | | | | | | | | | | When dealing with device trees, we need to have a solution to add custom phandles to the nodes we create/modify. Add a global variable phandle_next to act as a countdown counter starting with the highest valid phandle value 0xfffffffe. Add a new function get_next_phandle to get a value of the next available phandle and set it to a variable whose name is passed as a first argument. The global counter will be decremented with each call to this function. Signed-off-by: Michal Orzel <michal.orzel@amd.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
* Avoid exiting the script from the commonAyan Kumar Halder2021-12-211-23/+22
| | | | | | | | | | | | | | | | | | | | | | | If there is any error in compile_merge_partial_dts() and sanity_check_partial_dts(), it should return 1 to the caller. The caller will then check the return and call cleanup_and_return_err() (which terminates the script). This is to prevent compile_merge_partial_dts() and sanity_check_partial_dts() terminating the script. The reason being these functions can get invoked from disk_image (in the future) which may require some additional cleanup. Also, moved cleanup_and_return_err() to uboot-script-gen as the cleanup is specific to the script. Ensure that we preseve the directory containing the partial dtbs only when the dtbs were generated successfully. Else, we delete it. Signed-off-by: Ayan Kumar Halder <ayankuma@xilinx.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
* Avoid making changes in the device trees from the repositoryAyan Kumar Halder2021-12-171-2/+10
| | | | | | | | | | | | | | One should copy the device tree to a temporary file and then make any change (so as to enable merging of multiple device trees). In this case, the change is to remove the marker (/dts-v1/;) from all the device trees except the first one to be merged. DTC expects the marker to be present only once. Also, i, j, tmpdts and file should be set to local. This will avoid name collision. Signed-off-by: Ayan Kumar Halder <ayankuma@xilinx.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
* Refactor uboot-script-genAyan Kumar Halder2021-12-171-0/+167
Extract some of the functions from uboot-script-gen into common. This will be sourced by disk_image(in subsequent patch) which will invoke the functions for generating dtb. common will have access to all the environment variables defined in the Imagebuilder config file as described in README.md Signed-off-by: Ayan Kumar Halder <ayankuma@xilinx.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>