summaryrefslogtreecommitdiffstats
path: root/kernel/Pkgfile
blob: d79340146ef7219a745b7ab486778ff8bff3a41a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# Description: Le kernel avec les modules nvidia, ati, broadcom et virtualbox
# URL:  http://www.kernel.org
# Maintainer: git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
# Packager: thierryn1 at hispeed dot ch, tyrry33 at gmail dot com
# Depends on: git, prt-get

name=kernel
version=3.5.0
_BaseVersion=$(expr $version : '\([0-9]\.[0-9]\)')
release=1
PKGMK_NO_STRIP="yes"
PKGMK_IGNORE_FOOTPRINT="yes"
PKGMK_IGNORE_MD5SUM="yes"
SCRIPT_VERSION="pakxe.4"
INITRDBASE="nutyx-initrd"
_extra=08072012
_tools=22072012
NVIDIA_VERSION=304.32
VB_VERSION=4.1.18
VB_BUILD=78361
ATI_VERSION=12.6

[ "`uname -m`" == "i686"   ] && _ARCH=x86
[ "`uname -m`" == "x86_64"   ] && _ARCH=x86_64
[ "`uname -m`" == "i686"   ] && VB_ARCH=x86
[ "`uname -m`" == "x86_64"   ] && VB_ARCH=amd64
[ "`uname -m`" == "i686"   ] && BC_ARCH=x86_32
[ "`uname -m`" == "x86_64"   ] && BC_ARCH=x86_64

source=(http://www.broadcom.com/docs/linux_sta/hybrid-portsrc_${BC_ARCH}-v5_100_82_112.tar.gz
	http://download.virtualbox.org/virtualbox/${VB_VERSION}/VirtualBox-${VB_VERSION}-${VB_BUILD}-Linux_${VB_ARCH}.run
	http://www2.ati.com/drivers/linux/amd-driver-installer-${ATI_VERSION/./-}-x86.x86_64.run
	http://us.download.nvidia.com/XFree86/Linux-${_ARCH}/${NVIDIA_VERSION}/NVIDIA-Linux-${_ARCH}-${NVIDIA_VERSION}.run
	http://www.kernel.org/pub/linux/kernel/v3.0/linux-${_BaseVersion}.tar.xz
	http://kiao.no-ip.info/NuTyX/install-${SCRIPT_VERSION}.ash
	http://nutyx.meticul.eu/files/nutyx-initrd-`uname -m`-${_extra}.tar.bz2
	http://nutyx.meticul.eu/files/installtools-${_tools}.tar.bz2
	makefile_compat.patch
	bc_wl_abiupdate.patch
	ati-kernel-3.2.8.patch
	ati-kernel-3.4.patch
	broadcom-wl-kernel3-01.patch
	0005-add-support-for-linux-3.4.0.patch
	config_64
	config)

if [ "${version}" != "${_BaseVersion}.0" ]; then
source[${#source[*]}]="http://www.kernel.org/pub/linux/kernel/v3.0/patch-$version.xz"
fi

build(){

sed -i "s/^SCRIPT_VERSION=.\{1,\}/SCRIPT_VERSION=\"$SCRIPT_VERSION\"/" `prt-get printf %p --filter=$name`/$name/post-install

# firmware
#git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
#rm -r linux-firmware/.git

#cp -a linux-firmware $INITRDBASE/rootfs/lib/firmware

#mkdir -p $PKG/lib
#cp -a linux-firmware $PKG/lib/firmware

# initrd
cd $SRC

sed -i "s|#VERSION#|$SCRIPT_VERSION|g" \
$INITRDBASE/rootfs/install/functions

for i in setup-install setup-mirroir
do
        sed -i "s|#INSTALL#|install-$SCRIPT_VERSION.ash|" \
        $INITRDBASE/rootfs/install/$i || exit 1
done
for i in main.txt setup-grub
do
        sed -i "s|#VERSION#|MINI $SCRIPT_VERSION|g" \
        $INITRDBASE/rootfs/install/$i
done

# kernel sources
if ! [ -d /usr/src/linux-${_BaseVersion} ]; then
        mv linux-${_BaseVersion} /usr/src/
        ln -s  /usr/src/linux-${_BaseVersion} linux-${_BaseVersion}
        cd linux-${_BaseVersion}
        if [ -f $SRC/patch-$version.xz ]; then
		xzcat $SRC/patch-$version.xz | patch -Np1
        fi
        cd ..
else
        rm -r linux-${_BaseVersion}
fi
ln -s  /usr/src/linux-${_BaseVersion} linux-${_BaseVersion}
cd linux-${_BaseVersion}

# make mrproper

case `uname -m` in
        x86_64)
        mv $SRC/config_64 ./.config;;
        i?86)
        mv $SRC/config ./.config;;
esac
sed -i "s/EXTRAVERSION = .*/EXTRAVERSION =/" Makefile
# When a new patchlevel is release (3.2->3.3 for ex)
# decomment and run make menuconfig
#make menuconfig
case `uname -m` in
        x86_64)
                cp .config `prt-get printf %p --filter=$name`/$name/config_64;;
        i?86)
                cp .config `prt-get printf %p --filter=$name`/$name/config;;
