bootscript: sunxi: Add a dtb file path analyzer #7484
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Device tree files and overlay files are interconnected
and always located in the same place, separated by
the overlay subdirectory.
${fdtdir}/${fdtfile}
${fdtdir}/overlay/${overlay_prefix}-${overlay_file}.dtbo
By default, we are trying to download a dtb file from
the /boot/dtb folder, which is a link to the real folder.
Depending on the time and type of build, this link may
point directly to the target folder or to a subdirectory,
i.e. possible path options:
/boot/dtb/overlay
/boot/dtb/allwinner/overlay
In the file armbianEnv.txt we can also see:
fdtfile=sun8i-*.dtb
or
fdtfile=allwinner/sun8i-*.dtb
Thus, when the user has frozen the kernel and updated
the BSP package, or vice versa, updated only the kernel,
the following options are possible in the paths after
their concatenation in the script:
/boot/dtb/sun8i-*.dtb
/boot/dtb/allwinner/sun8i-*.dtb
/boot/dtb/allwinner/allwinner/sun8i-*.dtb
But only one is real.
Define and remember default path variables.
Provide the user with the ability to specify the path
to the target folder as:
fdtdir=/path/to/dir
Check the existence of the dtb file in all reasonable
paths and set the path to it.
If not found, download the default file from the default path.
How Has This Been Tested?
I think I've tested a lot of options.
But it only seems so.