123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- # Maintainer: Donald Carr <sirspudd at gmail dot com>
- #set -x
- options=('!strip')
- # The firmware the kernel produces blows: don't falsify this lightly
- # "linux-firmware=20170309.695f2d6-1"
- pkgrel=1
- pkgver=5.7.6.19.g340b1df92d20
- pkgdesc="Kernel build from head"
- arch=("x86_64" "aarch64" "armv7h")
- license=("GPL2.1")
- log_path="${PWD}/$(date +"%Y-%m-%d-%H%M").log"
- _kernel_src_dir=/opt/dev/src/OSS/linux
- pkgname() {
- oldpath=${PWD}
- cd $_kernel_src_dir
- postfix="spudd-$(git rev-parse --abbrev-ref HEAD)"
- if [[ -f testing ]]; then
- postfix=${postfix}-testing
- fi
- pkgname=linux-${postfix}
- cd ${oldpath}
- }
- pkgname
- if [ -z "${LOCAL_PI_VER}" ]; then
- install=spudd.install
- fi
- _make_cmd="make ${_xcompile_args}"
- pkgver() {
- cd $_kernel_src_dir
- git describe --tags | sed -e "s/^v//" | tr '-' '.'
- }
- build() {
- cd $_kernel_src_dir && git clean -xdf
- cp ${_config_file} ${_kernel_src_dir}/.config
- ${_make_cmd} all 2>&1 | tee ${log_path}
- if [ -n "${LOCAL_PI_VER}" ]; then
- ${_make_cmd} dtbs 2>&1 | tee -a ${log_path}
- fi
- }
- package() {
- boot_dir="${pkgdir}/boot"
- dtb_dir="${boot_dir}/dtbs"
- usr_dir="${pkgdir}/usr"
- firmware_dir="${usr_dir}/lib/firmware"
- preset_dir=${pkgdir}/etc/mkinitcpio.d
- cd $_kernel_src_dir
- INSTALL_MOD_PATH=${usr_dir} ${_make_cmd} modules_install
- if [ -n "${LOCAL_PI_VER}" ]; then
- INSTALL_DTBS_PATH=${dtb_dir} ${_make_cmd} dtbs_install
- fi
- mkdir -p ${boot_dir}
- if [ "${LOCAL_PI_VER}" = "3" ]; then
- cp arch/arm64/boot/Image ${boot_dir}/Image${postfix}
- elif [ "${LOCAL_PI_VER}" = "2" ]; then
- cp arch/arm/boot/zImage ${boot_dir}/vmlinuz-${postfix}
- else
- cp arch/x86/boot/bzImage ${boot_dir}/vmlinuz-${postfix}
- fi
- mkdir -p ${preset_dir}
- cp ${startdir}/spudd.preset ${preset_dir}/${postfix}.preset
- rm -Rf ${startdir}/firmware
- if [[ -d ${firmware_dir} ]]; then
- mv ${firmware_dir} ${startdir}
- fi
- }
- if [ -n "${LOCAL_PI_VER}" ]; then
- case ${LOCAL_PI_VER} in
- 2)
- echo "Compiling for the RPi 2 aarch32"
- _config_file="${startdir}/rpi2"
- _xcompile_args="ARCH=arm CROSS_COMPILE=/opt/armv7-rpi2-linux-gnueabihf/bin/armv7-rpi2-linux-gnueabihf-"
- ;;
- 3)
- #symbols omitted by default wtf!
- #DTC_FLAGS=\"-@ -H epapr\"
- echo "Compiling for the RPi 3 aarch64"
- _config_file="${startdir}/rpi3"
- _xcompile_args="ARCH=arm64 CROSS_COMPILE=/opt/x-tools/aarch64-rpi3-linux-gnu/bin/aarch64-rpi3-linux-gnu-"
- ;;
- *)
- echo "Only supports the rpi3 at this point in time"
- exit 1
- ;;
- esac
- else
- echo "Compiling for desktop"
- #_xcompile_args="CC=clang HOSTCC=clang"
- #_xcompile_args=""
- _config_file="${startdir}/desktop"
- #_config_file="${_kernel_src_dir}/configs/desktop"
- fi
- _make_cmd="eval time make VERBOSE=1 ${_xcompile_args}"
|