esac
make
case `uname -m` in
        x86_64)
                cp .config `prt-get printf %p --filter=$name`/$name/config_64;;
        i?86)
                cp .config `prt-get printf %p --filter=$name`/$name/config;;
esac
# Module broadcom
cd $SRC
patch -Np1 -i broadcom-wl-kernel3-01.patch
patch -Np2 -i 0005-add-support-for-linux-3.4.0.patch
patch -p0 src/wl/sys/wl_linux.c < bc_wl_abiupdate.patch
KBUILD_NOPEDANTIC=1 make -C $SRC/linux-${_BaseVersion} M=`pwd`
install -m 0644 -D wl.ko $PKG/lib/modules/${version}/kernel/drivers/zzzz/wl.ko

# Module nvidia
cd $SRC
sh NVIDIA-Linux-${_ARCH}-${NVIDIA_VERSION}.run --extract-only
cd NVIDIA-Linux-${_ARCH}-${NVIDIA_VERSION}/kernel
ln -s Makefile{.kbuild,}
SYSSRC=$SRC/linux-${_BaseVersion} make module
install -m 0644 -D nvidia.ko $PKG/lib/modules/${version}/kernel/drivers/zzzz/nvidia.ko

# Module ati
cd $SRC
sh amd-driver-installer-${ATI_VERSION/./-}-x86.x86_64.run --extract amd
cd amd
patch -Np1 -i ../makefile_compat.patch
#patch -Np1 -i ../ati-kernel-3.2.8.patch
patch -Np1 -i ../ati-kernel-3.4.patch
cd common/lib/modules/fglrx/build_mod
cp 2.6.x/Makefile .
cp $SRC/amd/arch/${_ARCH}/lib/modules/fglrx/build_mod/libfglrx_ip.a .
make -C $SRC/linux-${_BaseVersion} SUBDIRS="`pwd`" modules
install -m 0644 -D fglrx.ko $PKG/lib/modules/${version}/kernel/drivers/zzzz/fglrx.ko

# Modules VB
cd $SRC
sh VirtualBox-${VB_VERSION}-${VB_BUILD}-Linux_${VB_ARCH}.run --target vb --keep --noexec
cd vb
tar xfj VirtualBox.tar.bz2
cd src/vboxhost/
KERNELRELEASE=${version} KERN_DIR=$SRC/linux-${_BaseVersion} make
for i in *.ko
do
        install -D -m0644 $i \
        $PKG/lib/modules/${version}/kernel/drivers/zzzz/$i
done
# Install modules
cd $SRC/linux-${_BaseVersion}
sed -i "/rm\ -rf\ \$(MODLIB)\/kernel/d" Makefile
make -j1 INSTALL_MOD_PATH=$PKG modules_install
mkdir -p $PKG/boot
case `uname -m` in
        x86_64)
                cp  System.map \
                $PKG/boot/System_64.map-$version
                cp  .config    \
                $PKG/boot/config_64-$version
                cp  arch/x86_64/boot/bzImage \
                $PKG/boot/kernel-$version ;;
        i?86)
                cp  System.map \
                $PKG/boot/System.map-$version
                cp  .config \
                $PKG/boot/config-$version
                cp  arch/i386/boot/bzImage \
                $PKG/boot/kernel-$version ;;
esac
ln -sf kernel-$version $PKG/boot/kernel
cd $PKG/lib/modules/${version}/
rm {build,source}
ln -sv /usr/src/linux-${_BaseVersion} build
ln -sv /usr/src/linux-${_BaseVersion} source

# initrd
cd $SRC
mkdir -p $PKG/root/bin
install -m755 $SRC/install-${SCRIPT_VERSION}.ash \
        $PKG/root/bin/install-${SCRIPT_VERSION}.ash
bsdtar -c "-J" -f $PKG/boot/nutyx-initrd.tar.xz $INITRDBASE
}