runborg

Untitled

Jun 27th, 2020
2,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.44 KB | None | 0 0
  1. # cat build-pi-kernel.sh
  2. #!/bin/sh
  3. CWD=$(pwd)
  4. KERNEL_SRC=linux
  5.  
  6. if [ ! -d ${KERNEL_SRC} ]; then
  7.     echo "Linux Kernel source directory does not exists, please 'git clone'"
  8.     echo "get it with : git clone --depth=1 https://github.com/raspberrypi/linux linux"
  9.     exit 1
  10. fi
  11.  
  12. echo "I: Copy Kernel config (x86_64_vyos_defconfig) to Kernel Source"
  13. #cp x86_64_vyos_defconfig ${KERNEL_SRC}/arch/x86/configs
  14.  
  15. cd ${KERNEL_SRC}
  16.  
  17. KERNEL_VERSION=$(make kernelversion)
  18. KERNEL_SUFFIX=-$(dpkg --print-architecture)-rpi4-vyos
  19.  
  20. # VyOS requires some small Kernel Patches - apply them here
  21. # It's easier to habe them here and make use of the upstream
  22. # repository instead of maintaining a full Kernel Fork.
  23. # Saving time/resources is essential :-)
  24. PATCH_DIR=${CWD}/patches/kernel
  25. for patch in $(ls ${PATCH_DIR})
  26. do
  27.     echo "I: Apply Kernel patch: ${PATCH_DIR}/${patch}"
  28.     patch -p1 < ${PATCH_DIR}/${patch}
  29. done
  30.  
  31. echo "I: make bcm2711_defconfig"
  32. # Select Kernel configuration - currently there is only one
  33. #make x86_64_vyos_defconfig
  34. make bcm2711_defconfig
  35.  
  36. echo "I: Generate environment file containing Kernel variable"
  37. cat << EOF >${CWD}/kernel-vars
  38. #!/bin/sh
  39. export KERNEL_VERSION=${KERNEL_VERSION}
  40. export KERNEL_SUFFIX=${KERNEL_SUFFIX}
  41. export KERNEL_DIR=${CWD}/${KERNEL_SRC}
  42. EOF
  43.  
  44. echo "I: Build Debian Kernel package"
  45. make bindeb-pkg BUILD_TOOLS=1 LOCALVERSION=${KERNEL_SUFFIX} KDEB_PKGVERSION=${KERNEL_VERSION}-1 -j $(getconf _NPROCESSORS_ONLN)
Advertisement
Add Comment
Please, Sign In to add comment