Annotation of /trunk/include/kernel.sminc
Parent Directory | Revision Log
Revision 18717 -
(hide annotations)
(download)
Wed Aug 14 10:47:24 2013 UTC (11 years, 3 months ago) by niro
File size: 13920 byte(s)
Wed Aug 14 10:47:24 2013 UTC (11 years, 3 months ago) by niro
File size: 13920 byte(s)
-introduce new kernel_apply_patches function
1 | niro | 9311 | # kernel global smage functions |
2 | # $Id$ | ||
3 | |||
4 | # needed extra vars: | ||
5 | niro | 11369 | # ${KERNEL_TYPE}: needed, 'sources', 'headers' or 'image' |
6 | # ${BRANCH}: needed, style branch of the kernel | ||
7 | # ${KERNEL_CONFIG}: optional, needed if you want to override the default | ||
8 | # searchpath ${SOURCEDIR}/${PNAME}/config-${PVER}-${BRANCH}-${PBUILD} | ||
9 | niro | 9311 | # |
10 | niro | 11369 | # ${PSUBVER}: optional, only needed for 2.6.x.x naming scheme |
11 | # ${EXTRAVERSION}: optinal, extra version for the kernel name | ||
12 | # default setting is ${PSUBVER}-${BRANCH}-${PBUILD} | ||
13 | # ${KERNEL_IMAGE_PATH}: override the default KERNEL_IMAGE_PATH (to build xen images for e.g.) | ||
14 | # ${COMPRESS_MODULES}: compresses the kernel modules with given compressor (gzip|bzip2|xz) | ||
15 | # ${LINUX_FIRMWARE}: remove included firmware bits if requested | ||
16 | # set the version here like USE_LINUX_FIRMARE="20110605" | ||
17 | # version "internal" keeps the bits too | ||
18 | # | ||
19 | niro | 9311 | |
20 | sminclude mtools | ||
21 | |||
22 | # remove me when all distris support this: | ||
23 | if [[ ${USE_KERNEL_ARCH_EXTENSION} = true ]] | ||
24 | then | ||
25 | KERNEL_ARCH_EXTENSION="-${ARCH}" | ||
26 | else | ||
27 | KERNEL_ARCH_EXTENSION="" | ||
28 | fi | ||
29 | |||
30 | niro | 9466 | if [[ ! -z ${COMPRESS_MODULES} ]] |
31 | then | ||
32 | case ${COMPRESS_MODULES} in | ||
33 | gzip) | ||
34 | COMPRESS_MODULES_CMD="gzip -9v" | ||
35 | SDEPEND="${SDEPEND} | ||
36 | >= app-arch/gzip-1.4" | ||
37 | ;; | ||
38 | bzip2) | ||
39 | COMPRESS_MODULES_CMD="bzip2 -9v" | ||
40 | SDEPEND="${SDEPEND} | ||
41 | >= app-arch/bzip2-1.0.6" | ||
42 | ;; | ||
43 | xz) | ||
44 | COMPRESS_MODULES_CMD="xz -9v" | ||
45 | SDEPEND="${SDEPEND} | ||
46 | >= app-arch/xz-5" | ||
47 | ;; | ||
48 | none) | ||
49 | echo "Disabled compressed kernel-modules!" | ||
50 | COMPRESS_MODULES_CMD="" | ||
51 | ;; | ||
52 | *) die "Unkown compression format '${COMPRESS_MODULES}'" ;; | ||
53 | esac | ||
54 | fi | ||
55 | |||
56 | niro | 9311 | # some sane defaults |
57 | niro | 9863 | : ${PCAT="sys-kernel"} |
58 | niro | 9311 | : ${HOMEPAGE="http://magellan-linux.de/"} |
59 | niro | 9743 | : ${TARBALLPVER="${PVER}"} |
60 | : ${SRCFILE="linux-${TARBALLPVER}.tar.bz2"} | ||
61 | niro | 9311 | : ${SRCDIR="${BUILDDIR}/linux-${PVER}-${BRANCH}-${PBUILD}"} |
62 | |||
63 | niro | 9740 | if [[ -z ${SRC_URI[*]} ]] |
64 | then | ||
65 | SRC_URI=( | ||
66 | http://www.kernel.org/pub/linux/kernel/v$(echo ${PVER} | cut -d. -f1).x/${SRCFILE} | ||
67 | http://ftp.uni-erlangen.de/pub/Linux/MIRROR.kernel/v$(echo ${PVER} | cut -d. -f1).x/${SRCFILE} | ||
68 | mirror://kernel-${BRANCH}/${SRCFILE} | ||
69 | ) | ||
70 | case ${KERNEL_TYPE} in | ||
71 | image|sources) | ||
72 | SRC_URI=( | ||
73 | ${SRC_URI[*]} | ||
74 | mirror://kernel-${BRANCH}/config-${PVER}-${BRANCH}-${PBUILD}-i686 | ||
75 | mirror://kernel-${BRANCH}/config-${PVER}-${BRANCH}-${PBUILD}-x86_64 | ||
76 | ) | ||
77 | ;; | ||
78 | esac | ||
79 | fi | ||
80 | niro | 9311 | |
81 | case ${KERNEL_TYPE} in | ||
82 | image) | ||
83 | : ${PROVIDE="virtual/kernel"} | ||
84 | niro | 10194 | : ${DEPEND=">= virtual/module-tools |
85 | niro | 9311 | >= sys-fs/udev-115 |
86 | niro | 10194 | >= virtual/initramfs-tools |
87 | niro | 9311 | >= virtual/initscripts"} |
88 | niro | 11369 | if [[ ! -z ${LINUX_FIRMWARE} ]] && [[ ${LINUX_FIRMWARE} != internal ]] |
89 | then | ||
90 | DEPEND="${DEPEND} | ||
91 | >= sys-kernel/linux-firmware-${LINUX_FIRMWARE}" | ||
92 | fi | ||
93 | niro | 9745 | : ${DESCRIPTION="Kernel image of the '${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}' kernel branch."} |
94 | niro | 9311 | ;; |
95 | |||
96 | sources) | ||
97 | : ${PROVIDE="virtual/kernel-sources"} | ||
98 | niro | 9745 | : ${DESCRIPTION="Kernel sources of the '${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}' kernel branch."} |
99 | niro | 9311 | ;; |
100 | |||
101 | headers) | ||
102 | : ${PROVIDE="virtual/kernel-headers"} | ||
103 | : ${DESCRIPTION="Sanitized kernel headers for libc."} | ||
104 | ;; | ||
105 | esac | ||
106 | |||
107 | EXTRAVERSION="${PSUBVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}" | ||
108 | KERNEL_CONFIG="${SOURCEDIR}/${PNAME}/config-${PVER}-${BRANCH}-${PBUILD}-${ARCH}" | ||
109 | |||
110 | # special vars for mage file only | ||
111 | KPVER="${PVER}" | ||
112 | KPBUILD="${PBUILD}" | ||
113 | KBRANCH="${BRANCH}" | ||
114 | SPECIAL_VARS="${SPECIAL_VARS} KPVER KPBUILD KBRANCH" | ||
115 | |||
116 | niro | 18717 | # dummy function to apply kernel patches |
117 | kernel_apply_patches() | ||
118 | { | ||
119 | return 0 | ||
120 | } | ||
121 | |||
122 | niro | 9311 | kernel_src_prepare() |
123 | { | ||
124 | munpack ${SRCFILE} || die | ||
125 | niro | 9743 | mv ${BUILDDIR}/linux-${TARBALLPVER} ${SRCDIR} || die |
126 | niro | 9311 | |
127 | # fix permissions | ||
128 | chown -R 0:0 ${SRCDIR} || die | ||
129 | chmod -R a+r-w+X,u+w ${SRCDIR} || die | ||
130 | |||
131 | cd ${SRCDIR} | ||
132 | niro | 18717 | kernel_apply_patches || die |
133 | niro | 9311 | |
134 | # fixes INSTALL_PATH to /boot and EXTRAVERSION | ||
135 | sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' \ | ||
136 | -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile || die | ||
137 | niro | 9463 | |
138 | # fix sublevel version with 3.x kernels and higher | ||
139 | local kver=$(echo ${PVER} | sed "s:\.::g") | ||
140 | if [[ ${PVER%%.*} -gt 2 ]] | ||
141 | then | ||
142 | local sublevel="$(echo ${PVER} | cut -d. -f3)" | ||
143 | niro | 13438 | sed -i "s:^\(SUBLEVEL =\).*:\1 ${sublevel}:" Makefile || die |
144 | niro | 9463 | fi |
145 | niro | 9311 | } |
146 | |||
147 | kernel_src_compile() | ||
148 | { | ||
149 | cd ${SRCDIR} | ||
150 | |||
151 | make mrproper || die | ||
152 | |||
153 | if [[ ${KERNEL_TYPE} = sources ]] || [[ ${KERNEL_TYPE} = image ]] | ||
154 | then | ||
155 | # inject our kernel config | ||
156 | cp ${KERNEL_CONFIG} ${SRCDIR}/.config || die | ||
157 | make ARCH=${ARCH/i*86/x86} oldconfig || die | ||
158 | fi | ||
159 | |||
160 | case ${KERNEL_TYPE} in | ||
161 | image) | ||
162 | mmake ARCH=${ARCH/i*86/x86} || die | ||
163 | ;; | ||
164 | |||
165 | headers) | ||
166 | make ARCH=${ARCH/i*86/x86} headers_check || die | ||
167 | ;; | ||
168 | |||
169 | sources) | ||
170 | make clean || die | ||
171 | |||
172 | # needed to compile other programs like iptables | ||
173 | make ARCH=${ARCH/i*86/x86} prepare || die | ||
174 | # needed to cover >=2.6.14 builds | ||
175 | # but deprecated with >=2.6.21, prepare cover all targets there | ||
176 | local kver=$(echo ${PVER} | sed "s:\.::g") | ||
177 | # honor >=3.0.x; add one zero | ||
178 | if [[ ${PVER%%.*} -gt 2 ]] | ||
179 | then | ||
180 | kver="${kver}0" | ||
181 | fi | ||
182 | if [[ ${kver} < 2621 ]] | ||
183 | then | ||
184 | make ARCH=${ARCH/i*86/x86} prepare-all || die | ||
185 | fi | ||
186 | make ARCH=${ARCH/i*86/x86} scripts || die | ||
187 | |||
188 | # at least alsa-drivers needs this one ... | ||
189 | touch include/linux/autoconf.h || die | ||
190 | ;; | ||
191 | esac | ||
192 | } | ||
193 | |||
194 | kernel_image_src_install() | ||
195 | { | ||
196 | cd ${SRCDIR} | ||
197 | |||
198 | # needed directories | ||
199 | minstalldir /boot || die | ||
200 | |||
201 | # install modules | ||
202 | niro | 12741 | make ARCH=${ARCH/i*86/x86} INSTALL_MOD_PATH=${BINDIR}/usr modules_install || die |
203 | niro | 9311 | |
204 | # install kernelimage | ||
205 | if [[ -z ${KERNEL_IMAGE_PATH} ]] | ||
206 | then | ||
207 | local my_arch="${ARCH}" | ||
208 | [[ ${my_arch} = i*86 ]] && my_arch=i386 | ||
209 | minstallfile arch/${my_arch}/boot/bzImage \ | ||
210 | /boot/kernel-${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION} \ | ||
211 | || die | ||
212 | else | ||
213 | minstallfile ${KERNEL_IMAGE_PATH} \ | ||
214 | /boot/kernel-${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION} \ | ||
215 | || die | ||
216 | fi | ||
217 | |||
218 | # install System.map | ||
219 | minstallfile System.map \ | ||
220 | /boot/System.map-${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION} \ | ||
221 | || die | ||
222 | |||
223 | # install Module.symvers in boot and /usr/src | ||
224 | minstallfile Module.symvers \ | ||
225 | /boot/Module.symvers-${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION} \ | ||
226 | || die | ||
227 | minstalldir /usr/src/linux-${PVER}-${BRANCH}-${PBUILD} || die | ||
228 | minstallfile Module.symvers \ | ||
229 | /usr/src/linux-${PVER}-${BRANCH}-${PBUILD} \ | ||
230 | || die | ||
231 | |||
232 | # install kernel description | ||
233 | echo " | ||
234 | KRNVER=${BRANCH}-${PVER}-${ARCH}-${PBUILD}${KERNEL_ARCH_EXTENSION} | ||
235 | KRNLIB=${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION} | ||
236 | KRNIMG=kernel-${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION} | ||
237 | KRNINITRD= | ||
238 | " > ${BINDIR}/boot/kernelversion || die | ||
239 | |||
240 | # install kernel-config from srcdir | ||
241 | minstallfile .config \ | ||
242 | /boot/config-${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION} \ | ||
243 | || die | ||
244 | |||
245 | # fix build symlink | ||
246 | niro | 12741 | if [ -L ${BINDIR}/usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/build ] |
247 | niro | 9311 | then |
248 | echo "fixing build symlink" | ||
249 | niro | 12741 | rm ${BINDIR}/usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/build || die |
250 | niro | 9311 | mlink /usr/src/linux-${PVER}-${BRANCH}-${PBUILD} \ |
251 | niro | 12741 | /usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/build \ |
252 | niro | 9311 | || die |
253 | fi | ||
254 | |||
255 | # and fixing source symlink | ||
256 | niro | 12741 | if [ -L ${BINDIR}/usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/source ] |
257 | niro | 9311 | then |
258 | echo "fixing source symlink" | ||
259 | niro | 12741 | rm ${BINDIR}/usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/source || die |
260 | niro | 9311 | mlink /usr/src/linux-${PVER}-${BRANCH}-${PBUILD} \ |
261 | niro | 12741 | /usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/source \ |
262 | niro | 9311 | || die |
263 | fi | ||
264 | niro | 9466 | |
265 | # remove firmware bits if $LINUX_FIRMWARE was set | ||
266 | if [[ ! -z ${LINUX_FIRMWARE} ]] && [[ ${LINUX_FIRMWARE} != internal ]] | ||
267 | then | ||
268 | niro | 12741 | if [[ -d ${BINDIR}/usr/lib/firmware ]] |
269 | niro | 9466 | then |
270 | niro | 12741 | rm -rv ${BINDIR}/usr/lib/firmware |
271 | niro | 9466 | fi |
272 | fi | ||
273 | |||
274 | # compress modules if COMPRESS_MODULES_CMD was set | ||
275 | if [[ ! -z ${COMPRESS_MODULES_CMD} ]] | ||
276 | then | ||
277 | # compress all kernel modules | ||
278 | find ${BINDIR} -name \*.ko | xargs ${COMPRESS_MODULES_CMD} || die | ||
279 | fi | ||
280 | niro | 9311 | } |
281 | |||
282 | kernel_headers_src_install() | ||
283 | { | ||
284 | cd ${SRCDIR} | ||
285 | make ARCH=${ARCH/i*86/x86} INSTALL_HDR_PATH=${BINDIR}/usr headers_install || die | ||
286 | niro | 9746 | |
287 | # clean-up unnecessary files | ||
288 | find ${BINDIR} -name .install -or -name ..install.cmd | xargs --no-run-if-empty rm -f | ||
289 | niro | 9311 | } |
290 | |||
291 | kernel_sources_src_install() | ||
292 | { | ||
293 | cd ${BUILDDIR} | ||
294 | |||
295 | echo "Creating linux-${PVER}-${BRANCH}-${PBUILD} sources tarball ... " | ||
296 | tar cvjf ${BUILDDIR}/linux-${PVER}-${BRANCH}-${PBUILD}.tar.bz2 $(basename ${SRCDIR}) || die | ||
297 | |||
298 | echo "Moving linux-${PVER}-${BRANCH}-${PBUILD} tarball to \${BINDIR}/usr/src ... " | ||
299 | minstalldir /usr/src || die | ||
300 | mv ${BUILDDIR}/linux-${PVER}-${BRANCH}-${PBUILD}.tar.bz2 ${BINDIR}/usr/src || die | ||
301 | } | ||
302 | |||
303 | # installs module-sources path/to/SRCDIR to MODDIR/MODNAME | ||
304 | # kernel_external_modules_install path/to/SRCDIR DESTDIRNAME | ||
305 | kernel_external_modules_install() | ||
306 | { | ||
307 | cd ${BUILDDIR} | ||
308 | |||
309 | local modsrc="$1" | ||
310 | local moddest="$2" | ||
311 | local moddir="${BUILDDIR}/kernel-modules-${PVER}-${BRANCH}-${PBUILD}" | ||
312 | |||
313 | echo "Installing ${modsrc} to ${moddir}/${moddest} ..." | ||
314 | install -d ${moddir} || die | ||
315 | mv ${modsrc} ${moddir}/${moddest} || die | ||
316 | } | ||
317 | |||
318 | kernel_external_modules_tarball() | ||
319 | { | ||
320 | cd ${BUILDDIR} | ||
321 | |||
322 | echo "Creating kernel-modules-${PVER}-${BRANCH}-${PBUILD} sources tarball ... " | ||
323 | tar cvjf ${BUILDDIR}/kernel-modules-${PVER}-${BRANCH}-${PBUILD}.tar.bz2 \ | ||
324 | kernel-modules-${PVER}-${BRANCH}-${PBUILD} || die | ||
325 | |||
326 | echo "Moving kernel-modules-${PVER}-${BRANCH}-${PBUILD} tarball to \${BINDIR}/usr/src ... " | ||
327 | minstalldir /usr/src || die | ||
328 | mv ${BUILDDIR}/kernel-modules-${PVER}-${BRANCH}-${PBUILD}.tar.bz2 ${BINDIR}/usr/src || die | ||
329 | } | ||
330 | |||
331 | kernel_src_install() | ||
332 | { | ||
333 | case ${KERNEL_TYPE} in | ||
334 | image) | ||
335 | kernel_image_src_install || die | ||
336 | ;; | ||
337 | |||
338 | headers) | ||
339 | kernel_headers_src_install || die | ||
340 | ;; | ||
341 | |||
342 | sources) | ||
343 | kernel_sources_src_install || die | ||
344 | ;; | ||
345 | esac | ||
346 | } | ||
347 | |||
348 | kernel_major_version() | ||
349 | { | ||
350 | local ksrc="$@" | ||
351 | local kv | ||
352 | |||
353 | if [[ -z ${ksrc} ]] | ||
354 | then | ||
355 | kv="$(uname -r|cut -d. -f1-2)" | ||
356 | else | ||
357 | local version | ||
358 | local patchlevel | ||
359 | |||
360 | # get version from makefile | ||
361 | version=$(grep "^VERSION[[:space:]]*=[[:space:]]*[[:digit:]]" ${ksrc}/Makefile | sed "s/^.*=[[:space:]]*\([[:digit:]]\+\)/\1/g") | ||
362 | # get patchlevel from makefile | ||
363 | patchlevel=$(grep "^PATCHLEVEL[[:space:]]*=[[:space:]]*[[:digit:]]" ${ksrc}/Makefile | sed "s/^.*=[[:space:]]*\([[:digit:]]\+\)/\1/g") | ||
364 | # kernelversion | ||
365 | kv="${version}.${patchlevel}" | ||
366 | fi | ||
367 | |||
368 | echo "${kv}" | ||
369 | } | ||
370 | |||
371 | mod_suffix() | ||
372 | { | ||
373 | local ksrc="$@" | ||
374 | local mod_suffix | ||
375 | local kmv | ||
376 | |||
377 | kmv=$(kernel_major_version ${ksrc}) | ||
378 | if [[ ${kmv//.} -ge 26 ]] | ||
379 | then | ||
380 | mod_suffix="ko" | ||
381 | else | ||
382 | mod_suffix="o" | ||
383 | fi | ||
384 | |||
385 | echo ${mod_suffix} | ||
386 | } | ||
387 | |||
388 | kernel_image_preinstall() | ||
389 | { | ||
390 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] | ||
391 | then | ||
392 | mount /boot &> /dev/null | ||
393 | fi | ||
394 | } | ||
395 | |||
396 | kernel_image_preremove() | ||
397 | { | ||
398 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] | ||
399 | then | ||
400 | mount /boot &> /dev/null | ||
401 | fi | ||
402 | } | ||
403 | |||
404 | kernel_image_postremove() | ||
405 | { | ||
406 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] | ||
407 | then | ||
408 | # remove old image entry from grub | ||
409 | niro | 13880 | new-kernel-pkg -v --rminitrd --rmmoddep --remove ${KPVER}-${KBRANCH}-${KPBUILD} |
410 | niro | 9311 | fi |
411 | } | ||
412 | |||
413 | kernel_image_postinstall() | ||
414 | { | ||
415 | [ ! -d ${MROOT}/sys ] && install -d ${MROOT}/sys | ||
416 | |||
417 | # fixes a small glitch in <=mage-0.3.6-r15 with symlinks | ||
418 | [ -f ${MROOT}/usr/src/linux-${KPVER}-${KBRANCH}-${KPBUILD} ] && \ | ||
419 | rm ${MROOT}/usr/src/linux-${KPVER}-${KBRANCH}-${KPBUILD} | ||
420 | |||
421 | [ -x ${MROOT}/sbin/depmod ] && | ||
422 | ${MROOT}/sbin/depmod -ae \ | ||
423 | -F /boot/System.map-${KPVER}-${KBRANCH}-${KPBUILD} \ | ||
424 | ${KPVER}-${KBRANCH}-${KPBUILD} | ||
425 | |||
426 | # do not run this if ${MROOT} is set ! | ||
427 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] | ||
428 | then | ||
429 | new-kernel-pkg -v --mkinitrd --make-default --install ${KPVER}-${KBRANCH}-${KPBUILD} | ||
430 | fi | ||
431 | |||
432 | # symlink actual kernel to /boot/vmlinuz etc... | ||
433 | ln -snf kernel-${KPVER}-${KBRANCH}-${KPBUILD} ${MROOT}/boot/vmlinuz | ||
434 | ln -snf System.map-${KPVER}-${KBRANCH}-${KPBUILD} ${MROOT}/boot/System.map | ||
435 | ln -snf config-${KPVER}-${KBRANCH}-${KPBUILD} ${MROOT}/boot/config | ||
436 | [[ -f ${MROOT}/boot/initrd-${KPVER}-${KBRANCH}-${KPBUILD}.img ]] && | ||
437 | ln -snf initrd-${KPVER}-${KBRANCH}-${KPBUILD}.img ${MROOT}/boot/initrd | ||
438 | } | ||
439 | |||
440 | kernel_sources_postinstall() | ||
441 | { | ||
442 | # check for linux-VERSION/include as the kernel-image installs | ||
443 | # the file Modules.symver in the linux-VERSION directory | ||
444 | niro | 11362 | if mqueryfeature "kernelsrcunpack" && |
445 | [ ! -d ${MROOT}/usr/src/linux-${KPVER}-${KBRANCH}-${KPBUILD}/include ] | ||
446 | niro | 9311 | then |
447 | echo "Unpacking linux-${KPVER}-${KBRANCH}-${KPBUILD} source tarball ... " | ||
448 | tar xvjf ${MROOT}/usr/src/linux-${KPVER}-${KBRANCH}-${KPBUILD}.tar.bz2 -C ${MROOT}/usr/src | ||
449 | fi | ||
450 | |||
451 | niro | 11362 | if mqueryfeature "kernelsrcunpack" && |
452 | [ ! -d ${MROOT}/usr/src/kernel-modules-${KPVER}-${KBRANCH}-${KPBUILD} ] && | ||
453 | niro | 9311 | [ -f ${MROOT}/usr/src/kernel-modules-${KPVER}-${KBRANCH}-${KPBUILD}.tar.bz2 ] |
454 | then | ||
455 | echo "Unpacking kernel-modules-${KPVER}-${KBRANCH}-${KPBUILD} source tarball ... " | ||
456 | tar xvjf ${MROOT}/usr/src/kernel-modules-${KPVER}-${KBRANCH}-${KPBUILD}.tar.bz2 -C ${MROOT}/usr/src | ||
457 | fi | ||
458 | |||
459 | niro | 11362 | # create linux symlink |
460 | if mqueryfeature "linuxsymlink" | ||
461 | niro | 9311 | then |
462 | echo "Creating linux -> linux-${KPVER}-${KBRANCH}-${KPBUILD} symlink ... " | ||
463 | [ ! -d ${MROOT}/usr/src ] && install ${MROOT}/usr/src | ||
464 | ln -snf ${MROOT}/usr/src/linux-${KPVER}-${KBRANCH}-${KPBUILD} \ | ||
465 | ${MROOT}/usr/src/linux || die | ||
466 | fi | ||
467 | |||
468 | niro | 11362 | # create kernel-modules symlink |
469 | if mqueryfeature "linuxsymlink" && | ||
470 | niro | 9311 | [ -d ${MROOT}/usr/src/kernel-modules-${KPVER}-${KBRANCH}-${KPBUILD} ] |
471 | then | ||
472 | echo "Creating kernel-modules -> kernel-modules-${KPVER}-${KBRANCH}-${KPBUILD} symlink ... " | ||
473 | [ ! -d ${MROOT}/usr/src ] && install ${MROOT}/usr/src | ||
474 | ln -snf ${MROOT}/usr/src/kernel-modules-${KPVER}-${KBRANCH}-${KPBUILD} \ | ||
475 | ${MROOT}/usr/src/kernel-modules || die | ||
476 | fi | ||
477 | } | ||
478 | |||
479 | export_inherits kernel src_prepare src_compile src_install | ||
480 | |||
481 | # export pre/postinstall functions depending on KERNEL_TYPE | ||
482 | case ${KERNEL_TYPE} in | ||
483 | image) | ||
484 | export_inherits kernel_image preinstall preremove postinstall postremove | ||
485 | SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS} kernel_image_preinstall kernel_image_preremove kernel_image_postinstall kernel_image_postremove" | ||
486 | ;; | ||
487 | sources) | ||
488 | export_inherits kernel_sources postinstall | ||
489 | SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS} kernel_sources_postinstall" | ||
490 | ;; | ||
491 | esac |