Disk filesystem

This buildfile includes support for a filesystem for rotating media.

Notice the shared libraries that must be present, and that we put all x86-specific files inside the /x86 directory, rather than directly at root:

[virtual=x86_64,uefi +compress] .bootstrap = {
  startup-x86
  PATH=/proc/boot:/bin LD_LIBRARY_PATH=/proc/boot:/lib:/dll procnto
}

[+script] .script = {
    devc-con &   
    reopen /dev/con1 

# Disk drivers
    devb-eide blk cache=2m,automount=hd0t179:/,automount=cd0:/cd &

# Wait for a "bin" for the rest of the commands
    waitfor /bin 10

# Some common servers
    pipe
    mqueue
    devc-pty &

# Start the main shell
    [+session] esh &
}

# Redirect console messages
[type=link] /dev/console=/dev/con4

# Programs require the runtime linker (ldqnx.so) to be at
# a fixed location
[type=link] /usr/lib/ldqnx-64.so.2=/proc/boot/ldqnx-64.so.2

# Add for HD support
[type=link] /usr/lib/libcam.so.2=/proc/boot/libcam.so

# Add symbolic links for bin, dll, and lib 
# (files in /x86 with devb-eide)
[type=link] /bin=/x86/bin
[type=link] /dll=/x86/lib/dll
[type=link] /lib=/x86/lib

# We use the C shared library, GGC's low-level runtime library,
# and the runtime linker. 
libc.so
libgcc_s.so.1
ldqnx-64.so.2

# Include the hard disk shared objects so we can access the disk
libcam.so
io-blk.so

# For the UDF filesystem
cam-cdrom.so
fs-udf.so

# Include a console driver, shell, etc.
esh
devb-eide
devc-con
Note: For this release of the QNX Neutrino RTOS, you can't use the floating-point emulator (fpemu.so) in statically linked executables.

In this buildfile, we see the startup command line for the devb-eide command:

devb-eide blk cache=2m,automount=hd0t179:/automount=cd0:/cd &

This line indicates that the devb-eide driver should start, then pass the string beginning with cache= (without the ampersand) to the block I/O file (io-blk.so). When the driver starts up, it:

  1. Examines the command line passed to it.
  2. Sets up a two-megabyte cache (the cache=2m instruction).
  3. Automatically mounts the partition identified by hd0t179 (the first Power-Safe filesystem partition) as the pathname /hd.
  4. Automatically mounts the CD-ROM as /cd.

Once this driver is started, we then need to wait for it to get access to the disk and perform the mount operations. The following line looks after the wait:

waitfor /bin 10

It instructs the startup to wait for the pathname /bin to show up in the pathname space. (We're assuming a formatted hard disk that contains a valid QNX filesystem with ${QNX_TARGET} copied to the root.)

Now that we have a complete filesystem with all of the shipped executables installed, we run a few common executables such as the pipe server.

Finally, the list of shared objects contains the .so files required for the drivers and the filesystem.