]>
Commit | Line | Data |
---|---|---|
166a6c21 | 1 | ############################################################################### |
802ea3af MT |
2 | # IPFire.org - An Open Source Firewall Solution # |
3 | # Copyright (C) - IPFire Development Team <info@ipfire.org> # | |
166a6c21 MT |
4 | ############################################################################### |
5 | ||
15a11c5b MT |
6 | name = kernel |
7 | version = 3.0.4 | |
bcf38aec | 8 | release = 5 |
15a11c5b | 9 | thisapp = linux-%{version} |
166a6c21 | 10 | |
802ea3af MT |
11 | maintainer = Michael Tremer <michael.tremer@ipfire.org> |
12 | groups = System/Kernels | |
13 | url = http://www.kernel.org/ | |
14 | license = GPLv2 | |
15 | summary = The Linux kernel. | |
166a6c21 | 16 | |
802ea3af | 17 | description |
166a6c21 MT |
18 | The kernel package contains the Linux kernel (vmlinuz), the core of any \ |
19 | Linux operating system. The kernel handles the basic functions \ | |
20 | of the operating system: memory allocation, process allocation, device \ | |
21 | input and output, etc. | |
802ea3af | 22 | end |
166a6c21 | 23 | |
802ea3af | 24 | # Version helper variables. |
bcf38aec MT |
25 | localversion = %{release}.%{DISTRO_DISTTAG}.%{DISTRO_ARCH} |
26 | fullver = %{version}-%{localversion} | |
802ea3af | 27 | |
15a11c5b | 28 | sources = %{thisapp}.tar.gz |
802ea3af MT |
29 | |
30 | build | |
31 | requires | |
bcf38aec MT |
32 | binutils-devel |
33 | elfutils-devel | |
802ea3af MT |
34 | module-init-tools |
35 | ncurses-devel | |
bcf38aec MT |
36 | newt-devel |
37 | iputils | |
802ea3af | 38 | perl |
bcf38aec MT |
39 | python-devel |
40 | xz-lzma-compat | |
41 | end | |
42 | ||
43 | # A list of kernels to build. | |
44 | kernels = default | |
45 | ||
46 | if "%{DISTRO_ARCH}" == "i686" | |
47 | # Build a PAE-enabled kernel for the i686 architecture. | |
48 | kernels += PAE | |
49 | ||
50 | kernel_arch = x86 | |
51 | kernel_image = arch/%{kernel_arch}/boot/bzImage | |
52 | kernel_target = bzImage | |
802ea3af MT |
53 | end |
54 | ||
55 | prepare_cmds | |
802ea3af MT |
56 | rm -f %{DIR_APP}/localversion-grsec |
57 | ||
58 | sed -e "s/^HOSTCFLAGS.*=.*/& -fPIC/g" -i Makefile | |
59 | ||
60 | cp -vf %{DIR_SOURCE}/%{DISTRO_SNAME}_logo.ppm \ | |
61 | drivers/video/logo/logo_linux_clut224.ppm | |
62 | ||
bcf38aec MT |
63 | # Get rid of unwanted files resulting from patch fuzz. |
64 | find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null | |
65 | ||
66 | # Remove unnecessary SCM files. | |
67 | find . -name .gitignore -exec rm -f {} \; >/dev/null | |
68 | ||
69 | mkdir -pv configs | |
70 | configure_kernel() { | |
71 | local flavour=${1} | |
72 | local suffix | |
73 | if [ "${flavour}" != "default" ]; then | |
74 | suffix="-${flavour}" | |
75 | fi | |
76 | ||
77 | # This is the place, where the configuration files | |
78 | # should be dynamically generated. | |
79 | # For now, we just copy pregenerated ones. | |
80 | cp %{DIR_SOURCE}/config.%{arch}${suffix} .config | |
802ea3af | 81 | |
bcf38aec MT |
82 | make ARCH=%{kernel_arch} oldnoconfig |
83 | mv .config configs/config.${flavour} | |
84 | } | |
85 | ||
86 | # Generate configuration files for all kernels we are going to | |
87 | # build. | |
88 | for kernel in %{kernels}; do | |
89 | configure_kernel ${kernel} | |
90 | done | |
802ea3af MT |
91 | end |
92 | ||
93 | build | |
bcf38aec MT |
94 | build_kernel() { |
95 | local flavour=${1} | |
96 | local suffix | |
97 | local localversion="%{localversion}" | |
98 | local fullversion="%{fullver}" | |
99 | if [ "${flavour}" != "default" ]; then | |
100 | suffix="-${flavour}" | |
101 | localversion="${localversion}.${flavour}" | |
102 | fullversion="${fullversion}.${flavour}" | |
103 | fi | |
802ea3af | 104 | |
bcf38aec MT |
105 | # Clean up the source tree. |
106 | make mrproper | |
802ea3af | 107 | |
bcf38aec MT |
108 | # Install configuration file. |
109 | cp configs/config.${flavour} .config | |
802ea3af | 110 | |
bcf38aec MT |
111 | # Label the build. |
112 | sed -i Makefile \ | |
113 | -e "s/^EXTRAVERSION = .*/EXTRAVERSION = -${localversion}/g" | |
114 | ||
115 | # Run the build. | |
116 | make ARCH=%{kernel_arch} CC="gcc -fno-PIE" %{kernel_target} modules %{PARALLELISMFLAGS} | |
117 | ||
118 | # Install the results. | |
119 | mkdir -pv %{BUILDROOT}/boot %{BUILDROOT}/lib/modules/${fullversion} | |
120 | install -m 755 %{kernel_image} %{BUILDROOT}/boot/vmlinuz-${fullversion} | |
121 | install -m 644 .config %{BUILDROOT}/boot/config-${fullversion} | |
122 | install -m 644 System.map %{BUILDROOT}/boot/System.map-${fullversion} | |
123 | ||
124 | # Create empty initramfs (20M). | |
125 | dd if=/dev/zero of=%{BUILDROOT}/boot/initramfs-${fullversion}.img bs=1M count=20 | |
126 | ||
127 | # Install modules. | |
128 | make ARCH=%{kernel_arch} INSTALL_MOD_PATH=%{BUILDROOT} mod-fw= \ | |
129 | KERNELRELEASE=${fullversion} modules_install | |
130 | #make ARCH=%{kernel_arch} INSTALL_MOD_PATH=%{BUILDROOT} \ | |
131 | # KERNELRELEASE=${fullversion} vdso_install | |
802ea3af | 132 | |
bcf38aec MT |
133 | # Create an empty settings file for dracut |
134 | mkdir -pv %{BUILDROOT}/etc/ld.so.conf.d | |
135 | echo "# Placeholder file, no vDSO hwcap entries used in this kernel." \ | |
136 | > %{BUILDROOT}/etc/ld.so.conf.d/kernel-${fullversion}.conf | |
802ea3af | 137 | |
bcf38aec MT |
138 | # And now the scary looking part. |
139 | # | |
140 | # Recreate source and build links. | |
141 | rm -vf %{BUILDROOT}/lib/modules/${fullversion}/{build,source} | |
142 | mkdir -pv %{BUILDROOT}/lib/modules/${fullversion}/build | |
143 | ln -svf build %{BUILDROOT}/lib/modules/${fullversion}/source | |
802ea3af | 144 | |
bcf38aec MT |
145 | # Create dirs for extra modules. |
146 | mkdir -pv %{BUILDROOT}/lib/modules/${fullversion}/extra | |
802ea3af | 147 | |
bcf38aec MT |
148 | cp -v --parents $(find -type f -name "Makefile*" -o -name "Kconfig*") \ |
149 | %{BUILDROOT}/lib/modules/${fullversion}/build | |
150 | cp -v Module.symvers System.map \ | |
151 | %{BUILDROOT}/lib/modules/${fullversion}/build | |
152 | rm -vrf %{BUILDROOT}/lib/modules/${fullversion}/build/{Documentation,scripts,include} | |
153 | ||
154 | cp -v .config %{BUILDROOT}/lib/modules/${fullversion}/build | |
155 | cp -va scripts %{BUILDROOT}/lib/modules/${fullversion}/build | |
156 | find %{BUILDROOT}/lib/modules/${fullversion}/build/scripts -name "*.o" \ | |
157 | -exec rm -vf {} \; | |
158 | ||
159 | cp -va --parents arch/%{kernel_arch}/include \ | |
160 | %{BUILDROOT}/lib/modules/${fullversion}/build | |
161 | cp -va include %{BUILDROOT}/lib/modules/${fullversion}/build/include | |
162 | ||
163 | # Make sure we can build external modules. | |
164 | touch -r %{BUILDROOT}/lib/modules/${fullversion}/build/Makefile \ | |
165 | %{BUILDROOT}/lib/modules/${fullversion}/build/include/linux/version.h | |
166 | touch -r %{BUILDROOT}/lib/modules/${fullversion}/build/.config \ | |
167 | %{BUILDROOT}/lib/modules/${fullversion}/build/autoconf.h | |
168 | cp -v %{BUILDROOT}/lib/modules/${fullversion}/build/.config \ | |
169 | %{BUILDROOT}/lib/modules/${fullversion}/build/include/config/auto.conf | |
170 | ||
171 | find %{BUILDROOT}/lib/modules/${fullversion} -name "*.ko" -type f | \ | |
172 | xargs chmod u+x | |
173 | ||
174 | for i in alias alias.bin builtin.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap; do | |
175 | rm -vf %{BUILDROOT}/lib/modules/${fullversion}/modules.${i} | |
176 | done | |
177 | ||
178 | # Move all development files to /usr/src. | |
179 | mkdir -pv %{BUILDROOT}/usr/src/kernels | |
180 | mv -v %{BUILDROOT}/lib/modules/${fullversion}/build \ | |
181 | %{BUILDROOT}/usr/src/kernels/${fullversion} | |
182 | ln -svf ../../../usr/src/kernels/${fullversion} \ | |
183 | %{BUILDROOT}/lib/modules/${fullversion}/build | |
184 | ||
185 | find %{BUILDROOT}/usr/src/kernels -name ".*.cmd" -exec rm -f {} \; | |
186 | } | |
187 | ||
188 | for kernel in %{kernels}; do | |
189 | build_kernel ${kernel} | |
190 | done | |
191 | end | |
192 | ||
193 | install | |
802ea3af MT |
194 | # Install the header files |
195 | make ARCH=x86 INSTALL_HDR_PATH=dest headers_install | |
196 | mkdir -pv %{BUILDROOT}/usr/include | |
197 | find dest/include \( -name .install -o -name ..install.cmd \) -delete | |
198 | cp -rv dest/include/* %{BUILDROOT}/usr/include | |
199 | ||
200 | # Glibc provides these headers | |
201 | rm -rfv %{BUILDROOT}/usr/include/scsi \ | |
202 | %{BUILDROOT}/usr/include/asm*/atomic.h \ | |
203 | %{BUILDROOT}/usr/include/asm*/io.h \ | |
204 | %{BUILDROOT}/usr/include/asm*/irq.h | |
205 | ||
15a11c5b MT |
206 | # Remove all firmware files which are distributed by linux-firmware |
207 | rm -rfv %{BUILDROOT}/lib/firmware | |
bcf38aec MT |
208 | |
209 | # Install tools. | |
210 | # XXX cannot install this because of #263. | |
211 | #make -C tools/perf DESTDIR=%{BUILDROOT} \ | |
212 | # HAVE_CPLUS_DEMANGLE=1 prefix=/usr install install-man | |
802ea3af MT |
213 | end |
214 | end | |
215 | ||
216 | packages | |
bcf38aec MT |
217 | template KERNEL |
218 | kernel_release = %{fullver} | |
219 | ||
220 | summary = The Linux kernel %{kernel_release}. | |
221 | ||
222 | prerequires = module-init-tools | |
223 | provides = kernel | |
802ea3af MT |
224 | requires |
225 | dracut | |
226 | linux-firmware | |
227 | end | |
ad1ea534 | 228 | |
bcf38aec MT |
229 | files |
230 | /boot/System.map-%{kernel_release} | |
231 | /boot/vmlinuz-%{kernel_release} | |
232 | /boot/initramfs-%{kernel_release}.img | |
233 | /etc/ld.so.conf.d/kernel-%{kernel_release}.conf | |
234 | /lib/modules/%{kernel_release} | |
235 | end | |
236 | ||
237 | script postin | |
238 | depmod -a %{kernel_release} || : | |
239 | end | |
240 | ||
ad1ea534 | 241 | script posttransin |
bcf38aec MT |
242 | dracut --force /boot/initramfs-%{kernel_release}.img %{kernel_release} |
243 | end | |
244 | end | |
245 | ||
246 | template KERNELDEVEL | |
247 | kernel_release = %{fullver} | |
248 | ||
249 | summary = Development files of kernel-%{kernel_release}. | |
250 | description | |
251 | %{summary} | |
252 | ||
253 | Install this package in order to compile modules for | |
254 | kernel release %{kernel_release}. | |
255 | end | |
256 | ||
257 | filter_requires | |
258 | perl>=[0-9]\:.* | |
ad1ea534 MT |
259 | end |
260 | ||
bcf38aec MT |
261 | files |
262 | /lib/modules/%{kernel_release}/build | |
263 | /lib/modules/%{kernel_release}/source | |
264 | /usr/src/kernels/%{kernel_release} | |
ad1ea534 | 265 | end |
802ea3af | 266 | end |
bcf38aec MT |
267 | |
268 | package kernel | |
269 | template KERNEL | |
270 | end | |
271 | ||
272 | package kernel-devel | |
273 | template KERNELDEVEL | |
274 | end | |
275 | ||
276 | package kernel-PAE | |
277 | template KERNEL | |
278 | ||
279 | kernel_release = %{fullver}.PAE | |
280 | end | |
281 | ||
282 | package kernel-PAE-devel | |
283 | template KERNELDEVEL | |
284 | ||
285 | kernel_release = %{fullver}.PAE | |
286 | end | |
802ea3af MT |
287 | |
288 | package kernel-headers | |
802ea3af MT |
289 | summary = Header files of the kernel release %{fullver}. |
290 | desciption = %{summary} | |
c698e4be MT |
291 | |
292 | files | |
293 | /usr/include | |
294 | end | |
802ea3af | 295 | end |
bcf38aec MT |
296 | |
297 | #package kernel-tools | |
298 | # summary = Assortment of tools for the Linux kernel. | |
299 | # description = %{summary} | |
300 | # | |
301 | # files | |
302 | # /usr/bin | |
303 | # /usr/lib | |
304 | # end | |
305 | #end | |
802ea3af | 306 | end |