4 ms·
There are three parts in this sequence: 1. Boot up - this is very machine-dependent ("MD") so you'll find it in each architecture's source code. Look for files
by deprave 10y ago
There are three parts in this sequence:
1. Boot up - this is very machine-dependent ("MD") so you'll find it in each architecture's source code. Look for files named "locore.s" or "locore.S" in places like src/sys/i386/i386.
2. Kernel - the machine-independent ("MI") part, or where the fun begins... this is in src/sys/kern/init_main.c, look for the function main(). You'll see the different subsystems initialized, from the lowest level (auto configuration of hardware devices and console initialization) through fundamental subsystems (virtual memory, disk, network, processes, etc.), all the way to the scheduler. The scheduler will only have one process to work with (PID 1) which is init (src/sbin/init), so that's what gets executed.
3. Userland - /sbin/init is the first process that runs, and it takes care of running everything else, like daemons and eventually your login prompt. Your points of interest in init.c are runetcrc(), read_ttys(), and multi_user().
- tomcam 10y agoWhat a relief! Thanks for scratching that itch. Also turns out to be good code organization, but I needed that post to boot me up.
- mbrock 10y agoSomeone should make a site for sharing little "guided tours" of open source code bases...
- Terribledactyl 10y agoWhile not a walk through the code base, there are these wonderful volumes: http://www.aosabook.org/en/index.html http://www.aosabook.org/en/index.html that have creators/maintainers/contributors walk through at a higher level how these amazing programs work.