Check out the new MinnowBoard.org website for the most up-to-date information on the MinnowBoard Turbot and the MinnowBoard.org Community.

Projects/Maker Yocto

From MinnowBoard Wiki
Jump to: navigation, search

Building for MinnowBoard MAX Maker projects with Yocto

Yocto.png

Yocto allows builders to create a custom OS image for various uses which can be tailored to specific hardware instances. If you've never used Yocto before, we highly recommend getting acquainted with the project. A good place to start is the project's homepage here, where you can check out the Quick Start Guide here before continuing.

These recipes allow you to build a Yocto image that already has everything you need to use our maker guides.

Getting Yocto & recipes

From the quick start guide, if you haven't done this already:

Check out the latest sources of the poky and meta-intel repositories:

$ cd ~
$ mkdir source
$ cd source
$ git clone -b dizzy git://git.yoctoproject.org/poky
$ cd poky
$ git clone -b dizzy git://git.yoctoproject.org/meta-intel
$ git clone -b dizzy git://git.openembedded.org/meta-openembedded
$ git clone -b dizzy git://git.yoctoproject.org/meta-intel-iot-middleware
$ git clone -b dizzy https://github.com/MinnowBoard/meta-maker.git

Note: Please replace dizzy with daisy if you want to use the older release of Yocto project.

Prepare for build

Start off by initializing the build environment:

$ source oe-init-build-env

When building recipes, Yocto treats each package as another "layer" added on the existing build. Using a bitbake layer configuration file, you can tell the builder where to pull recipes from. These commands will add those configuration lines to the bitbake layers file, so they'll be included in our next build.

$ echo "BBLAYERS += \"$HOME/source/poky/meta-intel\"" >> conf/bblayers.conf
$ echo "BBLAYERS += \"$HOME/source/poky/meta-maker\"" >> conf/bblayers.conf
$ echo "BBLAYERS += \"$HOME/source/poky/meta-openembedded/meta-python\"" >> conf/bblayers.conf
$ echo "BBLAYERS += \"$HOME/source/poky/meta-openembedded/meta-oe\"" >> conf/bblayers.conf
$ echo "BBLAYERS += \"$HOME/source/poky/meta-openembedded/meta-networking\"" >> conf/bblayers.conf
$ echo "BBLAYERS += \"$HOME/source/poky/meta-intel-iot-middleware\"" >> conf/bblayers.conf

Another file, local.conf, has all local user setting for the builder. We need to specify a few things here for a successful build. This command specifies the machine architecture we're building for on the MinnowBoard. Use this one for a 32-bit machine:

$ echo "MACHINE = \"intel-core2-32\"" >> conf/local.conf

Or this one for a 64-bit machine:

$ echo "MACHINE = \"intel-corei7-64\"" >> conf/local.conf

These commands add the extra configuration needed for our maker build

$ echo "CORE_IMAGE_EXTRA_INSTALL += \"kernel-dev\"" >> conf/local.conf
$ echo "CORE_IMAGE_EXTRA_INSTALL += \"maker\"" >> conf/local.conf
$ echo "MACHINE_EXTRA_RRECOMMENDS += \"kernel-module-low-speed-spidev"\" >> conf/local.conf
$ echo "MACHINE_FEATURES_BACKFILL_CONSIDERED += \"rtc"\" >> conf/local.conf

Finally, this command gives us all the additional utilities to do development on the board

$ echo "EXTRA_IMAGE_FEATURES = \"debug-tweaks package-management dev-pkgs tools-sdk dev-pkgs\"" >> conf/local.conf

Now you're ready to run the build. The build process consumes most of your system's resources and can take a long time, especially on slower machines. To initiate the build, run

$ bitbake maker-image

Installation Media

In order to boot from the image, install it to a bootable device, such as an SD card, USB stick, or other storage media that you can connect to the MinnowBoard. The Yocto project files come with scripts to help you create a bootable device.

USB

If using a USB stick, insert it into your machine find out where it is mounted on your filesystem:

$ dmesg
# ... long list of stuff ...
[ 4448.293397] usb 4-1.3: USB disconnect, device number 4
[ 4755.000166] usb 4-1.2: new high-speed USB device number 5 using ehci-pci
[ 4755.093404] usb 4-1.2: New USB device found, idVendor=0781, idProduct=5580
[ 4755.093409] usb 4-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4755.093412] usb 4-1.2: Product: Extreme
[ 4755.093415] usb 4-1.2: Manufacturer: SanDisk
[ 4755.093418] usb 4-1.2: SerialNumber: AA010222141006580864
[ 4755.093911] usb-storage 4-1.2:1.0: USB Mass Storage device detected
[ 4755.094127] scsi8 : usb-storage 4-1.2:1.0
[ 4756.092695] scsi 8:0:0:0: Direct-Access     SanDisk  Extreme          0001 PQ: 0 ANSI: 6
[ 4756.093206] sd 8:0:0:0: Attached scsi generic sg3 type 0
[ 4756.093841] sd 8:0:0:0: [sdd] 61282631 512-byte logical blocks: (31.3 GB/29.2 GiB)
[ 4756.094786] sd 8:0:0:0: [sdd] Write Protect is off
[ 4756.094791] sd 8:0:0:0: [sdd] Mode Sense: 33 00 00 08
[ 4756.095787] sd 8:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 4756.107725]  sdd:
[ 4756.110829] sd 8:0:0:0: [sdd] Attached SCSI disk

You'll probably see something like this entry in your output. Be sure to note which device (sdX, with X being the value to look for) the drive is mounted to.

Once you know, you can run the setup script. Be sure to replace the "/dev/sdd" in the second line to reflect what your system told you.

$ sudo ~/source/poky/scripts/contrib/mkefidisk.sh \
/dev/sdd \
~/source/poky/build/tmp/deploy/images/intel-corei7-64/maker-image-intel-corei7-64.hddimg \
/dev/sda

Once you've run this command, you'll see output that looks something like this:

Image details
    image: '/home/evansteele/source/poky/build/tmp/deploy/images
     /intel-corei7-64/maker-image-intel-corei7-64.hddimg' -> 'maker-image-intel-corei7-64-20150731201241.hddimg'
     size: 1341833216 bytes
     modified: 2015-07-31 13:51:38.535839933 -0700
     type: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "SYSLINUX", 
     sectors/cluster 8, Media descriptor 0xf8, 
     sectors/track 32, heads 64, sectors 2620768 (volumes > 32 MB) , 
     FAT (32 bit), sectors/FAT 2555, serial number 0x55bbd7d8, label: "boot       "

Device details
  device: /dev/sdd
  vendor: SanDisk 
   model: Extreme         
    size: 31376707072 bytes

Prepare EFI image on /dev/sdd [y/N]?

Review the device details to make sure they match your USB. You don't want to overwrite your hard drive! If everything is correct, press y and enter. The image write process can take up to 20 minutes.

SD Card

You can also use an Mini-SD card for the MinnowBoard. You'll likely need a converter card of some sort to use it in most card readers, but anything will work as long as you can read/write to the card from your build machine.

The process is very similar to the SD card, but you'll want to change an argument in the script to tell the Minnowboard that you're booting from an SD card. If you run dmesg when you plug in an SD card, you may see something like this:

[ 7472.100618] mmc2: new high speed SDHC card at address 0007
[ 7472.102257] mmcblk0: mmc2:0007 SD08G 7.42 GiB 
[ 7472.110985]  mmcblk0: p1 p2 p3

As you can see, the device is identified as mmcblk0, which is what we'll want for the Minnowboard. Additionally, the device will be mounted in /dev/sd* so make sure you note that as well from dmesg. In this case, it's mounted to /dev/sdf This would make our new command look something like this:

$ sudo ~/source/poky/scripts/contrib/mkefidisk.sh \
/dev/sdf \
~/source/poky/build/tmp/deploy/images/intel-corei7-64/maker-image-intel-corei7-64.hddimg \
/dev/mmcblk0

You'll get another confirmation message, so review the SD card information so that it matches what you're expecting. If everything checks out, enter 'y' and press ENTER to start building an image for your SD card.

Booting

Now you'll need to boot into your new operating system. Insert your SD card, USB or other installation media into the Minnowboard and boot the device. Accessing the device can be done through a monitor or through an FTDI cable.

Whichever method you choose, if you've done it correctly, you'll see this screen in the UEFI shell:

UEFI Interactive Shell v2.1
EDK II
UEFI v2.40 (EDK II, 0x00010000)
Mapping table
      FS0: Alias(s):HD7a0b:;BLK1:
          PciRoot(0x0)/Pci(0x14,0x0)/USB(0x0,0x0)/HD(1,MBR,0x3F6F7313,0x800,0x9000)
     BLK0: Alias(s):
          PciRoot(0x0)/Pci(0x14,0x0)/USB(0x0,0x0)
     BLK2: Alias(s):
          PciRoot(0x0)/Pci(0x14,0x0)/USB(0x0,0x0)/HD(2,MBR,0x3F6F7313,0x9800,0x6E9800)
     BLK3: Alias(s):
          PciRoot(0x0)/Pci(0x14,0x0)/USB(0x0,0x0)/HD(3,MBR,0x3F6F7313,0x6F3000,0x5D800)
Press ESC in 1 seconds to skip startup.nsh or any other key to continue.
Shell> 

At this point, just enter this command to start the boot procedure:

Video Cable

You'll need an HDMI to micro-HDMI converter or cable to connect the Minnowboard to a monitor. Booting the Minnowboard will cause a UEFI shell to appear on your screen, so you'll need to connect a USB keyboard to use it.

FTDI

You can also interface with the Minnowboard through the serial connection. You'll need an FTDI to USB cable. You can find one here as an example. Connect it to your USB port on your PC and the FTDI pins on the Minnow, which are the pins in the picture below.

MinnowBoardMAX-A2-angled-top ftdi.png

Linux: Minicom

You'll want to use Minicom on Linux to connect to your device over the FTDI connection. Start Minicom in configuration mode:

$ sudo minicom -s

Select "Serial port setup" from the list and change the options so that they mirror these:

    +-----------------------------------------------------------------------+
    | A -    Serial Device      : /dev/ttyUSB0                              |
    |                                                                       |
    | C -   Callin Program      :                                           |
    | D -  Callout Program      :                                           |
    | E -    Bps/Par/Bits       : 115200 8N1                                |
    | F - Hardware Flow Control : No                                        |
    | G - Software Flow Control : Yes                                       |
    |                                                                       |
    |    Change which setting?                                              |
    +-----------------------------------------------------------------------+

Exit Minicom and restart it, then power on the Minnowboard.