public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* How can I add "busybox sh" as init during boot of the custom kernel?
@ 2023-10-22 23:56 gmssixty gmssixty
  2023-10-23  0:14 ` Randy Dunlap
  0 siblings, 1 reply; 7+ messages in thread
From: gmssixty gmssixty @ 2023-10-22 23:56 UTC (permalink / raw)
  To: linux-kernel

How can I add "busybox sh" as init during boot of the custom kernel? I
have compiled the kernel and put the bzImage in /dev/sda3 (/mnt/sda3).
Booted that kernel. After booting, I got a message to set the init
process. I have put the busybox in /bin. Now I want to add this
"busybox sh" as an init process. How can I do this?

Note that, I did not install any other software in that /dev/sda3
(/mnt/sda3). I have only bzImage and busybox.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How can I add "busybox sh" as init during boot of the custom kernel?
  2023-10-22 23:56 How can I add "busybox sh" as init during boot of the custom kernel? gmssixty gmssixty
@ 2023-10-23  0:14 ` Randy Dunlap
  2023-10-23  0:34   ` gmssixty gmssixty
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2023-10-23  0:14 UTC (permalink / raw)
  To: gmssixty gmssixty, linux-kernel



On 10/22/23 16:56, gmssixty gmssixty wrote:
> How can I add "busybox sh" as init during boot of the custom kernel? I
> have compiled the kernel and put the bzImage in /dev/sda3 (/mnt/sda3).
> Booted that kernel. After booting, I got a message to set the init
> process. I have put the busybox in /bin. Now I want to add this
> "busybox sh" as an init process. How can I do this?
> 
> Note that, I did not install any other software in that /dev/sda3
> (/mnt/sda3). I have only bzImage and busybox.

from Documentation/admin-guide/kernel-parameters.txt:
(or https://docs.kernel.org/admin-guide/kernel-parameters.html)

	init=		[KNL]
			Format: <full_path>
			Run specified binary instead of /sbin/init as init
			process.

-- 
~Randy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How can I add "busybox sh" as init during boot of the custom kernel?
  2023-10-23  0:14 ` Randy Dunlap
@ 2023-10-23  0:34   ` gmssixty gmssixty
  2023-10-23  1:59     ` Randy Dunlap
  0 siblings, 1 reply; 7+ messages in thread
From: gmssixty gmssixty @ 2023-10-23  0:34 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: linux-kernel

I tried this: init=/bin/busybox sh, but it got Kernel panic and
failed. On the other hand, what should I write in /sbin/init?

