:: Re: [DNG] Custom OS initiator. In n…
Forside
Slet denne besked
Besvar denne besked
Skribent: KatolaZ
Dato:  
Til: dng
Emne: Re: [DNG] Custom OS initiator. In need of some hints...
On Mon, Jun 13, 2016 at 08:16:44AM +0200, Edward Bartolo wrote:
> 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
>


If I can provide my 2 cents to the discusion, before writing a new
init you should have studied and understood very well one of the
existing ones, and what should happen behind the scenes from the
moment your kernel is decompressed to the appearance of a login
terminal. I would recommend to start with sysvinit or the standard
rc-based init of *BSD. By studying I mean looking into the code of the
process that is called "init" and into the code of all the processes
directly started by init (e.g., /etc/init.d/rc, in the case of
sysvinit, getty/agetty, etc...), and being sure to have understood
what is in there.

If you don't master the procedure behind system initialisation, to the
point of being able to replay in your mind all the steps that init
does while having a more or less precise idea of how those steps can
be implemented in your language of choice, then you will waste a lot
of time.

Personally, I think I couldn't start writing a new complete init
system anytime soon, despite I might have a very rough idea of what is
going on there, the main reason being that I have never really
*understood* how console management is performed under Linux (a
concrete contribution to this ignorance is the fact that we have had 5
or 6 different ways of managing console setups in the last 20 years,
most of them used concurrently on the same installation, but this is
not a good excuse anyway...).

My2Cents

KatolaZ

-- 
[ ~.,_  Enzo Nicosia aka KatolaZ - GLUGCT -- Freaknet Medialab  ]  
[     "+.  katolaz [at] freaknet.org --- katolaz [at] yahoo.it  ]
[       @)   http://kalos.mine.nu ---  Devuan GNU + Linux User  ]
[     @@)  http://maths.qmul.ac.uk/~vnicosia --  GPG: 0B5F062F  ] 
[ (@@@)  Twitter: @KatolaZ - skype: katolaz -- github: KatolaZ  ]