[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#783073: bootscripts: Support using fdtfile variable passed from u-boot



On Tue, 2015-04-21 at 08:54 -0700, Vagrant Cascadian wrote:
> Package: flash-kernel
> Version: 3.35
> Severity: wishlist
> Tags: patch

Hi Vagrant,

> The following patch prefers the use of the dtb file identified by the
> u-boot variable ${fdtfile}, which makes it easier to support installs
> where a single u-boot image can support multiple boards, but need to
> load different fdt files at boot.
> 
> It essentially makes a second copy of the .dtb file in
> /boot/dtbs-${kver}/${fdtfile}. Ideally, it would copy all of the .dtb
> files (to support the widest number of boards), but that should be
> made conditional for resource-constrained systems, so I started off
> with simply making a second copy.

There were moves at one point to consolidate/standardise this across
distros:
https://lists.linaro.org/pipermail/cross-distro/2014-May/000676.html

From
https://lists.linaro.org/pipermail/cross-distro/2014-June/000727.html it
seems that the preferred path was /boot/dtbs/$(uname -r) so I suppose we
ought to follow that here.

> I don't expect to see this in jessie, but hopefully something like this
> could be considered for jessie+1.

Absolutely.
> diff --git a/functions b/functions
> index a7ff6de..fc2c21b 100644
> --- a/functions
> +++ b/functions
> @@ -420,13 +420,18 @@ handle_dtb() {
>  
>  	local dtb="/usr/lib/linux-image-$kvers/$dtb_id"
>  	if [ "x$FK_KERNEL_HOOK_SCRIPT" = "xpostrm.d" ] ; then
> -		rm -f "/boot/dtb-$kvers"
> +		rm -f "/boot/dtb-$kvers" "/boot/dtbs-$kvers"

The second one is a directory, so I think this won't work.

I think best is to rm the expected file and then "rmdir
--ignore-fail-on-non-empty" the dir.

>  	else
>  		if [ -e $dtb ]; then
>  			echo "Installing $dtb_id into /boot/dtb-$kvers" >&2
>  			cp "$dtb" "/boot/dtb-$kvers.new"
>  			backup_and_install "/boot/dtb-$kvers.new" "/boot/dtb-$kvers"
>  			ln -nfs "dtb-$kvers" "/boot/dtb"
> +			echo "Installing $dtb_id into /boot/dtbs-$kvers/$dtb_id" >&2
> +			mkdir -p /boot/dtbs-$kvers/
> +			cp "$dtb" "/boot/dtbs-$kvers/$dtb_id.new"
> +			backup_and_install "/boot/dtbs-$kvers/$dtb_id.new" "/boot/dtbs-$kvers/"
> +			ln -nfs "dtbs-$kvers" "/boot/dtbs"

Do we really need the symlink too?

>  		else
>  			echo "$dtb not found" >&2
>  		fi
> 
> 
> live well,
>   vagrant


Reply to: