The buildfile for the default .boot image, qnxbasedma.build, includes lines that start the system by running diskboot.

[+script] startup-script = {
    # To save memory make everyone use the libc in the boot image!
    # For speed (less symbolic lookups) we point to libc.so.2 instead
    # of libc.so
    procmgr_symlink ../../proc/boot/libc.so.3 /usr/lib/ldqnx.so.2

    # Default user programs to priority 10, other scheduler (pri=10o)
    # Tell "diskboot" this is a hard disk boot (-b1)
    # Tell "diskboot" to use DMA on IDE drives (-D1)
    # Start 4 text consoles by passing "-n4" to "devc-con" 
    # and "devc-con-hid" (-o).
    # By adding "-e", the Linux ext2 filesystem will be mounted
    # as well.
    [pri=10o] PATH=/proc/boot diskboot -b1 -D1 \
-odevc-con,-n4 -odevc-con-hid,-n4

This script starts the system by running diskboot, a program that's used on disk-based systems to boot Neutrino. For the entire qnxbasedma.build file, see the Examples appendix.


When diskboot starts, it prompts:

Press the space bar to input boot options...

Most of these options are for debugging purposes. The diskboot program looks for a Neutrino partition to mount, then runs a series of script files to initialize the system:

Figure 1. Initialization done by diskboot.

The main script for initializing the system is /etc/system/sysinit; you usually keep local system initialization files in the /etc/rc.d directory. For example, if you want to run extra commands at startup on a node, say to mount an NFS drive, you might create a script file named rc.local, make sure it's executable, and put it in the /etc/rc.d directory. For more information, see the description of rc.local later in this chapter.

Here's what diskboot does:

  1. It starts the system logger, slogger. Applications use slogger to log their system messages; you can use sloginfo to view this log.
  2. Next, diskboot runs seedres to read the PnP BIOS and fill procnto's resource database. For more information about this database, see rsrcdbmr_attach() in the Neutrino C Library Reference.
  3. Then, diskboot starts pci-bios to support the PCI BIOS.
  4. After that, diskboot starts devb-eide or other disk drivers.
    Note: If you want to pass any options to devb-eide or other drivers, pass them to diskboot in your buildfile.
  5. Next, diskboot looks for filesystems (i.e., partitions and CDs) to mount, which it does by partition type. It recognizes:
    • CD-ROMs
    • types 1,4,6,11,12,14: DOS
    • type 131: Ext2 if the -e option is passed to diskboot
    • type 177, 178, 179: Power-Safe filesystem—177 and 178 indicate secondary partitions
    • type 77, 78, 79: QNX 4—77 and 78 indicate secondary partitions

    These are mounted as /fs/cdx for CD-ROMs, and /fs/hdx-type-y, where x is a disk number (e.g., /fs/cd0, /fs/hd1), and y is added for uniqueness as it counts upwards. For example, the second DOS partition on hard drive 1 would be /fs/hd1-dos-2.

    By default, one QNX 4 partition is mounted as / instead. This is controlled by looking for a .diskroot file on each QNX 4 partition. If only one such partition has a .diskroot file specifying a mountpoint of /, that partition is unmounted as /fs/hdx-type-y and is then mounted as /; if more than one is found, then diskboot prompts you to select one.

    The .diskroot file is usually empty, but it can contain some commands. For more information, see below.

  6. Optionally, diskboot runs the fat embedded shell, fesh.
  7. Next, diskboot starts the console driver, devc-con-hid (QNX Momentics 6.3.0 Service Pack 3 or later), or devc-con (earlier releases). They're similar, but devc-con-hid supports PS2, USB, and all other human-interface devices.
  8. Finally, diskboot runs the main system-initialization script, /etc/system/sysinit.