BBB Yocto Project

From Klaus' wiki
Revision as of 09:56, 27 November 2015 by Klaus (Talk | contribs)

Jump to: navigation, search

The Yocto Project, see the home page for further details, can create a distribution for the BBB.

For instructions on how to build a personal Yocto Project Distribution see Yocto Project Build Instructions.

Creating the boot SD

There are several methods to create a bootable SD card.

The easiest way is to use a graphical interface, e.g. gparted


Create two partitions, one size 40, or more, megabytes for u-boot and one for the rest of the SD card - here 7+ GB.

Label the boot partition boot and the other partition root.

The boot partition shall be a primary partition of type FAT32 while the rest is a ext3 or ext4 file system. Format the partitions to the designated file system types and set the boot flag for the boot partition.

Alternative method

Here is an alternative method only using the console if no graphical environment is available:

$ export DISK=/dev/sdc
$ umount ${DISK}1
 #<<<Note the addition of the '1'
$ sudo dd if=/dev/zero of=${DISK} bs=512 count=20
$ sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__
$ sudo mkfs.vfat -F 16 ${DISK}1 -n boot
$ sudo mkfs.ext4 ${DISK}2 -L rootfs

Here's whats happening:

  • Provided that the newly inserted SD card is /dev/sdc - could be another e.g. sdb depending on the disks in the PC - tell the rest of the script where the device is located (the DISK variable)
  • unmount if automount mounted it
  • dd is a very effective utility to create files and much more - here zeros is copied from /dev/zero (if=/dev/zero) to the disk (of=${DISK} i.e. /dev/sdc) with 512 bytes block size (bs=512) for 20 blocks (count=20)
  • Next rather than calling the fdisk the sfdisk partition table manipulating program is used with a HERE script (the part from __EOF__ to __EOF__)
  • With the partition the next is to make a file system with mkfs both vfat and ext4 file systems and at the same time labelling the partitions

Transfer binaries to the SD card

If you are developing on a remote computer, e.g. bren, you have to copy the files used below to your local computer. Use the scp command like this:

$ mkdir yocto
$ cd yocto
$ scp <username><path to the files>/<filename> .

The files you need is.

  • MLO
  • u-boot.img
  • core-image-sato-beaglebone.tar.bz2

you will find them in <your yocto dev. dir>/tmp/deploy/images/beaglebone/

Mount the two SD card partitions. On some Linuxes it is easily done by removing the SD card and reinsert it and automount will automagically mount the disk partitions.

From the Yocto Project distribution copy the MLO and the u-boot.img files to the boot partition.

In order to populate the root file system to the root partition untar the compressed root file system that bitbake produced.

$ cd <the mounted root partition>
$ sudo tar xf <path to local file>/core-image-sato-beaglebone.tar.bz2 .
$ sync

This is what is happening:

  • First change to the root partition on the SD card (on Fedora it is typically mounted /run/media/<username>/root)
  • Then untar the compressed root file system from where bitbake built it (here it is the graphical core-image-sato distribution)
  • Finally issue sync to let the kernel write everything to the SD card - when sync returns unmount the SD card.

Windows and Mac users

You will have to figure out from the descriptions above how to format and create the filesystems on the SD card and how to copy the files to the card.

One method is to use a virtual installation of Linux.

Otherwise use your favourite search engine to locate a description how to create and transfer the images to a SD card.

Booting the BBB with Yocto Project

Insert the SD card into the slot for it on the BBB. Press and hold the button on top of the board near the SD card in order to boot from the SD (otherwise the BBB will boot from the built in eMMC). Apply power through the USB connector.

Monitor the boot process

Only if the u-boot causes problems a serial connection may be helpful, otherwise it is usually enough to wait until the USB interface becomes available in the boot process.

So if the u-boot messages should not be monitored, just connect the USB cable to the PC and start the favourite serial communication program, e.g. CuteCom, Putty or screen. Wait until the tty USB device becomes available. The USB interface will become available when the system is near the end of the boot process - and at that time the u-boot messages are long gone.

If, for some reason, the board won't boot, a serial cable need to be connected to the board. Get a PL2303 cable - or build one your self...

Connect the serial cable to the port to J1 as shown below.

RPI Serial.png

PL2303 USB to serial cable

 Board       Wire    Function
 Pin 1.....Black.....Ground

 Pin 4.....Green.....Receive

 Pin 5.....White....Transmit
 (Where pin 1 is the one near the white dot)


Connecting the pl2303 cable to the BeagleBone Black

Stop u-boot

Using a serial interface it is possible to monitor the boot process.

Here the command

$ screen /dev/ttyUSB0 115200

is used to connect to the serial line (use Ctrl-a+k to kill the window). Putty or CuteCom can show the same.

Immediately after applying power and e-boot presents it self on the serial interface, hit any key on the keyboard to stop the boot process.

This is a typical output from the early boot process:

U-Boot SPL 2014.04-00014-g47880f5 (Apr 22 2014 - 13:23:54)
reading args
spl_load_image_fat_os: error reading image args, err - -1
reading u-boot.img
reading u-boot.img

U-Boot 2014.04-00014-g47880f5 (Apr 22 2014 - 13:23:54)

I2C:   ready
DRAM:  512 MiB
NAND:  0 MiB
*** Warning - readenv() failed, using default environment

Net:   <ethaddr> not set. Validating first E-fuse MAC
cpsw, usb_ether
Hit any key to stop autoboot:  0 

Here the u-boot has stopped and are awaiting a command.