Still don’t have a Meld Account?
Join now to be a part of the worlds largest embedded linux community!
Join Now!Tutorial 2: Using the SDK to Build a New Kernel and Root Filesystem
In Tutorial 1: Introduction to Embedded Linux Development with MVIP on the BeagleBoard-XM we downloaded the BeagleBoard SDK, extracted it, created a bootable microSD card and test booted the BeagleBoard-XM. In this Tutorial we'll look a little closer at the contents of the SDK and explain how the MontaVista Linux Integration Platform works.
In a terminal window on your host development machine return to the meldsdk directory created in Tutorial 1 and list the contents:
Note that for the purposes of this tutorial I will be using my username (wmat) for all examples. Please substitute your own username appropriately. For example: My $HOME directory is /home/wmat whereas yours will be /home/<your username>
$ cd /home/wmat/meldsdk/ti-beagle/
$ ls -lF total 24 drwxr-x--- 7 wmat wmat 4096 2011-06-27 09:30 beagle/ drwxr-x--- 11 wmat wmat 4096 2010-10-12 17:08 mvip/ drwxr-x--- 2 wmat wmat 4096 2011-06-27 09:27 prebuilt/ -rw-r----- 1 wmat wmat 5242 2011-06-27 09:37 README drwxr-x--- 3 wmat wmat 4096 2010-12-14 21:58 toolchain/
As you can see there are 4 top level directories in the SDK:
/beagle - Contains the MontaVista Integration Platform project for the BeagleBoard build.
/mvip - Contains the MontaVista Integration Platform kit.
/prebuilt - Contains the perbuilt root filesystem, bootloader, and Linux kernel used in Tutorial 1.
/toolchain - Contains the MontaVista toolchain applicable to the BeagleBoard architecture.
The MVIP SDK relies on the MVIP tools. These tools are found in the mvip/bin directory. Of particular importance is the bitbake tool. When working with the SDK, we want to use the bitbake binary provided by the SDK. To accomplish this, we need to add the mvip/bin directory to our PATH with the following command:
$ export PATH=/home/wmat/meldsdk/ti-beagle/mvip/bin/:$PATH
Now, we can use any of the executable binaries found in the mvip/bin directory from the command line. To confirm that you're using the MVIP version of bitbake, issue the following command:
$ which bitbake
/home/wmat/meldsdk/ti-beagle/mvip/bin/bitbake
Before we can make any modifications to source code and rebuild a new image, we need to edit two files to match the directory where we extracted the SDK. The two files are beagle/setup.sh and beagle/conf/local.conf.
Edit beagle/setup.sh and change the BASE_PATH variable to match the directory location where you extracted the SDK. In my case, the edited line becomes:
BASE_PATH=/home/wmat/meldsdk/ti-beagle
Next, edit beagle/conf/local.conf and change the BASE_PATH variable to match the directory location where you extracted the SDK: In my case, the edited line becomes:
BASE_DIR = "/home/wmat/meldsdk/ti-beagle"
Please ensure that you have quite a bit of free space available on your local disk, as building images can consume quite a bit of space. Before we build a new image for the BeagleBoard lets update the kernel to the latest linux-omap development kernel. To do this, we can add a directive to the local.conf file to tell bitbake where to look for kernel source. First let's create a local directory to hold the kernel source and clone the remote kernel repository into the new directory:
$ mkdir /home/wmat/dev/kernels
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
Once the clone completes you should have a frech copy of the latest linux-omap kernel in your new directory. Next, make a copy of the config file provided in the kernel source. From the linux-omap directory:
$ cp arch/arm/configs/omap2plus_defconfig ./.config
Now we need to tell MVIP where to find the kernel source and alternate kernel configuration file. To do this add the following two directives to your local.conf file:
KERNEL_SOURCE_DIRECTORY = "/home/wmat/dev/kernel/linux-omap" KERNEL_CONFIG = "/home/wmat/dev/kernel/linux-omap/.config"
Before we can build a new image, we need to make one more change. We need to update the Bitbake recipe for iproute2, as the source location has changed. Just do the following:
$ vim collections/core/recipes/iproute2/iproute2_2.6.33.bb
and change the SRC_URI to
SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/iproute/iproute2-2.6.33.tar.bz2/b371fca3fcb5e436e69a7c2111d84a3c/${P}.tar.bz2 \
We're now ready to build the new kernel using MVIP tools. To do this, we first source the set up file then issue the bitbake command:
$ cd /home/wmat/meldsdk/ti-beagle/beagle $ source setup.sh $ bitbake default-image
At this point, depending on the speed of your development machine, you may find this a good time to get a cup of coffee.
When complete, build results are placed in tmp/deploy/images/. At this point, simply follow the steps from Tutorial 1 using the results from the build to update .
