PKGBUILDs/core/kernel26-olinuxino/PKGBUILD
2012-08-05 12:53:55 -04:00

328 lines
14 KiB
Bash

# Contributor: Kiril Zyapkov <kiril.zyapkov@gmail.com>
# iMX233-OLinuXino-Maxi kernel for archlinuxarm
# basically replicates the oe-recipe
# see https://github.com/OSSystems/meta-fsl-arm-extra.git
# vim:set ts=2 sw=2 et:
buildarch=2
pkgbase="kernel26-olinuxino"
pkgname=('kernel26-olinuxino' 'kernel26-headers-olinuxino')
_kernelname=${pkgname#kernel26}
_basekernel=2.6
pkgver=${_basekernel}.35.3
pkgrel=6
makedepends=('xmlto' 'docbook-xsl' 'make' 'git' 'elftosb' 'imx-bootlets-olinuxino')
optdepends=()
options=('!strip' '!buildflags' '!makeflags')
arch=('arm')
CARCH=arm
KARCH=arm
LDFLAGS=""
license=('GPL2')
url="https://github.com/Freescale/meta-fsl-arm/"
source=(config
0002-cgroupfs-create-sys-fs-cgroup-to-mount-cgroupfs-on.patch
egalax_ts-enable-single-event-support.patch
NFS-Fix-nfsroot-support.patch
NFS-allow-nfs-root-mount-to-use-alternate-rpc-ports.patch
1130-ENGR00157473-MX5X-UART-disable-UART2-DMA-to-make-G.patch
1132-ENGR00155891-mx53_loco-enable-mc34708-s-WDI-functio.patch
1134-ENGR00159738-v4l2-correct-wrong-parameter-when-V4l2.patch
1136-ENGR00161215-1-arch-arm-Add-two-new-IOCTLs-in-mxc_v.patch
1137-ENGR00161215-2-vpu-Add-ioctls-for-querying-and-sett.patch
1139-ENGR00162464-update-pm4-microcode-pm4_microcode_r18.patch
1140-ENGR00162711-DA9053-Add-dummy-write-for-DA9053-I2C.patch
1141-ENGR00162708-MX5-Add-I2C-dummy-write-and-mask-nONKE.patch
1142-ENGR00163698-MX53-ARD-fix-typo-error-for-pwm1-pad-d.patch
1143-ENGR00162578-DMA-mx5-increase-DMA-Zone-size-to-112.patch
1144-ENGR00169603-MX53-ARD-FlexCAN-Set-lp_apm-as-clock.patch
1145-ENGR00170342-PWM-fix-pwm-output-can-t-be-set-to-100.patch
1146-ENGR00170244-1-ARM-AHCI-Enable-PDDQ-mode-when-no-d.patch
1147-ENGR00170244-2-ARM-AHCI-Enable-PDDQ-mode-when-no-d.patch
no-unaligned-access.patch
mx28-removecpufreq.patch
mxs-duart-use-ttyAMA-for-device-name.patch
w1-fix-support-multiple-master.patch
smsc95xx-randomize-mac-once.patch
dm9601-support-for-usb-ethernet-0x0fe6-0x9700.patch
wire-up-sys_accept4-on-ARM.patch
0001-mx53_loco-add-USR-led-support.patch
002_Return_ERESTARTSYS_from_IPU_GET_EVENT.patch
003_Sanitise_ipu_interrupt_return_value.patch
imx233-olinuxino.patch)
md5sums=('2c92cd3654927fd38d1adc39a6e551fe'
'bde087470cb0715ca709bd5bcd3803d0'
'ef8a1cf2d129de1a0a476a0b40e6f291'
'e086ab0b162d292549f9bf453e07ad2e'
'ff1281a87da6f8093992ad70d23e71d2'
'5e66409616ff8b83d6c4da27b7a20524'
'8bd2ccc655534a3954c7c4627504b983'
'5bd3f9fa736e52fc6805bb6ad31bb0fa'
'c32466adef3d6ef7cfbf78c82746c273'
'51b8c41987805f7df4940ca8acdc207f'
'33f10abba5e4477a869481afbd679708'
'a277ba90aff952c3328b0a15090f0162'
'1d37e5d871cc887b11f0d0526bade455'
'a7c588606614e54c327a81e9bf767284'
'2dae86eb8d34194fc7012fb054859f18'
'210074137b0be358a7c9ec483f7f76e6'
'4ccd4f497105f69930177fcffdb583c9'
'4cc4db3a2268b91583da861fbe064bfc'
'dd5fdabdf2c8609fbd8752c42f5773c2'
'bcba9216d3414a9de22b7d4fb24853e1'
'c2d9dba73587fd00d990a2521428d67b'
'302ad0fe4e990c789793e25ced58f712'
'c8894e44904cc1365e7110eb04aea1d6'
'14ec6ec6f9de8d1fd0333024481541af'
'f0ebf1f2dbfa4030ba3945fea97710a1'
'1d38c32d1d5348ef24745b2f38b0f040'
'1bf553ee320c43a8e0941274bcdb4bf2'
'be34abb50266df17160dd1c6170299f4'
'06d9896eb871dabcdb91b5f1a15bffdf'
'd02c1a4f67a2e5680b7e23cc5a1998cd')
__gitname="linux-2.6-imx"
__gitroot="git://git.freescale.com/imx/${__gitname}.git"
__gittag="rel_imx_2.6.35_11.09.01"
__gitcommit="691c08adeed64d5153937a0e31aaf4c251924471"
build() {
cd "$srcdir"
if [ -d $__gitname ] ; then
msg "Using existing GIT repo clone."
cd ${__gitname} && git checkout ${__gitcommit} -- .
msg "The local files are updated."
else
msg "GIT Checkout of ${_gitroot}"
git clone --depth=1 --branch=${__gittag} ${__gitroot} ${__gitname}
fi
cd ${srcdir}/${__gitname}
msg "Cleaning up the working copy..."
git clean -df
make mrproper
msg "Patching ..."
# i.MX233 support patches from Freescale
patch -Np1 -i ../0002-cgroupfs-create-sys-fs-cgroup-to-mount-cgroupfs-on.patch
patch -Np1 -i ../egalax_ts-enable-single-event-support.patch
patch -Np1 -i ../NFS-Fix-nfsroot-support.patch
patch -Np1 -i ../NFS-allow-nfs-root-mount-to-use-alternate-rpc-ports.patch
patch -Np1 -i ../1130-ENGR00157473-MX5X-UART-disable-UART2-DMA-to-make-G.patch
patch -Np1 -i ../1132-ENGR00155891-mx53_loco-enable-mc34708-s-WDI-functio.patch
patch -Np1 -i ../1134-ENGR00159738-v4l2-correct-wrong-parameter-when-V4l2.patch
patch -Np1 -i ../1136-ENGR00161215-1-arch-arm-Add-two-new-IOCTLs-in-mxc_v.patch
patch -Np1 -i ../1137-ENGR00161215-2-vpu-Add-ioctls-for-querying-and-sett.patch
patch -Np1 -i ../1139-ENGR00162464-update-pm4-microcode-pm4_microcode_r18.patch
patch -Np1 -i ../1140-ENGR00162711-DA9053-Add-dummy-write-for-DA9053-I2C.patch
patch -Np1 -i ../1141-ENGR00162708-MX5-Add-I2C-dummy-write-and-mask-nONKE.patch
patch -Np1 -i ../1142-ENGR00163698-MX53-ARD-fix-typo-error-for-pwm1-pad-d.patch
patch -Np1 -i ../1143-ENGR00162578-DMA-mx5-increase-DMA-Zone-size-to-112.patch
patch -Np1 -i ../1144-ENGR00169603-MX53-ARD-FlexCAN-Set-lp_apm-as-clock.patch
patch -Np1 -i ../1145-ENGR00170342-PWM-fix-pwm-output-can-t-be-set-to-100.patch
patch -Np1 -i ../1146-ENGR00170244-1-ARM-AHCI-Enable-PDDQ-mode-when-no-d.patch
patch -Np1 -i ../1147-ENGR00170244-2-ARM-AHCI-Enable-PDDQ-mode-when-no-d.patch
patch -Np1 -i ../no-unaligned-access.patch
patch -Np1 -i ../mx28-removecpufreq.patch
patch -Np1 -i ../mxs-duart-use-ttyAMA-for-device-name.patch
patch -Np1 -i ../w1-fix-support-multiple-master.patch
patch -Np1 -i ../smsc95xx-randomize-mac-once.patch
patch -Np1 -i ../dm9601-support-for-usb-ethernet-0x0fe6-0x9700.patch
patch -Np1 -i ../wire-up-sys_accept4-on-ARM.patch
patch -Np1 -i ../0001-mx53_loco-add-USR-led-support.patch
patch -Np1 -i ../002_Return_ERESTARTSYS_from_IPU_GET_EVENT.patch
patch -Np1 -i ../003_Sanitise_ipu_interrupt_return_value.patch
# board-specific patch
patch -Np1 -i ../imx233-olinuxino.patch
sed -i 's|/sbin/depmod|/bin/true|' Makefile
msg "Patching done, building the kernel."
cp ${srcdir}/config .config
# set extraversion to pkgrel
sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
# 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 oldconfig # using old config from previous kernel version
# Build!
make ${MAKEFLAGS} zImage modules
}
package_kernel26-olinuxino() {
pkgdesc="The Linux Kernel and modules for iMX233-OLinuXino-Maxi"
groups=('base')
depends=('coreutils' 'module-init-tools')
replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
'alsa-driver' 'ieee80211' 'hostap-driver26'
'pwc' 'nforce' 'squashfs' 'unionfs' 'ivtv'
'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs'
'gspcav1' 'atl2' 'wlan-ng26' 'rt2500' 'nouveau-drm')
provides=("kernel26=${pkgver}" "linux=${pkgver}")
install=kernel26.install
KARCH=arm
cd ${srcdir}/${__gitname}
# get kernel version
_kernver="$(make kernelrelease)"
# Install zImage, System.map and the config for reference
mkdir -p ${pkgdir}/{lib/modules,lib/firmware,boot}
make INSTALL_MOD_PATH="${pkgdir}" modules_install
#cp arch/$KARCH/boot/uImage ${pkgdir}/boot/uImage
cp arch/$KARCH/boot/zImage ${pkgdir}/boot/zImage
cp .config ${pkgdir}/boot/config-${_kernver}
cp System.map System.map-${_kernver}
# set correct depmod command for install
sed \
-e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
-e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
-i $startdir/kernel26.install
# Generate an imx233 boot image
msg "Generating sdcard image ..."
ln -sf /opt/imx-bootlets-olinuxino
elftosb -z -c ./imx-bootlets-olinuxino/linux.bd -o ${pkgdir}/boot/oli-${_kernver}.sb
# remove build and source links
rm -f ${pkgdir}/usr/lib/modules/${_kernver}/{source,build}
# move module tree /lib -> /usr/lib
mkdir -p "${pkgdir}/usr"
mv "$pkgdir/lib" "$pkgdir/usr"
# Now we call depmod...
depmod -b "$pkgdir" -F System.map "$_kernver"
}
package_kernel26-headers-olinuxino() {
pkgdesc="Header files and scripts for building modules for kernel26 for iMX233-OLinuXino-Maxi"
provides=("kernel26-headers=${pkgver}" "linux-headers=${pkgver}")
KARCH=arm
cd ${srcdir}/${__gitname}
# get kernel version
_kernver="$(make kernelrelease)"
install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
cd "${pkgdir}/usr/lib/modules/${_kernver}"
ln -sf ../../../src/linux-${_kernver} build
cd ${srcdir}/${__gitname}
install -D -m644 Makefile \
${pkgdir}/usr/src/linux-${_kernver}/Makefile
install -D -m644 kernel/Makefile \
${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
install -D -m644 .config \
${pkgdir}/usr/src/linux-${_kernver}/.config
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include
for i in acpi asm-generic config generated linux math-emu media net pcmcia scsi sound trace video; do
cp -a include/$i ${pkgdir}/usr/src/linux-${_kernver}/include/
done
# copy arch includes for external modules
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH
cp -a arch/$KARCH/include ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
# install platform- and machine-specific headers
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/mach-mx23
cp -a arch/$KARCH/mach-mx23/include ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/mach-mx23/
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/plat-mxs
cp -a arch/$KARCH/plat-mxs/include ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/plat-mxs/
# copy files necessary for later builds, like nvidia and vmware
cp Module.symvers ${pkgdir}/usr/src/linux-${_kernver}
cp -a scripts ${pkgdir}/usr/src/linux-${_kernver}
# fix permissions on scripts dir
chmod og-w -R ${pkgdir}/usr/src/linux-${_kernver}/scripts
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel
cp arch/$KARCH/Makefile ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
cp arch/$KARCH/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
# add headers for lirc package
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video
cp drivers/media/video/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/
for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo; do
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
cp -a drivers/media/video/$i/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
done
# add docbook makefile
install -D -m644 Documentation/DocBook/Makefile \
${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
# add dm headers
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
cp drivers/md/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
# add inotify.h
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/linux
cp include/linux/inotify.h ${pkgdir}/usr/src/linux-${_kernver}/include/linux/
# add wireless headers
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
cp net/mac80211/*.h ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
# add dvb headers for external modules
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
cp drivers/media/dvb/dvb-core/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
# add dvb headers for external modules
#mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
#cp include/config/dvb/*.h ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
# add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
cp drivers/media/dvb/frontends/lgdt330x.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
cp drivers/media/video/msp3400-driver.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
# add dvb headers
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb
cp drivers/media/dvb/dvb-usb/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends
cp drivers/media/dvb/frontends/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners
cp drivers/media/common/tuners/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/
# add xfs and shmem for aufs building
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/mm
cp fs/xfs/xfs_sb.h ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
# add headers vor virtualbox
cp -a include/drm $pkgdir/usr/src/linux-${_kernver}/include/
# add headers for broadcom wl
cp -a include/trace $pkgdir/usr/src/linux-${_kernver}/include/
# copy in Kconfig files
for i in `find . -name "Kconfig*"`; do
mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
done
chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
# remove unneeded architectures
rm -rf ${pkgdir}/usr/src/linux-${_kernver}/arch/{alpha,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,microblaze,mn10300,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa,x86}
}