1

[alpine-devel] [PATCH 1/8] main/syslinux: fix/refactor initramfs

Dubiousjim
Details
Message ID
<ec1a739590810d80e7a50dc12a04c046c3ed75b8.1372318132.git.dubiousjim@gmail.com>
Sender timestamp
1372318334
DKIM signature
missing
Download raw message
Patch: +7 -6
If xen.gz is present, there are multiple kernels, and later ones lack an
initramfs, they'll currently be (wrongly) configured to use a initramfs anyway.
Fixed.

We also refactor the check for /boot/initramfs-$tag, and configure this using a
separate INITRD line, instead of adding it to the APPEND line. In passing, this
also closes a second might-use-a-stale-initramfs bug.
---
 main/syslinux/update-extlinux | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/main/syslinux/update-extlinux b/main/syslinux/update-extlinux
index a4d4fa7..2b980a9 100755
--- a/main/syslinux/update-extlinux
+++ b/main/syslinux/update-extlinux
@@ -91,6 +91,8 @@ if [ -f "/boot/xen.gz" ]; then
 		if [ -f "/boot/initramfs-$tag" ]; then
 			everbose "Found initramfs: /boot/initramfs-$tag"
 			initramfs="initramfs-$tag"
+		else
+			initramfs=
 		fi
 		label=xen-$(grep -w -l $tag /usr/share/kernel/*/kernel.release \
 				| cut -d/ -f5)
@@ -113,11 +115,6 @@ fi
 for kernel in $(find /boot -name "vmlinuz-*" -type f); do
 	tag=$(basename $kernel | cut -b9-)
 	everbose "Found kernel: $kernel"
-
-	if [ -f "/boot/initramfs-$tag" ]; then
-		everbose "Found initramfs: /boot/initramfs-$tag"
-		initramfs="initrd=initramfs-$tag"
-	fi
 	label=$(grep -w -l $tag /usr/share/kernel/*/kernel.release | cut -d/ -f5)
 	if [ -z "$label" ]; then
 		label=$lst
@@ -128,7 +125,11 @@ for kernel in $(find /boot -name "vmlinuz-*" -type f); do
 	fi
 	echo "  MENU LABEL Linux $tag" >> $conf.new
 	echo "  KERNEL $(basename $kernel)" >> $conf.new
-	echo "  APPEND $initramfs root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts" >> $conf.new
+	if [ -f "/boot/initramfs-$tag" ]; then
+		everbose "Found initramfs: /boot/initramfs-$tag"
+		echo "  INITRD initramfs-$tag" >> $conf.new
+	fi
+	echo "  APPEND root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts" >> $conf.new
 	echo "" >> $conf.new
 	lst=$(($lst + 1))
 done
-- 
1.8.3.1



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa
Details
Message ID
<20130628164000.306a7674@ncopa-desktop.alpinelinux.org>
In-Reply-To
<ec1a739590810d80e7a50dc12a04c046c3ed75b8.1372318132.git.dubiousjim@gmail.com> (view parent)
Sender timestamp
1372430400
DKIM signature
missing
Download raw message
On Thu, 27 Jun 2013 03:32:14 -0400
Dubiousjim <dubiousjim@gmail.com> wrote:

> If xen.gz is present, there are multiple kernels, and later ones lack an
> initramfs, they'll currently be (wrongly) configured to use a initramfs anyway.
> Fixed.
> 
> We also refactor the check for /boot/initramfs-$tag, and configure this using a
> separate INITRD line, instead of adding it to the APPEND line. In passing, this
> also closes a second might-use-a-stale-initramfs bug.
> ---
>  main/syslinux/update-extlinux | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)

Looks good to me.

I'll apply unless someone nack it.

> diff --git a/main/syslinux/update-extlinux b/main/syslinux/update-extlinux
> index a4d4fa7..2b980a9 100755
> --- a/main/syslinux/update-extlinux
> +++ b/main/syslinux/update-extlinux
> @@ -91,6 +91,8 @@ if [ -f "/boot/xen.gz" ]; then
>  		if [ -f "/boot/initramfs-$tag" ]; then
>  			everbose "Found initramfs: /boot/initramfs-$tag"
>  			initramfs="initramfs-$tag"
> +		else
> +			initramfs=
>  		fi
>  		label=xen-$(grep -w -l $tag /usr/share/kernel/*/kernel.release \
>  				| cut -d/ -f5)
> @@ -113,11 +115,6 @@ fi
>  for kernel in $(find /boot -name "vmlinuz-*" -type f); do
>  	tag=$(basename $kernel | cut -b9-)
>  	everbose "Found kernel: $kernel"
> -
> -	if [ -f "/boot/initramfs-$tag" ]; then
> -		everbose "Found initramfs: /boot/initramfs-$tag"
> -		initramfs="initrd=initramfs-$tag"
> -	fi
>  	label=$(grep -w -l $tag /usr/share/kernel/*/kernel.release | cut -d/ -f5)
>  	if [ -z "$label" ]; then
>  		label=$lst
> @@ -128,7 +125,11 @@ for kernel in $(find /boot -name "vmlinuz-*" -type f); do
>  	fi
>  	echo "  MENU LABEL Linux $tag" >> $conf.new
>  	echo "  KERNEL $(basename $kernel)" >> $conf.new
> -	echo "  APPEND $initramfs root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts" >> $conf.new
> +	if [ -f "/boot/initramfs-$tag" ]; then
> +		everbose "Found initramfs: /boot/initramfs-$tag"
> +		echo "  INITRD initramfs-$tag" >> $conf.new
> +	fi
> +	echo "  APPEND root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts" >> $conf.new
>  	echo "" >> $conf.new
>  	lst=$(($lst + 1))
>  done



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---