Buildfile structure and contents

The buildfile for a bootable image includes three major sections: a bootstrap loader (which includes an operating system), a script, and executables and shared libraries.

Note:
  • Executables aren't strictly required, but without them the system won't actually do anything!
  • In most cases, the bootable image needs libc.so, which is required to run an executable.

Below is a very simple buildfile that can be used to generate a bootable image. This buildfile is based on a buildfile for a fictional Elsinor Hamlet 2B ON2B BSP, but has had all but the most basic OS capabilities stripped out:

Note: Many of the sample build files provide a /tmp that links to /dev/shmem as a temporary in-memory file system that is useful for demonstration systems that do not have a persistent file system. However, it is not a fully-featured file system (e.g., mkdir is not supported) and should not be used as /tmp in a deployed system. For example, a system configuration can have a /tmp based on devb-ram or devf-ram. Additionally, given QNX Neutrino's union mount capabilities, having both /dev/shmem and another resource manager mapped to /tmp at the same time may cause unexpected behaviour.
[image=0x10800000]
[virtual=armle-v7,raw] .bootstrap = {
# Startup parameters:
    # '-c' -> configure bottom SD slot pin muxing to support Silex SDIO based WLAN module
    # '-m' -> enable D-Cache, MMU during startup,
    #			which will improve boot time if booting from a compressed IFS.	
    # '-W' -> enable watchdog
    
    startup-imx6x-sabrelite -m -v

    PATH=:/proc/boot:/bin:/sbin:/usr/bin:/usr/sbin \
    LD_LIBRARY_PATH=:/proc/boot:/lib:/usr/lib:/lib/dll procnto-smp-instr -v
}

[+script] .script = {
# Initialise the console
    devc-sermx1 -e -F -S -c80000000 0x021E8000,59

    waitfor /dev/ser1 4

    reopen
    display_msg Welcome to QNX Neutrino 7.1 on the Elsinor Hamlet 2B ON2B (ARM Cortex-A9 MP Core)

    [+session] ksh /proc/boot/.console.sh &
}

# Redirect console messages
[type=link] /bin/sh=/proc/boot/ksh
[type=link] /dev/console=/dev/ser1
[type=link] /tmp=/dev/shmem

# Shared libraries
libc.so
libm.so
libgcc_s.so.1

# Programs require the runtime linker (ldqnx-64.so.2) to be in /usr/lib

/usr/lib/ldqnx-64.so.2=ldqnx-64.so.2

# Executables
devc-sermx1

# Set environment and start the main shell

[perms=0744] .console.sh={
    echo setting env variables.
    
    export SYSNAME=nto
    export TERM=qansi
    export HOME=/
    export PATH=:/bin:/usr/bin:/sbin:/usr/sbin:/proc/boot
    export LD_LIBRARY_PATH=:/lib:/usr/lib:/usr/lib/graphics/2BON2B:/lib/dll:/proc/boot
    
    # REMOTE_DEBUG (gdb or Momentics)
    #  - refer to the help documentation for the gdb, qconn and the IDE
    #    for more information on remote debugging
    #  - the commands shown require that NETWORK is enabled too
    
    devc-pty
    waitfor /dev/ptyp0 4
    #waitfor /dev/socket 4
    #PATH=$PATH:/usr/bin qconn port=8000
    
    ksh -l
}

# general commands
cp
ls
cat
ksh
pipe
pidin
uname
slogger2
slog2info
slay
mount
umount
use
date
shutdown
rm
mv

This buildfile has these contents:

For details about different parts of the buildfile, see the The bootstrap file, Scripts, and The rest of the buildfile topics.

Note: For information on making an image from this buildfile, see Building an OS image.

Sample buildfiles

For sample buildfiles, use the ones that come with your BSP and refer to the Sample Buildfiles appendix in this guide. See also the examples in the mkifs entry in the Utilities Reference.