mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: gmssixty gmssixty <gmssixty@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: How can I add "busybox sh" as init during boot of the custom kernel?
Date: Sun, 22 Oct 2023 18:59:42 -0700	[thread overview]
Message-ID: <89f666dc-e7b3-44ad-846c-b1f1ee278940@infradead.org> (raw)
In-Reply-To: <CAOx-CDVn7Ub31yiRpoZh4RhJBCvgZhb8Ca=cH9b0xWPjk5FNQA@mail.gmail.com>




> 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

  reply	other threads:[~2023-10-23  1:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-22 23:56 gmssixty gmssixty
2023-10-23  0:14 ` Randy Dunlap
2023-10-23  0:34   ` gmssixty gmssixty
2023-10-23  1:59     ` Randy Dunlap [this message]
2023-10-23 11:06       ` gmssixty gmssixty
2023-10-23 11:41         ` Bagas Sanjaya
2023-10-23 13:34           ` gmssixty gmssixty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89f666dc-e7b3-44ad-846c-b1f1ee278940@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=gmssixty@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®