BeagleBoardAndOpenEmbeddedGit

From eLinux.org
Revision as of 23:14, 10 December 2009 by CountDown (Talk | contribs)

Jump to: navigation, search


NOTE:

These instructions are unofficial and their correctness can not be guaranteed. The only site that has up-to-date official instructions is http://www.angstrom-distribution.org/building-angstrom. Before making any support requests be sure that you have followed those instructions precisely.

Build instructions

Please refer to http://www.angstrom-distribution.org/building-angstrom, putting instructions into this wiki only brings confusion and bugs. If you find the angstrom instructions to be lacking in some way, please that that up with angstrom people instead of putting stuff in here.

Preparing the system for booting

The output of the bitbake command will ultimately be found under the $OE_HOME/angstrom-dev/deploy/glibc/images/beagleboard. In there you can find at least 3 interesting files:

  • console-image-beagleboard.tar
  • console-image-beagleboard.jffs2 and
  • uImage-beagleboard.bin

The console images are representations of a full and self containing file system *including* a kernel. The uImage is a linux kernel image that is suitable to be loaded by the U-boot bootloader. The difference between the tar file and the jffs2 image is that the later is better suited to directly put on a raw partition.

We are going to use the U-boot that is already provided in the NAND flash of the beagleboard as that one already support the MMC can load kernel images from a fat file system. What we will do is to format a SD-card to hold both a fat and an ext2 file system. We will put the kernel in the fat file system as U-boot failed to load the image from a ext2 file system. We will unpack the console-image under the ext2 file system.

Create partitions and format the SD-card

We usually create two partitions, the first one has a FAT partition type and the second one a Linux file system type . We then format them and put content on them. We are not going the describe the formating other then briefly because it just if to easy to format the wrong partition. There are a few reasons for having a first partition as FAT but his is not the scope of this document ( Think of U-boot, windows , mass-storage ). Instruction for formatting the SD-card correctly can be found at: Boot Disk Format

Here is the output of the fdisk -l command after creating the new partitions.

Disk /dev/mmcblk0: 2032 MB, 2032664576 bytes
1 heads, 16 sectors/track, 248128 cylinders
Units = cylinders of 16 * 512 = 8192 bytes
Disk identifier: 0x2f3dffc4
        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1               2       12209       97664    b  W95 FAT32
/dev/mmcblk0p2           12210      248128     1887352   83  Linux

We now format the file systems ext2 file system under /mnt. Some system will perform a automount of the newly created file system. Try to disable this automount feature if possible (it is not easy) or use gparted

mkfs.vfat /dev/mmcblk0p1
mkfs.ext2 /dev/mmcblk0p2

Mount the ext2 file system and unpack the archive. Do not forget the -C option.

 mount /dev/mmcblk0p2  /mnt
 tar xvjpf $OE_HOME/angstrom-dev/deploy/glibc/images/beagleboard/console-image-beagleboard.tar.bz2 -C /mnt
 umount /mnt

Mount the fat file system and copy the kernel image to there.

 mount /dev/mmcblk0p1  /mnt
 cp system/angstrom/deploy/glibc/images/beagleboard/uImage-beagleboard.bin /mnt/uImage
 umount /mnt

Booting

We can put the SD-card in the beagleboard and wait for the U-boot prompt. The kernel we compiled only gave serial output if we first ran the coninfo command we therefore type coninfo and ask U-Boot to initialise the mmc stack. After that we set the kernel command line telling what the console is and where our root file system is located. We then load the image from the fat file system into memory and boot the kernel

coninfo
mmc init
setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1'
fatload mmc 0:1 0x80000000  uImage
saveenv
bootm

One very important note:

It's important to have an X-Loader on your Beagleboard that uses the uBoot on the SD Card that goes with the Angstrom uImage. The B5 Beagleboards do not appear to come with such an X-Loader / U-Boot combination (i.e. the B5 standard uBoot will lead to problems with the sound driver and other things, but will not tell you that it's creating a problem).

The fix is to load a new X-Loader which will in turn automatically load the uBoot from the SD card, which again in turn will load the uImage properly.

So you likely will have to upgrade the X-Loader. Here's what to do:

 * Make an SD Card with the Angstrom Demo files.  See the Beagleboard Wiki Page for more info on making the SD Card.
 * Put the SD Card in the Beagle, and boot up to the U-Boot Prompt.
 * Do the first six instructions in the Flashing Commands with U-Boot section.  
 * Reboot the Beagle to see that the new X-Loader is properly loaded.

This will update the X-Loader to a newer version that will automatically load uBoot from the SD card, and then load uImage from the SD card, rather than always using the uBoot in the Beagleboard NAND.

Setting the video resolution:

The Angstrom kernels since 2.6.27 have used "DSS2", which is a candidate for replacing the OMAP framebuffer driver in the mainline Linux kernel. It provides greater flexibility for support of the S-Video port on the BeagleBoard and more monitor resolutions than previous mainline kernels. Documentation for the driver is in the kernel source at [Documentation/arm/OMAP/DSS http://groups.google.com/group/beagleboard/msg/4c64b2c614622053].

Below is one example:

setenv bootargs console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait omap-dss.def_disp=lcd omapfb.video_mode=640x480MR-16@60

Using the OpenEmbedded Environment

If you have not used bitbake / OpenEmbedded before, a helpful example for creating packages that can be installed on a beagle linux install (such as the one created above) can be found at Hello World Tutorial for Gumstix.

See also Open Embedded User's Manual (these links point to nightly builds of the documentation and so should always be up to date):

and bitbake User's Manual:

OpenEmbedded development

See OpenEmbedded development guide for one way how to modify and build packages contained within OpenEmbedded (OE) for the BeagleBoard.