[Home]All In RAM Disk

Last edit: Peter Favrholdt on September 23, 2006 13:22 (3960 days, 23 hours and 24 minutes ago) (diff)
Rtai.Dk | RecentChanges | Preferences | DIAPM RTAI

http://www.die.supsi.ch/~bucher/embrtai.html

From: David Boyes
Subject: Bootable CD - another approach

Hi all,

Re recent posts about bootable CD's, I have just been looking at another
approach to a bootable RTAI CD, which is a CD to carry a working
application and to boot on a PC platform.  As a departure point I've taken
a system that can run purely in RAM - so put the CD in the drive, reboot
and your app is running without worrying about hard drives and installed
systems.  Apart from being neat, this is a way of distributing an app for
unskilled users, rather than for example distributing and running a
development platform.  Typically you might use about half the RAM as disk,
leaving half as usable RAM, so with 128M you can do quite a lot, and with a
lightweight system you get by with maybe as little as 32M.

I based the CD on BICK (Bootable ISO Construction Kit, thanks to Philip
Howard, see freshmeat), which uses Syslinux.  Because it is a way of making
a CD for which you want to choose the content I have not posted an image
(and anyway I don't have the server space).  The approach is to do a
Syslinux CD boot with a tiny initial ramdisk and a spoof init, setup a
tmpfs, copy the system from the CD to this, note where the CD was found,
change to the tmpfs as root, unmount the CD and run init.   I use
Slackware, and for Slackware 9 and 2.4.20 kernels I found a few mods that
were needed.  It is these I want to post now, thus :

- Make sure your kernel is compiled with both ramdisk and tmpfs support
(both are needed) plus of course support for CD and anything else you might
need.

- Having installed bick (currently 0.8.0), read README's and so on, you
will find you use "project directories", each of which has a subdirectory
called root-intel32.  You copy your file system (project tree) below
this.  In an RTAI context this will probably be an existing system which
you have got running and debugged on a hard disk.  Given that the target is
a small system this is probably not from your development platform but
something you had on a target (see for example my note on this
http://www.d.boyes.easynet.be/works/RTAI-cross-platform ).

- Move the kernel from root-intel32/boot to the project directory.

- Copy the fstab from the bick example (which is for a rescue disk) and
edit if required (but probably later when you understand what you are doing).

- The kit uses tar and the ld and libc libraries from the project
tree.  There is a problem with very recent tar's in that they use more
libraries - it's simplest to copy the tar from the bick example to your
root-intel32/bin or check this point with ldd.

- Edit the project directory config file (it will appear during
installation).  Remove the line starting "ia32parm=" and insert
"intel32parm="rw".  This adds "rw" to the boot instructions, forcing
read-write mount of the initial ram disk, which is required by kernels from
2.4.20.

- To keep the Slackware startup files schema, use an rc.S file like the one
in the attachment to this message.  This allows fsck to check the file
system on startup as this has to be done read-only.

- As per instructions build and burn the CD.  A few tries on CD-RW might be
a good idea, and if you are really worried you can find the boot "floppy"
image under "tmp/dir/intel32/boot", which you can try after a "cp boot.img
/dev/fd0" - it should run up to the init phase.

There are various message texts here which can be edited, and no doubt
other such details.

This is what has been interesting for my activities, though some further
things you can do are :

- Auto logon and start an application.

- Mount the CD drive from /dev/bootcd - you can change the CD or leave the
bootable CD in place, so you can separate application distribution from,
for example, user files.

- Mount a hard disk, floppy, flash disk etc. in the usual manner.  Examples
are hard disk partition for swap space, flash for user setup and logging,
floppies for security keys and so on.

- As usual use busybox, ash, uclibc and so forth for a very small system
(I've tried these with RTAI and they work fine).

- Mount the CD and use symlinks for things that can well remain on the
CD.  You will have to edit the buildcd script for this, but this is a
fairly simple edit to the mkisofs args.  For example use another tree
"ro_root", with things like module collections and non-real-time
applications.  You might for example automatically configure a network in
this way for various platforms, using a vast collection of network
interface modules on the CD.

Best regards
David Boyes

Edit text of this page | View other revisions | Download Rtai.dk
Search: