Dune HD STB - BOOT PROCESS DESCRIPTION


NOTE: Please first read the following:
   http://files.dune-hd.com/sdk/doc/html/dune_devel_info.html

Boot process involves the following steps:

1. Boot loader from serial flash in Sigma Designs SMP86xx chip.
2. Boot loader from NAND flash.
3. Linux kernel from NAND flash.
4. /sbin/init and /etc/init.d/rcS
5. /etc/init.d/S99local
6. /tango/bdstart.sh
7. /tango/firmware/bin/root
8. /tango/firmware/bin/shell

NOTE:
   - Steps 1-5 are handled by the hardware, boot loader and Linux kernel.
   - Steps 6-7 are handled by the code residing in /tango partition.

More details:

- /etc/init.d/S99local
   - This is the main boot script residing in the rootfs filesystem (which
     is the part of the Linux kernel image).
   - This boot script performs the following steps:
      - Loads various drivers:
         - FIP (front interface panel) driver.
         - IR (remote control) driver.
         - Drivers for storage devices (SATA, USB, SD card).
         - Drivers for additional filesystems (e.g. NTFS).
         - NAND flash driver.
      - Checks for local storage devices (e.g. USB flash drive).
         - If such devices are found, they are tried to be mounted.
         - NOTE: All mounted local storage devices are kept mounted in
           /tmp/boot_mnt/; these temporary mounts points are called "boot
           mounts"; at a later boot stage, /tango/bdstart.sh script will
           further analyze them and remount them into an appropriate final
           location.
      - Checks if emergency firmware recovery should be performed
        (triggered by "dune_firmware.dff" file in the root of any
        mounted local storage device).
         - Emergency firmware recovery updates all parts of the flash
           memory which are updated during normal firmware upgrade
           process. This includes all read-only parts of the firmware,
           such as Linux kernel and /tango. This does not include /mnt
           flash memory parition which is used to store STB settings.
         - After emergency firmware recovery is finished, the STB hangs
           and the user should remove the local storage device with
           "dune_firmware.dff" file and manually reboot the STB.
      - Checks if emergency settings reset should be performed (triggered
        by "dune_boot_reset_settings.flag" file in the root of any mounted
        local storage device).
         - Emergency settings reset reformats /mnt flash memory
           partition which is used to store STB settings.
         - After emergency settings reset is finished, the STB continues
           normal boot process.
      - Mounts the main read-only flash memory partition to /tango.
      - Mounts the main read-write flash memory partition to /mnt.
         - If this fails (e.g. the filesystem is corrupted), reformats it
           and retries.
      - Calls /tango/bdstart.sh.

- /tango/bdstart.sh
   - This is the main boot script residing in the /tango partition.
   - This boot script performs the following steps:
      - Loads some additional drivers.
      - Does some additional initialization.
      - Prepares some symlinks.
      - Prepares some environment variables.
      - Prepares some required directories and files in the RAM disk (e.g.
        in /tmp).
      - Handles "boot mounts", remounts some of the local storage devices
        to /persistfs ("system storage") and /D ("main storage") when
        needed.
      - Loads Sigma Designs MRUA drivers (microcodes and kernel modules).
      - Frees resources occupied by the boot splash.
      - Mounts /firmware_opt and/or /flashdata flash memory partitions,
        when they exist.
         - NOTE: The following scripts are used here:
            - /tango/firmware/mount_firmware_opt.sh
            - /tango/firmware/mount_flashdata.sh
      - Does some more initialization. In particular, calls the following
        extra init scripts:
         - /tango/firmware/scripts/init_timezone.sh
         - /tango/firmware/scripts/init_cron_apps.sh
         - /tango/firmware/ftpserver/run
         - /tango/firmware/smbserver/run
         - /tango/firmware/scripts/init_ssh_server.sh
      - Calls the following script, if it exists (can be used in custom
        firmware builds to do some extra custom initialization on STB
        boot):
         - /tango/firmware/config/start.sh
      - Does some more initialization.
      - Finally, launches the following executable:
         /tango/firmware/bin/root

- /tango/firmware/bin/root
   - This is the main executable which is launched in the end of the boot
     process.
   - This executable does the following:
      - Initializes certain aspects of STB hardware according to STB
        settings.
      - Prepares various system stuff (in particular, creates various
        important files in /tmp filesystem).
      - Launches all executables from /config/boot/ directory (if any).
         - NOTE: executables are launched sequentially and synchronously.
      - Launches various background activities and processes, in
        particular:
         - /tango/firmware/scripts/init_network.sh
         - /usr/sbin/httpd
         - /tango/firmware/bin/storage_manager
            - NOTE: applicable for firmware versions ..._b7+.
      - Checks if "emergency eject on boot" procedure should be performed
        (triggered by pressing "EJECT" button on the remote control)
        (useful for preventing an attempt to read an optical disc in the
        optical disc drive).
      - Finally, launches /tango/firmware/bin/shell in a loop (whenever
        shell is terminated, it is automatically restarted).