diff mbox series

initramfs-framework: remove hard dependency with busybox

Message ID 20250328180456.90413-1-gavrosc@yahoo.com
State New
Headers show
Series initramfs-framework: remove hard dependency with busybox | expand

Commit Message

Christos Gavros March 28, 2025, 6:04 p.m. UTC
In 'finish'script the Switch_root command with option -c is busybox specific.
When package-core-base-utils is selected the boot is breaking.
Remove -c option to make it compatible with both providers
Fixes [YOCTO #15716]

CC: Yoann Congal <yoann.congal@smile.fr>
CC: Randy MacLeod <randy.macleod@windriver.com>
CC: Ross Burton <ross.burton@arm.com>
CC: jbk <jbk@mm-software.com>
Signed-off-by: Christos Gavros <gavrosc@yahoo.com>
---
 meta/recipes-core/initrdscripts/initramfs-framework/finish | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adrian Freihofer March 29, 2025, 1:45 p.m. UTC | #1
Hi Christos

Since the -c has been around for a very long time, I assume that there
are many users who use it with busybox. Using it with core-utils will
probably remain the special use case.
The proposed fix raises the question of why the -c was introduced at
some point. If your fix also works for busybox, was the -c always
redundant? Or has something changed in the meantime?

Please also address the busybox users' point of view in the commit
message and summarize how this was tested with busybox in particular.

Thank you.
Adrian


On Fri, 2025-03-28 at 19:04 +0100, Christos Gavros via
lists.openembedded.org wrote:
> In 'finish'script the Switch_root command with option -c is busybox
> specific.
> When package-core-base-utils is selected the boot is breaking.
> Remove -c option to make it compatible with both providers
> Fixes [YOCTO #15716]
> 
> CC: Yoann Congal <yoann.congal@smile.fr>
> CC: Randy MacLeod <randy.macleod@windriver.com>
> CC: Ross Burton <ross.burton@arm.com>
> CC: jbk <jbk@mm-software.com>
> Signed-off-by: Christos Gavros <gavrosc@yahoo.com>
> ---
>  meta/recipes-core/initrdscripts/initramfs-framework/finish | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-core/initrdscripts/initramfs-
> framework/finish b/meta/recipes-core/initrdscripts/initramfs-
> framework/finish
> index ac0de9f996..716c2f44af 100755
> --- a/meta/recipes-core/initrdscripts/initramfs-framework/finish
> +++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish
> @@ -41,7 +41,7 @@ finish_run() {
>  		mount --move /sys $ROOTFS_DIR/sys
>  
>  		cd $ROOTFS_DIR
> -		exec switch_root -c /dev/console $ROOTFS_DIR
> ${bootparam_init:-/sbin/init}
> +		exec switch_root $ROOTFS_DIR ${bootparam_init:-
> /sbin/init}
>  	else
>  		debug "No rootfs has been set"
>  	fi
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#213861):
> https://lists.openembedded.org/g/openembedded-core/message/213861
> Mute This Topic: https://lists.openembedded.org/mt/111959232/4454582
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe:
> https://lists.openembedded.org/g/openembedded-core/unsub [
> adrian.freihofer@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Christos Gavros March 29, 2025, 4:01 p.m. UTC | #2
hi Adrian

thank you for the comment. I had a look in commits log and it looks that '-c' was there since the beginning in 2008/09/10 in script 'init-live.sh' and then moved in 'finish.sh' in 2011/12/08.
I reproduced the issue by using qemu and I described how I did it in detail in bug # 15716.
After I applied the change I tested both busybox and packagegroup-core-base-utils. The boot was successful in both cases.
Also '-c' is an option in busybox: https://www.busybox.net/downloads/BusyBox.html

I will wait for more comments and then I will extend the commit message and send a v2.

Br
Christos
Khem Raj March 29, 2025, 4:29 p.m. UTC | #3
On Sat, Mar 29, 2025 at 9:01 AM Christos Gavros via
lists.openembedded.org <gavrosc=yahoo.com@lists.openembedded.org>
wrote:
>
> hi Adrian
>
> thank you for the comment. I had a look in commits log and it looks that '-c' was there since the beginning in 2008/09/10 in script 'init-live.sh' and then moved in 'finish.sh' in 2011/12/08.
> I reproduced the issue by using qemu and I described how I did it in detail in bug #15716.
> After I applied the change I tested both busybox and packagegroup-core-base-utils. The boot was successful in both cases.
> Also '-c' is an option in busybox: https://www.busybox.net/downloads/BusyBox.html
>

-c option is to redirect the console after switching root. Some
devices it did not work properly because util-linux version moved the
pseudo filesystems like /dev automatically
but busybox version did not, maybe things have changed but I would
suggest that this operation is now happening with both switch_root
versions with you script manually doing so.

> I will wait for more comments and then I will extend the commit message and send a v2.
>
> Br
> Christos
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#213885): https://lists.openembedded.org/g/openembedded-core/message/213885
> Mute This Topic: https://lists.openembedded.org/mt/111959232/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish
index ac0de9f996..716c2f44af 100755
--- a/meta/recipes-core/initrdscripts/initramfs-framework/finish
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish
@@ -41,7 +41,7 @@  finish_run() {
 		mount --move /sys $ROOTFS_DIR/sys
 
 		cd $ROOTFS_DIR
-		exec switch_root -c /dev/console $ROOTFS_DIR ${bootparam_init:-/sbin/init}
+		exec switch_root $ROOTFS_DIR ${bootparam_init:-/sbin/init}
 	else
 		debug "No rootfs has been set"
 	fi