PKGBUILD 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Maintainer: Donald Carr <sirspudd at gmail dot com>
  2. #set -x
  3. options=('!strip')
  4. postfix=spudd
  5. if [[ -f testing ]]; then
  6. postfix=${postfix}-testing
  7. fi
  8. pkgname=linux-${postfix}
  9. # The firmware the kernel produces blows: don't falsify this lightly
  10. # "linux-firmware=20170309.695f2d6-1"
  11. pkgrel=1
  12. pkgver=5.7.rc6.89.g254d929d7df7
  13. pkgdesc="Kernel build from head"
  14. arch=("x86_64" "aarch64" "armv7h")
  15. license=("GPL2.1")
  16. log_path="${PWD}/$(date +"%Y-%m-%d-%H%M").log"
  17. _kernel_src_dir=/opt/dev/src/OSS/linux
  18. if [ -z "${LOCAL_PI_VER}" ]; then
  19. install=spudd.install
  20. fi
  21. _make_cmd="make ${_xcompile_args}"
  22. pkgver() {
  23. cd $_kernel_src_dir
  24. git describe --tags | sed -e "s/^v//" | tr '-' '.'
  25. }
  26. build() {
  27. cd $_kernel_src_dir && git clean -xdf
  28. cp ${_config_file} ${_kernel_src_dir}/.config
  29. ${_make_cmd} | tee ${log_path}
  30. ${_make_cmd} modules | tee ${log_path}
  31. if [ -n "${LOCAL_PI_VER}" ]; then
  32. ${_make_cmd} dtbs | tee ${log_path}
  33. fi
  34. }
  35. package() {
  36. boot_dir="${pkgdir}/boot"
  37. dtb_dir="${boot_dir}/dtbs"
  38. usr_dir="${pkgdir}/usr"
  39. firmware_dir="${usr_dir}/lib/firmware"
  40. preset_dir=${pkgdir}/etc/mkinitcpio.d
  41. cd $_kernel_src_dir
  42. INSTALL_MOD_PATH=${usr_dir} ${_make_cmd} modules_install
  43. if [ -n "${LOCAL_PI_VER}" ]; then
  44. INSTALL_DTBS_PATH=${dtb_dir} ${_make_cmd} dtbs_install
  45. fi
  46. mkdir -p ${boot_dir}
  47. if [ "${LOCAL_PI_VER}" = "3" ]; then
  48. cp arch/arm64/boot/Image ${boot_dir}/ImageSpudd
  49. elif [ "${LOCAL_PI_VER}" = "2" ]; then
  50. cp arch/arm/boot/zImage ${boot_dir}/vmlinuz-spudd
  51. else
  52. cp arch/x86/boot/bzImage ${boot_dir}/vmlinuz-spudd
  53. fi
  54. mkdir -p ${preset_dir}
  55. cp ${startdir}/spudd.preset ${preset_dir}/${postfix}.preset
  56. rm -Rf ${startdir}/firmware
  57. if [[ -d ${firmware_dir} ]]; then
  58. mv ${firmware_dir} ${startdir}
  59. fi
  60. }
  61. if [ -n "${LOCAL_PI_VER}" ]; then
  62. case ${LOCAL_PI_VER} in
  63. 2)
  64. echo "Compiling for the RPi 2 aarch32"
  65. _config_file="${startdir}/rpi2"
  66. _xcompile_args="ARCH=arm CROSS_COMPILE=/opt/armv7-rpi2-linux-gnueabihf/bin/armv7-rpi2-linux-gnueabihf-"
  67. ;;
  68. 3)
  69. #symbols omitted by default wtf!
  70. #DTC_FLAGS=\"-@ -H epapr\"
  71. echo "Compiling for the RPi 3 aarch64"
  72. _config_file="${startdir}/rpi3"
  73. _xcompile_args="ARCH=arm64 CROSS_COMPILE=/opt/x-tools/aarch64-rpi3-linux-gnu/bin/aarch64-rpi3-linux-gnu-"
  74. ;;
  75. *)
  76. echo "Only supports the rpi3 at this point in time"
  77. exit 1
  78. ;;
  79. esac
  80. else
  81. echo "Compiling for desktop"
  82. _xcompile_args="CC=clang HOSTCC=clang"
  83. #_xcompile_args=""
  84. _config_file="${_kernel_src_dir}/configs/desktop"
  85. fi
  86. _make_cmd="eval time make VERBOSE=1 ${_xcompile_args}"