Skip to content


Run the image inside a emulator

devtool build-image
runqemu beaglebone-yocto

Edit recipe sources

bitbake -c devshell <recipe>

Add new local recipe to sdk

devtool add hello-world /home/ton/beaglebone_os/hello_world

Run qemu in same window

runqemu beaglebone-yocto nographic

Remove packages from target

devtool undeploy-target htop root@

Remove recipe from workdir

ton@mx-5:~/beaglebone_os/sdk/iftop$ devtool reset iftop
NOTE: Starting bitbake server...
INFO: Cleaning sysroot for recipe iftop...
INFO: Leaving source tree /home/ton/beaglebone_os/sdk/test_sdk_full/workspace/sources/iftop as-is; if you no longer need it then please delete it manually
sudo rm -r /home/ton/beaglebone_os/sdk/test_sdk_full/workspace/sources/iftop

Debug recipe build errors in SDK workdir

cd sdk_path/workspace/sources/bwm-ng
C=arm-poky-linux-gnueabi ./configure --host=arm-poky-linux-gnueabi # or CC=..

Publish new SDK update

oe-publish-sdk tmp/deploy/sdk/ ~/beaglebone_os/sdk/updated-sdk

Update SDK

devtool sdk-update URL

Increase rootfs size

# Before
root@beaglebone-yocto:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       189M  169M  5.6M  97% /

# Expand rootfs by 5GB in conf/local.conf

# After
root@beaglebone-yocto:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       6.5G  122M  6.0G   2% /


Enable tests

Add to conf/local.conf:

# Enable automated tests
INHERIT += "testimage"
TEST_SUITES = "ping ssh df syslog scp vnc date dmesg example " # note example-test case here
BBPATH += " ${TOPDIR}/../sources/meta-bbb/lib/oeqa/runtime/cases"

Autorun tests


Edit local.conf and add line:


Edit /etc/sudoers file, and add:

# Enable qemu wihout sudo
ton ALL = NOPASSWD: /home/ton/beaglebone_os/poky/scripts/runqemu-ifup

Configure tap interface:

sudo /home/ton/beaglebone_os/poky/scripts/runqemu-gen-tapdevs 1000 1000 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin

Build qemu-helper package:

bitbake qemu-helper-native

Install dependencies on host:

sudo apt install sysstat iproute2

Run tests:

bitbake core-image-full-cmdline -c testimage

Add custom tests

Create a folder for test cases. Test cases has to be under < layer >/lib/oeqa/runtime/cases because they extend core's test cases

mkdir -p ~/beaglebone_os/sources/meta-bbb/lib/oeqa/runtime/cases

Create empty init file

touch ~/beaglebone_os/sources/meta-bbb/lib/oeqa/runtime/cases/

Create test case. Has to be same name than the recipe itself

touch ~/beaglebone_os/sources/meta-bbb/lib/oeqa/runtime/cases/

Make sure that the custom layer is in conf/local.conf BBLAYERS field

ton@mx-5:~/beaglebone_os$ grep -A 10 "BBLAYERS ?=" build/conf/bblayers.conf 
  /home/ton/beaglebone_os/poky/meta \
  /home/ton/beaglebone_os/poky/meta-poky \
  /home/ton/beaglebone_os/poky/meta-yocto-bsp \
  /home/ton/beaglebone_os/poky/meta-openembedded/meta-oe \
  /home/ton/beaglebone_os/sources/meta-bbb \ " # <--

Create a test recipe, which will create a few files

ton@mx-5:~/beaglebone_os$ tree sources/meta-bbb/recipes-example/example/
└── files
    ├── example.cpp
    └── LICENSE

1 directory, 3 files

Example recipe:

ton@mx-5:~/beaglebone_os/build$ cat /home/ton/beaglebone_os/sources/meta-bbb/recipes-example/example/ 
SUMMARY = "bitbake-layers recipe"
DESCRIPTION = "Recipe created by bitbake-layers"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d41d8cd98f00b204e9800998ecf8427e"

SRC_URI += " file://example.cpp "

S = "${WORKDIR}"


do_compile() {
    ${CXX} -Wall -g example.cpp -o example

do_install() {
    # Install example binary
    install -d ${D}${bindir}
    install -m 0755 ${S}/example ${D}${bindir}

    # Install test file
    install -d ${D}/etc
    touch ${D}/etc/test.txt

FILES_${PN} += "/etc/test.txt"

Example test case:

ton@mx-5:~$ cat ~/beaglebone_os/sources/meta-bbb/lib/oeqa/runtime/cases/ 
from import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends

class ExampleTest(OERuntimeTestCase):
    def test_files_exists(self):
        (status, output) ="ls -lai /etc/test.txt")
        self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))

        (status, output) ="ls -lai /usr/bin/example")
        self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))

Test results after running

RESULTS - date.DateTest.test_date: PASSED (10.40s)
RESULTS - df.DfTest.test_df: PASSED (1.12s)
RESULTS - ping.PingTest.test_ping: PASSED (0.01s)
RESULTS - scp.ScpTest.test_scp_file: PASSED (4.74s)
RESULTS - ssh.SSHTest.test_ssh: PASSED (1.98s)
RESULTS - example.ExampleTest.test_file_exists: PASSED (0.91s) # <- Our test case
core-image-full-cmdline () - Ran 6 tests in 19.166s
core-image-full-cmdline - OK - All required tests passed (successes=6, skipped=0, failures=0, errors=0)
NOTE: Tasks Summary: Attempted 768 tasks of which 767 didn't need to be rerun and all succeeded.

Intentionally breaking the test case results in a failed test run:

ton@mx-5:~/beaglebone_os/build$ grep -inr "usr/bin/" /home/ton/beaglebone_os/sources/meta-bbb/lib/oeqa/runtime/cases/
9:        (status, output) ="ls -lai /usr/bin/examle") # Looking for file 'examle', instead of 'example'

Traceback (most recent call last):
  File "/home/ton/beaglebone_os/sources/meta-bbb/lib/oeqa/runtime/cases/", line 10, in test_files_exists
    self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
AssertionError: 2 != 0 : status and output: 2 and ls: cannot access '/usr/bin/examle': No such file or directory


RESULTS - example.ExampleTest.test_files_exists: FAILED (1.76s)
core-image-full-cmdline () - Ran 6 tests in 19.922s
core-image-full-cmdline - FAIL - Required tests failed (successes=5, skipped=0, failures=1, errors=0)


Fix 'Exit code 137'

# Yocto build error stops unexpectedly:
yocto WARNING: exit code 137 from a shell command.

# Running out of memory
Confirm from dmesg

# Reboot PC, buy more RAM

Fix 'NOTE: Reconnecting to bitbake server' error

rm bitbake.lock
# or kill the other bitbake process