arch-flo-junk/packages/linux-asus-flo/PKGBUILD

323 lines
15 KiB
Text
Raw Permalink Normal View History

# ARMv7 multi-platform
# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
buildarch=4
_vendor=asus
_flavor=asus-flo
pkgbase=linux-${_flavor}
_srcname=linux-4.11
_kernelname=${pkgbase#linux}
_desc="ARMv7 kernel with patches for Nexus 7 2013 Wi-Fi"
pkgver=4.11.12
pkgrel=1
rcnrel=armv7-x1
arch=('armv7h')
url="http://www.kernel.org/"
license=('GPL2')
makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'uboot-tools' 'vboot-utils' 'dtc')
options=('!strip')
source=("http://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz"
"http://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.xz"
"http://rcn-ee.com/deb/sid-armhf/v${pkgver}-${rcnrel}/patch-${pkgver%.0}-${rcnrel}.diff.gz"
"00_Collapse_usb_support_into_one_node.patch"
"01_Add_regulator_tweaks_and_wcnss_entry_to_support_wifi.patch"
"02_Avoid_sending_high_rates_to_downstream_clocks_during_set_rate.patch"
"03_Support_devicetree_binding.patch"
"04_Summit_SMB345_charger_IC.patch"
"05_Add_smb345_charger_node.patch"
"06_Modify_the_elants_i2c_driver_to_not_immediately_fail_on_Nexus7.patch"
"07_Get_touchpanel_working_on_flo.patch"
"08_Add_mac_address.patch"
"09_Make_of_dma_deconfigure()_public.patch"
"10_Split_of_configure_dma()_into_mask_and_ops_configuration.patch"
"11_Configure_dma_operations_at_probe_time.patch"
"12_Handle_IOMMU_lookup_failure_with_deferred_probing_or_error.patch"
"13_Fix-renamed-symbol-in-drivers-qcom-hidma_mgmt.c.patch"
'config'
'linux.preset'
'linux-asus-flo.install'
'60-linux.hook'
'90-linux.hook')
sha512sums=('6610eed97ffb7207c71771198c36179b8244ace7222bebb109507720e26c5f17d918079a56d5febdd8605844d67fb2df0ebe910fa2f2f53690daf6e2a8ad09c3'
'ee9c5ac45896d84739c679834fcd15dfc46f9e939dcefd54ba049ac47168d71f0af680153615de002a2073ba79e44a9214f74af17ed16aa97d85e6df157fc6e8'
'6c24610802f25b33d949d8e2b414f4874ab7de826a8e8c65e6b1e87687e785786829944c6e705bc71659155554cdf5ec0b400028d5b7a1459592230f08ee0e9d'
'c79d93af715c59188c7fccbb0402623b599b2e9fed944bb444d0ea2279e4086fc2b9f9e30aac468331b0a25150e537cd1647dd5cb6f47b53bf0af573cf6c7c67'
'f11d7351873aecc73c612fa3d6f9411c6f777bdb502dc9ba918cd824fbb36596c476b164fb9cf7eac2fa1c9484fa21b78ec8d03c13f959933cb5c1e30ed54754'
'303b25b44280dfbaa4b85f6dbeabc7752956b69fa7b85a1d837947ef490327a1228789bf57077d90e7c669b2f79d35c927ca423d4bbffeecdf7c1369af1120fb'
'412f1d3245831b37a0fe95622fae7af607b0df364317f828f0c5bba06c616efc78aff5d58de8d0ebe7b0f55032dbc7d5a807220e56ba676b47b25176c7e3d583'
'ebd987d3cc0c5515e042c7bc8bd89d8b951d0cd4a0fb74a3dd45333698812e299d0f9477988740d00417e6e84e21a97a67a7496f3c18dc5c13f3cf36044dceb9'
'0e2baf625cab807f645110b2a10f7e6c5eceac78433cedbe644b87bcdd0a4e71768107623b8a2a7b52033af1db6414f460f79ebcb71373300d720469cc90cdab'
'b86e56c653f0426a0d2a4fb500a11bdce7739b48d053ff584bd6ee1e560fc7f7759cc8fe12c96da182e6ef126e0c687015f771d7b9c4a61c5f08a5a55b8eeb0a'
'957b3c317364c5f4973a09b18837101137fff6dfd97254fda1d9fc255e0e2277341cefd2cc9582dc275e2ec7c81fcaa3d7b544eed6c72cdfc4c04f5de80aa960'
'7dcc9de43ed0e9f433f73e78999b9533f0e1d48ede06bebe32ac621513a49f6900dd80bb7c2ca06f67421b3826e5624f20e0e2fa3c0150efe7933895f21942df'
'cc7fb2d646c1d602b507fa2d6ce77458e794e27d624ed0097cc35ce0486e71e4dd4cec96cdb8aaf5800126ec172efd30e1fd4706754eddb48a952d587284af32'
'e031b821cce7a561752aeb6837c93b97438c1bc1e81efa3bdda931ad552b515ffc89872b3df300ba8704bccd672a73af22974b49493e1f7ad5a8c652e43158af'
'38a539a97d8dd00be1ec2ab7bdb72caafe16865cba4b7a7152cf6b78ce0c9cf6206163f3edfd3a8371098a422647fbd3e83b2d89692e7d0675a51f4cad279e44'
'25e9f71f038e1ef41c31a472f49487b63604668610232bec3842460dd67955c70158982744e51cf96143f0c5d2402b99bb86aec1d5e3bd9841ca5c11087a0b1b'
'26ee047935db2a899972d3f41a8d4319202ee57aa1ab6824e75bfb1ce9c62f5dc09792728b2595be11cb138c8ad9690b2cd37d715188ef5b7b8b64c22987ec24'
'535b0824d9bf53dac6dd597669bcba99eb141da22c327089439c98af6ad8d39b6d656817c3d8fe3f5391817c54558a30e4c372025082a90edbabbb7b5ee89a53'
'f01e7925b262d2874a8a991b1f27d057356a2a384d2012b61be5a631d4e4d7cf87461c8fb9e7f183831f5a829ad204897f1f0545a52df6288a0e04a5c2e31b96'
'706b94db744f2b9d91b9a19197600a161401eba5708cfdb3ba13cacfe2bef6c2be700ca826f35e904995ee120c247d95e498a9f920dde32a5f1a65ec1a540268'
'7ad5be75ee422dda3b80edd2eb614d8a9181e2c8228cd68b3881e2fb95953bf2dea6cbe7900ce1013c9de89b2802574b7b24869fc5d7a95d3cc3112c4d27063a'
'a8fc668de860cf7b44269e35f879d130ccbc7db84d159ffcac6a92c02324f09c08fb57cccad18332f423bf2153c928633fa681ee96482c778dc76bffe80dd4f5')
prepare() {
cd "${srcdir}/${_srcname}"
# add upstream patch
git apply --whitespace=nowarn ../patch-${pkgver}
# RCN patch
git apply ../patch-${pkgver%.0}-${rcnrel}.diff
# postMarketOS patches
patch -p1 < '../00_Collapse_usb_support_into_one_node.patch'
patch -p1 < '../01_Add_regulator_tweaks_and_wcnss_entry_to_support_wifi.patch'
patch -p1 < '../02_Avoid_sending_high_rates_to_downstream_clocks_during_set_rate.patch'
patch -p1 < '../03_Support_devicetree_binding.patch'
patch -p1 < '../04_Summit_SMB345_charger_IC.patch'
patch -p1 < '../05_Add_smb345_charger_node.patch'
patch -p1 < '../06_Modify_the_elants_i2c_driver_to_not_immediately_fail_on_Nexus7.patch'
patch -p1 < '../07_Get_touchpanel_working_on_flo.patch'
patch -p1 < '../08_Add_mac_address.patch'
patch -p1 < '../09_Make_of_dma_deconfigure()_public.patch'
patch -p1 < '../10_Split_of_configure_dma()_into_mask_and_ops_configuration.patch'
patch -p1 < '../11_Configure_dma_operations_at_probe_time.patch'
patch -p1 < '../12_Handle_IOMMU_lookup_failure_with_deferred_probing_or_error.patch'
patch -p1 < '../13_Fix-renamed-symbol-in-drivers-qcom-hidma_mgmt.c.patch'
cat "${srcdir}/config" > ./.config
# add pkgrel to extraversion
sed -ri "s|^(EXTRAVERSION =)(.*)|\1 \2-${pkgrel}-${_flavor}|" Makefile
# don't run depmod on 'make install'. We'll do this ourselves in packaging
sed -i '2iexit 0' scripts/depmod.sh
}
build() {
cd "${srcdir}/${_srcname}"
# get kernel version
make prepare
# load configuration
# Configure the kernel. Replace the line below with one of your choice.
make menuconfig # CLI menu for configuration
#make nconfig # new CLI menu for configuration
#make xconfig # X-based configuration
#make oldconfig # using old config from previous kernel version
# ... or manually edit .config
# Copy back our configuration (use with new kernel version)
cp ./.config ../${pkgbase}-"$(date "+%Y.%m.%d-%H.%M")".config
####################
# stop here
# this is useful to configure the kernel
#msg "Stopping build"
#return 1
####################
#yes "" | make config
# build!
make \
${MAKEFLAGS} \
CFLAGS_MODULE=-fno-pic \
zImage modules qcom-apq8064-asus-nexus7-flo.dtb
}
_package() {
pkgdesc="The Linux Kernel and modules - ${_desc}"
depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
optdepends=('crda: to set the correct wireless channels of your country')
backup=("etc/mkinitcpio.d/${pkgbase}.preset")
provides=('kernel26' "linux=${pkgver}" "${pkgbase}-uimage")
conflicts=('linux' "${pkgbase}-uimage")
replaces=('linux-mvebu' 'linux-udoo' 'linux-sun4i' 'linux-sun5i' 'linux-sun7i' 'linux-usbarmory' 'linux-wandboard' 'linux-clearfog')
install=${pkgname}.install
cd "${srcdir}/${_srcname}"
KARCH=arm
# get kernel version
_kernver="$(make kernelrelease)"
_basekernel=${_kernver%%-*}
_basekernel=${_basekernel%.*}
mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
make INSTALL_MOD_PATH="${pkgdir}/usr" modules_install
#make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install
install -Dm644 "arch/$KARCH/boot/dts/qcom-apq8064-asus-nexus7-flo.dtb" "${pkgdir}/boot/dtbs/qcom-apq8064-asus-nexus7-flo.dtb"
cp arch/$KARCH/boot/zImage "${pkgdir}/boot/${pkgbase}"
cat arch/$KARCH/boot/zImage arch/$KARCH/boot/dts/qcom-apq8064-asus-nexus7-flo.dtb > "${pkgdir}/boot/${pkgbase}+dtb"
# make room for external modules
local _extramodules="extramodules-${_basekernel}${_kernelname}"
ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules"
# add real version for building modules and running depmod from hook
mkdir -p "${pkgdir}/usr/lib/modules/${_extramodules}"
echo "${_kernver}" > "${pkgdir}/usr/lib/modules/${_extramodules}/version"
chmod 644 "${pkgdir}/usr/lib/modules/${_extramodules}/version"
make INSTALL_MOD_PATH="${pkgdir}/usr" modules_install
# remove build and source links
rm "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build}
# now we call depmod...
depmod -b "${pkgdir}/usr" -F System.map "${_kernver}"
# sed expression for following substitutions
local _subst="
s|%PKGBASE%|${pkgbase}|g
s|%KERNVER%|${_kernver}|g
s|%EXTRAMODULES%|${_extramodules}|g
"
# install mkinitcpio preset file
mkdir -p "${pkgdir}/etc/mkinitcpio.d"
mkdir -p "${pkgdir}/usr/share/libalpm/hooks"
sed "${_subst}" ../linux.preset > "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
# install pacman hooks
sed "${_subst}" ../60-linux.hook > "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook"
sed "${_subst}" ../90-linux.hook > "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
chmod 644 "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook" \
"${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook" \
"${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
# remove firmware (provided by linux-firmware) (is this bad? somebody tell me please lol)
rm -rf "$pkgdir/usr/lib/firmware"
}
_package-headers() {
pkgdesc="Header files and scripts for building modules for linux kernel - ${_desc}"
provides=("linux-headers=${pkgver}")
conflicts=('linux-headers')
replaces=('linux-mvebu-headers' 'linux-sun4i-headers' 'linux-sun5i-headers' 'linux-sun7i-headers' 'linux-usbarmory-headers' 'linux-wandboard-headers' 'linux-clearfog-headers')
install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
cd "${srcdir}/${_srcname}"
install -D -m644 Makefile \
"${pkgdir}/usr/lib/modules/${_kernver}/build/Makefile"
install -D -m644 kernel/Makefile \
"${pkgdir}/usr/lib/modules/${_kernver}/build/kernel/Makefile"
install -D -m644 .config \
"${pkgdir}/usr/lib/modules/${_kernver}/build/.config"
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include"
for i in acpi asm-generic config crypto drm generated keys linux math-emu \
media net pcmcia scsi soc sound trace uapi video xen; do
cp -a include/${i} "${pkgdir}/usr/lib/modules/${_kernver}/build/include/"
done
# copy arch includes for external modules
mkdir -p ${pkgdir}/usr/lib/modules/${_kernver}/build/arch/$KARCH
cp -a arch/$KARCH/include ${pkgdir}/usr/lib/modules/${_kernver}/build/arch/$KARCH/
for i in dove exynos omap2; do
mkdir -p ${pkgdir}/usr/lib/modules/${_kernver}/build/arch/$KARCH/mach-${i}
cp -a arch/$KARCH/mach-${i}/include ${pkgdir}/usr/lib/modules/${_kernver}/build/arch/$KARCH/mach-${i}/
done
for i in omap orion samsung versatile; do
mkdir -p ${pkgdir}/usr/lib/modules/${_kernver}/build/arch/$KARCH/plat-${i}
cp -a arch/$KARCH/plat-${i}/include ${pkgdir}/usr/lib/modules/${_kernver}/build/arch/$KARCH/plat-${i}/
done
# copy files necessary for later builds, like nvidia and vmware
cp Module.symvers "${pkgdir}/usr/lib/modules/${_kernver}/build"
cp -a scripts "${pkgdir}/usr/lib/modules/${_kernver}/build"
# fix permissions on scripts dir
chmod og-w -R "${pkgdir}/usr/lib/modules/${_kernver}/build/scripts"
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/.tmp_versions"
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel"
cp arch/${KARCH}/Makefile "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/"
cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel/"
# add dm headers
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/md"
cp drivers/md/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/md"
# add inotify.h
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include/linux"
cp include/linux/inotify.h "${pkgdir}/usr/lib/modules/${_kernver}/build/include/linux/"
# add wireless headers
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/net/mac80211/"
cp net/mac80211/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/net/mac80211/"
# add dvb headers for external modules
# in reference to:
# http://bugs.archlinux.org/task/11194
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include/config/dvb/"
cp include/config/dvb/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/include/config/dvb/"
# add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
# in reference to:
# http://bugs.archlinux.org/task/13146
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/"
cp drivers/media/dvb-frontends/lgdt330x.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/"
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c/"
cp drivers/media/i2c/msp3400-driver.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c/"
# add dvb headers
# in reference to:
# http://bugs.archlinux.org/task/20402
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/usb/dvb-usb"
cp drivers/media/usb/dvb-usb/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/usb/dvb-usb/"
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends"
cp drivers/media/dvb-frontends/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/"
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/tuners"
cp drivers/media/tuners/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/tuners/"
# add xfs and shmem for aufs building
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/fs/xfs"
mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/mm"
# copy in Kconfig files
for i in $(find . -name "Kconfig*"); do
mkdir -p "${pkgdir}"/usr/lib/modules/${_kernver}/build/`echo ${i} | sed 's|/Kconfig.*||'`
cp ${i} "${pkgdir}/usr/lib/modules/${_kernver}/build/${i}"
done
chown -R root.root "${pkgdir}/usr/lib/modules/${_kernver}/build"
find "${pkgdir}/usr/lib/modules/${_kernver}/build" -type d -exec chmod 755 {} \;
# strip scripts directory
find "${pkgdir}/usr/lib/modules/${_kernver}/build/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
case "$(file -bi "${binary}")" in
*application/x-sharedlib*) # Libraries (.so)
/usr/bin/strip ${STRIP_SHARED} "${binary}";;
*application/x-archive*) # Libraries (.a)
/usr/bin/strip ${STRIP_STATIC} "${binary}";;
*application/x-executable*) # Binaries
/usr/bin/strip ${STRIP_BINARIES} "${binary}";;
esac
done
# remove unneeded architectures
rm -rf "${pkgdir}"/usr/lib/modules/${_kernver}/build/arch/{alpha,arc,arm26,arm64,avr32,blackfin,c6x,cris,frv,h8300,hexagon,ia64,m32r,m68k,m68knommu,metag,mips,microblaze,mn10300,openrisc,parisc,powerpc,ppc,s390,score,sh,sh64,sparc,sparc64,tile,unicore32,um,v850,x86,xtensa}
}
pkgname=("${pkgbase}" "${pkgbase}-headers")
for _p in ${pkgname[@]}; do
eval "package_${_p}() {
_package${_p#${pkgbase}}
}"
done