1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
9 thisapp = linux-%{version}
11 maintainer = Michael Tremer <michael.tremer@ipfire.org>
12 groups = System/Kernels
13 url = http://www.kernel.org/
15 summary = The Linux kernel.
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.
24 # Version helper variables.
25 localversion = %{release}.%{DISTRO_DISTTAG}.%{DISTRO_ARCH}
26 fullver = %{version}-%{localversion}
28 sources = %{thisapp}.tar.gz
43 # A list of kernels to build.
46 if "%{DISTRO_ARCH}" == "i686"
47 # Build a PAE-enabled kernel for the i686 architecture.
51 kernel_image = arch/%{kernel_arch}/boot/bzImage
52 kernel_target = bzImage
56 rm -f %{DIR_APP}/localversion-grsec
58 sed -e "s/^HOSTCFLAGS.*=.*/& -fPIC/g" -i Makefile
60 cp -vf %{DIR_SOURCE}/%{DISTRO_SNAME}_logo.ppm \
61 drivers/video/logo/logo_linux_clut224.ppm
63 # Get rid of unwanted files resulting from patch fuzz.
64 find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null
66 # Remove unnecessary SCM files.
67 find . -name .gitignore -exec rm -f {} \; >/dev/null
73 if [ "${flavour}" != "default" ]; then
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
82 make ARCH=%{kernel_arch} oldnoconfig
83 mv .config configs/config.${flavour}
86 # Generate configuration files for all kernels we are going to
88 for kernel in %{kernels}; do
89 configure_kernel ${kernel}
97 local localversion="%{localversion}"
98 local fullversion="%{fullver}"
99 if [ "${flavour}" != "default" ]; then
101 localversion="${localversion}.${flavour}"
102 fullversion="${fullversion}.${flavour}"
105 # Clean up the source tree.
108 # Install configuration file.
109 cp configs/config.${flavour} .config
113 -e "s/^EXTRAVERSION = .*/EXTRAVERSION = -${localversion}/g"
116 make ARCH=%{kernel_arch} CC="gcc -fno-PIE" %{kernel_target} modules %{PARALLELISMFLAGS}
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}
124 # Create empty initramfs (20M).
125 dd if=/dev/zero of=%{BUILDROOT}/boot/initramfs-${fullversion}.img bs=1M count=20
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
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
138 # And now the scary looking part.
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
145 # Create dirs for extra modules.
146 mkdir -pv %{BUILDROOT}/lib/modules/${fullversion}/extra
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}
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" \
159 cp -va --parents arch/%{kernel_arch}/include \
160 %{BUILDROOT}/lib/modules/${fullversion}/build
161 cp -va include %{BUILDROOT}/lib/modules/${fullversion}/build/include
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
171 find %{BUILDROOT}/lib/modules/${fullversion} -name "*.ko" -type f | \
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}
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
185 find %{BUILDROOT}/usr/src/kernels -name ".*.cmd" -exec rm -f {} \;
188 for kernel in %{kernels}; do
189 build_kernel ${kernel}
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
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
206 # Remove all firmware files which are distributed by linux-firmware
207 rm -rfv %{BUILDROOT}/lib/firmware
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
218 kernel_release = %{fullver}
220 summary = The Linux kernel %{kernel_release}.
222 prerequires = module-init-tools
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}
238 depmod -a %{kernel_release} || :
242 dracut --force /boot/initramfs-%{kernel_release}.img %{kernel_release}
247 kernel_release = %{fullver}
249 summary = Development files of kernel-%{kernel_release}.
253 Install this package in order to compile modules for
254 kernel release %{kernel_release}.
262 /lib/modules/%{kernel_release}/build
263 /lib/modules/%{kernel_release}/source
264 /usr/src/kernels/%{kernel_release}
279 kernel_release = %{fullver}.PAE
282 package kernel-PAE-devel
285 kernel_release = %{fullver}.PAE
288 package kernel-headers
289 summary = Header files of the kernel release %{fullver}.
290 desciption = %{summary}
297 #package kernel-tools
298 # summary = Assortment of tools for the Linux kernel.
299 # description = %{summary}