:: Re: [DNG] Custom OS initiator. In n…
Kezdőlap
Delete this message
Reply to this message
Szerző: Steve Litt
Dátum:  
Címzett: dng
Tárgy: Re: [DNG] Custom OS initiator. In need of some hints...
On Mon, 13 Jun 2016 11:02:12 +0200
Didier Kryn <kryn@???> wrote:

> Le 13/06/2016 08:16, Edward Bartolo a écrit :
> > Hi,
> >
> > This is a question about implementing a minimal OS initiator. If
> > DNG's admins/mods deem this email is misplaced please delete it or
> > ignore it.
> >
> > Till now, I implemented a little OS initiator that calls "/bin/bash"
> > and then enters an infinite while loop that does nothing. The loop's
> > purpose is to prevent PID 1 from exiting.
> >
> > I would like to have my OS initiator:
> > a) initiate a terminal before launching it. /sbin/init launches six
> > such terminals tty1..tty6
> > b) prevent this terminal from closing
> > c) do some basic child process management
>
>      Here's something you could try:

>
> mount -t proc proc /proc
> mount -t sysfs sys /sys
> mount -t devtmpfs dev /dev  # or mount /dev as tmpfs and start 
> hotplugger (udev/eudev/vdev/mdev)
> mount -t tmpfs run /run
> mknod -m 0600 /dev/console c 5 1
> mknod -m 0660 /dev/tty1    c 4 1
> while ( true )
> do
>      printf 'Entering interactive shell\n'
>      setsid /bin/sh -c 'exec bash </dev/tty1 >/dev/tty1 2>&1'
> done;

>
>      Have fun.
>                          Didier


And later, when Edward makes a real PID1, everything before the line
about /dev/console comprises the first few statements of the /etc/rc
shellscript.

SteveT

Steve Litt
June 2016 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb