How to create a Runtime Kit from the QNX Software Development Platform

Introduction

The Neutrino RTOS Runtime Kit is a version of the Neutrino RTOS for the x86 family of processors. It contains only those pieces of the OS that are required for execution of programs — the runtimes — and omits any development pieces. This allows suppliers of software to distribute a tailored version of the OS to their end-users.

The general idea is that the end user should be able to boot from the Runtime Kit media and install the Neutrino RTOS with little or no help from the supplier. The resulting installation will be specifically suited to the supplier's requirements.


Note: Create your custom runtime kit on a Neutrino host machine. This will ensure that all critical file permission information is retained.

These instructions assume familiarity with the Neutrino operating system from a user perspective, general POSIX commands such as cp and tar, and basic Korn shell scripting. A study of the installation notes for the Neutrino-hosted version of the QNX Software Development Platform is highly recommended.

Organization of the Runtime Kit

The Runtime Kit is made of an installation utility plus associated archive files that contain the actual RTOS pieces.


Note: The QSS Runtime Modules are defined in the license guide. For more information about runtimes and royalties, contact your QSS sales representative.

The rtkit directory in the root directory of the QNX Software Development Platform Installation and Boot CD (x86 Targets) includes some text files that list the files you'll likely need for different parts of the runtime kit. For more information about these lists, see the “readme” file in the rtkit directory.


Note: We've included these file lists as examples.

You need to include the files for the base operating system, but you can add other files if you need them in your runtime kit. You can build separate archives for each file list, or you can combine the file lists and build one archive, depending on how you want to install the runtime kit.

Standard installation steps

The basic steps taken by the standard installer for a development seat are:

  1. Partition the hard disk (fdisk).
  2. Initialize the filesystem (mkqnx6fs).
  3. Copy the core OS.
  4. Copy the prebuilt boot images to .boot.
  5. Copy other modules as required.

You must also perform these steps in any custom runtime kit installation script. The nature of the runtime kit would make the installation script perform these steps with little or no user input. For an example, see Sample installation script,” below.

Creating the archives

You can create archive files from the file lists in the rtkit directory in the root directory of the Installation and Boot CD (x86 Targets). In general, you create an archive as follows:

  1. Go to the $QNX_TARGET directory.
  2. Run the following:

    $QNX_HOST/usr/bin/tar -T filelist -c -z -f output_archive_name.tgz

    where filelist is the name of a file that lists the files you want to include in the runtime kit. This command might take a while, depending on the number of files that you're including in the archive.

Alternatively, if you know what the system requires, you can create a directory tree by copying files and using tar on the result. This way, the installation script needs to unpack only one archive. For example:

  1. mkdir output
  2. cd output
  3. cp -pc $QNX_TARGET/x86/usr/bin/ls usr/bin/ls
  4. Repeat step 3 for each file you need to include.
  5. tar -z -c --owner=0 --group=0 -f ../output.tgz .

    You need the --owner=0 --group=0 options to make sure that all the files belong to root in the archive.

Creating the CD

You need the QNX Software Development Platform Installation and Boot CD (x86 Targets) for this part. On a Neutrino host, this will typically be mounted in /fs/cd0 if it's inserted in the drive.

