The Z Boot Process
(Original author unknown. Initial howto origin: http://www.grennan.com/myzaurus/The-Z-Boot-Process.html)
(Note: we need to mark any model/ROM specific features.)
The "boot" process is divide into 3 main parts:
- Boot (from power on until control passes to the kernel)
- Kernel Startup (from the time the kernel gets control of the host hardware until it is ready to run user processes)
- Process Startup (/sbin/init and onwards)
See also: http://www.arm.linux.org.uk/developer/
There is also a prequel to all this: Flashing. Probably wants a separate howto, but the flashing process lays out the root filesystem and installs the kernel image.
These steps describe the process of a COLD boot. This is one where the reset button under back battery cover has been pressed. When this is done it puts some part of the Z into a state that is not otherwise set.
I'm gussing the boot loader located at FLASH memory address 0x00000000 is executed. This part of the Z containes lots of hidden options. One is the "CD" keyboard process to jump to the FLASH memory manager.
from message [Kernel Boot Order]:
- What runs first depends on what type of kernel you start running. If you're using a compressed kernel (aka zImage), the startup code in arch/arm/boot/compressed/head.S runs (and maybe some other architecture specific code in other head-*.S files in that directory). We then move on to the decompressor proper (via decompress_kernel) in arch/arm/boot/compressed/misc.c which gunzips the kernel. We then relocate the kernel if required, and call it.
- This is where we join the uncompressed kernel (aka Image) startup. arch/arm/kernel/head-armv.S describes this, and includes such things as page table initialisation and processor cache initialisation (via support stuff in arch/arm/mm/proc-*.S).
- We then proceed to start_kernel in init/main.c, and everything follows from that point on. The only other thing to note is that the various drivers are initialised via a table built by the linker from the __initcall() and module_init() statements scattered throughout the kernel source. The code which calls them can be found in init/main.c: do_initcalls().
The boot process ends when the Linux kernel entry point _stext (or _start) is called.
For an excellent description of this, see [The Linux 2.4 Kernel's Startup Procedure].
The kernel run
I'd like more information on just how the kernel is started and if it is any different then one executed on a workstation. I'm thinking it must be because it is run in place.
The root file system is mounted read only
This 'disk' space is really FLASH memory. It is only updated by the load process.
For information about what is contained in FLASH see the documentaion on [ROM image layout | http://docs.zaurus.com/index.php?id=romimage-layout.html].
The init program is executed
init runs /etc/rc.d/rc.sysinit
Here is where things start getting confusing. The Z uses lots of sim links.
At this point in the process /etc is not /etc. It is a sim link to /home/etc which is itself a simlink to ../root/etc. So /etc is really /root/etc.
- /etc -> /home/etc -> ../root/etc/rc.d/rc.sysinit
In rc.sysint the path is set to /sbin:/bin:/usr/sbin.rom:/usr/bin.rom. Then if the file /etc/sysconfig/network exists it is executed.
8) /root/etc/rc.d/rc.rofilesys is run
- The rc.sysinit function has found that this is the
- first time the system was booted.
Most of the root file system is empty at this point.
- A fresh copy of the ____ file system needs to be created.
- These file systems are keep in:
/root/.dev_default.tar /root/.home_default.tar /root/.var_default.tar
- The command oncheck is run. This command determines if the system has been cold booted.
- If the system has been cold booted:
- 8a) /dev is created
- The command:
- dd if=/dev/zero of=/dev/ram1 bs=1024 count=64
- carves out the memory needed (64k) for /dev
- A minux file system is made in this space.
- mkfs.minix -i 512 /dev/ram1 64
- The file system is mounted and the default devices
- are created.
- mount -t minix /dev/ram1 /dev
- cd /
- tar xf /root/.dev_default.tar
- 8b) /home is created
- This space is created with:
- dd if=/dev/zero of=/dev/mtd1 bs=1024 count=0x00600000
- NOTE: The size used here is set by ____.
- This space is made into an FS2 disk disk and mounted.
- Then the home and var archives are restored into
- the space.