Skip to content

Instantly share code, notes, and snippets.

@kapare
Created December 11, 2015 18:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kapare/6b5f1f1ca4c5b3e570c2 to your computer and use it in GitHub Desktop.
Save kapare/6b5f1f1ca4c5b3e570c2 to your computer and use it in GitHub Desktop.

Create Yocto custom distro for NUC.

Here a summary of Yocot Project Mega-Manual adapted for the NUC.

mkdir nuc
cd nuc
git clone git://git.yoctoproject.org/poky
cd poky
git checkout -b jethro origin/jethro
git clone git://git.yoctoproject.org/meta-intel
cd meta-intel/
git checkout -b jethro origin/jethro
cd ../..

Next command will change directory to build and creates config files.

source poky/oe-init-build-env

Automatic way to add new layer

Here an example to meta-intel layer.

bitbake-layers add-layer "/home/knight/SSD120/nuc/poky/meta-intel/"

Manual way to add layer

vim conf/bblayers.conf

Here an example where to add the meta-intel layer.

LCONF_VERSION = "6"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /home/knight/SSD120/nuc/poky/meta \
  /home/knight/SSD120/nuc/poky/meta-yocto \
  /home/knight/SSD120/nuc/poky/meta-yocto-bsp \
  /home/knight/SSD120/nuc/poky/meta-intel \
  "
BBLAYERS_NON_REMOVABLE ?= " \
  /home/knight/SSD120/nuc/poky/meta \
  /home/knight/SSD120/nuc/poky/meta-yocto \
  "

Manual way to change the MACHINE

vim conf/local.conf

Replace:

#MACHINE ??= "qemux86"
MACHINE ??= "intel-corei7-64"

Build the OS

bitbake core-image-sato-dev

Create the image

We will use the OpenEmbedded Image Creator, wic. To list available images formats that are supported:

wic list images

Some native package need to be installed before we can create the image:

bitbake parted-native

To create the image for the sato-dev:

wic create mkefidisk -e core-image-sato-dev

The result from this command will specify the path were the image have been created.

Checking basic build environment...
Done.

Creating image(s)...

Info: The new image(s) can be found here:
  /var/tmp/wic/build/mkefidisk-201512101939-sda.direct

The following build artifacts were used to create the image(s):
  ROOTFS_DIR:                   /home/knight/SSD120/nuc/build/tmp/work/intel_corei7_64-poky-linux/core-image-sato-dev/1.0-r0/rootfs
  BOOTIMG_DIR:                  /home/knight/SSD120/nuc/build/tmp/work/intel_corei7_64-poky-linux/core-image-sato-dev/1.0-r0/core-image-sato-dev-1.0/hddimg
  KERNEL_DIR:                   /home/knight/SSD120/nuc/build/tmp/deploy/images/intel-corei7-64
  NATIVE_SYSROOT:               /home/knight/SSD120/nuc/build/tmp/sysroots/x86_64-linux


The image(s) were created using OE kickstart file:
  /home/knight/SSD120/nuc/poky/scripts/lib/wic/canned-wks/mkefidisk.wks

In this case:

/var/tmp/wic/build/mkefidisk-201512101939-sda.direct

Extra Geeky Home Made List USB Device command:

alias ldu='echo;echo "LIST OF USB DISK DEVICE";DevList=`cat /proc/partitions | grep sd[a-z]$ | awk '\''{print $4}'\''`;for device in ${DevList};do ID_BUS=`udevadm info --query=all --path=/sys/block/${device} | grep ID_BUS | cut -d'=' -f2-`;ID_TYPE=`udevadm info --query=all --path=/sys/block/${device} | grep ID_TYPE | cut -d'=' -f2-`;VID=`udevadm info --query=all --path=/sys/block/${device} | grep ID_VENDOR_ID | cut -d'=' -f2-`;MID=`udevadm info --query=all --path=/sys/block/${device} | grep ID_MODEL_ID | cut -d'=' -f2-`;if [[ ${ID_BUS} == "usb" && ${ID_TYPE} == "disk" ]]; then DESC=`lsusb -d ${VID}:${MID}`;echo "[ /dev/${device} ] - ${DESC}";fi;done;echo'

Faster Flashing

To speed up in half the time the copy of the image to the destination we use. The bmap-tools create a map of files and empty spaces of an image. Using this information, it can avoid spending time on writing 0s. bitmap-tools

IMAGE_PATH=/var/tmp/wic/build/mkefidisk-201512101939-sda.direct
bmaptool create $IMAGE_PATH > /tmp/image.bmap
sudo bmaptool copy --bmap /tmp/image.bmap $IMAGE_PATH /dev/sdd

Booting USB key on the NUC

NOTE: Successful attempt was made to boot the NUC with USB key and Yocto Desktop image was started.

NOTE: The apple keyboard, apple mouse and the touchscreen were not working.

NOTE: There was a conflict at the boot between rootfs partition from SSD and USB key. Disabling the SATA was required to boot properly with USB.

NOTE: There was issue when trying to boot again with SATA and Ubuntu. The SATA boot partition is not visible anymore!!!

@coderbusy7
Copy link

coderbusy7 commented Jul 24, 2020

Hi ,
Thanks for the tutorial.
I'm trying to create a yocto image for INTEL E8000 board with a touchscreen.
I followed the above steps but it seems like the boot stucks with a message systemctl manager failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment