Compiling Custom Kernel

Last modified by Yu Pang Law on 2023/01/24 12:36

  1. Update FreeBSD to latest patch
    freebsd-update fetch
    freebsd-update install
  2. Install git
    pkg install git
  3. Updating source file
    git clone -o freebsd https://git.FreeBSD.org/src.git /usr/src
    cd /usr/src
    git checkout stable/13
  4. prepare custom kernel file
    mkdir /root/kernels
    cd /usr/src/sys/amd64/conf
    cp GENERIC /root/kernels/MYKERNEL
    ln -s /root/kernels/MYKERNEL

    depends on your CPU architecture, config file location may be different. For usual, Intel/AMD CPU, it will be amd64

  5. add/remove options in the MYKERNEL file
  6. Compile and install MYKERNEL, then reboot
    cd /usr/src
    make buildkernel KERNCONF=MYKERNEL
    make installkernel KERNCONF=MYKERNEL
    reboot
  7. Check if MYKERNEL is installed correctly
    uname -a
    If correct, it should show MYKERNEL
Tags:
 
Copyrighted by Pangnet.net