Compiling and Updating Linux Kernel

Perform the following steps to compile and update Linux kernel:

  1. Install dependencies to build kernel:
    apt-get install build-essential linux-source bc kmod cpio flex libncurses5-dev libelf-dev libssl-dev dwarves bison git
  2. Clone the kernel from StarFive Github:
    git clone https://github.com/starfive-tech/linux
  3. Checkout the desired Kernel version:
    git checkout <Tag Version>
  4. Build the kernel with bindeb-pkg:
    cd linux/
    cp arch/riscv/configs/starfive_visionfive2_defconfig .config
    make ARCH=riscv olddefconfig
    make ARCH=riscv -j$(nproc) bindeb-pkg
  5. Once the compile is finished, install the .deb Kernel packages.

    dpkg -i *.deb
    Note: Currently the dtbs are not synced once you installed a different version of kernel, you'll need to copy over the dtbs from /usr/lib/linux-image-<custom version>/starfive to /boot/dtbs/