[libcamera-ci,RFC,v1,1/5] Add job to generate container for cross compilation
diff mbox series

Message ID 20260119102039.3521673-2-barnabas.pocze@ideasonboard.com
State Superseded
Headers show
Series
  • on-device-testing proof of concept
Related show

Commit Message

Barnabás Pőcze Jan. 19, 2026, 10:20 a.m. UTC
Add a job that generates a debian based container with the necessary
dependencies to cross compile for the given architecture.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 .gitlab-ci/setup-debian-cross-container.sh | 45 ++++++++++++++++++++++
 gitlab-ci.yml                              | 40 +++++++++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100755 .gitlab-ci/setup-debian-cross-container.sh

--
2.52.0

Comments

Laurent Pinchart Jan. 22, 2026, 2:16 a.m. UTC | #1
Hi Barnabás,

Thank you for the patch.

On Mon, Jan 19, 2026 at 11:20:35AM +0100, Barnabás Pőcze wrote:
> Add a job that generates a debian based container with the necessary
> dependencies to cross compile for the given architecture.

Our Debian containers already support cross-compiling. Is there a reason
to create another container ?

> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> ---
>  .gitlab-ci/setup-debian-cross-container.sh | 45 ++++++++++++++++++++++
>  gitlab-ci.yml                              | 40 +++++++++++++++++++
>  2 files changed, 85 insertions(+)
>  create mode 100755 .gitlab-ci/setup-debian-cross-container.sh
> 
> diff --git a/.gitlab-ci/setup-debian-cross-container.sh b/.gitlab-ci/setup-debian-cross-container.sh
> new file mode 100755
> index 0000000..82aea02
> --- /dev/null
> +++ b/.gitlab-ci/setup-debian-cross-container.sh
> @@ -0,0 +1,45 @@
> +#!/bin/bash
> +
> +set -ex
> +
> +packages=(
> +	python3-autopep8
> +	python3-dev
> +	python3-jinja2
> +	python3-pyparsing
> +	python3-ply
> +	python3-yaml
> +)
> +
> +multiarch_packages=(
> +	libevent-dev
> +	libpisp-dev
> +	libssl-dev
> +	libudev-dev
> +	libyaml-dev
> +	openssl
> +)
> +
> +arch="$1"
> +
> +export DEBIAN_FRONTEND=noninteractive
> +
> +dpkg --add-architecture "$arch"
> +apt update -y
> +
> +pkgs=()
> +
> +packages+=( "crossbuild-essential-$arch" )
> +for pkg in "${packages[@]}"; do
> +	pkgs+=( "$pkg" )
> +done
> +
> +multiarch_packages+=( "cross-exe-wrapper" )
> +multiarch_packages+=( "pkg-config" )
> +for pkg in "${multiarch_packages[@]}"; do
> +	pkgs+=( "$pkg:$arch" )
> +done
> +
> +apt install -y "${pkgs[@]}"
> +
> +meson env2mfile --cross --debarch "$arch" -o "/opt/meson-$arch.cross"
> diff --git a/gitlab-ci.yml b/gitlab-ci.yml
> index bc44feb..afac21f 100644
> --- a/gitlab-ci.yml
> +++ b/gitlab-ci.yml
> @@ -73,6 +73,18 @@ include:
>      FDO_DISTRIBUTION_VERSION: 'trixie'
>      FDO_DISTRIBUTION_TAG: '2025-11-02.0'
> 
> +.debian-cross-build:
> +  variables:
> +    CROSS_BUILD_DISTRIBUTION_VERSION: 'trixie'
> +    CROSS_BUILD_TAG: '2026-01-09.0'
> +    CROSS_BUILD_IMAGE: 'on-device-testing/debian-rootfs'
> +
> +.debian-cross-build-architectures:
> +  parallel:
> +    matrix:
> +      - ARCH:
> +        - arm64
> +
>  .container-debian:
>    extends:
>      - .fdo.container-build@debian
> @@ -104,6 +116,34 @@ container-debian:13:
>      - .container-debian
>      - .libcamera-ci.debian:13
> 
> +container-build-debian-cross:
> +  extends:
> +    - .fdo.container-build@debian
> +    - .debian-cross-build
> +    - .debian-cross-build-architectures
> +  stage: container
> +  needs: []
> +  variables:
> +    GIT_STRATEGY: none
> +    FDO_DISTRIBUTION_VERSION: "$CROSS_BUILD_DISTRIBUTION_VERSION"
> +    FDO_DISTRIBUTION_TAG: "build-debian-cross-$CROSS_BUILD_TAG-$ARCH"
> +    FDO_DISTRIBUTION_PACKAGES: >-
> +      ca-certificates
> +      build-essential
> +      dpkg-dev
> +      findutils
> +      git
> +      meson
> +      ruby
> +    FDO_DISTRIBUTION_EXEC: >-
> +      if echo $CI_CONFIG_PATH | grep -q '@' ; then
> +        git clone --depth 1 --single-branch "${CI_SERVER_URL}/$${CI_CONFIG_PATH/*@/}" .ci-config ;
> +        rm -rf .gitlab-ci ;
> +        mv .ci-config/.gitlab-ci/ . ;
> +      fi ;
> +      .gitlab-ci/setup-debian-cross-container.sh "$ARCH" ;
> +      gem install fpm ;
> +
>  # ------------------------------------------------------------------------------
>  # Build stage - Build libcamera for various platforms and configurations
>  # ------------------------------------------------------------------------------
Barnabás Pőcze Jan. 22, 2026, 10:43 a.m. UTC | #2
2026. 01. 22. 3:16 keltezéssel, Laurent Pinchart írta:
> Hi Barnabás,
> 
> Thank you for the patch.
> 
> On Mon, Jan 19, 2026 at 11:20:35AM +0100, Barnabás Pőcze wrote:
>> Add a job that generates a debian based container with the necessary
>> dependencies to cross compile for the given architecture.
> 
> Our Debian containers already support cross-compiling. Is there a reason
> to create another container ?


This started out as a separate repository, but the main reason is that
I wanted the rootfs and the cross compilation container to be "in sync",
to be built "at the same time", that's why they are both tied to the
`CROSS_BUILD_TAG` variable.

Another thing is that cross compilation is done in debian 12 container, but that can
no longer be built: https://gitlab.freedesktop.org/pobrn/libcamera/-/jobs/91608343
because the rustc version is too old.

Should I try to move the virtme-ng + cross compilation parts into debian 13
to see if that works?


> 
>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
>> ---
>>   .gitlab-ci/setup-debian-cross-container.sh | 45 ++++++++++++++++++++++
>>   gitlab-ci.yml                              | 40 +++++++++++++++++++
>>   2 files changed, 85 insertions(+)
>>   create mode 100755 .gitlab-ci/setup-debian-cross-container.sh
>>
>> diff --git a/.gitlab-ci/setup-debian-cross-container.sh b/.gitlab-ci/setup-debian-cross-container.sh
>> new file mode 100755
>> index 0000000..82aea02
>> --- /dev/null
>> +++ b/.gitlab-ci/setup-debian-cross-container.sh
>> @@ -0,0 +1,45 @@
>> +#!/bin/bash
>> +
>> +set -ex
>> +
>> +packages=(
>> +	python3-autopep8
>> +	python3-dev
>> +	python3-jinja2
>> +	python3-pyparsing
>> +	python3-ply
>> +	python3-yaml
>> +)
>> +
>> +multiarch_packages=(
>> +	libevent-dev
>> +	libpisp-dev
>> +	libssl-dev
>> +	libudev-dev
>> +	libyaml-dev
>> +	openssl
>> +)
>> +
>> +arch="$1"
>> +
>> +export DEBIAN_FRONTEND=noninteractive
>> +
>> +dpkg --add-architecture "$arch"
>> +apt update -y
>> +
>> +pkgs=()
>> +
>> +packages+=( "crossbuild-essential-$arch" )
>> +for pkg in "${packages[@]}"; do
>> +	pkgs+=( "$pkg" )
>> +done
>> +
>> +multiarch_packages+=( "cross-exe-wrapper" )
>> +multiarch_packages+=( "pkg-config" )
>> +for pkg in "${multiarch_packages[@]}"; do
>> +	pkgs+=( "$pkg:$arch" )
>> +done
>> +
>> +apt install -y "${pkgs[@]}"
>> +
>> +meson env2mfile --cross --debarch "$arch" -o "/opt/meson-$arch.cross"
>> diff --git a/gitlab-ci.yml b/gitlab-ci.yml
>> index bc44feb..afac21f 100644
>> --- a/gitlab-ci.yml
>> +++ b/gitlab-ci.yml
>> @@ -73,6 +73,18 @@ include:
>>       FDO_DISTRIBUTION_VERSION: 'trixie'
>>       FDO_DISTRIBUTION_TAG: '2025-11-02.0'
>>
>> +.debian-cross-build:
>> +  variables:
>> +    CROSS_BUILD_DISTRIBUTION_VERSION: 'trixie'
>> +    CROSS_BUILD_TAG: '2026-01-09.0'
>> +    CROSS_BUILD_IMAGE: 'on-device-testing/debian-rootfs'
>> +
>> +.debian-cross-build-architectures:
>> +  parallel:
>> +    matrix:
>> +      - ARCH:
>> +        - arm64
>> +
>>   .container-debian:
>>     extends:
>>       - .fdo.container-build@debian
>> @@ -104,6 +116,34 @@ container-debian:13:
>>       - .container-debian
>>       - .libcamera-ci.debian:13
>>
>> +container-build-debian-cross:
>> +  extends:
>> +    - .fdo.container-build@debian
>> +    - .debian-cross-build
>> +    - .debian-cross-build-architectures
>> +  stage: container
>> +  needs: []
>> +  variables:
>> +    GIT_STRATEGY: none
>> +    FDO_DISTRIBUTION_VERSION: "$CROSS_BUILD_DISTRIBUTION_VERSION"
>> +    FDO_DISTRIBUTION_TAG: "build-debian-cross-$CROSS_BUILD_TAG-$ARCH"
>> +    FDO_DISTRIBUTION_PACKAGES: >-
>> +      ca-certificates
>> +      build-essential
>> +      dpkg-dev
>> +      findutils
>> +      git
>> +      meson
>> +      ruby
>> +    FDO_DISTRIBUTION_EXEC: >-
>> +      if echo $CI_CONFIG_PATH | grep -q '@' ; then
>> +        git clone --depth 1 --single-branch "${CI_SERVER_URL}/$${CI_CONFIG_PATH/*@/}" .ci-config ;
>> +        rm -rf .gitlab-ci ;
>> +        mv .ci-config/.gitlab-ci/ . ;
>> +      fi ;
>> +      .gitlab-ci/setup-debian-cross-container.sh "$ARCH" ;
>> +      gem install fpm ;
>> +
>>   # ------------------------------------------------------------------------------
>>   # Build stage - Build libcamera for various platforms and configurations
>>   # ------------------------------------------------------------------------------
Laurent Pinchart Jan. 22, 2026, 11:16 a.m. UTC | #3
On Thu, Jan 22, 2026 at 11:43:40AM +0100, Barnabás Pőcze wrote:
> 2026. 01. 22. 3:16 keltezéssel, Laurent Pinchart írta:
> > Hi Barnabás,
> > 
> > Thank you for the patch.
> > 
> > On Mon, Jan 19, 2026 at 11:20:35AM +0100, Barnabás Pőcze wrote:
> >> Add a job that generates a debian based container with the necessary
> >> dependencies to cross compile for the given architecture.
> > 
> > Our Debian containers already support cross-compiling. Is there a reason
> > to create another container ?
> 
> This started out as a separate repository, but the main reason is that
> I wanted the rootfs and the cross compilation container to be "in sync",
> to be built "at the same time", that's why they are both tied to the
> `CROSS_BUILD_TAG` variable.
> 
> Another thing is that cross compilation is done in debian 12 container, but that can
> no longer be built: https://gitlab.freedesktop.org/pobrn/libcamera/-/jobs/91608343
> because the rustc version is too old.

Aaarghhhhh virtme-ng v1.18 uses a version of the virtme-ng-init
submodule that does not pin specific version of dependencies :-/

This may be fixable by upgrading virtme-ng to v1.23 or newer. It would
be worth trying the latest version.

> Should I try to move the virtme-ng + cross compilation parts into debian 13
> to see if that works?

It seems to be a good idea, with the latest virtme-ng version ideally.
I'd start with this, and move to a newer virtme-ng on Debian 12 only if
we run into serious issues with Debian 13.

> >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> >> ---
> >>   .gitlab-ci/setup-debian-cross-container.sh | 45 ++++++++++++++++++++++
> >>   gitlab-ci.yml                              | 40 +++++++++++++++++++
> >>   2 files changed, 85 insertions(+)
> >>   create mode 100755 .gitlab-ci/setup-debian-cross-container.sh
> >>
> >> diff --git a/.gitlab-ci/setup-debian-cross-container.sh b/.gitlab-ci/setup-debian-cross-container.sh
> >> new file mode 100755
> >> index 0000000..82aea02
> >> --- /dev/null
> >> +++ b/.gitlab-ci/setup-debian-cross-container.sh
> >> @@ -0,0 +1,45 @@
> >> +#!/bin/bash
> >> +
> >> +set -ex
> >> +
> >> +packages=(
> >> +	python3-autopep8
> >> +	python3-dev
> >> +	python3-jinja2
> >> +	python3-pyparsing
> >> +	python3-ply
> >> +	python3-yaml
> >> +)
> >> +
> >> +multiarch_packages=(
> >> +	libevent-dev
> >> +	libpisp-dev
> >> +	libssl-dev
> >> +	libudev-dev
> >> +	libyaml-dev
> >> +	openssl
> >> +)
> >> +
> >> +arch="$1"
> >> +
> >> +export DEBIAN_FRONTEND=noninteractive
> >> +
> >> +dpkg --add-architecture "$arch"
> >> +apt update -y
> >> +
> >> +pkgs=()
> >> +
> >> +packages+=( "crossbuild-essential-$arch" )
> >> +for pkg in "${packages[@]}"; do
> >> +	pkgs+=( "$pkg" )
> >> +done
> >> +
> >> +multiarch_packages+=( "cross-exe-wrapper" )
> >> +multiarch_packages+=( "pkg-config" )
> >> +for pkg in "${multiarch_packages[@]}"; do
> >> +	pkgs+=( "$pkg:$arch" )
> >> +done
> >> +
> >> +apt install -y "${pkgs[@]}"
> >> +
> >> +meson env2mfile --cross --debarch "$arch" -o "/opt/meson-$arch.cross"
> >> diff --git a/gitlab-ci.yml b/gitlab-ci.yml
> >> index bc44feb..afac21f 100644
> >> --- a/gitlab-ci.yml
> >> +++ b/gitlab-ci.yml
> >> @@ -73,6 +73,18 @@ include:
> >>       FDO_DISTRIBUTION_VERSION: 'trixie'
> >>       FDO_DISTRIBUTION_TAG: '2025-11-02.0'
> >>
> >> +.debian-cross-build:
> >> +  variables:
> >> +    CROSS_BUILD_DISTRIBUTION_VERSION: 'trixie'
> >> +    CROSS_BUILD_TAG: '2026-01-09.0'
> >> +    CROSS_BUILD_IMAGE: 'on-device-testing/debian-rootfs'
> >> +
> >> +.debian-cross-build-architectures:
> >> +  parallel:
> >> +    matrix:
> >> +      - ARCH:
> >> +        - arm64
> >> +
> >>   .container-debian:
> >>     extends:
> >>       - .fdo.container-build@debian
> >> @@ -104,6 +116,34 @@ container-debian:13:
> >>       - .container-debian
> >>       - .libcamera-ci.debian:13
> >>
> >> +container-build-debian-cross:
> >> +  extends:
> >> +    - .fdo.container-build@debian
> >> +    - .debian-cross-build
> >> +    - .debian-cross-build-architectures
> >> +  stage: container
> >> +  needs: []
> >> +  variables:
> >> +    GIT_STRATEGY: none
> >> +    FDO_DISTRIBUTION_VERSION: "$CROSS_BUILD_DISTRIBUTION_VERSION"
> >> +    FDO_DISTRIBUTION_TAG: "build-debian-cross-$CROSS_BUILD_TAG-$ARCH"
> >> +    FDO_DISTRIBUTION_PACKAGES: >-
> >> +      ca-certificates
> >> +      build-essential
> >> +      dpkg-dev
> >> +      findutils
> >> +      git
> >> +      meson
> >> +      ruby
> >> +    FDO_DISTRIBUTION_EXEC: >-
> >> +      if echo $CI_CONFIG_PATH | grep -q '@' ; then
> >> +        git clone --depth 1 --single-branch "${CI_SERVER_URL}/$${CI_CONFIG_PATH/*@/}" .ci-config ;
> >> +        rm -rf .gitlab-ci ;
> >> +        mv .ci-config/.gitlab-ci/ . ;
> >> +      fi ;
> >> +      .gitlab-ci/setup-debian-cross-container.sh "$ARCH" ;
> >> +      gem install fpm ;
> >> +
> >>   # ------------------------------------------------------------------------------
> >>   # Build stage - Build libcamera for various platforms and configurations
> >>   # ------------------------------------------------------------------------------

