This post describes a procedure to generate a Linux SD card image for RIoTboard using Yocto on an openSUSE 13.2 x86_64 host. This procedure is just a clone of the excellent procedure documented by Bryan Hinton (referred to below as B.H. for brevity) with a handful of alterations to accommodate a different host OS, more modest host hardware, minor changes in the resulting Yocto build and one or two issues peculiar to my combination of hardware and software. Bryan's document enumerates the features of this particular Yocto build and should be consulted prior to reading the procedure below:
https://community.freescale.com/docs/DOC-103530
The procedure described below was motivated in part by a desire to see if a RIoTboard build environment for Linux could be created in openSUSE 13.2 as this is the distribution on all of my modern computers. The procedure was also motivated by a desire to come up with an alternative to the Yocto-generated Linux 3.10.17 image provided at riotboard.org since that image causes my RIoTboard to hang when using an HDMI-to-DVI cable for video output (the available Android and Linux 3.0.35 images produce proper video output).
Conventions
In an effort to make it clear where my procedure differs from that of B.H, I will use the same numbering scheme for corresponding sections in B.H.'s document. I will also make differing command lines or code bold in order to highlight changes.
1. Hardware and software prerequisites.
I used a Gateway NE56R12u laptop running openSUSE 13.2 x86_64 as the host machine. This laptop has a 2.1 GHz Intel B950 dual-core Pentium processor and 8 GB of physical memory. The OS partition has 40 GB, and the /home partition has 135 GB almost all of which was available prior to creating the build environment. Internet connection was 1.5 Mbps down/256 kbps up.
uname output for the host openSUSE 13.2 x86_64 OS is as follows:
stmorgan@linux-wdyv:~> uname -ia
Linux linux-wdyv.site 3.16.7-32-desktop #1 SMP PREEMPT Wed Jan 20 14:05:33 UTC 2016 (d4df98a) x86_64 x86_64 x86_64 GNU/Linux
2. Required Packages for a 64-bit openSUSE 13.2 Host development system.
I used the following commands to install the package list for openSUSE from the Yocto Project Mega Manual without changes:
sudo zypper install python gcc gcc-c++ git chrpath make wget python-xml
sudo zypper install diffstat makeinfo python-curses patch socat libSDL-devel xterm
3. Pull the Freescale community BSP platform source code from github.
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x $HOME/bin/repo
echo "PATH=$PATH:$HOME/bin" >> $HOME/.bashrc
source .bashrc
mkdir -p $HOME/src/fsl-community-bsp
cd $HOME/src/fsl-community-bsp
repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b fido
repo sync
4. Setup the build environment using the predefined imx6dl-riotboard machine.
MACHINE=imx6dl-riotboard . ./setup-environment build
5. Create a new layer for the custom Linux distribution.
cd $HOME/src/fsl-community-bsp/sources
mkdir -p meta-bsec/conf/distro
mkdir -p meta-bsec/recipes-bsec/images
cd poky/meta/recipes-extended/images
cp core-image-full-cmdline.bb ../../../../meta-bsec/recipes-bsec/images/bsec-image.bb
6. Customize the image in the meta-bsec layer.
cd $HOME/src/fsl-community-bsp/sources/meta-bsec/recipes-bsec/images
Edit bsec-image.bb as follows.
DESCRIPTION = "A console-only image with more full-featured Linux system \
functionality installed."
IMAGE_FEATURES += "dev-pkgs tools-sdk tools-debug tools-profile tools-testapps \
debug-tweaks splash ssh-server-openssh package-management"
IMAGE_INSTALL = "\
packagegroup-core-boot \
packagegroup-core-full-cmdline \
packagegroup-core-tools-profile \
packagegroup-core-buildessential \
kernel-modules \
${CORE_IMAGE_EXTRA_INSTALL} \
kernel-devsrc \
"
inherit core-image
# Add extra space to the rootfs image
IMAGE_ROOTFS_EXTRA_SPACE_append += "+ 3000000"
7. Create layer.conf file in the meta-bsec layer.
Create sources/meta-bsec/conf/layer.conf with the following contents:
BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "bsec"
BBFILE_PATTERN_bsec = "^${LAYERDIR}/"
BBFILE_PRIORITY_bsec = "6"
8. Create the distribution configuration file in the meta-bsec layer.
Create sources/meta-bsec/conf/distro/bsecdist.conf with the following contents:
require conf/distro/poky.conf
# distro name
DISTRO = "bsecdist"
DISTRO_NAME = "bsecdist distribution"
DISTRO_VERSION = "1.0"
DISTRO_CODENAME = "bsc"
DISTRO_FEATURES_append = " alsa usbhost usbgadget keyboard bluetooth"
SDK_VENDOR = "-bsecdistsdk"
SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}"
MAINTAINER = "bsecdist "
INHERIT += "buildhistory"
BUILDHISTORY_COMMIT = "1"
9. Add the new layer to bblayers.conf.
cd $HOME/src/fsl-community-bsp/build/conf
Edit bblayers.conf as follows.
LCONF_VERSION = "6"
BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"
BBFILES ?= ""
BBLAYERS = " \
${BSPDIR}/sources/poky/meta \
${BSPDIR}/sources/poky/meta-yocto \
\
${BSPDIR}/sources/meta-openembedded/meta-oe \
${BSPDIR}/sources/meta-openembedded/meta-multimedia \
\
${BSPDIR}/sources/meta-fsl-arm \
${BSPDIR}/sources/meta-fsl-arm-extra \
${BSPDIR}/sources/meta-fsl-demos \
${BSPDIR}/sources/meta-bsec \
"
10. Customize the local configuration.
Edit local.conf as follows:
MACHINE ??= 'imx6dl-riotboard'
DISTRO ?= 'bsecdist'
PACKAGE_CLASSES ?= "package_rpm package_deb"
EXTRA_IMAGE_FEATURES = " "
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K"
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
ASSUME_PROVIDED += "libsdl-native"
CONF_VERSION = "1"
BB_NUMBER_THREADS = '2'
PARALLEL_MAKE = '-j 2'
DL_DIR ?= "${BSPDIR}/downloads/"
ACCEPT_FSL_EULA = "1"
# archive source code for all of the packages that will be built into the image
INHERIT += "archiver"
ARCHIVER_MODE[src] = "original"
# ensure that license files accompany each binary in final image
COPY_LIC_MANIFEST = "1"
COPY_LIC_DIRS = "1"
# setup source mirror
# make sure that bitbake checks for all of the source tarballs in a local directory
# before going to the Internet to fetch them.
SOURCE_MIRROR_URL ?= "file://${BSPDIR}/source-mirror/"
INHERIT += "own-mirrors"
# create a shareable cache of source code management backends
BB_GENERATE_MIRROR_TARBALLS = "1"
As B.H. had a quad-core processor and a fast Internet connection, it made sense for him to increase the number of processes, but I just kept the defaults given my modest setup.
11. Execute the build.
cd $HOME/src/fsl-community-bsp/build
time bitbake bsec-image
Here is the build console output for the curious:
stmorgan@linux-wdyv:~/src/fsl-community-bsp/build> time bitbake bsec-image
WARNING: Host distribution "openSUSE-project-13.2" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Parsing recipes: 100% |#########################################| Time: 00:03:16
Parsing of 1603 .bb files complete (0 cached, 1603 parsed). 2088 targets, 140 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: multiple providers are available for jpeg (jpeg, libjpeg-turbo)
NOTE: consider defining a PREFERRED_PROVIDER entry to match jpeg
NOTE: multiple providers are available for jpeg-native (jpeg-native, libjpeg-turbo-native)
NOTE: consider defining a PREFERRED_PROVIDER entry to match jpeg-native
Build Configuration:
BB_VERSION = "1.26.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "openSUSE-project-13.2"
TARGET_SYS = "arm-poky-linux-gnueabi"
MACHINE = "imx6dl-riotboard"
DISTRO = "bsecdist"
DISTRO_VERSION = "1.0"
TUNE_FEATURES = "arm armv7a vfp thumb neon callconvention-hard cortexa9"
TARGET_FPU = "vfp-neon"
meta
meta-yocto = "(nobranch):528bdf528d8bfca7746543f61609b9aceb54d53b"
meta-oe
meta-multimedia = "(nobranch):a7c1a2b0e6947740758136216e45ca6ca66321fc"
meta-fsl-arm = "(nobranch):c9f259a4bf8472dfa3ff75f1c3fcbe5e0ded7aaf"
meta-fsl-arm-extra = "(nobranch):ad90ca98459f5de9483bb3ba5a81be0a67b078c3"
meta-fsl-demos = "(nobranch):17f9da65efb5c65c1d44b5cc18584034b29a742b"
meta-bsec = "<unknown>:<unknown>"
NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: Failed to fetch URL http://downloads.sourceforge.net/project/libpng/libpng16/1.6.16/libpng-1.6.16.tar.xz, attempting MIRRORS if available
WARNING: Failed to fetch URL ftp://ftp.freedesktop.org/pub/mesa/10.4.4/MesaLib-10.4.4.tar.bz2, attempting MIRRORS if available
WARNING: Failed to fetch URL http://www.apache.org/dist/apr/apr-1.5.1.tar.bz2, attempting MIRRORS if available
WARNING: Failed to fetch URL http://www.apache.org/dist/subversion/subversion-1.8.11.tar.bz2, attempting MIRRORS if available
WARNING: Failed to fetch URL http://www.cpan.org/authors/id/D/DM/DMEGG/SGMLSpm-1.03ii.tar.gz, attempting MIRRORS if available
WARNING: Failed to fetch URL http://downloads.sourceforge.net/levent/libevent-2.0.21-stable.tar.gz, attempting MIRRORS if available
WARNING: lttng-modules: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel.
WARNING: QA Issue: perf rdepends on liblzma, but it isn't a build dependency? [build-deps]
WARNING: log_check: There is a warn message in the logfile
WARNING: log_check: Matched keyword: [warn]
WARNING: log_check: warning: libstdc++-dev-4.9.2-r0@cortexa9hf_vfp_neon is already installed
WARNING: log_check: There is a warn message in the logfile
WARNING: log_check: Matched keyword: [warn]
WARNING: log_check: warning: gettext-dev-0.19.4-r0@cortexa9hf_vfp_neon is already installed
WARNING: log_check: There is a warn message in the logfile
WARNING: log_check: Matched keyword: [warn]
WARNING: log_check: warning: libgomp-dev-4.9.2-r0@cortexa9hf_vfp_neon is already installed
WARNING: log_check: There is a warn message in the logfile
WARNING: log_check: Matched keyword: [warn]
WARNING: log_check: warning: libc6-dev-2.21-r0@cortexa9hf_vfp_neon is already installed
WARNING: log_check: There is a warn message in the logfile
WARNING: log_check: Matched keyword: [warn]
WARNING: log_check: warning: libgcc-s-dev-4.9.2-r0@cortexa9hf_vfp_neon is already installed
WARNING: log_check: There is a warn message in the logfile
WARNING: log_check: Matched keyword: [warn]
WARNING: log_check: warning: libubsan-dev-4.9.2-r0@cortexa9hf_vfp_neon is already installed
WARNING: log_check: There is a warn message in the logfile
WARNING: log_check: Matched keyword: [warn]
WARNING: log_check: warning: libasan-dev-4.9.2-r0@cortexa9hf_vfp_neon is already installed
NOTE: Tasks Summary: Attempted 6410 tasks of which 18 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
Summary: There were 30 WARNING messages shown.
real 600m58.864s
user 596m9.764s
sys 93m20.155s
B.H.'s build took 4 hours, while mine took 10 hours. A subsequent re-build without changes took less than 90 minutes and only about 200 tasks needed execution as opposed to the 6410 required initially.
B.H. also enumerates a list of five files that define input specifications in this step. I made no changes to any of these files.
12. Write the GNU/Linux BSP image to an SD card.
This step was the only real hurdle in the entire process. The bottom line is that I was unable to get a dd command to create a usable SD card unless I deleted all partitions on the card prior to executing dd. The Partitioner tool in the YaST Control Center can be used to delete partitions on the SD card as needed in openSUSE.
lsblk --fs
cd $HOME/src/fsl-community-bsp/build/tmp/deploy/images/imx6dl-riotboard
sudo dd if=bsec-image-imx6dl-riotboard.sdcard of=/dev/sdb bs=1M
sudo sync
The lsblk command is used to insure that the SD card has no partitions (partitions would show up as sdb1, sdb2, etc.).
13. Set the physical switches on the RioTboard to boot from the uSD or SD card.
I was using an SD card, so I set the switches accordingly (1 0 1 0 0 1 0 1).
14. Connect the target to the necessary peripherals for boot.
Since the Yocto-generated Linux 3.10.17 image did not produce usable video or boot on my board, I made a point of creating a serial connection to the RIoTboard J18 port in addition to connecting the HDMI-to-DVI cable, and that setup is documented here:
I was pleasantly surprised to find that the openSUSE BSP image not only booted, it generated the proper video output on the HDMI-to-DVI cable as well. In addition to a USB keyboard and mouse, I connected a microphone/headphone set with 3.5mm connectors to test the RIoTboard audio input/output.
15. Test audio recording, audio playback, and Internet connectivity.
Type root to log in to the target. The root password is not set.
Execute the following command on the RIoTboard:
alsamixer
Press F6.
Press arrow down so that 0 imx6-riotboard-sgtl5000 is highlighted.
Press Enter.
Increase Headphone level to 79<>79.
Increase PCM level to 75<>75.
Press Tab.
Increase Mic level to 59.
Increase Capture to 80<>80.
Press Esc.
At this point B.H. used sample sounds available in the build to test the audio output, but these samples are not present in the latest build. I therefore skipped this step and proceeded to the microphone test since it actually tests both recording and playback of .WAV files.
cd /usr/share/alsa
mkdir tmp
cd tmp
arecord -d 10 micintest.wav
Talk into the microphone for ten seconds.
aplay micintest.wav
You should hear your recording played through the headphones.
ping riotboard.org
You should get an ICMP reply.
root@imx6dl-riotboard:~# uname -ia
Linux imx6dl-riotboard 4.1.2-fslc+g95d9e15 #1 SMP Sat Feb 13 02:40:39 EST 2016 armv7l GNU/Linux
Conclusion
openSUSE 13.2 can be used to create a Linux BSP for the RIoTboard using Yocto and Bryan Hinton's procedure as a basis. If you have been disappointed by the lack of a pre-built Yocto Linux image, I would encourage you to set up a build environment in your Linux distribution (whatever it may be) and create your own BSP, assuming you have the necessary memory and disk space.