Skip to content
Michael Forney edited this page Jun 8, 2019 · 11 revisions

Prerequisites

To build a linux kernel from an oasis system, you'll need make, flex, as well as the core system.

If you enable CONFIG_UNWINDER_ORC, you will also need to install the libelf library and headers.

Clone

First, checkout the linux sources.

git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git /src/linux
cd /src/linux
git checkout $TAG

You'll need to apply some patches to remove the perl dependency, and fix the build with sbase.

git pull --no-edit https://github.com/oasislinux/linux

Configure

If your toolchain does not support running dynamic executables, you need to set HOSTCC in your make invocations.

export MAKEFLAGS='HOSTCC=cc\ -static'

Configure the kernel for your system. If you installed the ncurses library and headers, you should be able to use make menuconfig.

Firmware

You may want to build some firmware into your kernel.

The linux-firmware repository contains a lot of common firmware (for example, iwlwifi).

git clone https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git /src/linux-firmware

Then, determine the firmware you want in your kernel ($FIRMWARE), and update your .config

CONFIG_EXTRA_FIRMWARE_DIR="/src/linux-firmware"
CONFIG_EXTRA_FIRMWARE="$FIRMWARE"

intel-ucode

If you have an Intel CPU, you may want linux to update the microcode at boot. Download the latest microcode from Intel

cd /src/linux-firmware
curl -LO https://downloadmirror.intel.com/26798/eng/microcode-20170511.tgz
zcat microcode-20170511.tgz | pax -r intel-ucode/*

You can determine the firmware file for your CPU with /proc/cpuinfo

awk -F '\t*: *' '
	$1 == "cpu family" {fam=$2}
	$1 == "model"      {mod=$2}
	$1 == "stepping"   {step=$2}
	END {printf "intel-ucode/%02x-%02x-%02x\n", fam, mod, step}
' /proc/cpuinfo

Then, adjust CONFIG_EXTRA_FIRMWARE appropriately.

Build

make

Install

mount /boot
[ -f /boot/linux ] && cp /boot/linux /boot/linux.old
cp arch/x86/boot/bzImage /boot/linux
umount /boot
Clone this wiki locally