Patch
diff mbox series

diff --git a/.gitlab-ci/setup-debian-cross-container.sh b/.gitlab-ci/setup-debian-cross-container.sh
new file mode 100755
index 0000000..82aea02
--- /dev/null
+++ b/.gitlab-ci/setup-debian-cross-container.sh
@@ -0,0 +1,45 @@ 
+#!/bin/bash
+
+set -ex
+
+packages=(
+	python3-autopep8
+	python3-dev
+	python3-jinja2
+	python3-pyparsing
+	python3-ply
+	python3-yaml
+)
+
+multiarch_packages=(
+	libevent-dev
+	libpisp-dev
+	libssl-dev
+	libudev-dev
+	libyaml-dev
+	openssl
+)
+
+arch="$1"
+
+export DEBIAN_FRONTEND=noninteractive
+
+dpkg --add-architecture "$arch"
+apt update -y
+
+pkgs=()
+
+packages+=( "crossbuild-essential-$arch" )
+for pkg in "${packages[@]}"; do
+	pkgs+=( "$pkg" )
+done
+
+multiarch_packages+=( "cross-exe-wrapper" )
+multiarch_packages+=( "pkg-config" )
+for pkg in "${multiarch_packages[@]}"; do
+	pkgs+=( "$pkg:$arch" )
+done
+
+apt install -y "${pkgs[@]}"
+
+meson env2mfile --cross --debarch "$arch" -o "/opt/meson-$arch.cross"
diff --git a/gitlab-ci.yml b/gitlab-ci.yml
index bc44feb..afac21f 100644
--- a/gitlab-ci.yml
+++ b/gitlab-ci.yml
@@ -73,6 +73,18 @@  include:
     FDO_DISTRIBUTION_VERSION: 'trixie'
     FDO_DISTRIBUTION_TAG: '2025-11-02.0'

