summaryrefslogtreecommitdiff
path: root/config/linux-base.yaml
blob: 9e152e5b7f1fcc195f31d4e2ed165924a442a87c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright (c) 2022, Arm Limited.
# SPDX-License-Identifier: MIT

%YAML 1.2
---
description: >-
  Linux kernel build config. Builds the kernel image and set of modules. Image
  is exported as the KERNEL artifact, while the modules are exported in a tgz
  archive as the KMODULES artifact. Modules are only built if a higher level
  layer specifies `export BUILD_KMODULES=true` in the prebuild section.

  By default the defconfig is built. Users can optionally add commands to the
  prebuild list to modify the config (e.g. `./scripts/config ...`) or even
  replace the .config, as required.

  A higher level layer can optionally request kselftests to be built by
  specifying `export BUILD_KSELFTESTS=true` in the prebuild section. If
  specified, the kselftests package is exported in a tgz archive as the
  KSELFTESTS artifact.

build:
  linux:
    repo:
      remote: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
      revision: v6.1

    toolchain: aarch64-linux-gnu-

    prebuild:
      - export BUILD_KMODULES=false
      - export BUILD_KSELFTESTS=false
      - export KBUILD_BUILD_HOST="shrinkwrap"
      - export ARCH=arm64
      - make -j${param:jobs} O=${param:builddir} defconfig

    build:
      # Finalize the config.
      - make -j${param:jobs} O=${param:builddir} olddefconfig

      - if [ "$$BUILD_KMODULES" = "true" ]; then
          # Make the kernel image and modules.
      -   make -j${param:jobs} O=${param:builddir} Image modules

          # Package the modules into a tgz archive.
      -   make -j${param:jobs} O=${param:builddir} INSTALL_MOD_PATH=${param:builddir}/modules modules_install
      -   tar -caf ${param:builddir}/modules.tgz -C ${param:builddir}/modules .
      -   rm -rf ${param:builddir}/modules
      - else
          # Make the kernel image.
      -   make -j${param:jobs} O=${param:builddir} Image

          # Dummy modules archive to keep artifacts happy.
      -   touch ${param:builddir}/modules.tgz
      - fi

      - if [ "$$BUILD_KSELFTESTS" = "true" ]; then
          # Make kselftests and package into tgz archive.
      -   make -j${param:jobs} O=${param:builddir} headers_install
      -   make -j${param:jobs} O=${param:builddir} -C tools/testing/selftests install INSTALL_PATH=${param:builddir}/kselftests
      -   tar -caf ${param:builddir}/kselftests.tgz -C ${param:builddir}/kselftests .
      -   rm -rf ${param:builddir}/kselftests
      - else
          # Dummy kselftests archive to keep artifacts happy.
      -   touch ${param:builddir}/kselftests.tgz
      - fi

    clean:
      - export ARCH=arm64
      - make -j${param:jobs} O=${param:builddir} clean

    artifacts:
      KERNEL: ${param:builddir}/arch/arm64/boot/Image
      KMODULES: ${param:builddir}/modules.tgz
      KSELFTESTS: ${param:builddir}/kselftests.tgz