Intro

In my previous posts I have shared my first experience with debos and how to run debos in a container. In today’s post, I’d like to present how can we use all of that to generate base Debian image for an ARM board. My board of choice for this particular example will be the HummingBoard Edge.

The post is inspired by the feedback from the new users (such as this one) that there are no end-to-end examples how to quickly start using this tool.

HummingBoard Edge upstream support

The Hummingboard Edge is described in the Linux by the hummingboard2 devicetree. It is supported since the 4.16 Linux release. I have decided to use the sid flavor of Debian in order to get quite recent kernel version (4.18+98 at the moment of writing).

debos recipe

The full recipe and all other files are available in the 3mdeb/debos-recipes repository on github.

I wanted to create a really base system image, just to try out that it boots properly. I took the existing RPI3 recipe as a starting point.

As stated in the previous paragraph, the sid flavor of Debian will be used, hence following action in the recipe file appears:

Some of the following actions are:

  • setting the hostname with a run action:

note that we can decide with the chroot flag whether the command shall be executed on the host or in the chrooted environment

  • copying over extlinux config files with an overlay action:

The extlinux config I came up with could have been definitely improved (e.g. to be autogenerated, to use UUID for root partition etc.), but is perfectly enough for the purpose of this demonstration.

  • installation of the Linux and U-Boot packages:

Another important action is the image-partition. We can specify there the final image size, partitions to be created as well as their mount points. Note that the /etc/fstab entries will be automatically added for created partitions.

The substantial difference from the RPI3 recipe is the bootloader. Unlike many other ARM boards, RPI3 does not use the U-Boot installed directly (into not partitioned area) at the start of the image file (or block device).

As shown in the mx6cuboxi README, SPL U-Boot shall be installed into the device as follows:

In debos, we can use the raw action and use build-in sector keyword to install binaries at required offsets:

Note that we can use filesystem as an argument for the origin in order to gain access to files located in the filesystem we have generated in the previous steps. This feature does not seem to be documented somewhere, but I found such map in the code. Other useful arguments might be: artifacts or recipe.

The final actions include deploying filesystem to image and compressing the final image. Optionally, the bmap file can be generated.

Image building

I’ve used our debos docker container to perform debos build. I chose to save the run script in my PATH for easy execution:

The end result looks like:

And we should have a final image file:

Image flashing

The usual way

No explanation needed for the dd command:

The fancy way

Thanks to the bmap file we created, we can use bmaptools to flash the image. Explanation of this tool could be itself a story for another post. More details can be found in the bmaptool documentation.

We might need to install the tool first:

Image can be flashed with following command:

Comparison

It is a good opportunity to show a quick comparison between those two:

  • dd – 1 minute 18 seconds

  • bmaptool – 38 seconds

Image running

The boot log:

Conclusion

As I have shown in this post, debos can be quite easily used for building Debian image for an ARM platform. This is especially true if such board has good mainline support and the Linux and U-Boot packages for it are already available in the Debian package feed. I hope that my post can be helpful for new debos users and that my recipe gets merged into the debos-recipes, so it can be easily accessible.