Boot process (300 series)

From NAS-Central Zyxel Wiki
Jump to: navigation, search

Boot process

On power on the SoC starts executing the contents of the flash memory. The first flash block contains u-boot

u-boot

U-boot reads the u-boot environment from it's flash block, to know what to do. Then it loads a Linux kernel (uImage) from either flash block kernel_1 or kernel_2 in memory, and executes it. It passes a commandline, which it read from the environment.

kernel

The kernel initializes the hardware, extracts an embedded ramdrive an initrd, containing a complete Linux root file system. According to the commandline it has to start /init from this ramdrive.

initrd

/init

The script /init does some network initialisations. (It actually renames /eth0 to /egiga0, probably to keep the firmware more or less compatibel with the ancient NSA-220. The last action of /init is to start /linuxrc

/linuxrc

/linuxrc is just a symlink to busybox, and this will basically execute the script /etc/inittab. (OK, it doesn't *look* like a script, but that's only because of it's strange syntax). According to /etc/inittab the script /etc/init.d/rcS will be called.

/etc/init.d/rcS

This script is mainly responsible for bringing up other filesystems.

Normal boot

/dev/sda1

/dev/sda1 is mounted on /zyxel/mnt/sysdisk. This partition contains a file sysdisk.img, which is actually an ext2 filesystem. The file will be loopmounted on /ram_bin/

sysdisk.img

This filesystem contains mainly the contents of /usr, which is the webinterface, and (almost) all daemons. The directories from this filesystem are bindmounted on several directories of the rootfs. Further is contains a script etc/init.d/rcS2, and calling this is the last action of /etc/init.d/rcS

Ram boot

When no (prepared) harddisk is available, this system has to completely work from RAM.

Ramdrive

A ramdrive is created to which the content of either flashblock rootfs1 or rootfs2 is extracted. This becomes a file sysdisk.img, which is indeed the same one which is available on a prepared harddisk.

/ram_bin/etc/init.d/rcS2

The script rcS2 mounts the raid array (s), starts all daemons which bear the firmware. Samba, ntdpd, apache, dropbox, ..., it is also responsible for initiating and starting the package system. The last action of rcS2 is to turn the sysled to green. (Blinking blue is the power-on default)