Jan 3, 2010

Setup Buildroot for Beagleboard Development

Currently, when development with Beagleboard we often use OE distribution. The OE is hard to maintain for
me, and it requires to open everything so that I use buildroot to develop on Beagleboard.

Here is how to setup one.
1) Download the buildroot from http://www.buildroot.org/
2) You might want to use external toolchain by downloading the ARM toolchain from CodeSourcery (http://www.codesourcery.com/) or build using crosstool-ng
3) You might also want to use the omap linux kernel by downloading it using git (git clone git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git)
4) Extract the buildroot into a folder and type `make menuconfig` to configure it.
   * Target Architecture: arm
   * Target Architecture Variant: generic_arm
   * Target ABI: EABI
   * For my Beagleboard, I need to configure the Target Options > Generic serial port config (y) > and change Serial port to run a getty on to (ttyS2) instead of (ttyS0)
      - If using ttyS0, the my board cannot boot and stuck at `ip: RTNETLINK answers: File exists` (http://forums.xilinx.com/xlnx/board/message?board.id=ELINUX&thread.id=1677)
   * Go to Toolchain settings
      - If you are using External Toolchain, select Toolchain type to External binary toolchain and set the External toolchain path to correct path of your toolchain (i.e. /usr/local/xtools/armunknownlinuxuclibcgnueabi. This is my crosstool-ng installed location)
      - If you are using Internal Toolchain (the toolchain built by buildroot), select  Toolchain type to Buildroot toolchain.

    * Go to Target filesystem options and select the target fs to build.
      - If you are building the u-boot, you need to enter the Das U-Boot Monitor and select
         + board name: omap3_beagle
    * Go to kernel settings
      - If you are using Internal Kernel, select Kernel type to linux (Advanced Configuration) and select the kernel version as well as the configuration file to use (in the Linux Kernel Configuration), I copied the omap3_beagle_defconfig from arch/arm/configs to a specified location and customized it.
      - If you are using External Kernel, select Kernel type to none.
5) Save the configuration and type `make` to build the system. After finished, the image is located at binaries/[project_name]/

   + If using external kernel, you will need to copy the kernel module into the root filesystem at project_build_arm/[project_name]/root or into the NFS root folder. (in kernel folder: make ... INSTALL_MOD_PATH=...)
   + The crosstool-ng cannot compile the uboot because of some bugs (http://old.nabble.com/-U-Boot---PATCH-2-2--ARM:-fix-build-error-with-gcc-4.4.2-about-inline-function-declared-weak-p26188857.html)

   + The internal kernel is getting from kernel.org and doesn't contain the patches for omap platform. Need to sync with omap git repository to create the patch and put it under the target/.../ folder inside the buildroot
   + The internal toolchain is generic arm, and does not have omap specified optimization, need to sync with OE repository to create the patch and put it under the toolchain/.../ folder inside the buildroot
   + The internal kernel cannot have USB Gadget Driver, maybe missing some patch for omap
   + Add _defconfig (or board specific into the buildroot)

No comments: