init
- The first process
- Geek quiz: Name two other special things the kernel does for process 1
- pstree
The Unix philosophy
- Do One Thing and do it well
This is a continuation of last Friday’s examples, theseries of servers, that echo JSON expressions.
- One connection only
- One connection at a time
- Concurrent connections
— Introducing the
fork
- Concurrent connections without zombies
- One connection at a time using
socketserver
— handles termination ungracefully - Concurent connections based
on example
socketserver
cod withthreading
— tries to terminate early - Concurent connections following the SocketServer example of keenerd@gmail
Booting the computer
The file systems
Run the following commands on both your workstation and your Pi.
df -Th / df -Th /boot df -Th
Look at the Tecmint.com Linux Howto’s page on 7 Ways to Determine the File System Type in Linux and try these commands out on your Pi and workstation. You’ll have to skip the commands requiring sudo access on your workstation.
Initial Root Directory
This is a bit of an aside since it isn’t the first step in the boot process and often isn’t used in Raspberry Pi systems.
First, take a look at the Wikipedia page on the initial ramdisk. This file is stored in /boot/initrd.img-&hellip on the lab Ubuntu computers. On the Pi’s /boot/kernel7.img has a simular purpose, but it is difficult to decompress. So, we’re going to look at one on the workstations.
- Connect to the /var/tmp directory.
- Copy /boot/initrd.img-&hellip to /var/tmp.
- Unzip (or rather
gunzip
) the init ramdisk into the file /var/tmp/initrd.cpio . - Compare the size of the compressed and uncompressed initrd files.
- Create a subdirectory of /var/tmp and connect to it.
- Extract files from the cpio archive using something like cpio -id < ../initrd.cpio
- Examine the contents. This should give you and idea of what a big system needs to boot.
Some references
The present boot setup?
I just noticed that the latest version of the UNIX and Linux System Administration Handbook is available on-line at UNC Asheville. This has been consider the sysadmin book for years.
This is not all public domain software. There is (according to one source at Broadcom — yes, the one that’s in the news) there are million lines of protected code used to start the boot process. (See Understanding the Raspberry Pi Boot Process and boot flow for more details.
- The boot disk is an ordinary FAT32 size system
- First stage bootloader in ROM on Broadcom SoC. Executed on GPU.
- Second stage bootloader, stored in bootcode.bin is executed in GPU.
- Third stage bootloader, stored in start.elf starts.
- Reads config.txt, the ”BIOS“, and sets parameters.
- cmdline.txt is read for kernel arguments
- Kernel, kernel.img or kernel7.img, is loaded. (Loaded image is prefixed by a decompressing program?).
- Kernel starts!
- Tables are initialized....
OS Running!
The first user process, init, or /sbin/init is started. Control passes to user space.
See what /sbin/init really is.
Systemd
It has won. However, there are still directores at /etc/rc*.d .