You need various components for a full build.
- Bootloader
- Logic: FPGA or CPLD
- kernel+initrd (ram filesystem)
- Rootfs
There are also ancilliary tools such as bbl to help install this stuff. Here we cover how to build all these parts.
The quickstart version
Checkout balloonboard svn and do make:
svn checkout svn://balloonboard.org/balloon/trunk balloonsvn cd balloonsvn make
This builds things in a build directory at the same level as balloonsvn
You can also do make dist to install all the generated binaries into a distro directory at the same level as balloonsvn. This will copy the relevant sources into place too in due course.
This mechanism does not build the vhdl code as that needs the Xilinx Webpack tools. And currently bootldr is not dealt with either as it needs a chroot containing an old (v2.95) compiler.
The patches are managed with quilt. See QuiltHowto for details on how that works so you can use it to easily make changes, update patches and check changes back in.
To check code back in you will need svn access on balloonboard.org. email wookey@wookware.org with an ssh key to get access.
Tools and libraries you might need
The build procedure needs various tools and libraries to be present on your system. The makefiles will warn you about some things, and on a Debian system, automatically install the needed packages if you have sudo rights. You need make, glibc headers, bzip2, wget, quilt, module-init-tools, fakeroot, texinfo, bison and flex in addition to the ARM toolchain, see below.
apt-get install build-essential bzip2 quilt module-init-tools fakeroot texinfo bison flex wget apt-get install libncurses5-dev debhelper debootstrap emdebian-tools gcc-4.1-arm-linux-gnu
The symptoms of module-init-tools not being installed are non-intuitive: if building the modules results in a lot of messages complaining about ELF files not being for this architecture, then module-init-tools probably isn't installed.
The ARM GCC 4.1 toolchain is also required, which is available from http://www.emdebian.org/tools/crosstools.html. To install this on a Debian machine, add
deb http://www.emdebian.org/debian/ stable main
to /etc/apt/sources.list. Then
apt-get update apt-get install gcc-4.1-arm-linux-gnu
Bootloader
The current bootloader used is bootldr from handhelds.org. It has been quite heavily modified to include YAFFS2 support and FPGA support.
There are currently two branches, the trunk version which works with a modern gcc, and the branch version which only works with gcc2.95. The branch version is the one that has all the latest stuff in it.
Get it from svn with: svn checkout svn://balloonboard.org/balloon/branches/bootldr36-pxa-sa1100
Make sure you have an arm cross-compiler installed (currently v2.95 is needed).
Build an initial loader with: make
By default it builds the minimalist version for initial JTAG download. To make a full-featured loader edit the config.local.mk file and comment out CONFIG_BALLOON_SMALL=y To make one for balloon2 set CONFIG_ARCH=SA1100 in config.local.mk, then make again
Resulting binaries:
<release>/bootldr/bootldr.fast
<release>/bootldr/bootldr.small
kernel
You should not need to do this manually - the build is integrated into the svn makefiles. But here is a description of what goes on, should you wish to play with it.
Check out the kernel patches from svn checkout svn://balloonboard.org/balloon/trunk/kernel/2.6.21
Apply them to a fresh kernel source: from either http://balloonboard.org/files/balloon3/distro/test-v0.2/sources/kernel/linux-2.6.21.1.tar.bz2 or http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.1.tar.bz2 You can do this with just patch, but it is set up to use quilt.
- Set the config for balloon3 and build the kernel
The easiest way to do this:
svn checkout svn://balloonboard.org/balloon/trunk balloonsvn cd balloonsvn make
To do it manually:
svn checkout svn://balloonboard.org/balloon/trunk balloonsvn mkdir -p build/kernel cd build/kernel wget http://balloonboard.org/files/balloon3/distro/test-v0.3/sources/kernel/linux-2.6.22.2.tar.bz2 tar -xvjf linux-2.6.22.2.tar.bz2 svn checkout svn://balloonboard.org/balloon/trunk/kernel patches quilt push -a
Assuming that went OK you should be ready to build:
make balloon3_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnu- make zImage
Resulting binaries:
<release>/kernel/zImage
Note that, as checked out of svn, the build procedure will make a kernel with an initrd built in. To get rid of it, uncheck the option "Initial RAM filesystem and RAM disk (initramfs/initrd) support" under "General setup" in make menuconfig.
initrd
You should not need to do this manually - the build is integrated into the svn makefiles. But here is a description of what goes on, should you wish to play with it.
This is currently built with buildroot. To do it manually:
svn checkout svn://balloonboard.org/balloon/trunk balloonsvn mkdir -p build/buildroot cd build/buildroot wget http://balloonboard.org/files/balloon3/distro/test-v0.3/sources/initrd/buildroot18662.tar.bz2 tar -xvjf buildroot18662.tar.bz2 svn checkout svn://balloonboard.org/balloon/trunk/initrd patches quilt push -a
Assuming that went OK you should be ready to build:
make oldconfig make
The result is a rootfs in build_arm/root
To get the initrd combined into the kernel you need to either set CONFIG_INITRAMFS_SOURCE to the dir containing your unpacked initrd, or copy a cpio archive of the initrd into usr/initramfs_data.cpio, then remake zImage. (see http://www.timesys.com/timesource/initramfs.htm for more details on how this all works)
Resulting binaries:
<release>/kernel/zImageInitrd
debian rootfs
This is made with debootstrap.
debootstrap --verbose --arch arm --foreign etch --include=udev,pcmciautils,balloon3-config,ntpdate,avahi-daemon,libdaemon0,lib avahi-common3,libavahi-core4,avahi-autoipd,libnss-mdns,libdbus-1-3,dbus etch-arm-chroot http://ftp.uk.debian.org/debian/
Then we apply a script rootfs-config to set various things up properly. These are the things which need to be configured in the rootfs in order to boot it on a target. These things are:
- It sets up devices (mtd, sd, fb, ttyS0-2)
- /etc/apt/sources.list points to ftp.uk.debian.org, and balloonboard.org for updates - (the default ftp.debian.org does not have arm packages)
- /etc/network/interfaces created for eth0 etc using dhcp
- /etc/securetty added ttyS1 and ttyS2 - allows root logon
- /etc/hostname set to balloon
The package balloon3-config takes care of 2nd-stage config.
- /etc/fstab set to sensible defaults
- /etc/passwd or /etc/shadow root password set to rootme
- shell set to bash for boot speed
- password change date set so it doesn;t ask you to change it every login
- /etc/hosts set up
- apt cache cleared out
- /dev/random pointed at /dev/urandom so ssh keys can be generated
- chmod 755 /
A prototype version is downloadable here: http://husaberg.toby-churchill.com/balloon/releases/development/balloon3/distro/debian/debootstrap-etch-arm-patched.yaffs2.gz
Resulting Binaries:
<release>/rootfs/debian/debianstage1root.tgz
Normally this is processed into a full debian rootfs by mounting it over usb and running debootstrap --second stage to produce a fully-functional rootfs:
<release>/rootfs/debian/debianroot.tgz
logic files
These are checked out of svn: svn checkout svn://balloonboard.org/balloon/trunk/vhdl
You need the xilinx web pack to build the binaries.
Resulting binaries:
<release>/vhdl/cpld/l3cpld.xsvf (for CPLD)
<release>/vhdl/fpga/l3fpga.bin (for FPGA)
Programming utilities
These are curently built in-tree, unlike the kernel, initrd and rootfs - the makefiles will be fully integrated soon. Check them out of svn and build everything:
svn checkout svn://balloonboard.org/balloon/trunk/bbl make
This builds bflash, (and jflash), audio-off, and playxvsf - which are the various utils needed to program up a Balloon. make install will install them into your system (in /usr/local/bin) if you have sudo access, so that you can use them straight away.