PKGBUILD 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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=4.19.r1936.g943bdfd15951
  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. ${_make_cmd} dtbs
  27. }
  28. package() {
  29. boot_dir="${pkgdir}/boot"
  30. dtb_dir="${boot_dir}/dtbs"
  31. usr_dir="${pkgdir}/usr"
  32. firmware_dir="${usr_dir}/lib/firmware"
  33. preset_dir=${pkgdir}/etc/mkinitcpio.d
  34. cd $_kernel_src_dir
  35. INSTALL_MOD_PATH=${usr_dir} ${_make_cmd} modules_install
  36. INSTALL_DTBS_PATH=${dtb_dir} ${_make_cmd} dtbs_install
  37. mkdir -p ${boot_dir}
  38. if [ "${LOCAL_PI_VER}" = "3" ]; then
  39. cat arch/arm64/boot/Image arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dtb > ${boot_dir}/ImageSpudd
  40. elif [ "${LOCAL_PI_VER}" = "2" ]; then
  41. cat arch/arm/boot/zImage arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dtb > ${boot_dir}/vmlinuz-spudd
  42. else
  43. cp arch/x86/boot/bzImage ${boot_dir}/vmlinuz-spudd
  44. fi
  45. mkdir -p ${preset_dir}
  46. cp ${startdir}/spudd.preset ${preset_dir}
  47. rm -Rf ${startdir}/firmware
  48. if [[ -d ${firmware_dir} ]]; then
  49. mv ${firmware_dir} ${startdir}
  50. fi
  51. }
  52. if [ -n "${LOCAL_PI_VER}" ]; then
  53. case ${LOCAL_PI_VER} in
  54. 2)
  55. echo "Compiling for the RPi 2 aarch32"
  56. _config_file="${startdir}/rpi2"
  57. _xcompile_args="ARCH=arm CROSS_COMPILE=/opt/armv7-rpi2-linux-gnueabihf/bin/armv7-rpi2-linux-gnueabihf-"
  58. ;;
  59. 3)
  60. echo "Compiling for the RPi 3 aarch64"
  61. _config_file="${startdir}/rpi3"
  62. _xcompile_args="ARCH=arm64 CROSS_COMPILE=/opt/x-tools/aarch64-rpi3-linux-gnu/bin/aarch64-rpi3-linux-gnu-"
  63. ;;
  64. *)
  65. echo "Only supports the rpi3 at this point in time"
  66. exit 1
  67. ;;
  68. esac
  69. else
  70. echo "Compiling for desktop"
  71. _config_file="${_kernel_src_dir}/configs/desktop"
  72. fi
  73. _make_cmd="make ${_xcompile_args}"