A BitBake layer for my Linux based projects.
This is a Bitbake layer that includes recipes for my different Linux-based projects.
It is tested to work with Yocto zeus
but may work with other versions as well.
Whenever I am work on a hobby project that involves Linux, I used to follow the
golden image
approach, which involves getting the latest prebuilt image at the time (e.g. Raspbian
),
installing the various dependencies and once everything is right, I
document them as accurately as possible.
Unfortunately, this approach has several issues, including but not limited to:
- A step may be omitted from the documentation
- Dependencies and operating systems change
- It takes time for persons to precisely reproduce each step
To tackle these problems, Yocto Project is used to build
a Linux distribution that includes, in a standardized and repeatable manner, the necessary
software.
Additionally, dimitriOS
is a way to experiment with creating configurable platforms for
embedded Linux systems.
To create a dimitriOS
image you need to decide:
- The hardware you are going to run your system on
- The software image you want to use
If there is a Yocto Board Support Package (BSP) for the board you are interested in, then
you should be able to run dimitriOS
images on it.
Currently, the supported boards are:
Board | MACHINE |
---|---|
Raspberry Pi | raspberrypi |
Raspberry Pi Zero | raspberrypi0 |
Raspberry Pi Zero Wifi | raspberrypi0-wifi |
Raspberry Pi 2 | raspberrypi2 |
Raspberry Pi 3 | raspberrypi3 |
Raspberry Pi 4 | raspberrypi4 |
Raspberry Pi Compute Module | raspberrypi-cm |
Raspberry Pi 3 Compute Module | raspberrypi-cm3 |
To support different use cases for our Linux distribution, we have different images. Unlike the software running on your laptop or mobile device at the moment, this one has a very specific purpose and does not come with additional software.
Currently, there are images for the following projects:
Project | Recipe |
---|---|
Cryptopuck | cryptopuck-image |
VasttraPi | vasttrapi-image |
Yocto workshop | workshop-image |
- Install the host dependencies necessary for the Yocto build
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
pylint3 xterm
- Get the repo tool to fetch the sources
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
- Create a
dimitriOS
directory for the buildmkdir dimitriOS && cd dimitriOS
- Choose the
dimitriOS
manifest that includes the BSP for your board and load the respective board configuration. E.g. For Raspberry Pi boards:repo init -u https://github.com/platisd/dimitriOS-manifest.git -m dimitriOS-rpi.xml
export TEMPLATECONF=~/dimitriOS/layers/meta-dimitriOS/rpi-conf/
- Fetch the source code
repo sync
- Source the build environment
. layers/poky/oe-init-build-env build
- Select the particular board you are targetting. E.g. For Raspberry Pi 4:
export MACHINE=raspberrypi4
- . Build the image for the particular board. E.g. For Cryptopuck:
bitbake cryptopuck-image
To rebuild an image using a new shell session, repeat the last three steps.
dimitriOS
is also used to give an introduction to Yocto for beginners.
To build the image demonstrated during the workshop, you should follow the
previous steps and in the final step, run: bitbake workshop-image
.
If you want to avoid version controlling your WiFi credentials, you can set them during build-time using environment variables.
- Set or export two environment variables containing your credentials
export WIFI_SSID=your-ssid
export WIFI_PASSWORD=your-password
- Register them via the
BB_ENV_EXTRAWHITE
variableexport BB_ENV_EXTRAWHITE="WIFI_SSID WIFI_PASSWORD"
- Build
workshop-image
bitbake workshop-image
If you are making your own image, don't forget to include wifi-autoconnect
in your image.
Using arduino-cli
we can compile Arduino sketches during the Yocto build that will end up
on the target filesystem and can be flashed to a connected microcontroller during runtime.
Check out smartcar-mqtt for the corresponding resources and documentation.