Giter VIP home page Giter VIP logo

edi-var's Introduction

edi Project Configuration for Variscite Boards

This edi project configuration currently supports the Variscite var-som-mx8m-nano on the Symphony-Board.

var-som-mx8m-nano

Note

The master branch is currently basing upon Debian bookworm. For Debian bullseye please check out the debian_bullseye branch.

Introduction

The edi configuration contained in this repository can be used to generate the following artifacts:

  • A minimal (e.g. no display, no sound) Debian bookworm arm64 (64bit) image suitable for the Variscite var-som-mx8m-nano.
  • A matching Mender update artifacts for the above configuration.
  • An LXD container with a pre-installed cross development toolchain (arm64) for C and C++.

Important Note

Please note that image generation operations require superuser privileges, and therefore you can easily break your host operating system. Therefore, make sure that you have a backup copy of your data.

Basic Usage

Preparation

Prior to using this edi project configuration you have to install edi according to this instructions. Please take a careful look at the "Setting up ssh Keys" section since you will need a proper ssh key setup in order to access the container or the target device using ssh.

The image post-processing commands require some additional tools. On Ubuntu 20.04 and newer those tools can be installed as follows:

sudo apt install e2fsprogs bmap-tools mtools parted rsync zerofree python3-sphinx mender-artifact

Creating a Target Image

A target image can be created using the following command:

sudo edi -v image create var-som-mx8m-nano.yml

The resulting image can be copied to a SD card (here /dev/mmcblk0) using the following command (Please note that everything on the SD card will be erased!):

sudo bmaptool copy artifacts/var-som-mx8m-nano.img /dev/mmcblk0

If the command fails, unmount the SD card and repeat the above command.

Once you have booted the device using this SD card you can access it using ssh (the access should be granted thanks to to your ssh keys):

ssh variscite@IP_ADDRESS

The password for the user variscite is variscite (just in case you want to execute a command using sudo or login via a local terminal).

Flashing the Image to the eMMC

The same image that has been used for the SD card can also be flashed to the builtin eMMC as follows:

Copy the image to the device that has been booted from the SD card:

scp artifacts/var-som-mx8m-nano.img variscite@IP_ADDRESS:

Access the device:

ssh variscite@IP_ADDRESS

Flash the image to the eMMC (Everything on mmcblk2 will be erased!):

sudo dd if=var-som-mx8m-nano.img of=/dev/mmcblk2 bs=1M

Now you can switch the device off and toggle the "BOOT SELECT" switch from "SD" to "INT". When powering up the device again, it should boot the new image from the eMMC storage device.

Connecting to Mender

To enable over the air (OTA) updates, the generated images are configured to connect to https://hosted.mender.io/. In order to connect to your Mender tenant you have to provide your tenant token prior to building the images. The tenant token can be added to configuration/mender/mender.yml. If you do not want to add the tenant token to the version control system you can also copy configuration/mender/mender.yml to configuration/mender/mender_custom.yml and add the tenant token there.

Creating a Cross Development LXD Container

A cross development container can be created using the following command:

sudo edi -v lxc configure var-som-mx8m-nano-cross-dev-bookworm var-som-mx8m-nano-cross-dev.yml

The container can be accessed as follows (the password is ChangeMe!):

lxc exec var-som-mx8m-nano-cross-dev-bookworm -- login ${USER}

Or with ssh (Hint: retrieve IP_OF_CONTAINER with lxc list):

ssh IP_OF_CONTAINER

You can directly start to cross compile applications:

aarch64-linux-gnu-g++ ...

For your convenience, the LXD container shares the folder edi-workspace with the host operating system.

Documenting an Artifact

During the image build the documentation gets rendered to artifacts/CONFIGNAME_documentation as reStructuredText. The text files can be transformed into a nice pdf file with some additional tools that need to be installed first:

sudo apt install texlive-latex-recommended texlive-pictures texlive-latex-extra texlive-xetex latexmk

Then the pdf can be generated using the following commands:

cd artifacts/CONFIGNAME_documentation
make PDFLATEX=xelatex latexpdf
make PDFLATEX=xelatex latexpdf

More Information

For more information about the Variscite hardware please take a look at the official documentation.

For more information about this setup please read the edi documentation and this blog post.

For details about the Mender based robust update integration please refer to this blog post.

If you are curious about the U-Boot bootloader setup please take a look at this blog post.

For the kernel build instructions please check the docs folder of this project.

edi-var's People

Contributors

lueschem avatar villewitt avatar

Stargazers

 avatar  avatar

Watchers

 avatar

edi-var's Issues

Create Initial Release

