PKGBUILD 2.4 KB

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