Yocto kirkstone image for BeagleBone Black
Build
Install dependencies
sudo apt-get install bc build-essential chrpath diffstat gawk git libncurses5-dev pkg-config socat subversion texi2html texinfo u-boot-tools liblz4-tool
Clone yocto repo
Source build env
Build minimal image
Setup sd card
1. make sure that sd card is empty
2. lsblk
sdc 8:32 1 58G 0 disk
3. if not, sudo cfdisk /dev/sdc -> delete all partitions and write
4. eject the sd card and connect back in, check that the card is empty
Flash image to beaglebone
cd tmp/deploy/images/beaglebone-yocto
sudo dd if=core-image-full-cmdline-beaglebone-yocto.wic of=/dev/sdc bs=4M
Bootup linux
Eject sd card, connect it to beaglebone
Open serial console:
gtkterm -p /dev/ttyUSB0 -s 115200
Press and hold the button near the sd card slot to boot from sd card, power up the beaglebone
Create extenesible sdk
Install SDK
Set executable if it isn't already and run the script
# set executable if it isn't already and run the script
chmod +x tmp/deploy/sdk/poky-glibc-x86_64-core-image-full-cmdline-cortexa8hf-neon-beaglebone-yocto-toolchain-ext-4.0.9.sh
./tmp/deploy/sdk/poky-glibc-x86_64-core-image-full-cmdline-cortexa8hf-neon-beaglebone-yocto-toolchain-ext-4.0.9.sh
To change the install directory
./tmp/deploy/sdk/poky-glibc-x86_64-core-image-full-cmdline-cortexa8hf-neon-beaglebone-yocto-toolchain-ext-4.0.9.sh -d /my/path/here
SDK Usage
source /home/ton/beaglebone_os/sdk/test_sdk_full/environment-setup-cortexa8hf-neon-poky-linux-gnueabi
Add recipe to the target image
On target, htop missing
Add new recipe to the sdk
Try to build the recipe
Edit recipe
# Fix recipe by adding 'FILES:${PN} += "/usr/share/icons"' or in older yocto versions 'FILES_${PN} += "/usr/share/icons"'
devtool edit-recipe htop
Deploy to the target
Run new package on target device
At this point the binary is on the target, but shared libraries are missing
root@beaglebone-yocto:~# htop
htop: error while loading shared libraries: libnl-3.so.200: cannot open shared object file: No such file or directory
root@beaglebone-yocto:~#
If the recipe depends on other packages ( for example in htop: DEPENDS = "systemd libcap libnl xz" ) that are not on the target device yet, image needs to be built and deployed to target. Sdk gets updated with workdir recipe and it's dependencies, so the image can be built with devtool
Alternatively, you can copy the runtime libs to the target: On the target, find out where the binary is located
Cd to target root
Source sdk, if not sourced already
Find dependencies
for file in $(arm-poky-linux-gnueabi-readelf -a /usr/bin/htop | \
grep "Shared library" | \
sed -nr '/Shared library:/ s/.*Shared library:([^"]+).*/\1/p' | \
tr -d "[]"); \
do name=$(echo $file | cut -d '.' -f 1) && find /home/ton/beaglebone_os/build/tmp/sysroots-components/cortexa8hf-neon -name $name.*; \
done \
> dependencies.txt
Copy libs to target
Htop should now be usable on the target
CPU[|||||| 7.1%] Tasks: 29, 1 thr, 64 kthr; 1 running
Mem[|||||||||||||| 30.1M/488M] Load average: 0.89 0.23 0.08
Swp[ 0K/0K] Uptime: 00:00:39
[Main] [I/O]
PID USER PRI NI VIRT RES SHR S CPU%-MEM% TIME+ Command
210 root 20 0 4036 3116 2356 R 2.6 0.6 0:00.22 htop
1 root 20 0 10076 7188 5788 S 0.6 1.4 0:04.44 /sbin/init
184 messagebus 20 0 4932 3116 2804 S 0.6 0.6 0:00.31 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activati
133 rpc 20 0 3936 2248 2020 S 0.0 0.4 0:00.03 /usr/sbin/rpcbind -w -f
Apply the recipe to source tree