diff mbox series

[5/6] Infrastructure for arm64 linux builds

Message ID 20250410114628.2060072-6-andrew.cooper3@citrix.com (mailing list archive)
State New
Headers show
Series Cleanup and Linux ARM64 support | expand

Commit Message

Andrew Cooper April 10, 2025, 11:46 a.m. UTC
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
CC: Anthony PERARD <anthony.perard@vates.tech>

v2:
 * Drop musl-dev.  It's brought in by build-base.
 * Include findutils to fix build warnings.
---
 .gitlab-ci.yml                            |  7 ++++++
 containerize                              |  1 +
 images/alpine/3.18-arm64-build.dockerfile | 27 +++++++++++++++++++++++
 scripts/build-linux.sh                    | 10 +++++++++
 4 files changed, 45 insertions(+)
 create mode 100644 images/alpine/3.18-arm64-build.dockerfile

Comments

Andrew Cooper April 10, 2025, 2:08 p.m. UTC | #1
On 10/04/2025 2:51 pm, Anthony PERARD wrote:
> On Thu, Apr 10, 2025 at 12:46:27PM +0100, Andrew Cooper wrote:
>> diff --git a/images/alpine/3.18-arm64-build.dockerfile b/images/alpine/3.18-arm64-build.dockerfile
>> new file mode 100644
>> index 000000000000..b6d9bd1af531
>> --- /dev/null
>> +++ b/images/alpine/3.18-arm64-build.dockerfile
>> @@ -0,0 +1,27 @@
>> +# syntax=docker/dockerfile:1
>> +FROM --platform=linux/arm64/v8 alpine:3.18
>> +LABEL maintainer.name="The Xen Project" \
>> +      maintainer.email="xen-devel@lists.xenproject.org"
> I though we were repeating the "LABEL" on each line these days, to avoid
> the backslash at the end of the line. ;-)

Oh right.  I'll fix.

>
>> +
>> +RUN apk --no-cache add bash
>> +
>> +RUN bash -ex <<EOF
>> +      adduser -D user --shell bash
>> +
>> +      DEPS=(# Base environment
>> +            build-base
>> +            curl
>> +
>> +            # Linux build deps
>> +            bison
>> +            findutils
>> +            flex
>> +            openssl-dev
>> +            perl
>> +      )
>> +
>> +      apk add --no-cache "\${DEPS[@]}"
> If I take one example from xen.git, we don't escape the $ and it's just
> "${DEPS[@]}", is it because the script is run with:
>
>     RUN bash -ex <<EOF
>
> instead of
>
>     RUN <<EOF
>     #!/usr/bin/bash
>
> ?
>
>
> As for the rest of the patch, it looks fine to me. I don't know if the
> change to the build config are necessary but they looks fine.

Ah, I meant to look at that and forgot.  This was started from the x86
container already in test-artefacts.

But yes, we want to do this the way xen.git does, with a set -eu too.

>
> With the LABEL repeated on each line:
> Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>

Thanks.

~Andrew
diff mbox series

Patch

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a8e56b165ed6..6faa85d8dd7c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -16,6 +16,13 @@  stages:
     exclude:
       - binaries/.gitignore
 
+.arm64-artifacts:
+  extends: .artifacts
+  tags:
+    - arm64
+  variables:
+    CONTAINER: alpine:3.18-arm64-build
+
 .x86_64-artifacts:
   extends: .artifacts
   tags:
diff --git a/containerize b/containerize
index fd488cc57596..7abeb119ff6a 100755
--- a/containerize
+++ b/containerize
@@ -24,6 +24,7 @@  die() {
 #
 BASE="registry.gitlab.com/xen-project/hardware/test-artifacts"
 case "_${CONTAINER}" in
+    _alpine-3.18-arm64-build) CONTAINER="${BASE}/alpine:3.18-arm64-build" ;;
     _alpine-x86_64-rootfs) CONTAINER="${BASE}/alpine:x86_64-rootfs" ;;
     _alpine-x86_64-build|_) CONTAINER="${BASE}/alpine:x86_64-build" ;;
 esac
diff --git a/images/alpine/3.18-arm64-build.dockerfile b/images/alpine/3.18-arm64-build.dockerfile
new file mode 100644
index 000000000000..b6d9bd1af531
--- /dev/null
+++ b/images/alpine/3.18-arm64-build.dockerfile
@@ -0,0 +1,27 @@ 
+# syntax=docker/dockerfile:1
+FROM --platform=linux/arm64/v8 alpine:3.18
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+RUN apk --no-cache add bash
+
+RUN bash -ex <<EOF
+      adduser -D user --shell bash
+
+      DEPS=(# Base environment
+            build-base
+            curl
+
+            # Linux build deps
+            bison
+            findutils
+            flex
+            openssl-dev
+            perl
+      )
+
+      apk add --no-cache "\${DEPS[@]}"
+EOF
+
+USER user
+WORKDIR /build
diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh
index c78cd6ca46da..652fdba7b9d1 100755
--- a/scripts/build-linux.sh
+++ b/scripts/build-linux.sh
@@ -21,6 +21,7 @@  cd linux-"${LINUX_VERSION}"
 make defconfig
 ./scripts/config --enable BRIDGE
 ./scripts/config --enable IGC
+./scripts/config --enable IPV6
 ./scripts/config --enable TUN
 
 case $UNAME in
@@ -32,6 +33,10 @@  case $UNAME in
             | grep '=m' \
             | sed 's/=m/=y/g' >> .config
         ;;
+
+    aarch64)
+        ./scripts/config --enable XEN_NETDEV_BACKEND
+        ;;
 esac
 
 make olddefconfig
@@ -41,4 +46,9 @@  case $UNAME in
         make -j$(nproc) bzImage
         cp arch/x86/boot/bzImage "${COPYDIR}"
         ;;
+
+    aarch64)
+        make -j$(nproc) Image
+        cp arch/arm64/boot/Image "${COPYDIR}"
+        ;;
 esac