Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Building the kernel

M. Herdiansyah edited this page Jul 19, 2021 · 15 revisions

Building the kernel should generally follow the KISS guide.

The only difference is you'll have to use GNU make (and, if kernels < 5.7, GNU as, probably) and manually specify HOSTCC, CC, and YACC.

You also need to download a patch that would make it work with byacc instead of bison. (Thanks to E5ten for this)

/path/to/kernelsource $ curl -fLo byacc.patch https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/raw/
/path/to/kernelsource $ patch -p1 < byacc.patch

To use gmake menuconfig, you may also need netbsd-curses (or ncurses for its GNU counterpart).

For kernel 5.6 and older, you'll need this command:

gmake YACC=yacc CC=cc HOSTCC=cc -j "$(nproc)"

For kernels 5.7 and later, you'll need this instead:

gmake YACC=yacc LLVM=1 LLVM_IAS=1 -j "$(nproc)"

Since version 5.10, you may also need to do this sed call:

sed -i 's/$(LIBELF_FLAGS)/$(LIBELF_FLAGS) -D__always_inline=inline/' tools/objtool/Makefile

Clone this wiki locally