Note that the values and file names used in this set of instructions are for illustrative purposes only. You may use whatever names are appropriate for your application.

  1. Make a working directory and change into it:
    mkdir working_dir
    cd working_dir
      
  2. Create the required directory repository and boot/fs:
    mkdir -p repository
    mkdir -p boot/fs
      
  3. Copy the following required files from the original Installation and Boot CD (x86 Targets) to working_dir/boot/fs:
    cp /fs/cd0/boot/fs/qnxbase.qfs /fs/cd0/boot/fs/*.ifs ./boot/fs
      

    These are large files, so it could take a while to copy them.

  4. Copy the Runtime Kit version of the CD boot image (instflop-rtkit.dat) from the rtkit directory in the root directory of the Installation and Boot CD (x86 Targets) to the working_dir directory:
    cp /fs/cd0/rtkit/instflop-rtkit.dat ./instflop.dat
      
  5. Copy each of the archives you created earlier (see Creating the archives,” above) to ./repository:

    cp path_and_name_of_archive ./repository

  6. Create or copy the installation script and call it rtinstall. For a sample script, see Sample installation script,” below. Ensure the script is executable:

    cp path_to_script/rtinstall .
    chmod a+x ./rtinstall

  7. Go to the any part of the Download area of our website (e.g. Downloads-->All) and select Third-party software from the sidebar. Choose QNX Momentics 6.3.x. Download the cdrecord package, following the instructions given on the website.

    Note: The 6.3.x version of the cdrecord package is also compatible with QNX Neutrino 6.4.

  8. Make a CD image that can be burned, using the mkisofs utility from the cdrecord package. For example:

    path/mkisofs -r -b instflop.dat -c boot/isocatalog -J -o ../rtkit.iso .

    where path is the directory you installed mkisofs in.

  9. Transfer the resulting rtkit.iso file to a Windows or Linux machine, and use any CD-burning program such as Nero (on Windows) or cdrecord (on Linux) to create a CD.

Sample installation script

This is an example of an installation script that you can modify to suit the way you want to install the runtime kit.


Note: This installation script creates a nophoton file. To run Photon using this example, you must log in as root and type ph. If you remove the touch command that creates this file, Photon will start when you boot the system and will provide a graphical login.

#!/qnxbase/bin/sh

SRCPATH=$1

# We need it later on even if the user ejects the CD
cp /qnxbase/bin/shutdown /dev/shmem/

# This is a slightly non-standard runtime environment
export PATH=/qnxbase/bin:/qnxbase/usr/bin:/qnxbase/sbin:/qnxbase/usr/sbin:$PATH
export LD_LIBRARY_PATH=/qnxbase/lib:/qnxbase/usr/lib:/qnxbase/lib/dll:$LD_LIBRARY_PATH

pipe &
on -W 60 -w /dev/pipe

ln -sP /dev/shmem /tmp

# For those scripts that need it
ln -sP /qnxbase/bin/sh /bin/sh

progTitle="QNX Software Development Platform 6.4.1"
qconfigTitle="qnx-6.4.1"
instList="qnx6-host qnx6-target qnx6-qde qnx6-target-html"
nonsu=0

CMDID="id";
HOSTARCN="qnx6-host"
tgtdir="usr/qnx650"


sdk_inst=1
gpl_inst=0

###############################################################################
# functions
###############################################################################

getresp() {
	printf "$1 [$2] "
	read resp
	if test "X$resp" = "X" ; then
		resp=$2
	fi
}

if [ $(fdisk /dev/hd0 query -t179) -ne 0 ]
then
	echo "Error: t179 partition already exists on first hard disk" 1>&2 
	echo "Aborting installation" 1>&2 
fi

fdisk /dev/hd0 add -t179
fdisk /dev/hd0 boot -t179
fdisk /dev/hd0 loader
mount -e /dev/hd0
mkqnx6fs -Tdesktop /dev/hd0t179
mount -tqnx6 /dev/hd0t179 /install

if [ ! -d /install ]
then
	echo "Error mounting /install"
	exit 1
fi

cd /install
for instarchive in $SRCPATH/repository/*.tgz
do
	echo "Extracting $instarchive"
	tar -zxf $instarchive
done

# This bit is here since the system really wants everything 
# rooted at / but the archives include files in x86/*. If x86 
# is a directory, then we put things right. The alternative is to 
# do the right thing when making the archives.
if [ -d x86 ]
then
	cp -cRp x86/* .
	rm -rf x86
	ln -s . x86
fi

mkdir -p /install/boot/fs
cp $SRCPATH/boot/fs/*.ifs /install/boot/fs/
cp $SRCPATH/boot/fs/*.ifs /install/.boot/

cat >/install/.diskroot <<HERE
mount=/
HERE

[ -d /install/etc/system/config ] || mkdir -p /install/etc/system/config
touch /install/etc/system/config/nophoton

getresp "Press ENTER to restart"
shutdown