Open tasks till initial release:

  • Prepare bullseye cross development container
  • Make edi-boot-shim available for Debian bullseye
  • Upgrade U-Boot
  • Upgrade Kernel to 5.4
  • Upgrade to Debian Bullseye
  • Change default user (currently named imx)
  • Add libubootenv-tool package
  • Add fdisk package
  • Update README.md
  • Adjust Mender poll interval
  • Remove preconfigured WiFi
  • Document Kernel build
  • Dynamically mount firmware and data partition
  • Adjust primary boot.scr to boot from eMMC (mmcdev=2 instead of mmcdev=1)
  • Dynamically adjust fw_env.config on first boot
  • Dynamically adjust mender config on first boot
  • Switch device type to "-v2"
  • Switch to GPT partition table
  • Adjust copyright in write_doc, rootfs2image, image2mender, lxd2rootfs

Identical machine-id on multiple devices

Problem Description

Despite the deletion of /etc/machine-id during the image build it was observed that the machine-id is identical on multiple device instances.

Root Cause

There is a "redundant" copy of /etc/machine-id in /var/lib/dbus/machine-id. During the first boot /etc/machine-id gets derived from /var/lib/dbus/machine-id.

Solution

Also delete /var/lib/dbus/machine-id during image build.

Kernel: Enable binfmt_misc

Currently one edi-ci test fails:

variscite@var-som-mx8m-nano-f8dc7a452e20:~$ sudo systemctl list-units --failed
  UNIT                   LOAD   ACTIVE SUB    DESCRIPTION                     
● systemd-binfmt.service loaded failed failed Set Up Additional Binary Formats

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
1 loaded units listed.
variscite@var-som-mx8m-nano-f8dc7a452e20:~$ sudo systemctl status systemd-binfmt
× systemd-binfmt.service - Set Up Additional Binary Formats
     Loaded: loaded (/lib/systemd/system/systemd-binfmt.service; static)
     Active: failed (Result: exit-code) since Fri 2023-03-17 13:17:03 UTC; 14min ago
       Docs: man:systemd-binfmt.service(8)
             man:binfmt.d(5)
             https://docs.kernel.org/admin-guide/binfmt-misc.html
             https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
    Process: 1780 ExecStart=/lib/systemd/systemd-binfmt (code=exited, status=1/FAILURE)
   Main PID: 1780 (code=exited, status=1/FAILURE)
        CPU: 25ms

Mar 17 13:17:02 var-som-mx8m-nano-f8dc7a452e20 systemd[1]: Starting systemd-binfmt.service - Set Up Additional Binary Formats...
Mar 17 13:17:03 var-som-mx8m-nano-f8dc7a452e20 systemd-binfmt[1780]: Failed to flush binfmt_misc rules, ignoring: No such file or directory
Mar 17 13:17:03 var-som-mx8m-nano-f8dc7a452e20 systemd-binfmt[1780]: /usr/lib/binfmt.d/python3.11.conf:1: Failed to add binary format 'python3.11': No such file or directory
Mar 17 13:17:03 var-som-mx8m-nano-f8dc7a452e20 systemd[1]: systemd-binfmt.service: Main process exited, code=exited, status=1/FAILURE
Mar 17 13:17:03 var-som-mx8m-nano-f8dc7a452e20 systemd[1]: systemd-binfmt.service: Failed with result 'exit-code'.
Mar 17 13:17:03 var-som-mx8m-nano-f8dc7a452e20 systemd[1]: Failed to start systemd-binfmt.service - Set Up Additional Binary Formats.
variscite@var-som-mx8m-nano-f8dc7a452e20:~$ sudo ls /proc/sys/fs/binfmt_misc
ls: cannot access '/proc/sys/fs/binfmt_misc': No such file or directory

Required kernel option:

CONFIG_BINFMT_MISC=m

failed to build due to python3-apt package missing

Hello,
I try to build without any modification, but I'm facing this error
[WARNING]: Updating cache and auto-installing missing dependency: python3-apt
fatal: [edi-tmp-64928cb510fe1a1276d0]: FAILED! => {"changed": false, "cmd": "apt-get install --no-install-recommends python3-apt -y -q", "msg": "E: Package 'python3-apt' has no installation candidate", "rc": 100, "stderr": "E: Package 'python3-apt' has no installation candidate\n", "stderr_lines": ["E: Package 'python3-apt' has no installation candidate"], "stdout": "Reading package lists...\nBuilding dependency tree...\nPackage python3-apt is not available, but is referred to by another package.\nThis may mean that the package is missing, has been obsoleted, or\nis only available from another source\n\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Package python3-apt is not available, but is referred to by another package.", "This may mean that the package is missing, has been obsoleted, or", "is only available from another source", ""]}

how to fix that ?

Thank you

Modifications for VAR-SOM-iMX8M-MINI

Hi, guys. Sorry for the beginner question but I'm not used to cross-compile/building embedded images in complex environments.
Could you guide me on how hard and what should I adopt in order to use your repo?

I'm currently using a Debian bullseye and would like to use Mender for OTA as you did. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.