PKGBUILD 2.8 KB

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