Giter VIP home page Giter VIP logo

kernel-pkgscripts's Introduction

Linux Kernel Packaging Helpers

Build distro-specific kernel packages from checked out (potentially dirty) and configured git kernel source tree. Customized for my personal use-cases.

Usage

Run the <distro>/kpkg.py scripts directly from the checked out tree.

For example, run

../kbuild/fedora/kpkg.py build -j 24 -s my-kernel

to build a kernel for Fedora with local-version suffix -my-kernel (specified by -s; the full version would be something like 6.2.1-1-my-kernel) using 24 threads/processes (specified by -j). The architecture will be the same as the host system. Similarly, for Fedora, the distribution target (e.g. Fedora 37) will also be the same as the host system.

Note that invocation of the packaging scripts assumes that a suitable config has been generated for the target architecture and is available at .config in the kernel source tree.

Use kpkg.py --help to see all available options.

Cross-compiling

Make sure to install the respective cross-compilation toolchain, e.g. aarch64-linux-gnu-gcc for aarch64. You can specify the target architecture via the parameter -t. For example, to compile an AArch64 (ARM64) kernel for Arch Linux, run

../kbuild/arch/kpkg.py build -j 24 -s my-kernel -t aarch64  

from inside the kernel tree.

Building from Different Host-Distributions

You can use the provided Containerfiles with toolbox to compile packages for different distributions than the host distribution. All required dependencies should already be included.

To set up a toolbox, build the container via (for example)

podman build -t archlinux-kernel-toolbox -f arch/toolbox/Containerfile

and create the toolbox

toolbox create --image localhost/archlinux-kernel-toolbox kbuild-archlinux

You can then enter the toolbox via

toolbox enter kbuild-archlinux

and run the Arch Linux packaging (arch/kpkg.py) script from there.

SecureBoot Signing

For Fedora and Arch Linux, kernels can be automatically signed for secure boot with a machine owner key (MOK). You can generate such a key pair by running the provided keys/generate.sh script.

To sign kernel images, use --sbsign-key <key-file> and --sbsign-cert <crt-file>. For example, to build a signed kernel for Fedora, run

../kbuild/fedora/kpkg.py build -j 24 -s my-kernel \
    --sbsign-key ../kbuild/keys/mok.key \
    --sbsign-cert ../kbuild/keys/mok.crt

Supported Use-Cases

Supported distributions:

  • Arch Linux
  • Fedora
  • Debian (limited)

Supported architectures:

  • x86_64 (only tested by compiling natively on x86)
  • aarch64 (only tested by cross-compiling from x86)

kernel-pkgscripts's People

Contributors

qzed avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

kernel-pkgscripts's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.