LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* In initrd, init program is needed or not?
@ 2001-09-12 14:01 qiuqingjun
  2001-09-12 14:41 ` Peter Barada
  0 siblings, 1 reply; 4+ messages in thread
From: qiuqingjun @ 2001-09-12 14:01 UTC (permalink / raw)
  To: linuxppc-embedded


Hi, all
I am a newbie in ramdisk, I could not find the answers of the following questions in the previous maillists.

There is a program, called init, in some ramdisk.image.gz. however in SIMPLE-ramdisk.image.gz, I did not find it.
I could not understand what the init programe does?

BTW, if I want to access /proc/... , what files should I add in ramdisk. Should I add a program called MOUNT in /bin? who exec rc and fstab script , shell(bash , ash) or kernel?
Thank you in advance.


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: In initrd, init program is needed or not?
  2001-09-12 14:01 In initrd, init program is needed or not? qiuqingjun
@ 2001-09-12 14:41 ` Peter Barada
  2001-09-13  5:07   ` qiuqingjun
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Barada @ 2001-09-12 14:41 UTC (permalink / raw)
  To: qiuqingjun; +Cc: linuxppc-embedded


>BTW, if I want to access /proc/... , what files should I add in
>ramdisk. Should I add a program called MOUNT in /bin? who exec rc and
>fstab script , shell(bash , ash) or kernel? Thank you in advance.

After the kernel mounts the root filesystem(via initrd, etc)
it attempts to start the init process be createing a thread
and trying to exec init from the following places(in this order):

/sbin/init
/etc/init
/bin/init

And if none of them can be found, then it tries to fire up a shell
from:

/bin/shell

See init/main.c, init()

Depending on the init executable you place in your root filesystem, it
runs the /etc/rc script, and in there is where you'd a snippet the
looks something like:

/sbin/expand /etc/ramfs.img /dev/ram1
/sbin/mount -n -t proc proc /proc
/sbin/mount -n -t ext2 /dev/ram1 /var

Where the first line decompresses a ramdisk ext filesystem image into
/dev/ram1, the second line mounts the /proc filesystem, and the third
line mounts the ramdisk(/dev/ram1) as a filesystem on /var

Note that /sbin/expand and /sbin/mount can not be in the ramdisk.
Neithere can /sbin/init or /etc/rc.
They have to be in the root filesystem which is mounted before init
starts up.

YMMV,

--
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: In initrd, init program is needed or not?
  2001-09-12 14:41 ` Peter Barada
@ 2001-09-13  5:07   ` qiuqingjun
  2001-09-13 14:18     ` Peter Barada
  0 siblings, 1 reply; 4+ messages in thread
From: qiuqingjun @ 2001-09-13  5:07 UTC (permalink / raw)
  To: linuxppc-embedded


Hi, Peter Barada,
Thank your explaination of init program in detail, however , I have another question:
Where can I find the source code of the init program?
Thank you again!

Qiu Qingjun

>
> >BTW, if I want to access /proc/... , what files should I add in
> >ramdisk. Should I add a program called MOUNT in /bin? who exec rc and
> >fstab script , shell(bash , ash) or kernel? Thank you in advance.
>
> After the kernel mounts the root filesystem(via initrd, etc)
> it attempts to start the init process be createing a thread
> and trying to exec init from the following places(in this order):
>
> /sbin/init
> /etc/init
> /bin/init
>
> And if none of them can be found, then it tries to fire up a shell
> from:
>
> /bin/shell
>
> See init/main.c, init()
>
> Depending on the init executable you place in your root filesystem, it
> runs the /etc/rc script, and in there is where you'd a snippet the
> looks something like:
>
> /sbin/expand /etc/ramfs.img /dev/ram1
> /sbin/mount -n -t proc proc /proc
> /sbin/mount -n -t ext2 /dev/ram1 /var
>
> Where the first line decompresses a ramdisk ext filesystem image into
> /dev/ram1, the second line mounts the /proc filesystem, and the third
> line mounts the ramdisk(/dev/ram1) as a filesystem on /var
>
> Note that /sbin/expand and /sbin/mount can not be in the ramdisk.
> Neithere can /sbin/init or /etc/rc.
> They have to be in the root filesystem which is mounted before init
> starts up.
>
> YMMV,
>
> --
> Peter Barada                                   Peter.Barada@motorola.com
> Wizard                                         781-852-2768 (direct)
> WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)
>
>

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: In initrd, init program is needed or not?
  2001-09-13  5:07   ` qiuqingjun
@ 2001-09-13 14:18     ` Peter Barada
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Barada @ 2001-09-13 14:18 UTC (permalink / raw)
  To: qiuqingjun; +Cc: linuxppc-embedded


>Hi, Peter Barada,
>Thank your explaination of init program in detail, however , I have
>another question:
>
>Where can I find the source code of the init program?
>Thank you again!

We 'borrowed' the init code from the ucLinux distribution (user/init).
I'm thinking of changing to the version that is distributed with HardHat.
I know that will be more code(hence larger footprint), but the
benifit of using an actively developing piece of code is very appealing.

--
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2001-09-13 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-12 14:01 In initrd, init program is needed or not? qiuqingjun
2001-09-12 14:41 ` Peter Barada
2001-09-13  5:07   ` qiuqingjun
2001-09-13 14:18     ` Peter Barada

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