Raspberry Pi: Building the Kernel

Todo jjj

  • https://www.raspberrypi.org/documentation/linux/kernel/building.md

    (Story is not quite up to date)

  • Toolchain (on Fedora)

    # dnf install binutils-arm-linux-gnu gcc-arm-linux-gnu
    
  • Kernel source

    On the Raspi …
    $ uname -r
    5.4.83-v7+
    
    $ git clone https://github.com/raspberrypi/linux
    $ cd linux/
    $ git checkout --track remotes/origin/rpi-5.4.y
    

    Fix EXTRAVERSION

    Toplevel Makefile
    VERSION = 5
    PATCHLEVEL = 4
    SUBLEVEL = 83
    EXTRAVERSION = -v7
    
  • Build

    • Use config from running Pi kernel

      On the Pi …
      # modprobe configs
      # ls -l /proc/config.gz
      

      Copy and unzip that into kernel root, as .config

      On host …
      $ make ARCH=arm CROSS_COMPILE=arm-linux-gnu- oldconfig
      
    • Build

      On host …
      $ make ARCH=arm CROSS_COMPILE=arm-linux-gnu- zImage modules dtbs
      

Graph

cluster_linux Linux cluster_linux_kernel Linux Kernel Driver Development linux_kernel_raspi_kernel_build Raspberry Pi: Building the Kernel