+.debian-cross-build:
+  variables:
+    CROSS_BUILD_DISTRIBUTION_VERSION: 'trixie'
+    CROSS_BUILD_TAG: '2026-01-09.0'
+    CROSS_BUILD_IMAGE: 'on-device-testing/debian-rootfs'
+
+.debian-cross-build-architectures:
+  parallel:
+    matrix:
+      - ARCH:
+        - arm64
+
 .container-debian:
   extends:
     - .fdo.container-build@debian
@@ -104,6 +116,34 @@  container-debian:13:
     - .container-debian
     - .libcamera-ci.debian:13

+container-build-debian-cross:
+  extends:
+    - .fdo.container-build@debian
+    - .debian-cross-build
+    - .debian-cross-build-architectures
+  stage: container
+  needs: []
+  variables:
+    GIT_STRATEGY: none
+    FDO_DISTRIBUTION_VERSION: "$CROSS_BUILD_DISTRIBUTION_VERSION"
+    FDO_DISTRIBUTION_TAG: "build-debian-cross-$CROSS_BUILD_TAG-$ARCH"
+    FDO_DISTRIBUTION_PACKAGES: >-
+      ca-certificates
+      build-essential
+      dpkg-dev
+      findutils
+      git
+      meson
+      ruby
+    FDO_DISTRIBUTION_EXEC: >-
+      if echo $CI_CONFIG_PATH | grep -q '@' ; then
+        git clone --depth 1 --single-branch "${CI_SERVER_URL}/$${CI_CONFIG_PATH/*@/}" .ci-config ;
+        rm -rf .gitlab-ci ;
+        mv .ci-config/.gitlab-ci/ . ;
+      fi ;
+      .gitlab-ci/setup-debian-cross-container.sh "$ARCH" ;
+      gem install fpm ;
+
 # ------------------------------------------------------------------------------
 # Build stage - Build libcamera for various platforms and configurations
 # ------------------------------------------------------------------------------