On Sonntag, 4. Dezember 2022 18:20:38 CET Jonas Smedegaard wrote: > Quoting Nicolas Frattaroli (2022-12-04 18:03:30) > > if I specify U_BOOT_FDT to be an absolute path, it won't be > > used by u-boot-update if the default version FDT directory > > exists. > > > > u-boot-update should check as the very first thing for FDT > > line generation whether the path begin with an /, and if > > it does, the file exists, and U_BOOT_FDT_DIR is either > > default or empty (which gets set to default) make it use > > the U_BOOT_FDT file as-is. > > > > This would allow for packages to provide supplemental device trees > > without replacing the whole kernel. > > Thanks for reporting. > > Would it be possible for you to provide a draft proposed change as a > unified diff file, and a (more concrete) example of how the change is > useful? > > No need for a perfect patch - just helpful if you can provide something > more concrete. > > > Kind regards, > > - Jonas > >
Hello, thank you for the quick response. A more concrete example is this defaults file: U_BOOT_FDT=/usr/lib/devicetrees-plebian-quartz64/rockchip/rk3566-soquartz-blade.dtb U_BOOT_FDT_DIR="" The expected output would be an fdt line in extlinux.conf with fdt /usr/lib/devicetrees-plebian-quartz64/rockchip/rk3566-soquartz-blade.dtb even if /usr/lib/linux-image-$KERNELVERSION exists. The use-case for this is to provide a separate device trees package on my Debian live image on my SBCs that contains device trees which are modified from what Debian's kernel ships, or ones it doesn't ship at all. Since device trees are forwards- and backwards compatible, and the drivers I care about for the SoC have already been mainlined for a while, I really only need to give it some device trees. The idea behind shipping Debian's kernel package rather than my own is that I don't want my users to be left stranded with an out of date kernel should I die in a tragic blimp accident. Here's a (somewhat untested in this iteration) patch: --- diff --git a/u-boot-update b/u-boot-update index 69da211..e5ffb22 100755 --- a/u-boot-update +++ b/u-boot-update @@ -182,7 +182,10 @@ do else _INITRD="" fi - if [ -e "${_BOOT_PATH}${U_BOOT_FDT_DIR}${_VERSION}/${U_BOOT_FDT}" ] && [ -n "${U_BOOT_FDT}" ] + if [ -e ${U_BOOT_FDT} ] && [ -n "${U_BOOT_FDT}" ] && [ "/" = $(echo "${U_BOOT_FDT}" | head -c1) ] + then + _FDT="fdt ${U_BOOT_FDT}" + elif [ -e "${_BOOT_PATH}${U_BOOT_FDT_DIR}${_VERSION}/${U_BOOT_FDT}" ] && [ -n "${U_BOOT_FDT}" ] then _FDT="fdt ${U_BOOT_FDT_DIR}${_VERSION}/${U_BOOT_FDT}" elif [ -d "${_BOOT_PATH}${U_BOOT_FDT_DIR}${_VERSION}/" ]