On Mon, Oct 23, 2023 at 6:15 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
>
>
> On 10/22/23 16:56, gmssixty gmssixty wrote:
> > How can I add "busybox sh" as init during boot of the custom kernel? I
> > have compiled the kernel and put the bzImage in /dev/sda3 (/mnt/sda3).
> > Booted that kernel. After booting, I got a message to set the init
> > process. I have put the busybox in /bin. Now I want to add this
> > "busybox sh" as an init process. How can I do this?
> >
> > Note that, I did not install any other software in that /dev/sda3
> > (/mnt/sda3). I have only bzImage and busybox.
>
> from Documentation/admin-guide/kernel-parameters.txt:
> (or https://docs.kernel.org/admin-guide/kernel-parameters.html)
>
>         init=           [KNL]
>                         Format: <full_path>
>                         Run specified binary instead of /sbin/init as init
>                         process.
>
> --
> ~Randy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How can I add "busybox sh" as init during boot of the custom kernel?
  2023-10-23  0:34   ` gmssixty gmssixty
@ 2023-10-23  1:59     ` Randy Dunlap
  2023-10-23 11:06       ` gmssixty gmssixty
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2023-10-23  1:59 UTC (permalink / raw)
  To: gmssixty gmssixty; +Cc: linux-kernel




> On Mon, Oct 23, 2023 at 6:15 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>>
>>
>>
>> On 10/22/23 16:56, gmssixty gmssixty wrote:
>>> How can I add "busybox sh" as init during boot of the custom kernel? I
>>> have compiled the kernel and put the bzImage in /dev/sda3 (/mnt/sda3).
>>> Booted that kernel. After booting, I got a message to set the init
>>> process. I have put the busybox in /bin. Now I want to add this
>>> "busybox sh" as an init process. How can I do this?
>>>
>>> Note that, I did not install any other software in that /dev/sda3
>>> (/mnt/sda3). I have only bzImage and busybox.
>>
>> from Documentation/admin-guide/kernel-parameters.txt:
>> (or https://docs.kernel.org/admin-guide/kernel-parameters.html)
>>
>>         init=           [KNL]
>>                         Format: <full_path>
>>                         Run specified binary instead of /sbin/init as init
>>                         process.
>>

On 10/22/23 17:34, gmssixty gmssixty wrote:
> I tried this: init=/bin/busybox sh, but it got Kernel panic and
> failed. On the other hand, what should I write in /sbin/init?
> 

Please don't top-post.

You need a file name after init=.
"/bin/busybox sh" is not a file name AFAIK.

To use /sbin/init, enter
	init=/sbin/init

To use bash (e.g.), enter
	init=/usr/bin/bash

The kernel init code already tries to use /sbin/init if that file is
present, along with /etc/init, /bin/init, and /bin/sh .


-- 
~Randy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How can I add "busybox sh" as init during boot of the custom kernel?
  2023-10-23  1:59     ` Randy Dunlap
@ 2023-10-23 11:06       ` gmssixty gmssixty
  2023-10-23 11:41         ` Bagas Sanjaya
  0 siblings, 1 reply; 7+ messages in thread
From: gmssixty gmssixty @ 2023-10-23 11:06 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: linux-kernel

On Mon, Oct 23, 2023 at 7:59 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
>
>
>
> > On Mon, Oct 23, 2023 at 6:15 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> >>
> >>
> >>
> >> On 10/22/23 16:56, gmssixty gmssixty wrote:
> >>> How can I add "busybox sh" as init during boot of the custom kernel? I
> >>> have compiled the kernel and put the bzImage in /dev/sda3 (/mnt/sda3).
> >>> Booted that kernel. After booting, I got a message to set the init
> >>> process. I have put the busybox in /bin. Now I want to add this
> >>> "busybox sh" as an init process. How can I do this?
> >>>
> >>> Note that, I did not install any other software in that /dev/sda3
> >>> (/mnt/sda3). I have only bzImage and busybox.
> >>
> >> from Documentation/admin-guide/kernel-parameters.txt:
> >> (or https://docs.kernel.org/admin-guide/kernel-parameters.html)
> >>
> >>         init=           [KNL]
> >>                         Format: <full_path>
> >>                         Run specified binary instead of /sbin/init as init
> >>                         process.
> >>
>
> On 10/22/23 17:34, gmssixty gmssixty wrote:
> > I tried this: init=/bin/busybox sh, but it got Kernel panic and
> > failed. On the other hand, what should I write in /sbin/init?
> >
>
> Please don't top-post.
>
> You need a file name after init=.
> "/bin/busybox sh" is not a file name AFAIK.
>
> To use /sbin/init, enter
>         init=/sbin/init
>
> To use bash (e.g.), enter
>         init=/usr/bin/bash
>
> The kernel init code already tries to use /sbin/init if that file is
> present, along with /etc/init, /bin/init, and /bin/sh .
>
>
> --
> ~Randy

What would I write in /sbin/init? I mean, what will be the content of
/sbin/init? Should I write: "exec /bin/busybox sh" in /sbin/init? Or
should I write "/bin/busybox sh" in /sbin/init?

BTW, what is top-post?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How can I add "busybox sh" as init during boot of the custom kernel?
  2023-10-23 11:06       ` gmssixty gmssixty
@ 2023-10-23 11:41         ` Bagas Sanjaya
  2023-10-23 13:34           ` gmssixty gmssixty
  0 siblings, 1 reply; 7+ messages in thread
From: Bagas Sanjaya @ 2023-10-23 11:41 UTC (permalink / raw)
  To: gmssixty gmssixty, Randy Dunlap; +Cc: Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 839 bytes --]

On Mon, Oct 23, 2023 at 05:06:38PM +0600, gmssixty gmssixty wrote:
> 
> What would I write in /sbin/init? I mean, what will be the content of
> /sbin/init? Should I write: "exec /bin/busybox sh" in /sbin/init? Or
> should I write "/bin/busybox sh" in /sbin/init?

Since you have Busybox system, /sbin/init should be a symlink to
/bin/busybox.

> 
> BTW, what is top-post?

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Thanks.

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How can I add "busybox sh" as init during boot of the custom kernel?
  2023-10-23 11:41         ` Bagas Sanjaya
@ 2023-10-23 13:34           ` gmssixty gmssixty
  0 siblings, 0 replies; 7+ messages in thread
From: gmssixty gmssixty @ 2023-10-23 13:34 UTC (permalink / raw)
  To: Bagas Sanjaya; +Cc: Randy Dunlap, Linux Kernel Mailing List

On Mon, Oct 23, 2023 at 5:41 PM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
>
> On Mon, Oct 23, 2023 at 05:06:38PM +0600, gmssixty gmssixty wrote:
> >
> > What would I write in /sbin/init? I mean, what will be the content of
> > /sbin/init? Should I write: "exec /bin/busybox sh" in /sbin/init? Or
> > should I write "/bin/busybox sh" in /sbin/init?
>
> Since you have Busybox system, /sbin/init should be a symlink to
> /bin/busybox.
>
> >
> > BTW, what is top-post?
>
> A: http://en.wikipedia.org/wiki/Top_post
> Q: Were do I find info about this thing called top-posting?
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing in e-mail?
>
> A: No.
> Q: Should I include quotations after my reply?
>
> http://daringfireball.net/2007/07/on_top
>
> Thanks.
>
> --
> An old man doll... just what I always wanted! - Clara

I have not installed bash. In that case, how can I run "busybox sh"? I
have tried linking /bin/busybox to /sbin/init. After boot, it prompts
to press Enter to activate console. But after pressing Enter, it
prompts the same message again.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-23 13:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-22 23:56 How can I add "busybox sh" as init during boot of the custom kernel? gmssixty gmssixty
2023-10-23  0:14 ` Randy Dunlap
2023-10-23  0:34   ` gmssixty gmssixty
2023-10-23  1:59     ` Randy Dunlap
2023-10-23 11:06       ` gmssixty gmssixty
2023-10-23 11:41         ` Bagas Sanjaya
2023-10-23 13:34           ` gmssixty gmssixty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox