What and why?

As it was mentioned in previous post I haven’t find Linux image for MangoPi MQ Pro board with working bluetooth so I thrown the board away decided to create my own. I didn’t go with “fix broken one” way because the only images available at the moment of writing were Armbian and Ubuntu and I’m not fun of either of them.

So I decided to use Yocto Project compatible distribution and create my own layer on top of it. The outcome is: Moelinux (Mangopi OpenEmbedded LINUX) layer. At the moment of writing:

  • Wifi, Bluetooth and HDMI output work
  • Init manager is systemd, with NetworkManager and bluetoothctl installed and enabled.
  • The only available image is moelinux-image-base, without graphical environment
  • Image doesn’t contain package management tool installed. I’m on the way to have read-only rootfs with separate (read-write) data partition

How to use

The image is kind of useless out of the box and this is the reason why images are not published. However the user can easily build their own images on top of Moelinux or enable features they need with local.conf file customization. For example:

To add new packages to the image:

IMAGE_INSTALL:append = "<space separated list of packages to install>"

To build entire image with musl instead of glibc:

TCLIBC = "musl"

To disable root password (for debug purposes only!):

EXTRA_IMAGE_FEATURES:append = " debug-tweaks "


Setup user account

Currently users accounts are not set up and image is usable only with debug-tweaks enabled (see above). It’d be good to have user account with default password created

Build and publish images with package manager installed

As being said it may be useful for general audience to have something which works out of the box and packages can be transferred without reflashing.

Implement data partition

Currently entire sdcard is being rewritten each time image is built and being flashed. This is not convenient as users wants to preserve some data accross different versions of the images. The way it’s going to be done is to specify partition with fstype=none at the end of sdcard image and then create filesystem manualy. This will allow to put content there which will not be overwritten by bmaptool copy because partition will be recreated using exact same geometry each time and mkfs will not be called. Unfortunately this flow is broken (or not implemented) in current revision of OpenEmbedded. Patch has been sent for review.

If package needs some files to be kept accross reboot (first candidate is NetworkManager ) then it should be bbappend’ed with:

inherit persistent
## This is not needed if PERSIST_FILE belongs to main package, not a subpackage like in this case
RDEPENDS:${PN}-daemon:append = "moelinux-persist"

persistent bbclass contains following variables definition:

PERSIST_FS_LABEL = "moeper-mnt-data"  ## moeper is the prefix, do not change it! -mnt-data specifies mount point where the filesystem will be mounted to

It means there MUST be filesystem with label moeper-mnt-data on the device. and there is SHOULD be path /etc/NetworkManager/system-connections/ on the filesystem. Special crafted systemd mount unit will mount this filesystem to /mnt/temp (prefix moeper is droppend and suffix -mnt-data became /mnt/data). During build process of the image buildsystem will replace files specified in PERSIST_FILE variable with symbolic links pointing to persist mount point/PERSIST_FILE. in case if file/directory existed they will be renamed with .vendor suffix.

As the result once sdcard is flashed with new image the partition will be recreated, but filesystem will not. Files should be in place and network connection (in this example) will be up and running. Otherwise serial console (or monitor with keyboard) will be required to bring it up again. Initial implementation is available in persist_class branch and generally works (BUGS BUGS BUGS! You’ve been warned!)