This article applies to PADS 2.1 or greater. Please note the points below have all been taken into account by Pika's implementation of FreePBX on Warp so this instruction is largely intended for non-FreePBX users.


#1 - Reduce the ramdisk size.

In 2.1, Pika has tried to make this automatic however it can still need some small tweaking. For example, there is a field in menuconfig now that adds 'padding' to your image. This padding is there to accomodate any dynamic file creations on a directory residing in ramdisk. And this padding is always taken away from your available RAM and reserved. This padding is currently set as an additional 40% of your image size. However, in most cases this padding is much too large - especially in cases of larger ramdisk images.

To change this from PADS, run 'make menuconfig', under the 'Advanced Options' heading you will find a 'Root ramdisk overhead' setting. This should likely be set to something much lower - like 5%-10%? (The default FreePBX image uses 10% for this number.) Then re-burning the ramdisk image will make the appropriate changes to uboot variables to accomodate this change. This change should improve the general RAM usage of the Warp.

But keep in mind if you reduce this number too small some operations may fail. For example, you may try to copy a file to '/bin' (located in ramdisk which is the read-only memory) and it may fail with 'no space left on disk' or something to this affect.

Some additional notes:
* To determine the ramdisk size used on Warp you can try the following command on Warp: 'cat/proc/cmdline' The output looks like the following:
root=/dev/ram rw ramdisk_size=0x19E10 ip=deflt:deflt:deflt:255.255.255.0:warp:eth0 ff panic=1 console=ttyS0,115200
* To determine additional information about any image that you build you can try the following command on your development machine from the base PADS directory: './utils/warptrailer images/IMAGE.wrp' The output looks like the following (note the last two fields 'size' in Bytes and 'ramdisk size' in KB):
magic PIKA Warped v1
crc b13c1db401b7c70cbd95a6a896974688
type root
date 2010/05/20 15:54:46
time 1274385286
version 2.2.0-56
os Gunther
arch PPC
part n/a
flash nand
pstart 0x00200000
psize 0x03e00000
size 0x019142f3
ramdisk size 0x00019E10


#2 - Remvoing unnecessary files and strip files.

This is typically done when you are satisified with your final image just before executing 'make image' the final time. Here are an example of the things that can be done as a Makefile directive or through a script:

# busybox has no man application so delete man pages
rm -rf $(TARGET_DIR)/usr/man
rm -rf $(TARGET_DIR)/usr/share/man
rm -rf $(TARGET_DIR)/usr/share/info
rm -rf $(TARGET_DIR)/usr/share/emacs
rm -rf $(TARGET_DIR)/usr/share/gtk-doc
rm -rf $(TARGET_DIR)/usr/share/doc
rm -rf $(TARGET_DIR)/usr/local/share/man
rm -rf $(TARGET_DIR)/usr/include
# remove static libraries, not needed on system with no compiler
rm -f `find $(TARGET_DIR) -name "*.a"`
rm -f `find $(TARGET_DIR) -name "*.la"`
rm -f `find $(TARGET_DIR) -name "*.lo"`
# strip libraries, not needed on system with no debugger
@for lib in `find $(TARGET_DIR) -name "*.so*"`; do \
if [ -f $$lib ]; then \
if [[ $$lib == "$(TARGET_DIR)/lib/libpthread.so" || $$lib == "$(TARGET_DIR)/lib/libpthread.so_orig" || $$lib == "$(TARGET_DIR)/lib/libc.so" \
|| $$lib == "$(TARGET_DIR)/lib/libc.so_orig" || $$lib == "$(TARGET_DIR)/lib/libc.so.6" || $$lib == "$(TARGET_DIR)/lib/libc-2.3.5.so" ]]; then \
echo "Skipping $$lib"; \
else \
$(BASE_DIR)/toolchain/usr/bin/powerpc-linux-strip --strip-all $$lib; \
fi \
fi \
done


where TARGET_DIR is set as '/build_warp/root'. These command were obtain from the main PADS Makefile and are used by FreePBX. As you can see this attempts to remove unnecessary files like man pages and then strip libraries files. Stripping removes debugging information which for productization is usually not necessary. Keep in mind however that after you perform this final optimization step you will not be able to re-build PADS without cleaning and re-building. The reason being some of the files that are removed are necessary during the build process and can only be recovered by re-building.


Both of these items can drastically improve the general RAM usage of current Warp.