1 # Maintainer: TDY <tdy@gmx.com>
3 pkgname=kernel26rsbac-daz
7 _kernelname=linux-$_kernelver-${_patchset%-*}-$pkgver
9 pkgdesc="A minimal RSBAC kernel compiled with the DAZ module for an official Dazuko interface"
11 url="http://www.rsbac.org/"
13 depends=('coreutils' 'module-init-tools' 'mkinitcpio>=0.5.18')
15 backup=(boot/kconfig26$_patchset etc/mkinitcpio.d/$pkgname.preset)
16 install=$pkgname.install
17 source=(ftp://rsbac.org/download/kernels/$pkgver/${_kernelver%.*}/$_kernelname.tar.bz2
18 config config.x86_64 $pkgname.preset)
19 md5sums=('c47326fdd5b820797d2c31ea18bcd3b3'
20 '3a14bcc11708340a59fb3dca4933d64e'
21 '3514ff55799e13edf2256a95b91bcba7'
22 '5e25b039c75cd7a525889e04731917e5')
26 _kernver=${_kernelver%.*}-$_patchset
27 cd "$srcdir/$_kernelname"
29 # msg "Applying -ARCH patch..."
30 # patch -Np1 -i ../patch-$_kernelver-1-ARCH || return 1
32 msg "Configuring kernel..."
33 [ "$CARCH" = "x86_64" ] && \
34 cat ../config.x86_64 > .config || cat ../config > .config
35 sed -i "s/\(LOCALVERSION=\).*/\1\"-$_patchset\"/g" .config
36 sed -i "s/\(KERNELRELEASE = \).*/\1$_kernver/g" Makefile
37 yes "" | make config > /dev/null || return 1
39 msg "Building kernel..."
40 make bzImage modules || return 1
41 install -dm755 "$pkgdir"/{lib/modules,boot}
42 make INSTALL_MOD_PATH="$pkgdir" modules_install || return 1
44 msg "Copying kernel files..."
45 cp System.map "$pkgdir/boot/System.map26$_patchset"
46 cp arch/$_karch/boot/bzImage "$pkgdir/boot/vmlinuz26$_patchset"
47 install -Dm644 Makefile "$pkgdir/usr/src/linux-$_kernver/Makefile"
48 install -Dm644 kernel/Makefile \
49 "$pkgdir/usr/src/linux-$_kernver/kernel/Makefile"
50 install -Dm644 .config "$pkgdir/usr/src/linux-$_kernver/.config"
51 install -Dm644 .config "$pkgdir/boot/kconfig26$_patchset"
53 install -dm755 "$pkgdir/usr/src/linux-$_kernver/include"
54 for i in acpi asm-{generic,x86} config linux math-emu media net pcmcia scsi \
56 cp -a include/$i "$pkgdir/usr/src/linux-$_kernver/include/"
59 cp Module.symvers "$pkgdir/usr/src/linux-$_kernver/"
60 cp -a scripts "$pkgdir/usr/src/linux-$_kernver/"
61 chmod og-w -R "$pkgdir/usr/src/linux-$_kernver/scripts"
63 install -dm755 "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/kernel"
64 cp arch/$_karch/Makefile "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/"
65 [ "$CARCH" = "i686" ] && cp arch/$_karch/Makefile_32.cpu \
66 "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/"
67 cp arch/$_karch/kernel/asm-offsets.s \
68 "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/kernel/"
70 msg "Copying headers..."
72 install -dm755 "$pkgdir/usr/src/linux-$_kernver/drivers/media/video"
73 cp drivers/media/video/*.h \
74 "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/"
75 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 \
77 install -dm755 "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/$i"
78 cp -a drivers/media/video/$i/*.h \
79 "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/$i/"
83 install -dm755 "$pkgdir/usr/src/linux-$_kernver/drivers/md"
84 cp drivers/md/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/md/"
87 install -dm755 "$pkgdir/usr/src/linux-$_kernver/include/linux"
88 cp include/linux/inotify.h "$pkgdir/usr/src/linux-$_kernver/include/linux/"
90 msg2 "CLUSTERIP file for iptables"
91 install -dm755 "$pkgdir/usr/src/linux-$_kernver/net/ipv4/netfilter"
92 cp net/ipv4/netfilter/ipt_CLUSTERIP.c \
93 "$pkgdir/usr/src/linux-$_kernver/net/ipv4/netfilter/"
96 install -dm755 "$pkgdir/usr/src/linux-$_kernver/net/mac80211"
97 cp net/mac80211/*.h "$pkgdir/usr/src/linux-$_kernver/net/mac80211/"
99 msg2 "dvb for FS#9912"
100 install -dm755 "$pkgdir/usr/src/linux-$_kernver/drivers/media/dvb/dvb-core"
101 cp drivers/media/dvb/dvb-core/*.h \
102 "$pkgdir/usr/src/linux-$_kernver/drivers/media/dvb/dvb-core/"
104 msg2 "dvb for FS#11194"
105 install -dm755 "$pkgdir/usr/src/linux-$_kernver/include/config/dvb"
106 cp include/config/dvb/*.h \
107 "$pkgdir/usr/src/linux-$_kernver/include/config/dvb/"
109 msg2 "dvb for FS#13146"
110 install -dm755 "$pkgdir/usr/src/linux-$_kernver/drivers/media/dvb/frontends"
111 cp drivers/media/dvb/frontends/lgdt330x.h \
112 "$pkgdir/usr/src/linux-$_kernver/drivers/media/dvb/frontends/"
113 cp drivers/media/video/msp3400-driver.h \
114 "$pkgdir/usr/src/linux-$_kernver/drivers/media/dvb/frontends/"
116 msg2 "xfs and shmem for aufs building"
117 install -dm755 "$pkgdir/usr/src/linux-$_kernver/fs/xfs"
118 install -dm755 "$pkgdir/usr/src/linux-$_kernver/mm"
119 cp fs/xfs/xfs_sb.h "$pkgdir/usr/src/linux-$_kernver/fs/xfs/"
121 msg2 "virtualbox for FS#14568"
122 cp -a include/drm "$pkgdir/usr/src/linux-$_kernver/include/"
124 msg2 "broadcom wl for FS#14568"
125 cp -a include/trace "$pkgdir/usr/src/linux-$_kernver/include/"
128 cp vmlinux "$pkgdir/usr/src/linux-$_kernver/"
130 msg "Copying Kconfigs..."
131 for i in $(find . -name "Kconfig*"); do
132 install -dm755 "$pkgdir/usr/src/linux-$_kernver/$(echo $i | sed 's#/Kconfig.*##')"
133 cp $i "$pkgdir/usr/src/linux-$_kernver/$i"
136 cd "$pkgdir/usr/src/linux-$_kernver/include" && \
137 ln -s asm-$_karch asm
138 chown -R root.root "$pkgdir/usr/src/linux-$_kernver"
139 find "$pkgdir/usr/src/linux-$_kernver" -type d -exec chmod 755 '{}' \;
140 cd "$pkgdir/lib/modules/$_kernver" && \
141 (rm -f source build; ln -sf ../../../usr/src/linux-$_kernver build)
143 msg "Preparing install script..."
144 sed -i "s/KERNEL_VERSION=.*/KERNEL_VERSION=$_kernver/g; \
145 s/RSBAC_VERSION=.*/RSBAC_VERSION=$pkgver/g" "$startdir/$install"
146 sed -i "s/LOCAL_VERSION=.*/LOCAL_VERSION=$_patchset/g" \
147 "$startdir/$install" "$srcdir/$pkgname.preset"
149 msg "Installing mkinitcpio preset..."
150 install -Dm644 "$srcdir/$pkgname.preset" \
151 "$pkgdir/etc/mkinitcpio.d/$pkgname.preset" || return 1
152 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='$_kernver'" \
153 > "$pkgdir/etc/mkinitcpio.d/$pkgname.kver"
155 msg "Purging unneeded architectures..."
156 find "$pkgdir/usr/src/linux-$_kernver/arch"/* -maxdepth 0 -type d \
157 ! -name "$_karch" -exec rm -rf '{}' \;
159 msg "Removing firmware..."
160 rm -rf "$pkgdir/lib/firmware"