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.
- Executables aren't strictly required, but without them the system won't actually do anything!
- In most cases, the bootable image needs libc.so, ldqnx-64.so (or ldqnx.so for ARMv7le), and libgcc_s.so which are 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:
[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
- the offset in memory where the bootable image starts, specified by the
imageattribute; this offset applies to the bootstrap section that immediately follows, and is particular to this board - a bootstrap loader (also called a bootfile or
bootstrap file), which includes an operating system —
starting with
[virtual=armle-v7,raw] - a script of commands to execute after the OS loads — starting with
[+script] - a list of links and files to include in the image — starting with
[type=link] /bin/sh=/proc/boot/ksh
For details about different parts of the buildfile, see the The bootstrap file
, The script file
, and
The rest of the buildfile
topics.
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. Refer also to the
examples in the mkifs entry in the
Utilities Reference.
