In this section, there is a functional buildfile that you can use to create an OS image that can be loaded by GRUB without a hard disk or any local storage.
Create the image by typing the following:
$ mkifs -vvv build.txt build.img $ cp build.img /tftpboot
Here is the buildfile:
[virtual=x86,elf +compress] boot = { startup-bios PATH=/proc/boot:/bin:/usr/bin:/sbin:/usr/sbin: \ /usr/local/bin:/usr/local/sbin \ LD_LIBRARY_PATH=/proc/boot: \ /lib:/usr/lib:/lib/dll procnto } [+script] startup-script = { procmgr_symlink ../../proc/boot/libc.so.3 /usr/lib/ldqnx.so.2 # # do magic required to set up PnP and pci bios on x86 # display_msg Do the BIOS magic ... seedres pci-bios waitfor /dev/pci # # A really good idea is to set hostname and domain # before qnet is started # setconf _CS_HOSTNAME aboyd setconf _CS_DOMAIN ott.qnx.com # # If you do not set the hostname to something # unique before qnet is started, qnet will try # to create and set the hostname to a hopefully # unique string constructed from the ethernet # address, which will look like EAc07f5e # which will probably work, but is pretty ugly. # # # start io-pkt, network driver and qnet # # NB to help debugging, add verbose=1 after -pqnet below # display_msg Starting io-pkt-v6-hc and speedo driver and qnet ... io-pkt-v6-hc -dspeedo -pqnet display_msg Waiting for ethernet driver to initialize ... waitfor /dev/io-pkt/en0 60 display_msg Waiting for Qnet to initialize ... waitfor /net 60 # # Now that we can fetch executables from the remote server # we can run devc-con and ksh, which we do not include in # the image, to keep the size down # # In our example, the server we are booting from # has the hostname qpkg and the SAME domain: ott.qnx.com # # We clean out any old bogus connections to the qpkg server # if we have recently rebooted quickly, by fetching a trivial # executable which works nicely as a sacrificial lamb # /net/qpkg/bin/true # # now print out some interesting techie-type information # display_msg hostname: getconf _CS_HOSTNAME display_msg domain: getconf _CS_DOMAIN display_msg uname -a: uname -a # # create some text consoles # display_msg . display_msg Starting 3 text consoles which you can flip display_msg between by holding ctrl alt + OR ctrl alt - display_msg . devc-con -n3 waitfor /dev/con1 # # start up some command line shells on the text consoles # reopen /dev/con1 [+session] TERM=qansi HOME=/ PATH=/bin:/usr/bin:\ /usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:\ /proc/boot ksh & reopen /dev/con2 [+session] TERM=qansi HOME=/ PATH=/bin:/usr/bin:\ /usr/local/bin:/sbin:/usr/sbin:\ /usr/local/sbin:/proc/boot ksh & reopen /dev/con3 [+session] TERM=qansi HOME=/ PATH=/bin:\ /usr/bin:/usr/local/bin:/sbin:/usr/sbin:\ /usr/local/sbin:/proc/boot ksh & # # startup script ends here # } # # Let's create some links in the virtual file system so that # applications are fooled into thinking there's a local hard disk # # # Make /tmp point to the shared memory area # [type=link] /tmp=/dev/shmem # # Redirect console (error) messages to con1 # [type=link] /dev/console=/dev/con1 # # Now for the diskless qnet magic. In this example, we are booting # using a server which has the hostname qpkg. Since we do not have # a hard disk, we will create links to point to the servers disk # [type=link] /bin=/net/qpkg/bin [type=link] /boot=/net/qpkg/boot [type=link] /etc=/net/qpkg/etc [type=link] /home=/net/qpkg/home [type=link] /lib=/net/qpkg/lib [type=link] /opt=/net/qpkg/opt [type=link] /pkgs=/net/qpkg/pkgs [type=link] /root=/net/qpkg/root [type=link] /sbin=/net/qpkg/sbin [type=link] /usr=/net/qpkg/usr [type=link] /var=/net/qpkg/var [type=link] /x86=/ # # These are essential shared libraries which must be in the # image for us to start io-pkt, the ethernet driver and qnet # libc.so.2 libc.so devn-speedo.so lsm-qnet.so # # copy code and data for all following executables # which will be located in /proc/boot in the image # [data=copy] seedres pci-bios setconf io-pkt-v6-hc waitfor # uncomment this for debugging # getconf