platisd / meta-dimitriOS

A BitBake layer for my Linux based projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

meta-dimitriOS

A BitBake layer for my Linux based projects.

What

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.

Why

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:

  1. A step may be omitted from the documentation
  2. Dependencies and operating systems change
  3. 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.

How

To create a dimitriOS image you need to decide:

  1. The hardware you are going to run your system on
  2. The software image you want to use

Supported hardware

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

Available images

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

How-to: Build a dimitriOS image

  1. Install the host dependencies necessary for the Yocto build
    1. 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
  2. Get the repo tool to fetch the sources
    1. mkdir ~/bin
    2. PATH=~/bin:$PATH
    3. curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    4. chmod a+x ~/bin/repo
  3. Create a dimitriOS directory for the build
    1. mkdir dimitriOS && cd dimitriOS
  4. Choose the dimitriOS manifest that includes the BSP for your board and load the respective board configuration. E.g. For Raspberry Pi boards:
    1. repo init -u https://github.com/platisd/dimitriOS-manifest.git -m dimitriOS-rpi.xml
    2. export TEMPLATECONF=~/dimitriOS/layers/meta-dimitriOS/rpi-conf/
  5. Fetch the source code
    1. repo sync
  6. Source the build environment
    1. . layers/poky/oe-init-build-env build
  7. Select the particular board you are targetting. E.g. For Raspberry Pi 4:
    1. export MACHINE=raspberrypi4
  8. . Build the image for the particular board. E.g. For Cryptopuck:
    1. bitbake cryptopuck-image

To rebuild an image using a new shell session, repeat the last three steps.

Yocto workshop

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.

Set SSID and password for wpa_supplicant.conf during build

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 variable
    • export 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.

Compile Arduino sketches in Yocto

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.

About

A BitBake layer for my Linux based projects

License:MIT License


Languages

Language:BitBake 100.0%