From a24e371cd213391f6a2545f2e22d563b7873b96a Mon Sep 17 00:00:00 2001 From: Gottox Date: Tue, 21 Jan 2014 21:45:40 +0100 Subject: [PATCH] Adding kernel-odroid-u2 for odroid u2/u3 --- srcpkgs/kernel-headers-odroid-u2 | 1 + srcpkgs/kernel-odroid-u2/template | 164 ++++++++++++++++++++++++++++++ srcpkgs/linux/template | 5 + 3 files changed, 170 insertions(+) create mode 120000 srcpkgs/kernel-headers-odroid-u2 create mode 100644 srcpkgs/kernel-odroid-u2/template diff --git a/srcpkgs/kernel-headers-odroid-u2 b/srcpkgs/kernel-headers-odroid-u2 new file mode 120000 index 00000000000..b3a59db17e5 --- /dev/null +++ b/srcpkgs/kernel-headers-odroid-u2 @@ -0,0 +1 @@ +kernel-odroid-u2/ \ No newline at end of file diff --git a/srcpkgs/kernel-odroid-u2/template b/srcpkgs/kernel-odroid-u2/template new file mode 100644 index 00000000000..6f48c1a4684 --- /dev/null +++ b/srcpkgs/kernel-odroid-u2/template @@ -0,0 +1,164 @@ +# Template file for 'kernel-odroid-u2' +# +# Latest commit as of 20140121 +_githash="9277d733a276fb27da1061d5210ac3c45a16ac18" + +pkgname=kernel-odroid-u2 +version=3.8.13.14 +revision=1 +maintainer="Enno Boland " +homepage="http://www.kernel.org" +license="GPL-2" +short_desc="The Linux kernel and modules for the Odroid U2/U3 (3.12 series [git ${_githash}])" +create_srcdir=yes +distfiles="https://github.com/hardkernel/linux/archive/${_githash}.tar.gz" +checksum=894cdbbdd0e5ef3ec4b57e4aef57f52fd83ed6fa99a2dc11aaca96ef028a9c99 +wrksrc="linux-${_githash}" + +_kernver="${version}_${revision}" + +nostrip=yes +noverifyrdeps=yes +only_for_archs="armv7l" +hostmakedepends="perl python kmod>=11_2 uboot-mkimage openssl which elfutils bc" +makedepends="ncurses-devel" +depends="kmod>=11_2" +triggers="kernel-hooks" +# These files could be modified when an external module is built. +mutable_files=" + /usr/lib/modules/${_kernver}/modules.dep + /usr/lib/modules/${_kernver}/modules.dep.bin + /usr/lib/modules/${_kernver}/modules.symbols + /usr/lib/modules/${_kernver}/modules.symbols.bin + /usr/lib/modules/${_kernver}/modules.alias + /usr/lib/modules/${_kernver}/modules.alias.bin + /usr/lib/modules/${_kernver}/modules.devname" + +do_configure() { + if [ "$CROSS_BUILD" ]; then + _args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-" + fi + + unset LDFLAGS + # Use upstream default configuration, no need to maintain ours. + make ${makejobs} ${_args} ARCH=arm odroidu2_defconfig + + # Always use our revision to CONFIG_LOCALVERSION to match our pkg version. + sed -i -e "s|^\(CONFIG_LOCALVERSION=\).*|\1\"_${revision}\"|" .config +} + +do_build() { + if [ "$CROSS_BUILD" ]; then + _args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-" + fi + unset LDFLAGS + make ${makejobs} ${_args} ARCH=arm prepare + make ${makejobs} ${_args} ARCH=arm zImage modules +} + +do_install() { + local hdrdest + + # Run depmod after compressing modules. + sed -i '2iexit 0' scripts/depmod.sh + + # Install kernel, firmware and modules + make ARCH=arm INSTALL_MOD_PATH=${DESTDIR} modules_install + + vinstall arch/arm/boot/zImage 644 boot + + hdrdest=${DESTDIR}/usr/src/kernel-headers-odroid-${_kernver} + + # Switch to /usr. + vmkdir usr + mv ${DESTDIR}/lib ${DESTDIR}/usr + + cd ${DESTDIR}/usr/lib/modules/${_kernver} + rm -f source build + ln -sf ../../../src/kernel-headers-odroid-${_kernver} build + + cd ${wrksrc} + + # Remove firmware stuff provided by the "linux-firmware" pkg. + rm -rf ${DESTDIR}/usr/lib/firmware + + mkdir -p ${hdrdest}/include + for i in acpi asm-generic config crypto drm generated linux math-emu \ + media net pcmcia scsi sound trace video xen; do + [ -d include/$i ] && cp -a include/$i ${hdrdest}/include + done + + cd ${wrksrc} + # Copy files necessary for later builds. + cp Module.symvers ${hdrdest} + cp -a scripts ${hdrdest} + + # fix permissions on scripts dir + chmod og-w -R ${hdrdest}/scripts + + # copy arch includes for external modules + mkdir -p ${hdrdest}/arch/arm/mach-exynos + mkdir -p ${hdrdest}/arch/arm/plat-samsung + + cp -a arch/arm/include ${hdrdest}/arch/arm + cp -a arch/arm/mach-exynos/include ${hdrdest}/arch/arm/mach-exynos + cp -a arch/arm/plat-samsung/include ${hdrdest}/arch/arm/plat-samsung + + mkdir -p ${hdrdest}/arch/arm/kernel + + cp arch/arm/Makefile ${hdrdest}/arch/arm + if [ "$MACHINE_ARCH" = "i686" ]; then + cp arch/arm/Makefile_32.cpu ${hdrdest}/arch/arm + fi + cp arch/arm/kernel/asm-offsets.s ${hdrdest}/arch/arm/kernel + + # Add docbook makefile + install -Dm644 Documentation/DocBook/Makefile \ + ${hdrdest}/Documentation/DocBook/Makefile + + # Add md headers + mkdir -p ${hdrdest}/drivers/md + cp drivers/md/*.h ${hdrdest}/drivers/md + + # Add inotify.h + mkdir -p ${hdrdest}/include/linux + cp include/linux/inotify.h ${hdrdest}/include/linux + + # Add wireless headers + mkdir -p ${hdrdest}/net/mac80211/ + cp net/mac80211/*.h ${hdrdest}/net/mac80211 + + # add dvb headers for external modules + mkdir -p ${hdrdest}/include/config/dvb/ + cp include/config/dvb/*.h ${hdrdest}/include/config/dvb/ + + # Copy in Kconfig files + for i in $(find . -name "Kconfig*"); do + mkdir -p ${hdrdest}/$(echo $i | sed 's|/Kconfig.*||') + cp $i ${hdrdest}/$i + done + + # Remove unneeded architectures + for arch in alpha arm26 avr32 blackfin cris frv h8300 \ + ia64 m* p* s* um v850 x86 xtensa; do + rm -rf ${hdrdest}/arch/${arch} + done + + # Compress all modules with xz to save a few MBs. + msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n" + find ${DESTDIR} -name '*.ko' -exec gzip -9 {} \; + + # ... and run depmod again. + depmod -b ${DESTDIR}/usr -F System.map ${_kernver} +} + +kernel-headers-odroid-u2_package() { + nostrip=yes + noverifyrdeps=yes + short_desc="Linux kernel headers for the Odroid U2/U3 (3.12 series [${_githash}])" + pkg_install() { + vmove usr/src + vmove usr/lib/modules/${_kernver}/build + } +} + diff --git a/srcpkgs/linux/template b/srcpkgs/linux/template index 9585bb204e1..a184a3cee95 100644 --- a/srcpkgs/linux/template +++ b/srcpkgs/linux/template @@ -19,6 +19,11 @@ case "$XBPS_TARGET_MACHINE" in depends="kernel-rpi" _depends_headers="kernel-rpi-headers" ;; + armv7l*) + makedepends="kernel-odroid-u2 linux-firmware dracut" + depends="kernel-odroid-u2" + _depends_headers="kernel-headers-odroid-u2" + ;; *) msg_error "${pkgname}-${version}: unsupported target machine.\n";; esac