This is a simple quick-start guide to getting Buildroot working with a Friendly ARM Mini2440 dev board.

Buildroot requires various development programs to be installed on the host computer. From memory, Gentoo has them all pre-installed, but on Ubuntu/Debian you will need to manually install them with the following command:

sudo apt-get install libncurses5-dev bison g++ flex gettext texinfo patch git-core libtool autoconf subversion

The next step is to download the latest Git version of Buildroot. There have been some recent changes that allow the use of non-standard u-boot and kernel packages, this is why we can’t use the last release version.

Change to the directory you want to place Buildroot (git will create a new directory to place it in) and run

git clone git://git.buildroot.net/buildroot

As Buildroot downloads all it’s own packages it is handy to have a download directory that is located outside the Buildroot folder. This prevents you deleting all your downloads when you rm -rf your Buildroot folder and start again! Note that when you run “make distclean” the symbolic link is deleted, so don’t forget to replace it.

mkdir dl
cd buildroot
ln -s ../dl

Buildroot uses a menu based configuration system to change toolchain options and select packages to build. Most of the toolchain options can be a bit confusing at first, so don’t change anything until after you have a working system – you might end up going around in circles otherwise!

I have created a basic config file for a Mini2440 that builds a toolchain, basic busybox rootfs, u-boot (sort of), and a Kernel. It is not yet included in Buildroot so you will have to download it.

wget http://www.pauljones.id.au/temp/mini2440_defconfig -O ./configs/mini2440_defconfig

You will also need the Kernel config file as well. (I put this in the parent directory so it doesn’t get wiped when you do “make distclean”)

wget http://www.pauljones.id.au/temp/mini2440_kernelconfig -O ./configs/mini2440_kernelconfig

Ok, so now we are nearly ready to go. The last thing to do is configure everything – if this is your first time it should work without touching any of the settings.

make mini2440_defconfig
make menuconfig

There is one setting you need to change in the Kernel config – the screen size. This can be found in Device Drivers -> Graphics support -> Support for frame buffer devices ->LCD select (8 inch 640X480 L80 LCD)

Change it to suit your device.

make linux26-menuconfig
make

After about 40 seconds an error will occur building u-boot tools. I don’t know why this happens, but it’s trying to use the wrong compiler. Never mind, there is a work-around.

All we need to do is remove the custom Mini2440 u-boot from Buildroot and replace it with a more recent version. As this will overwrite our u-boot image we need to make a copy of it first.

cp output/images/u-boot.bin output/images/u-boot-mini2440.bin

Now run “make menuconfig” again so we can change u-boot to one of the built-in versions:

make menuconfig

Goto Bootloaders -> U-Boot

Change the board name to “smdk2410″

Change the U-Boot version to 2010.06

Now exit menuconfig (don’t forget to save your changes!) and run make again. You can now go and get a cup of coffee – This should take about 20 mins depending on the speed of your computer.

If you don’t need to build u-boot for your Mini2440 you can just make the above changes at the start. We can’t disable u-boot because Buildroot needs the program that converts the Kernel images to a u-image.

make

When it finishes, have a look in the output/images folder – These are the files of interest.

lsĀ  output/images/
  • rootfs.jffs2 and rootfs.tar – These contain the rootfs, as I’m sure you have guessed. Which one you need depends on how you boot your system – jffs2 if you boot from nand using u-boot, and tar if you use nfs or a flash card. Buildroot currently doesn’t have support for yaffs, so if you are still using vivi you will need to manually convert an ext2 file or just upgrade to u-boot.
  • u-boot-mini2440.bin – This is the special Mini2440 version of u-boot. This is the file that you need to flash u-boot to your device
  • u-boot.bin – Ignore this file, it’s built for the wrong device.
  • uImage – This is the kernel image.

How you use these files is beyond the scope of this tutorial.

If you make any major changes and then find that you are getting errors, either compile or runtime, it is best to do a complete “make distclean” and start again. Make sure you save your config files first (.config for Buildroot and output/build/linux-custom/.config for the kernel) and recreate the symbolic link to the download dir.

Enjoy!

(ps. I hope to write a tutorial soon on how to build a crosstool-ng toolchain and integrate it with Buildroot – this reduces the compile time significantly.)

« »