Skip to main content

Arch Build System

ABS is a system that automates the building of packages from source code; it uses makepkg to build packages based on information in PKGBUILD, and pacman to install them.

Install

Install asp to use ABS.

sudo pacman -S asp

Usage (kernel build)

The following is an example of how to build a kernel. Create build/ as a working directory.

mkdir build
cd build

Download the PKGBUILD for the Linux kernel.

asp update linux
asp export linux

Modify PKGBUILD to rename the package and prevent it from generating documentation.

cd linux
vim PKGBUILD
3c3
< pkgbase=linux
---
> pkgbase=linux-custom
64d63
< make htmldocs
191c190
< pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
---
> pkgname=("$pkgbase" "$pkgbase-headers")

Use the following command to download the source code.

makepkg -so
.
├── archlinux-linux
│ ├── branches
│ ├── config
│ ├── description
│ ├── FETCH_HEAD
│ ├── HEAD
│ ├── hooks
│ ├── info
│ ├── objects
│ ├── packed-refs
│ └── refs
├── config
├── PKGBUILD
├── sphinx-workaround.patch
└── src
├── archlinux-linux <- Kernel source code here
├── config -> /home/mori/kernelbuild/linux/config
└── sphinx-workaround.patch -> /home/mori/kernelbuild/linux/sphinx-workaround.patch

Build kernel package with makepkg as shown below, and install it with pacman.

makepkg -se     # Additionally 'f' option needed when overwrite pkg
sudo pacman -U linux-custom-[version].arch1-1-x86_64.pkg.tar.zst linux-custom-headers-[version].arch1-1-x86_64.pkg.tar.zst

Kernel/Arch Build System