aboutsummaryrefslogtreecommitdiff
path: root/scripts/common
Commit message (Collapse)AuthorAgeFilesLines
* 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>