Installing Debian to internal flash
Debian can be installed onto the Freerunner's flash with room to spare. Here's how:
Install Debian to uSD
Using the install.sh, install Debian on the uSD card (see DebianOnFreeRunner for installation instructions). Boot from the uSD card into Debian.
Add packages (optional)
apt-get install any additional packages you know you want. (You'll still be able to do it later, but it's faster now.) In my case, I added
apt-get install subversion python-crypto python-gdbm python-gtk2 xauth x2x python-pysqlite2 vim-gtk gpaint tangogps gpsd apmd patch patchutils
and still had 53MB free space on flash at the end of this. You probably will want to "apt-get clean" at this point.
Create rootfs and kernel images
On the Freerunner,
mkdir /var/tmp/root mount /dev/root /var/tmp/root
On your workstation:
ssh email@example.com "mkfs.jffs2 -d /var/tmp/root -e 128 --pad --no-cleanmarkers" | pv -W > debian-rootfs.jffs2
(The "| pv -W" is optional, it just gives you something to watch as the bytes fly by.)
Copy the /boot/uImage.bin to the workstation, or wget the one install.sh grabbed.
Flash the images
Flash the kernel image and the rootfs from the previous step to the Freerunner using dfu-util in the usual way.
Note that you can also flash the rootfs directly from within your Debian system running on the uSD, by simply erasing (e.g. rm -rf /flash/*) the jffs2 filesystem and then copying your Debian install onto it (e.g. cp -ax / /flash).
Fixup the flash rootfs
Boot into Debian from the uSD again. On the Freerunner
mount /mnt/flash vim /mnt/flash/etc/fstab
- Change the filesystem type for the rootfs line from ext2 to jffs2
- Comment out the mmcblk0p1 and mtdblock6 lines (add a # to the beginning of the line)
Reboot, and let the FR boot from its internal flash. It will take a while, but Debian should boot.
Installing additional software (optional)
Once you are running from the Freerunner's flash, you can use apt-get and friends as included in Debian squeeze and onwards as usual (314334).
If you want you can move /var/cache/apt where APT stores downloaded packages with an entry in /etc/fstab like this to a tmpfs:
tmpfs /var/cache/apt tmpfs defaults,noatime 0 0
The first invocation of any APT command after a reboot will take a considerable amount of time then through to build the binary cache of package information.
Saving more flash space
The first thing you can do to save some flash space is to install the localepurge package. You can also configure --path-exclude and --path-include options for dpkg.
To save yet more flash space, you can also keep the /var/lib/apt/lists under tmpfs, but note that it will eat up your precious RAM space. So if you use such a setup, you will probably want to setup a swap file (or partition) on the microSD card.