PKGBUILD 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.11.19.g9e539bc574bf
  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. _make_cmd="make ${_xcompile_args}"
  25. pkgver() {
  26. cd $_kernel_src_dir
  27. git describe --tags | sed -e "s/^v//" | tr '-' '.'
  28. }
  29. build() {
  30. cd $_kernel_src_dir && git clean -xdf
  31. cp ${_config_file} ${_kernel_src_dir}/.config
  32. ${_make_cmd} all 2>&1 | tee ${log_path}
  33. if [ -n "${LOCAL_PI_VER}" ]; then
  34. ${_make_cmd} dtbs 2>&1 | tee -a ${log_path}
  35. fi
  36. }
  37. package() {
  38. boot_dir="${pkgdir}/boot"
  39. dtb_dir="${boot_dir}/dtbs"
  40. usr_dir="${pkgdir}/usr"
  41. firmware_dir="${usr_dir}/lib/firmware"
  42. preset_dir=${pkgdir}/etc/mkinitcpio.d
  43. cd $_kernel_src_dir
  44. INSTALL_MOD_PATH=${usr_dir} INSTALL_MOD_STRIP=1 ${_make_cmd} modules_install
  45. if [ -n "${LOCAL_PI_VER}" ]; then
  46. INSTALL_DTBS_PATH=${dtb_dir} ${_make_cmd} dtbs_install
  47. fi
  48. mkdir -p ${boot_dir}
  49. if [ "${LOCAL_PI_VER}" = "3" ]; then
  50. cp arch/arm64/boot/Image ${boot_dir}/Image${postfix}
  51. elif [ "${LOCAL_PI_VER}" = "2" ]; then
  52. cp arch/arm/boot/zImage ${boot_dir}/vmlinuz-${postfix}
  53. else
  54. cp arch/x86/boot/bzImage ${boot_dir}/vmlinuz-${postfix}
  55. fi
  56. mkdir -p ${preset_dir}
  57. cp ${startdir}/spudd.preset ${preset_dir}/${postfix}.preset
  58. sed -i "s/spudd/${postfix}/g" ${preset_dir}/${postfix}.preset
  59. rm -Rf ${startdir}/firmware
  60. if [[ -d ${firmware_dir} ]]; then
  61. mv ${firmware_dir} ${startdir}
  62. fi
  63. }
  64. if [ -n "${LOCAL_PI_VER}" ]; then
  65. case ${LOCAL_PI_VER} in
  66. 2)
  67. echo "Compiling for the RPi 2 aarch32"
  68. _config_file="${startdir}/rpi2"
  69. _xcompile_args="ARCH=arm CROSS_COMPILE=/opt/armv7-rpi2-linux-gnueabihf/bin/armv7-rpi2-linux-gnueabihf-"
  70. ;;
  71. 3)
  72. #symbols omitted by default wtf!
  73. #DTC_FLAGS=\"-@ -H epapr\"
  74. echo "Compiling for the RPi 3 aarch64"
  75. _config_file="${startdir}/rpi3"
  76. _xcompile_args="ARCH=arm64 CROSS_COMPILE=/opt/x-tools/aarch64-rpi3-linux-gnu/bin/aarch64-rpi3-linux-gnu-"
  77. ;;
  78. *)
  79. echo "Only supports the rpi3 at this point in time"
  80. exit 1
  81. ;;
  82. esac
  83. else
  84. echo "Compiling for desktop"
  85. #_xcompile_args="CC=clang HOSTCC=clang"
  86. #_xcompile_args=""
  87. _config_file="${startdir}/desktop"
  88. #_config_file="${_kernel_src_dir}/configs/desktop"
  89. fi
  90. _make_cmd="eval time make VERBOSE=1 ${_xcompile_args}"