Bootstrapping - reducing OS image size

I looking for suggestions on how to fit a minimal PPC QNX image into
less than 512Kb of linear flash.

Here’s my setup:

QNX 6.2 on a custom PPC board configured w/ a 512Kb boot flash
(socketed), a 32 Mb NAND flash disk (not socketed), 32+ Mb of RAM, a
serial port and an Ethernet port.

Currently, the boot flash contains a very small IPL (< 32 kb) that is
capable of loading a image from the NAND flash or using the serial port
(slow!). When I first bring a board up, I’m forced to use the serial
download to load a image capable of formatting the NAND flash and
storing a full OS images in NAND. This is OK for development but not
ideal for production. (Pre-programmed NAND flash parts are not readily
available or cost-effective.)

I’d like to make use of the Ethernet interface to speed things up. If I
could create an OS image small enough, I could put it in the linear boot
flash w/ the IPL. This image would contain the esh, a startup script
and the minimal network configuration needed to run TFTP. The image
would use TFTP to transfer the necessary files/libraries/etc to shared
memory where it could then execute a script to format the NAND flash and
store the production OS image.

  • I’m getting close to the desired size, but I still can’t squeeze
    everything (IPL + image) into 512Kb. My build file and mkifs output are
    below
  • I’d prefer to keep the devc driver and esh if possible to enable
    scripting and some amount of debugging
  • I’ve stripped down libc and libsocket using the method described in
    http://www.qnx.com/developer/articles/index.html?article=may2301
  • Other options include added Ethernet/bootp support directly to the
    IPL, but this would be a significant development effort

Any suggestions are welcome. Thanks!

Dan Giorgis

–build file–

[image=0x100000]
[virtual=ppcbe/binary +compress] .bootstrap = {
startup-james
PATH=/proc/boot procnto-600 # run this 2nd
}

[+script] .script = {
devc-ser8250-jace5 -e -c25000000 -b57600 0xffffc000,9 &
reopen
display_msg Welcome to Neutrino on jace8240(james)

These env variables inherited by all the programs which follow

SYSNAME=nto
TERM=qansi

start the pci driver

pci-jace5 &
waitfor /dev/pci

initialize the ethernet driver

io-net -ddevn-speedo.so -pnpm-ttcpip.so if=en0:10.10.8.52 &

kick off a command-line shell on the serial port

[+session pri=30] esh -l &
}

links

[type=link] /bin/login=/proc/boot/login
[type=link] /bin/ls=/proc/boot/ls
[type=link] /dev/console=/dev/ser1
[type=link] /usr/lib/ldqnx.so.2=/proc/boot/libc.so
[type=link] /tmp=/dev/shmem
[type=link] /bin/sh=/proc/boot/esh

shared libraries

devn-speedo.so

npm-ttcpip.so

custom libc / libsocket

bootrom/libsocket.so.2
bootrom/libc.so.2

[data=c]

binaries

io-net
pci-jace5=pci-james
devc-ser8250-jace5
esh
tftp

–mkifs output—

Offset Size Entry Ramoff Target=Host
100000 100 ---- — Startup-header
100100 b008 101e8c — ._L4.AAD
10b108 5c ---- — Image-header
10b164 3bc ---- — Image-directory
---- — ---- — bin/sh=/proc/boot/esh
---- — ---- — tmp=/dev/shmem
---- — ---- — usr/lib/ldqnx.so.2=/proc/boot/libc.so
---- — ---- — dev/console=/dev/ser1
---- — ---- — bin/ls=/proc/boot/ls
---- — ---- — bin/login=/proc/boot/login
10b520 178 ---- — proc/boot/.script=._L4.AAC
10c000 51000 12a03c — proc/boot/procnto-600=._L4.AAE
15d000 10000 3324 —
proc/boot/devn-speedo.so=C:/QNXsdk/target/qnx6/ppcbe/lib/dll/devn-speedo.so
16d000 17000 3804 —
proc/boot/npm-ttcpip.so=C:/QNXsdk/target/qnx6/ppcbe/lib/dll/npm-ttcpip.so
184000 1b000 51b0 —
proc/boot/libsocket.so.2=bootrom/libsocket.so.2
19f000 3e000 c238 — proc/boot/libc.so.2=bootrom/libc.so.2
1dd000 11424 480417cc —
proc/boot/io-net=C:/QNXsdk/target/qnx6/ppcbe/sbin/io-net
1ef000 adc8 48040b64 —
proc/boot/pci-jace5=images/ppcbe/sbin/pci-james
1fa000 9008 48041228 —
proc/boot/devc-ser8250-jace5=images/ppcbe/sbin/devc-ser8250-jace5
204000 4030 48040e64 —
proc/boot/esh=C:/QNXsdk/target/qnx6/ppcbe/bin/esh
209000 4fcc 48040be0 —
proc/boot/tftp=C:/QNXsdk/target/qnx6/ppcbe/usr/bin/tftp
20dfcc 4 ---- — Image-trailer

“Dan Giorgis” <dang@tridium.com> wrote in message
news:3D53C63A.1060704@tridium.com

I looking for suggestions on how to fit a minimal PPC QNX image into
less than 512Kb of linear flash.

Here’s my setup:

QNX 6.2 on a custom PPC board configured w/ a 512Kb boot flash
(socketed), a 32 Mb NAND flash disk (not socketed), 32+ Mb of RAM, a
serial port and an Ethernet port.

Currently, the boot flash contains a very small IPL (< 32 kb) that is
capable of loading a image from the NAND flash or using the serial port
(slow!). When I first bring a board up, I’m forced to use the serial
download to load a image capable of formatting the NAND flash and
storing a full OS images in NAND. This is OK for development but not
ideal for production. (Pre-programmed NAND flash parts are not readily
available or cost-effective.)

