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

Re: Support for sunxi-based ARM systems in d-i

On Mon, 2014-05-05 at 21:45 +0200, Karsten Merker wrote:
> On Mon, May 05, 2014 at 08:17:06PM +0100, Ian Campbell wrote:
> > This does make me wonder if f-k with your patch needs to be more careful
> > about overwriting /boot/vmlinuz in case it is a symlink.
> Indeed. Does anything speak against explicitly calling "rm -f" on the
> file defined by Boot-{Kernel,Initrd}-Path before writing to it? If 
> it is a symlink, only the symlink gets removed and the file it points
> to stays untouched, and if it is a file, removing it does no harm.

I'm not sure. How about just avoiding the issue altogether with
something like this (untested):

--- a/functions
+++ b/functions
@@ -282,9 +282,13 @@ mkimage_script() {
 	local sdata="$3"
 	local script="$4"
+	local tdata="$tmpdir/boot.scr.subst"
 	printf "Generating boot script u-boot image... " >&2
+	sed -e 's/@@KERNEL_VERSION@@/$kvers/g' \
+		< $sdata > $tdata
 	mkimage -A arm -O linux -T script -C none -a "$saddr" -e "$saddr" \
-		-n "$sdesc" -d "$sdata" "$script" >&2 1>/dev/null
+		-n "$sdesc" -d "$tdata" "$script" >&2 1>/dev/null
 	echo "done." >&2
With this there is no need to copy or link anything since you can use
"setenv kvers @@KERNEL_VERSION@@" in the boot.scr and then use
vmlinuz-${kvers} etc (or use @@KERNEL_VERSION@@ throughout).

This shouldn't have any impact on any existing boot script which doesn't
use the @@KERNEL_VERSION@@ pattern.

A less appealing alternative would be for flash-kernel to always prepend
a setenv to the script itself, or perhaps to generate a second script
which could be optionally sourced from this one a la uEnv.txt. I think
the patch above is the simplest alternative though.


Reply to: