preload app during image build

Hi everyone,

I would like to preload an app during the build process of the image, is there a yocto recipe that does that?
The final result would be to have a CI that builds the complete image for our devices, and the flasher image that is very useful to have.


HI Federico!
You can use a full power of self hosted github runner to create a different scenarions during operations with Github Actions.
Recently I created a Github Action for this case, to use it with Open Balena.
If you want, you can open a PR with updated version of Balena CLI to preload image with compression, and publish as build artifact in Github Actions.
Full guide how to setup Self-hosted Github Actions Runner here Manual



i’m still having troubles with that… seems like another volume issue…

here is my pipeline (gitlab ci) but I always get an error:

  image: ubuntu:bionic
  # services:  //tried with and without, same error
  #   - name: docker:dind
  #     alias: docker
    - apt-get update
    - apt-get install -y wget unzip
    - export DEBUG=1
    - wget -O
    - unzip
    - cp balena-cli/balena ./
    - apt-get install -y
    - |
      echo -e "
          balenaUrl: ********
      " > ~/.balenarc.yml
    - ./balena login --credentials --email ***** --password ******
    - wget
    - unzip
    - ./balena preload balena.img --app 14

after balena-preload is built I get:

  RAN: /sbin/losetup -f --show --offset 4194304 --sizelimit 41943040 /img/balena.img
losetup: /img/balena.img: failed to set up loop device: No such file or directory

any idea?


@teslov - Do you happen to have any ideas here? Thanks!

Actually, looking closer, I wonder if this is a pathing issue. The preload command is looking for a /img/balena.img, but, I dont see that img path getting created. I think the unzip step prior might need to dump the balena.img artifact into a /img folder, and then the command might execute properly.


I tried changing the path, but I get the same error, any suggestion?

I don’t have a pipeline setup, but, I simply took your 3 relevant commands and just tested them, and they worked fine for me…

balena preload balena.img --app 14

I did have to make an edit: I had to replace wget with curl and provide it with --output
Unzipping worked fine, of course.
A note on the --app flag however, I could not use an Application ID number, I had to provide it with the friendly name of the application.

This ended up working fine on my machine, however:

david@david$ balena preload balena.img --app AppNameHere
Building Docker preloader image. [========================] 100%
| Checking that the image is a writable file
| Finding a free tcp port and getting balena settings
| Checking if the image is an edison zip archive
/ Creating preloader container
/ Starting preloader container
/ Fetching application AppNameHere
| Reading image information
? Select a release current
- Fetching application
- Resizing partitions and waiting for dockerd to start
Pulling 1 image [========================] 100%
| Cleaning up temporary files

Perhaps double check you are using the App friendly name, and, for testing purposes try running the commands on it’s their own on the target machine, perhaps there is an OS issue or the build machine doesn’t have all dependencies installed.

Did you happen to give that a try Federico?

Hi, yes I managed to get it working using “shell” gitlab runner, I didn’t succeed using docker runner though…