Skip to content

KernelCI command line

Guillaume Tucker edited this page Jul 5, 2019 · 1 revision

This page describes how to reproduce all the KernelCI steps locally with command line tools.

Work in progress - only building kernels is currently supported

Kernel builds

Sample commands to build a kernel locally from linux-next:

  1. Optional: set up a local mirror If you already have a linux check out:
git clone \
  --mirror git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git \
  --reference=~/src/linux linux-mirror.git

Then to update the mirror, or create it if you skipped the command above:

./kci_build update_mirror --config=next --mirror=linux-mirror.git
  1. Create a local check-out (or update an existing one when running this again)
./kci_build update_repo --config=next --kdir=linux --mirror=linux-mirror.git

Optionally, to generate additional config fragments (e.g. to then build defconfig+kselftest):

./kci_build generate_fragments --config=next --kdir=linux
  1. Build the kernel with defconfig
./kci_build build_kernel --defconfig=defconfig --arch=x86 --build-env=gcc-7 --kdir=linux

To see the compiler output, add --verbose. The output can be found in linux/build.

To build again without regenerating the kernel config file, just omit the --defconfig argument:

./kci_build build_kernel --arch=x86 --build-env=gcc-7 --kdir=linux

Note: the build-env option is only used to populate the meta-data for the KernelCI database, it is not downloading a build environment. A future improvement would be to enable using a Docker image as with Jenkins builds (jenkins/build.jpl).

  1. Install the kernel binaries in a local directory
./kci_build install_kernel --config=next --kdir=linux

See the output in linux/_install_.

  1. If you have a kernelci-backend instance running, you can send the kernel and also the meta-data with these commands:
./kci_build push_kernel --kdir=linux --api=https://localhost:12345 --token=1234-5678
./kci_build publish_kernel --kdir=linux --api=https://localhost:12345 --token=1234-5678

Alternatively, to store the meta-data locally in a JSON file:

./kci_build publish_kernel --kdir=linux --json-path=build-meta.json
You can’t perform that action at this time.