I’d like to make use of the Ethernet interface to speed things up. If I
could create an OS image small enough, I could put it in the linear boot
flash w/ the IPL. This image would contain the esh, a startup script
and the minimal network configuration needed to run TFTP. The image
would use TFTP to transfer the necessary files/libraries/etc to shared
memory where it could then execute a script to format the NAND flash and
store the production OS image.

  • I’m getting close to the desired size, but I still can’t squeeze
    everything (IPL + image) into 512Kb. My build file and mkifs output are
    below
  • I’d prefer to keep the devc driver and esh if possible to enable
    scripting and some amount of debugging
  • I’ve stripped down libc and libsocket using the method described in
    http://www.qnx.com/developer/articles/index.html?article=may2301
  • Other options include added Ethernet/bootp support directly to the
    IPL, but this would be a significant development effort

Any suggestions are welcome. Thanks!

This build script produced an IFS size of 612k for an mtx603.
Further reductions could be expected from stripping down the libraries and
switching to ne2000 as in your posted script.

\

Target: mtx603 (ppcbe)

IP: tmtx603 (10.75.1.101)

Root: 10.75.1.2, labrtp

Date: August 16, 2002

[image=0x1f0000]
[virtual=ppcbe/binary +compress] .bootstrap = {
startup-mtx600 -N tmtx603 -D 8250…9600 -v
PATH=/proc/boot:/bin:/sbin:/usr/bin:/usr/sbin
LD_LIBRARY_PATH=/proc/boot:/lib:/lib/dll:/usr/lib procnto-600
}

[+script] startup.script = {

procmgr_symlink …/…/proc/boot/libc.so.2 /usr/lib/ldqnx.so.2

pci bus

display_msg Starting PCI server…
pci-raven
waitfor /dev/pci

network support

display_msg Starting TCP/IP networking…
io-net -d tulip -pttcpip if=en0:10.75.1.101
waitfor /dev/socket
waitfor /dev/io-net
waitfor /timeout
ifconfig en0 10.75.1.101

remote file systems



display_msg NFS mounting / from labrtp …
fs-nfs2 10.75.1.2:/ppcbe /
waitfor /bin/mount 10

mount points under /usr are different for Neutrino host vs Windows &

Solaris
display_msg NFS mounting /usr/help …
mount -t nfs 10.75.1.2:/usr/help /usr/help
display_msg NFS mounting /usr/info …
mount -t nfs 10.75.1.2:/usr/info /usr/info
display_msg NFS mounting /usr/man …
mount -t nfs 10.75.1.2:/usr/man /usr/man
display_msg NFS mounting /usr/lib/terminfo …
mount -t nfs 10.75.1.2:/usr/lib/terminfo /usr/lib/terminfo
display_msg NFS mounting /usr/photon/config …
mount -t nfs 10.75.1.2:/usr/photon/config /usr/photon/config
display_msg NFS mounting /usr/photon/font_repository …
mount -t nfs 10.75.1.2:/usr/photon/font_repository
/usr/photon/font_repository
display_msg NFS mounting /usr/photon/keyboard …
mount -t nfs 10.75.1.2:/usr/photon/keyboard /usr/photon/keyboard
display_msg NFS mounting /usr/photon/palette …
mount -t nfs 10.75.1.2:/usr/photon/palette /usr/photon/palette
display_msg NFS mounting /usr/photon/share …
mount -t nfs 10.75.1.2:/usr/photon/share /usr/photon/share
display_msg NFS mounting /usr/photon/translations …
mount -t nfs 10.75.1.2:/usr/photon/translations /usr/photon/translations
display_msg NFS mounting /usr/welcome …
mount -t nfs 10.75.1.2:/usr/photon/welcome /usr/photon/welcome
display_msg NFS mounting /usr/share …
mount -t nfs 10.75.1.2:/usr/share /usr/share


waitfor /usr/help
waitfor /usr/info
waitfor /usr/man
waitfor /usr/lib/terminfo
waitfor /usr/photon/config
waitfor /usr/photon/font_repository
waitfor /usr/photon/keyboard
waitfor /usr/photon/palette
waitfor /usr/photon/share
waitfor /usr/photon/translations
waitfor /usr/photon/welcome
waitfor /usr/share

display_msg NFS mounting /tmp …
mount -t nfs 10.75.1.2:/tmp/ppcbe /tmp
waitfor /tmp
display_msg NFS mounting /etc from Release Branch file server…
mount -t nfs 10.75.1.200:/xfer/etc/6.2 /etc
waitfor /etc
display_msg NFS mounting /etc/sysinit…
mount -t nfs 10.75.1.200:/xfer/sysinit /etc/sysinit
waitfor /etc/sysinit

some drivers/managers we want started before the initialization file

display_msg Starting remaining drivers…
slogger -l /tmp/mtx603.log
devc-ser8250 -e -c1846200 -b9600 0x800003f8,104 0x800002f8,103
waitfor /dev/ser1 10
devc-pty -e
pipe
waitfor /dev/pipe

final system initialization

display_msg Handing off to /etc/sysinit/toolslab.init …
on -t /dev/ser1 /bin/ksh -i /etc/sysinit/toolslab.init labrtp nfs default
}

links

[type=link] /dev/ser7=/dev/ser1
[type=link] /dev/console=/dev/ser1
[type=link] /bin/ph=/etc/sysinit/ph.init

libraries

devn-tulip.so
npm-ttcpip.so
libsocket.so
libc.so.2

\

image binaries

[data=c]

pci-raven
io-net
ifconfig
fs-nfs2

added data and scripts

[perms=+r]

/tmtx603.labrtp.nfs.bld=./tmtx603.labrtp.nfs.bld