# Maintainer: Sébastien Luttringer # Customized version of linux for seblu computers pkgname=linux-seblu pkgver=4.5_rc5 pkgrel=1 pkgdesc='The Linux Kernel cooked by Seblu' arch=('x86_64') license=('GPL2') url='http://www.kernel.org' options=('!strip') makedepends=('kmod' 'git' 'make' 'gcc' 'bc') depends=('linux-firmware' 'kernel-install-hook') install=linux-seblu.install source=("git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git#tag=v${pkgver/_/-}" "config.$CARCH") md5sums=('SKIP' 'SKIP') prepare() { cd linux # apply patches for _f in "${source[@]}"; do if [[ "$_f" =~ \.patch$ ]]; then msg2 "Patching $_f" patch -p1 < "$srcdir/$_f" fi done # loading default config # use make localmodconfig to check .config is correct msg2 'Copying config' install "$srcdir/config.$CARCH" .config # force suffixe in config (must be the right!) msg2 'Setting kernel suffix' sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${pkgname#linux*}\"|g" .config # remove git informations # these info will be used by make kernelrelease and produce wrong information # because ownership has fakely be changed by fakeroot during packaging. rm -rf .git # define current build version echo "$(($pkgrel - 1 )) " > .version } build() { cd linux msg2 'Make prepare' make prepare msg2 'Make bzImage' make bzImage msg2 'Make modules' make modules } package() { cd linux # get real compiled kernel version kernrel=$(make kernelrelease) pkgdesc="$pkgdesc, version $kernrel" pkgname="linux-$kernrel" pkgver=$(make kernelversion|tr '-' '_') provides=("linux=$pkgver" "linux-headers=$pkgver") msg2 "Kernel release: $kernrel" msg2 "Package kernel version: $pkgver" msg2 'Install vmlinuz' install -D -m644 arch/x86/boot/bzImage "$pkgdir/usr/lib/kernel/vmlinuz-$kernrel" msg2 'Install modules' # disable DEPMOD because it fail due to poor hack in scripts/depmod.sh make -s INSTALL_MOD_PATH="$pkgdir/usr" DEPMOD=/bin/true modules_install msg2 'Install headers' install_sources msg2 'Remove firmwares' rm -rf "$pkgdir/usr/lib/firmware" msg2 'Generate modules.dep and map files' # run depmod to keep track of these files and remove them with the package depmod -b "$pkgdir/usr" -F System.map "$kernrel" } install_sources() { local kernsrc="$pkgdir/usr/src/$pkgname" # create $kernsrc directory install -d -m 755 "$kernsrc" # remove previous build and source links rm -f "$pkgdir/usr/lib/modules/$kernrel"/{source,build} ln -rs "$kernsrc" "$pkgdir/usr/lib/modules/$kernrel"/source ln -rs "$kernsrc" "$pkgdir/usr/lib/modules/$kernrel"/build # Copy kernel config files cd "$srcdir"/linux install -D -m644 Makefile "$kernsrc/Makefile" install -D -m644 kernel/Makefile "$kernsrc/kernel/Makefile" install -D -m644 .config "$kernsrc/.config" for i in localversion*; do [[ -e "$i" ]] && install -m644 "$i" "$kernsrc/$i" done # create include directory install -d "$kernsrc/include" for i in acpi asm-generic config crypto drm generated linux math-emu \ media net pcmcia scsi sound trace uapi video xen; do cp -a include/$i "$kernsrc/include/" done # remove unneeded architectures for i in "$kernsrc"/arch/*; do [[ "$i" != x86 ]] && rm -rf "$i" done # copy arch includes for external modules install -d "$kernsrc/arch/x86" cp -a arch/x86/include "$kernsrc/arch/x86/" # copy files necessary for later builds, like nvidia and vmware cp Module.symvers "$kernsrc" cp -a scripts "$kernsrc" # fix permissions on scripts dir chmod og-w -R "$kernsrc/scripts" # add x86 makefile install -d "$kernsrc/.tmp_versions" install -d "$kernsrc/arch/x86/kernel" cp arch/x86/Makefile "$kernsrc/arch/x86/" cp arch/x86/kernel/asm-offsets.s "$kernsrc/arch/x86/kernel/" # add docbook makefile install -D -m644 Documentation/DocBook/Makefile "$kernsrc/Documentation/DocBook/Makefile" # add dm headers install -d "$kernsrc/drivers/md" cp drivers/md/*.h "$kernsrc/drivers/md" # add inotify.h install -d "$kernsrc/include/linux" cp include/linux/inotify.h "$kernsrc/include/linux/" # add wireless headers install -d "$kernsrc/net/mac80211/" cp net/mac80211/*.h "$kernsrc/net/mac80211/" # add dvb headers for external modules # in reference to: # http://bugs.archlinux.org/task/9912 install -d "$kernsrc/drivers/media/dvb-core" cp drivers/media/dvb-core/*.h "$kernsrc/drivers/media/dvb-core/" # add dvb headers for external modules # in reference to: # http://bugs.archlinux.org/task/11194 install -d "$kernsrc/include/config/dvb/" cp include/config/dvb/*.h "$kernsrc/include/config/dvb/" # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new # in reference to: # http://bugs.archlinux.org/task/13146 install -Dm644 drivers/media/dvb-frontends/lgdt330x.h \ "$kernsrc/drivers/media/dvb-frontends/dvb-frontends/lgdt330x.h" install -Dm644 drivers/media/i2c/msp3400-driver.h \ "$kernsrc/drivers/media/i2c/msp3400-driver.h" # add dvb headers # in reference to: # http://bugs.archlinux.org/task/20402 install -d "$kernsrc/drivers/media/usb/dvb-usb" cp drivers/media/usb/dvb-usb/*.h "$kernsrc/drivers/media/usb/dvb-usb/" install -d "$kernsrc/drivers/media/dvb-frontends" cp drivers/media/dvb-frontends/*.h "$kernsrc/drivers/media/dvb-frontends/" install -d "$kernsrc/drivers/media/tuners" cp drivers/media/tuners/*.h "$kernsrc/drivers/media/tuners/" # copy in Kconfig files for i in $(find . -name "Kconfig*"); do install -d "$kernsrc"/$(echo $i | sed 's|/Kconfig.*||') cp "$i" "$kernsrc/$i" done # fix permissions chown -R root:root "$kernsrc" find "$kernsrc" -type d -exec chmod 755 {} \; # strip scripts directory find "$kernsrc/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do case "$(file -bi "$binary")" in *application/x-sharedlib*) # Libraries (.so) strip $STRIP_SHARED "$binary";; *application/x-archive*) # Libraries (.a) strip $STRIP_STATIC "$binary";; *application/x-executable*) # Binaries strip $STRIP_BINARIES "$binary";; esac done # check rights chown -R root.root "$kernsrc" chmod -R u=rwX,go=rX "$kernsrc" } # vim:set ts=2 sw=2 ft=sh et: