User Tools

Site Tools


doc:techref:preinit_mount

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
doc:techref:preinit_mount [2013/03/12 21:08]
hnyman add note about r35712 effects on firstboot
doc:techref:preinit_mount [2013/11/29 11:20] (current)
digitsm Some intro for Failsafe section
Line 15: Line 15:
  
   - boot loader loads kernel   - boot loader loads kernel
-  - kernel loads+  - kernel loads whilst scaning the mtd partition //rootfs// for a valid superblock for mounting the SquashFS partition (which contains /etc). More info at [[doc/​techref/​filesystems#​technical.details]]
   - kernel calls ''/​etc/​preinit''​ (the kernel considers this to be the ''​init''​ (or root) process   - kernel calls ''/​etc/​preinit''​ (the kernel considers this to be the ''​init''​ (or root) process
   - ''/​etc/​preinit''​ prepares system for multiuser mode   - ''/​etc/​preinit''​ prepares system for multiuser mode
Line 36: Line 36:
   - Initializes device tree (/​dev) ​   - Initializes device tree (/​dev) ​
   - Initializes console (serial console if present, otherwise dummy so that the script interpreter works properly)   - Initializes console (serial console if present, otherwise dummy so that the script interpreter works properly)
-  - Presents opportunity for the user to enter a special operating mode called '​failsafe'​ (Failsafe mode is presented in a separate section. ​ Once failsafe ​ mode is entered it doesn'​t exit.  A reboot is necessary to enter normal ​ operating mode). +  - Presents opportunity for the user to enter a special operating mode called ​**'​failsafe'​** (Failsafe mode is presented in a separate section. ​ Once failsafe ​ mode is entered it doesn'​t exit.  A reboot is necessary to enter normal ​ operating mode). 
-  - Mounts the root filesystem (this involves a number steps, presented in  a separate section)+  - **Mounts the root filesystem** (this involves a number steps, presented in  a separate section)
   - If it's the first time booting after flashing the firmware, and a previous configuration was saved during the flashing process, that configuration is restored.   - If it's the first time booting after flashing the firmware, and a previous configuration was saved during the flashing process, that configuration is restored.
   - Becomes (though ''​exec''​) '​init'​ which goes to multiuser mode   - Becomes (though ''​exec''​) '​init'​ which goes to multiuser mode
  
 ===== Failsafe ===== ===== Failsafe =====
 +
 +The //root file system// is actually an overlay which can be consisted of a read-only SquashFS file system (mounted at ''/​rom''​) and a writable JFFS2 partition (mounted under ''/​overlay''​). In Failsafe mode only the squashfs FS will be mounted (changes made to jffs2 partitons will be ignored), plus the following steps:
  
   - Prepares network interface (optional) and notifies that failsafe mode is being entered   - Prepares network interface (optional) and notifies that failsafe mode is being entered
Line 55: Line 57:
 the following text refers to the jffs2 portion of a [[doc:​techref:​combined_squashfs_jffs2|squashfs/​jffs2]] system. the following text refers to the jffs2 portion of a [[doc:​techref:​combined_squashfs_jffs2|squashfs/​jffs2]] system.
  
 +  - Kernel has previously mounted squashfs partition by scanning the mtd partition ''​rootfs''​ for a valid superblock (see step 2 of [[doc/​techref/​preinit_mount#​contextboot.sequencel]]) FIXME **Make sure it's correct**
   - If there is no mtd device with label ''​rootfs_data'',​ then mounts ''/​dev/​root''​ (e.g. squashfs or all_jffs2 with no squashfs) as root filesystem, and indicates that further steps should be skipped   - If there is no mtd device with label ''​rootfs_data'',​ then mounts ''/​dev/​root''​ (e.g. squashfs or all_jffs2 with no squashfs) as root filesystem, and indicates that further steps should be skipped
   - If mtd device ''​rootfs_data''​ has not already been formatted, mounts a tmpfs (ramdisk) as root filesystem, and indicates that further steps should be skipped.   - If mtd device ''​rootfs_data''​ has not already been formatted, mounts a tmpfs (ramdisk) as root filesystem, and indicates that further steps should be skipped.
-  - Mounts previously formatted ​jjfs2 partition on ''/​jffs2''​ and indicates successful mount. +  - Mounts previously formatted ​jffs2 partition on ''/​overlay''​ and indicates successful mount. 
-  - Makes successfully mounted ''/​jffs''​ (if it exists) the new root filesystem and moves the new root filesystem to ''/​rom'',​ and indicates to skip further steps.+  - Makes successfully mounted ''/​overlay''​ (if it exists) the new root filesystem and moves previous ​root filesystem to ''/​rom'',​ and indicates to skip further steps.
   - This is only reached on an error condition; attempts to mount a tmpfs (ramdisk) as root filesystem   - This is only reached on an error condition; attempts to mount a tmpfs (ramdisk) as root filesystem
   - This is only reached if no other step succeeds; attempt to mount ''/​dev/​root''​ (e.g. squashfs/​all_jffs2) as root filesystem.   - This is only reached if no other step succeeds; attempt to mount ''/​dev/​root''​ (e.g. squashfs/​all_jffs2) as root filesystem.
 +
 +** * ** ''/​overlay''​ was previously named ''/​jffs2''​
  
 ===== First Boot ===== ===== First Boot =====
Line 121: Line 126:
 ====== Preinit Operation ====== ====== Preinit Operation ======
  
-Preinit consists of a number of the scripts. ​ The main script is ''/​etc/​preinit''​+Preinit consists of a number of scripts. ​ The main script is ''/​etc/​preinit''​
 which reads in the scripts. ​ The scripts define functions which they attach to which reads in the scripts. ​ The scripts define functions which they attach to
-hooks. ​ These hooks are, when processed, ​launch ​the functions in the order they+hooks. ​ These hooks are, when processed, ​launching ​the functions in the order they
 were added to the hooks. were added to the hooks.
  
Line 134: Line 139:
   * ''​preinit_mount_root''​   * ''​preinit_mount_root''​
  
-These hooks are actually just string ​variables with the name of each function to+Each hook have a corresponding ​string ​variable containing ​the name of each function to
 be executed, separated by spaces. ​ The hook variables have ''​_hook''​ appended to be executed, separated by spaces. ​ The hook variables have ''​_hook''​ appended to
 the hook name.  Thus the name of the variable for the ''​preinit_essential''​ hook the hook name.  Thus the name of the variable for the ''​preinit_essential''​ hook
doc/techref/preinit_mount.1363118907.txt.bz2 · Last modified: 2013/03/12 21:08 by hnyman