:: Re: [DNG] Custom OS initiator. In n…
トップ ページ
このメッセージを削除
このメッセージに返信
著者: Didier Kryn
日付:  
To: Edward Bartolo, dng
題目: Re: [DNG] Custom OS initiator. In need of some hints...
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