PKGBUILD 2.4 KB

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