PKGBUILD 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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=.6.ck1.r34.g4db000cc9f80
  13. pkgdesc="Kernel build from head"
  14. arch=("x86_64" "aarch64" "armv7h")
  15. license=("GPL2.1")
  16. _kernel_src_dir=/opt/dev/src/OSS/linux
  17. if [ -z "${LOCAL_PI_VER}" ]; then
  18. install=spudd.install
  19. fi
  20. _make_cmd="make ${_xcompile_args}"
  21. pkgver() {
  22. cd $_kernel_src_dir
  23. git describe --tags | cut -c2- | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
  24. }
  25. build() {
  26. cd $_kernel_src_dir && git clean -xdf
  27. cp ${_config_file} ${_kernel_src_dir}/.config
  28. ${_make_cmd}
  29. ${_make_cmd} modules
  30. if [ -n "${LOCAL_PI_VER}" ]; then
  31. ${_make_cmd} dtbs
  32. fi
  33. }
  34. package() {
  35. boot_dir="${pkgdir}/boot"
  36. dtb_dir="${boot_dir}/dtbs"
  37. usr_dir="${pkgdir}/usr"
  38. firmware_dir="${usr_dir}/lib/firmware"
  39. preset_dir=${pkgdir}/etc/mkinitcpio.d
  40. cd $_kernel_src_dir
  41. INSTALL_MOD_PATH=${usr_dir} ${_make_cmd} modules_install
  42. if [ -n "${LOCAL_PI_VER}" ]; then
  43. INSTALL_DTBS_PATH=${dtb_dir} ${_make_cmd} dtbs_install
  44. fi
  45. mkdir -p ${boot_dir}
  46. if [ "${LOCAL_PI_VER}" = "3" ]; then
  47. cp arch/arm64/boot/Image ${boot_dir}/ImageSpudd
  48. elif [ "${LOCAL_PI_VER}" = "2" ]; then
  49. cp arch/arm/boot/zImage ${boot_dir}/vmlinuz-spudd
  50. else
  51. cp arch/x86/boot/bzImage ${boot_dir}/vmlinuz-spudd
  52. fi
  53. mkdir -p ${preset_dir}
  54. cp ${startdir}/spudd.preset ${preset_dir}/${postfix}.preset
  55. rm -Rf ${startdir}/firmware
  56. if [[ -d ${firmware_dir} ]]; then
  57. mv ${firmware_dir} ${startdir}
  58. fi
  59. }
  60. if [ -n "${LOCAL_PI_VER}" ]; then
  61. case ${LOCAL_PI_VER} in
  62. 2)
  63. echo "Compiling for the RPi 2 aarch32"
  64. _config_file="${startdir}/rpi2"
  65. _xcompile_args="ARCH=arm CROSS_COMPILE=/opt/armv7-rpi2-linux-gnueabihf/bin/armv7-rpi2-linux-gnueabihf-"
  66. ;;
  67. 3)
  68. #symbols omitted by default wtf!
  69. #DTC_FLAGS=\"-@ -H epapr\"
  70. echo "Compiling for the RPi 3 aarch64"
  71. _config_file="${startdir}/rpi3"
  72. _xcompile_args="ARCH=arm64 CROSS_COMPILE=/opt/x-tools/aarch64-rpi3-linux-gnu/bin/aarch64-rpi3-linux-gnu-"
  73. ;;
  74. *)
  75. echo "Only supports the rpi3 at this point in time"
  76. exit 1
  77. ;;
  78. esac
  79. else
  80. echo "Compiling for desktop"
  81. _xcompile_args="CC=clang HOSTCC=clang"
  82. #_xcompile_args=""
  83. _config_file="${_kernel_src_dir}/configs/desktop"
  84. fi
  85. _make_cmd="make VERBOSE=1 ${_xcompile_args}"