For discussion of Alpine Linux development and developer support

2 2

[alpine-devel] [PATCH] mkinitfs: init: enable the init= kernel command line argument

Jesse Young
Details
Message ID
<20180813185524.GA2527@varda.jlyo.org>
Sender timestamp
1534186524
DKIM signature
missing
Download raw message
Patch: +8 -5
---
 initramfs-init.in | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/initramfs-init.in b/initramfs-init.in
index 8233af4..f7c2493 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -282,7 +282,7 @@ rtc_exists() {
 set -- $(cat /proc/cmdline)
 
 myopts="alpine_dev autodetect autoraid chart cryptroot cryptdm cryptheader cryptoffset
-	cryptdiscards cryptkey debug_init dma init_args keep_apk_new modules ovl_dev
+	cryptdiscards cryptkey debug_init dma init init_args keep_apk_new modules ovl_dev
 	pkgs quiet root_size root usbdelay ip alpine_repo apkovl alpine_start splash
 	blacklist overlaytmpfs rootfstype rootflags nbd resume s390x_net dasd ssh_key"
 
@@ -312,6 +312,9 @@ done
 # enable debugging if requested
 [ -n "$KOPT_debug_init" ] && set -x
 
+# set default values
+: ${KOPT_init:=/sbin/init}
+
 # pick first keymap if found
 for map in /etc/keymap/*; do
 	if [ -f "$map" ]; then
@@ -466,7 +469,7 @@ if [ -n "$KOPT_root" ]; then
 		fi
 	done
 	sync
-	exec /bin/busybox switch_root $sysroot $chart_init /sbin/init $KOPT_init_args
+	exec /bin/busybox switch_root $sysroot $chart_init "$KOPT_init" $KOPT_init_args
 	echo "initramfs emergency recovery shell launched"
 	exec /bin/busybox sh
 fi
@@ -725,9 +728,9 @@ if [ "$KOPT_chart" = yes ]; then
 	chart_init="/sbin/bootchartd start-rootfs"
 fi
 
-if [ ! -x $sysroot/sbin/init ]; then
+if [ ! -x "${sysroot}${KOPT_init}" ]; then
 	[ "$KOPT_splash" != "no" ] && echo exit > $sysroot/$splashfile
-	echo "/sbin/init not found in new root. Launching emergency recovery shell"
+	echo "$KOPT_init not found in new root. Launching emergency recovery shell"
 	echo "Type exit to continue boot."
 	/bin/busybox sh
 fi
@@ -743,7 +746,7 @@ sync
 
 [ "$KOPT_splash" = "init" ] && echo exit > $sysroot/$splashfile
 echo ""
-exec /bin/busybox switch_root $sysroot $chart_init /sbin/init $KOPT_init_args
+exec /bin/busybox switch_root $sysroot $chart_init "$KOPT_init" $KOPT_init_args
 
 [ "$KOPT_splash" != "no" ] && echo exit > $sysroot/$splashfile
 echo "initramfs emergency recovery shell launched"
-- 
2.18.0



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Jesse Young
Details
Message ID
<1538333738.1438919.1525692792.6563E564@webmail.messagingengine.com>
In-Reply-To
<20180813185524.GA2527@varda.jlyo.org> (view parent)
Sender timestamp
1538333738
DKIM signature
missing
Download raw message
On Mon, Aug 13, 2018, at 13:55, Jesse Young wrote:
>
> [Patch]
>

Gentle ping. Can this be included, or is there feedback?

Thanks,
Jesse


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa
Details
Message ID
<20190103142421.3941d83b@ncopa-desktop.copa.dup.pw>
In-Reply-To
<20180813185524.GA2527@varda.jlyo.org> (view parent)
Sender timestamp
1546521861
DKIM signature
missing
Download raw message
On Mon, 13 Aug 2018 13:55:24 -0500
Jesse Young <jlyo@jlyo.org> wrote:

> ---
>  initramfs-init.in | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)

This was finally merged, for inclusion in alpine v3.9.
Thank you!

-nc

> diff --git a/initramfs-init.in b/initramfs-init.in
> index 8233af4..f7c2493 100755
> --- a/initramfs-init.in
> +++ b/initramfs-init.in
> @@ -282,7 +282,7 @@ rtc_exists() {
>  set -- $(cat /proc/cmdline)
>  
>  myopts="alpine_dev autodetect autoraid chart cryptroot cryptdm cryptheader cryptoffset
> -	cryptdiscards cryptkey debug_init dma init_args keep_apk_new modules ovl_dev
> +	cryptdiscards cryptkey debug_init dma init init_args keep_apk_new modules ovl_dev
>  	pkgs quiet root_size root usbdelay ip alpine_repo apkovl alpine_start splash
>  	blacklist overlaytmpfs rootfstype rootflags nbd resume s390x_net dasd ssh_key"
>  
> @@ -312,6 +312,9 @@ done
>  # enable debugging if requested
>  [ -n "$KOPT_debug_init" ] && set -x
>  
> +# set default values
> +: ${KOPT_init:=/sbin/init}
> +
>  # pick first keymap if found
>  for map in /etc/keymap/*; do
>  	if [ -f "$map" ]; then
> @@ -466,7 +469,7 @@ if [ -n "$KOPT_root" ]; then
>  		fi
>  	done
>  	sync
> -	exec /bin/busybox switch_root $sysroot $chart_init /sbin/init $KOPT_init_args
> +	exec /bin/busybox switch_root $sysroot $chart_init "$KOPT_init" $KOPT_init_args
>  	echo "initramfs emergency recovery shell launched"
>  	exec /bin/busybox sh
>  fi
> @@ -725,9 +728,9 @@ if [ "$KOPT_chart" = yes ]; then
>  	chart_init="/sbin/bootchartd start-rootfs"
>  fi
>  
> -if [ ! -x $sysroot/sbin/init ]; then
> +if [ ! -x "${sysroot}${KOPT_init}" ]; then
>  	[ "$KOPT_splash" != "no" ] && echo exit > $sysroot/$splashfile
> -	echo "/sbin/init not found in new root. Launching emergency recovery shell"
> +	echo "$KOPT_init not found in new root. Launching emergency recovery shell"
>  	echo "Type exit to continue boot."
>  	/bin/busybox sh
>  fi
> @@ -743,7 +746,7 @@ sync
>  
>  [ "$KOPT_splash" = "init" ] && echo exit > $sysroot/$splashfile
>  echo ""
> -exec /bin/busybox switch_root $sysroot $chart_init /sbin/init $KOPT_init_args
> +exec /bin/busybox switch_root $sysroot $chart_init "$KOPT_init" $KOPT_init_args
>  
>  [ "$KOPT_splash" != "no" ] && echo exit > $sysroot/$splashfile
>  echo "initramfs emergency recovery shell launched"



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