In simple words about ARMBIAN

This is essentially a Linux build process describing some of the problems you may encounter when using ARMBIAN. Well, and most importantly, because of what it was needed, this is the ability to cascade mount the file system. True, it is not AUFS that is used, but Overlay2, since in the latest versions of Linux Kernell it is already built in and there is no need to apply a patch.

1. Download the latest version of ArmBian, it may change from version to version, so the instruction is as of 2.09.2022.

2. Run /bin/bash compile.sh

3. There are 2 assembly options to choose from:

– U-boot and kernel packages – only the bootloader and the kernel, then you will have to assemble the file system yourself.

– Full OS images for flashing – a full-fledged OS, with all the giblets.

We are interested in the last point.

4. There are already 3 instructions to choose from:

Do not change the kernel configuration – Do not change the kernel config. Those. use it as it is. This is convenient if you only need to rebuild the OS already with a previously configured kernel.

Show a kernel configuration menu before compilation – Open kernel settings before building.

Use precompiled packages from Armbian repository – Use previously built configuration.

We have not yet reached the core, so we use the first item, we need to check if our board is on the list.

5. A long list of boards appears with their brief description, which unfortunately does not include our Olinuxino A13.

6. Because Olinuxino A13 is not in the list, look for the board config at config/board/.. olinux-som-a13.csc and change the extension to .conf. After we repeat everything from point 2 and make sure that the board has appeared in the list.

Choose a board and move on.

P.s. in paragraph 2 there will be a curse that the config has been changed, just skip by pressing Enter.

7. And so on.

The next window prompts you to select a base system:

– bullseye Debian 11 Bullseye – debian-based axis.

– jammy Ubuntu jammy 22.04 LTS – ubuntu-based axis.

We will make a server version, so there is not much difference what to choose. All software is well put both there and there. The main difference between them is other than the name in the window manager. Debian is KDE based on QT, Ubuntu is GNOME based on GTK.

I like GTK better, so we choose the last option.

8. Next window:

Choose image type.

You need to select the type of image to be built.

– Standard image with console interface – standard OS image.

– Minimal image with console interface – minimal image, contains the minimum required software. Everything else can be installed as needed.

Here we select the minimum image. This is only a trial build, in the future we will edit it.

9. At this point, Armbian installs the build system and builds the image. Long story short, we’re waiting for the end…

After a couple of hours of waiting, if there were no serious failures, the ArmBian folder will grow from a couple of hundred megabytes to a couple of tens of gigabytes. The dimensions are explained by the docker that ArmBian uses for the build, where the build environment is hosted.

The finished image will be located at …output/images/ and if your board was on the list and you are satisfied with the default configuration, then you can end there.

But in my case, it will be the base for a custom IoT device server, so the requirements for it are as follows:

a) minimum occupied RAM – we will remove all unnecessary software, even the minimum configuration does not suit me. even there is too much.

b) fault tolerance of the file system – the file system should not die with a sharp power outage, so I will use a cascade mounted file system. I will take Overley_2 since it is built into the kernel in the latest versions of kernell.

c) speed up loading – we will remove unnecessary movements when loading the OS from ArmBian.

10. Correction of the ArmBian build system.

The assembly of the OS in Armbian occurs by running the “debootstrap” command, in older versions it was enough to fix the installed packages at:

-lib/configuration.sh

There are several variables where the packages were registered:

– PACKAGE_LIST_ADDITIONAL

– PACKAGE_LIST

-PACKAGE_LIST_DESKTOP

Here it was possible to correct the list of downloadable packages, in the latest versions these lists were moved to separate files.

Let’s start setting up for an adult:

10.1 Customizing the configuration file.

At userpatches/config-example.conf you will find a file where you can set more extensive settings than the menu gives. You can find more about them here https://docs.armbian.com/Developer-Guide_Build-Options/so we will describe the most basic:

– PROGRESS_LOG_TO_FIL=”yes” – the build process is duplicated in a separate file. A useful thing, you can always see the errors that have occurred or what has been installed.

– BOARD = “olinux-som-a13” – board name from point 6.

– RELEASE=”jammy” – OS version. Currently Ubuntu 22.04.

– BUILD_MINIMAL=”yes” – build a minimum set of packages.

– BUILD_DESKTOP=”no” – do not build a window manager.

– AUFS=”yes” – add support for a cascaded mounted file system to the assembly.

– KERNEL_ONLY=”no” – build kernel only.

– KERNEL_CONFIGURE=”no” – skip kernel configuration.

If everything is configured correctly, then during the assembly there will be no menu with a request for configuration. At this stage, you can try to assemble and make sure that nothing is broken.

10.2 Configuring packages in debootstrap.

By default, even when building the minimum version, there are still quite a few extra packages available. They can be removed by editing the list in debootstrap (the command through which the OS file system is assembled).

The decision to free up additional space can be made after the final assembly. In this case, you will have to go to ../config/cli/jammy/main/ where (jammy is the name of the distribution) where by editing the files:

– packages

– packages.additional

– as well as files in folders

Allows you to get rid of extra packages in the assembly.

It is also possible to add additional packages, for this at ../userpatches/ you need to create a “lib.config” file with a list of required packages:

PACKAGE_LIST_ADDITIONAL=”$PACKAGE_LIST_ADDITIONAL mc ffmpeg libsndfile1 libgsm1 libportaudio2 overlayroot alsa-base alsa-tools alsa-utils alsamixergui”

I have here some libraries for working with sound and the boost library, tk. I plan to develop in C++.

If something has changed, it will not be superfluous to make an assembly to check that nothing has been broken.

10.3 Cleaning up unnecessary from the OS boot.

To remove the excess, we restore the image to a pre-prepared SD card from which we will continue to boot.

At the first start, there is a request to change the login and password from the default ones:

– default login – root

– default pass – 1234

These are also suitable for us, therefore, in order to exclude the change of authorization, we delete the files at the address:

– /etc/profile.d/armbian-check-first-login.sh

– /etc/profile.d/armbian-check-first-login-reboot.sh

ArmBian makes an update every time it starts, this is a harmful procedure and it’s superfluous for me, so we delete everything related to it:

– /etc/cron.d/armbian-truncate-logs

– /etc/cron.d/armbian-update

– /etc/cron.d/sysstat

– /etc/update-mot.d/41-armbian-config

– /etc/update-mot.d/40-armbian-updates

– /etc/cron.daily/apt-compat

The finished image is a complete file system plus 200 MB. But during the first boot, the image is stretched to all the free space in memory. This is not very convenient, because. we will divide the memory into readonly and rewritable areas. In short, we delete the file that spoils life:

– /usr/lib/systemd/system/armbian-resize-filesystem.service

10.4 AUFS setup.

Embedded devices have one significant problem, they are subject to periodic power outages. This has a bad effect on the integrity of the file system, sooner or later it falls.

The way out of this situation is to use a “cascading file system”, in recent kernel versions there is built-in support for “overlay fs”.

Overlay fs will be deployed in RAM. By default, it takes half of the RAM for the file system and “read only” for its starting point.

Run command:

echo ‘overlayroot=”tmpfs”‘ >> /etc/overlayroot.conf

Exit command:

overlayroot-chroot

11. Check and start.

We start the board from the SD card:

– Connect to SOB “uart 1” default speed 115200 and observe boot order.

– Running Htop shows general system options:

– Running “mc” will show the file system memory used:

In this image, 176MIB is free from 1138MIB.

– After starting “overlay” in “mc”, you can see that the size of the file system has shrunk to half of the RAM (230MIB):

ps Here, of course, not all the problems that you may encounter, but the most frequent ones.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *