Creating custom images with the ADS root builder
Adsrootbuilder is a set of tools designed to aid users of Debian on ADS embedded systems in generating flash images of their application and linux operating system.
Debian users (and possibly others) can use these tools to "trim down" their installed operating system and product application into small filesystem image(s) suitable for programming into onboard flash memory on the ADS boards. Adsrootbuilder supports generating both ramdisks (ext2) and mtd flash filesystem images (cramfs and jffs2).
The adsrootbuilder is included in the ADS traditional Debian distribution. A link to a current version is in this topic.
The adsrootbuilder works by setting a timestamp and then looking for files with access times newer than that timestamp. This means that any files accessed after you run adsrootbuilder the first time will be included in your images.
In order to catch essential startup files and libraries, the system will be rebooted after the timestamp is created. After your system has rebooted, you should run your application or do anything with the system that you will want to do under the flash images. When you are done, you can run adsrootbuilder without any arguments to complete the build process.
You should use care not to access unneeded files while running the adsrootbuilder - it is very easy to end up with far more files in your images than are neccessary. Tools like 'ls' and 'find' update the access times on directories they look in. The root builder will, however, allow you to edit a list of the files it detects as accessed before building an image, so if you accidentially add unwanted files you can remove them from the list at that point.
In addition to the filesystem images, adsrootbuilder will leave a tarball of all the accessed files in /var/lib/adsrootbuilder/. If you want to make a trivial change to your filesystem images or simply use this tarball as a starting point for a hand-tuned filesystem, you can invoke adsrootbuilder with the '--noscan' option (before any other options - see 'adsrootbuilder -h' for the proper command line order) to use an existing tarball.
Here are step-by-step instructions for using the adsrootbuilder to create any of three types of images; a ramdisk, a jffs2 filesystem or a cramfs filesystem.
- To start with you should be running the full Debian distribution from disk, and should have any changes you want to make already made to the system and ready for deployment.
- You should also have a Compact Flash card that is already set up to boot the ramdisk, jffs2, or cramfs filesystem produced by ADS, which you can find in this topic.
- Boot from disk and log in as root.
- Run "ramdisk-configure", "jffs2-configure", or "cramfs-configure", depending on the type of image you want to create. These programs will tune the system for that image type.
- Run "adsrootbuilder -c ads-ramdisk.conf". If creating a jffs2 or cramfs image, replace "ramdisk" with the image type.
- The system will be rebooted. Exercise the system by running your application or do anything that you want to be able to do using the flash image.
- Log in as root if you didn't already, and run "adsrootbuilder" for the second time. Follow the prompts as it create the new embedded image.
- The image will be created in /var/lib/adsrootbuilder/, and you can copy it to your compact flash card to install and boot it.
- If the resulting image is missing files or doesn't quite work, repeat the steps, making sure to exercise any files you missed before. It may take a few tries to learn how to create a suitable image.