Project

General

Profile

Support #687

Compile a New Kernel for Arch On Raspberry Pi

Added by Daniel Curtis about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Kernel Hacking
Target version:
Start date:
10/29/2015
Due date:
% Done:

100%

Estimated time:
5.00 h
Spent time:

Description

While playing around trying to get ZFS to work properly on my Raspberry Pi 2 running Arch Linux, I decided to recompile the Linux kernel with ZFS support built in. This is a guide on my attempts, may eat your cat.

Prepare the Environment

  • Make sure the system is up to dat:
    pacman -Syu
    
  • Install a few dependencies:
    pacman -S base-devel git make gcc bc wget rsync screen ncurses
    

Download the Kernel

  • Switch to a source directory and download the Raspberry Pi toolchain:
    cd /usr/src
    git clone https://github.com/raspberrypi/tools
    
  • Export the toolchain path:
    export CCPREFIX=/usr/src/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-
    
  • Download the latest kernel from GitHub:
    git clone -b rpi-4.1.y http://github.com/raspberrypi/linux
    
  • Then export the kernel source path:
    export KERNEL_SRC=/usr/src/linux
    

Build the Kernel

  • Prepare the kernel build environment:
    cd /usr/src/linux
    make mrproper
    
  • Load the current config into the kernel source directory:
    zcat /proc/config.gz > /usr/src/linux/.config
    
  • Use the previous kernel config with the new kernel build environment:
    make oldconfig
    
    • (Optional) Modify the current kernel source configuration:
      make menuconfig
      
  • Build the kernel:
    make -j4
    
  • Install the kernel modules:
    make modules_install
    
  • Then backup the old kernel and copy over the new kernel:
    cp /boot/kernel7.img /boot/kernel7.old.img
    cp /usr/src/linux/arch/arm/boot/Image /boot/kernel7.img
    
  • Reboot into the new kernel:
    reboot
    

Resources

Also available in: Atom PDF