====== Frenzy bootstrapping ====== ===== kernel stage ===== Bootstrapping starts from that BIOS passes control to cdboot bootmanager which is located in bootable area of CD. cdboot runs BTX loader (/boot/loader). BTX loader reads its configuration files, loads kernel and necessary modules and displays boot menu (with the logo). Then kernel loading and devices identification are run. There is specified in the loader configuration that root file system shouyld be mounted from compressed image /boot/frenzyroot.gz. After loading kernel root file system is mounted from this image and control is passed to /sbin/init process which is run from this place. ===== frenzyroot stage ===== frenzyroot image contains several base utilities : ''cp sh test echo init mdconfig mount mount_cd9660 mount_nullfs umount sleep'' There are several important files in /etc also, including rc-scripts specially written for Frenzy. /sbin/init runs /etc/rc. This is a non-standard script which performs all initial tuning and booting LiveCD. ==== 1. Bootable device searching ==== First we should find and mount the disk the system is booted from. Script looks file frenzy.uzip at every CD-ROM and USB drives in an order. If such file was found the disk that contains in is mounted in /Frenzy/boot directory. ==== 2. Mounting compressed file system ==== frenzy.uzip contains compressed file system that will be used as a root. Yet it cannot be mounted over existing root FS we do the following. File system from frenzy.uzip is mounted at /Frenzy/fs directory, after that we use mount_nullfs to mount directories ''bin, boot, lib, libexec, sbin, usr'' from compressed image over the existing file system. ==== 3. Locale setting ==== Nice font is loaded and screenmap is set up. This is neede to display russian menu. ==== 4. Calculating the size of RAM-disk ==== We calculate the volume of system RAM. Hence we set up RAM-disk size by default (10,15,30 and 45 megs). ==== 5. Boot menu ==== Boot menu is displayed on screen. We set up boot parameters (its descriptioon see [[doc_en:boot|here]]). ==== 6. Creating RAM-disk ==== We create RAM-disk with specified size and mount it to /Frenzy/ramdisk. Directories ''etc, root, var, mnt'' will be stored there. We create them, copy to them files from appropriate directories located in /Frenzy/fs and mount these directories over the directories of root with mount_nullfs. Than settings defined in boot menu are stored in /etc/frenzy.boot ==== 7. Patches loading ==== We look through the directory /Frenzy/boot/frenzy.conf. If there are scripts whose names are end with '.patch' we perform them. This is useful in case if you add some pathes for configuration files but do not want to rebuild compressed image. ==== 8. 'toram' boot mode (optional) ==== If the parameter 'toram' was chosen then loading to memory will be performed: * RAM-disk of enough size will be created (size is calculated automatically depending of frenzy.uzip size) and mounted to /Frenzy/mfs. * Copy /Frenzy/boot/frenzy/frenzy.uzip there and then remount /Frenzy/fs from this file. * Remount file systems from new /Frenzy/fs as described at clause 2. After loading to RAM CD-ROM drive is freed and tray is ejected. ==== 9. Looking for partitions on HDD ==== By default are mounted in "read only" mode. The next menu options are available: * **hdrw** - mount in write mode (FAT/UFS/EXT2FS only) * **nohdmnt** - search partitions, create mount points and fstab update but do not mount partitions * **nohdd** - search and mount are not performed ==== 10. fromhdd boot mode (optional) ==== If ''fromhdd'' parameter was chosen than bootstrapping from HDD will be performed: * Search the file frenzy/frenzy.uzip at every mounted partition. * If such file was found than operations described in clause 8 are performed (remounting compressed image and directories). After the bootstrapping from hard disk CD-ROM is freed and its tray is ejected. ==== 11. Miscellaneous ==== * /tmp/.frenzy file is created (existence of this file is interpreted by scripts as the sign of CD/Flash bootstrapping). * System language is set up by /usr/local/bin/frlang (language is set up during the bootstrapping). * Backup settings from diskette/HDD/USB drive/CD are restored (directory frenzy/backup). This step can be cancelled with **nobackup** option. At last, /etc/rc is run. ===== base stage ===== Running system rc-scripts almost identical to standard FreeBSD's one. But there are some differences : 1. Some part of rc-scripts is edited such way to not to run them if ''/tmp/.frenzy'' exists. These scripts are used to mount partiotions described in fstab and to check them with fsck (this is not needed when booting from livecd because it is done by other scenarios). 2. After all rc-scripts are run ''/etc/rc.d/FRENZY'' is executed which performs the following: * running mouse detecting utility (''/usr/local/bin/mouse-detect'') * running an utility that gathers system information (if the option **hwinfo** was chosen) * enabling autologin at the first terminal (always enabled while booting from CD/Flash) * running GUI (if **gui** option was chosen)