2 |
# $Id$ |
# $Id$ |
3 |
|
|
4 |
# needed extra vars: |
# needed extra vars: |
5 |
# ${KERNEL_TYPE}: needed, 'sources', 'headers' or 'image' |
# ${KERNEL_TYPE}: needed, 'sources', 'headers' or 'image' |
6 |
# ${BRANCH}: needed, style branch of the kernel |
# ${BRANCH}: needed, style branch of the kernel |
7 |
# ${KERNEL_CONFIG}: optional, needed if you want to override the default |
# ${KERNEL_CONFIG}: optional, needed if you want to override the default |
8 |
# searchpath ${SOURCEDIR}/${PNAME}/config-${PVER}-${BRANCH}-${PBUILD} |
# searchpath ${SOURCEDIR}/${PNAME}/config-${PVER}-${BRANCH}-${PBUILD} |
9 |
|
# |
10 |
|
# ${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 |
# |
# |
|
# ${PSUBVER}: optional, only needed for 2.6.x.x naming scheme |
|
|
# ${EXTRAVERSION}: optinal, extra version for the kernel name |
|
|
# default setting is ${PSUBVER}-${BRANCH}-${PBUILD} |
|
|
# ${KERNEL_IMAGE_PATH}: override the default KERNEL_IMAGE_PATH (to build xen images for e.g.) |
|
|
# ${COMPRESS_MODULES}: compresses the kernel modules with given compressor (gzip|bzip2|xz) |
|
19 |
|
|
20 |
sminclude mtools |
sminclude mtools |
21 |
|
|
27 |
KERNEL_ARCH_EXTENSION="" |
KERNEL_ARCH_EXTENSION="" |
28 |
fi |
fi |
29 |
|
|
|
# remove included firmware bits if requested |
|
|
# set the version here like USE_LINUX_FIRMARE="20110605" |
|
|
# version "internal" keeps the bits too |
|
|
if [[ ! -z ${LINUX_FIRMWARE} ]] && [[ ${LINUX_FIRMWARE} != internal ]] |
|
|
then |
|
|
DEPEND="${DEPEND} |
|
|
>= sys-kernel/linux-firmware-${LINUX_FIRMWARE}" |
|
|
fi |
|
|
|
|
30 |
if [[ ! -z ${COMPRESS_MODULES} ]] |
if [[ ! -z ${COMPRESS_MODULES} ]] |
31 |
then |
then |
32 |
case ${COMPRESS_MODULES} in |
case ${COMPRESS_MODULES} in |
85 |
>= sys-fs/udev-115 |
>= sys-fs/udev-115 |
86 |
>= virtual/initramfs-tools |
>= virtual/initramfs-tools |
87 |
>= virtual/initscripts"} |
>= virtual/initscripts"} |
88 |
|
if [[ ! -z ${LINUX_FIRMWARE} ]] && [[ ${LINUX_FIRMWARE} != internal ]] |
89 |
|
then |
90 |
|
DEPEND="${DEPEND} |
91 |
|
>= sys-kernel/linux-firmware-${LINUX_FIRMWARE}" |
92 |
|
fi |
93 |
: ${DESCRIPTION="Kernel image of the '${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}' kernel branch."} |
: ${DESCRIPTION="Kernel image of the '${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}' kernel branch."} |
94 |
;; |
;; |
95 |
|
|
113 |
KBRANCH="${BRANCH}" |
KBRANCH="${BRANCH}" |
114 |
SPECIAL_VARS="${SPECIAL_VARS} KPVER KPBUILD KBRANCH" |
SPECIAL_VARS="${SPECIAL_VARS} KPVER KPBUILD KBRANCH" |
115 |
|
|
116 |
|
# dummy function to apply kernel patches |
117 |
|
kernel_apply_patches() |
118 |
|
{ |
119 |
|
return 0 |
120 |
|
} |
121 |
|
|
122 |
kernel_src_prepare() |
kernel_src_prepare() |
123 |
{ |
{ |
124 |
munpack ${SRCFILE} || die |
munpack ${SRCFILE} || die |
129 |
chmod -R a+r-w+X,u+w ${SRCDIR} || die |
chmod -R a+r-w+X,u+w ${SRCDIR} || die |
130 |
|
|
131 |
cd ${SRCDIR} |
cd ${SRCDIR} |
132 |
|
kernel_apply_patches || die |
133 |
|
|
134 |
# fixes INSTALL_PATH to /boot and EXTRAVERSION |
# fixes INSTALL_PATH to /boot and EXTRAVERSION |
135 |
sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' \ |
sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' \ |
140 |
if [[ ${PVER%%.*} -gt 2 ]] |
if [[ ${PVER%%.*} -gt 2 ]] |
141 |
then |
then |
142 |
local sublevel="$(echo ${PVER} | cut -d. -f3)" |
local sublevel="$(echo ${PVER} | cut -d. -f3)" |
143 |
sed -i "s:^\(SUBLEVEL =\).*:\1 ${sublevel}:" Makefile || die |
sed -i "s:^\(SUBLEVEL =\).*:\1 ${sublevel}:" Makefile || die |
144 |
fi |
fi |
145 |
} |
} |
146 |
|
|
199 |
minstalldir /boot || die |
minstalldir /boot || die |
200 |
|
|
201 |
# install modules |
# install modules |
202 |
make ARCH=${ARCH/i*86/x86} INSTALL_MOD_PATH=${BINDIR} modules_install || die |
make ARCH=${ARCH/i*86/x86} INSTALL_MOD_PATH=${BINDIR}/usr modules_install || die |
203 |
|
|
204 |
# install kernelimage |
# install kernelimage |
205 |
if [[ -z ${KERNEL_IMAGE_PATH} ]] |
if [[ -z ${KERNEL_IMAGE_PATH} ]] |
243 |
|| die |
|| die |
244 |
|
|
245 |
# fix build symlink |
# fix build symlink |
246 |
if [ -L ${BINDIR}/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/build ] |
if [ -L ${BINDIR}/usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/build ] |
247 |
then |
then |
248 |
echo "fixing build symlink" |
echo "fixing build symlink" |
249 |
rm ${BINDIR}/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/build || die |
rm ${BINDIR}/usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/build || die |
250 |
mlink /usr/src/linux-${PVER}-${BRANCH}-${PBUILD} \ |
mlink /usr/src/linux-${PVER}-${BRANCH}-${PBUILD} \ |
251 |
/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/build \ |
/usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/build \ |
252 |
|| die |
|| die |
253 |
fi |
fi |
254 |
|
|
255 |
# and fixing source symlink |
# and fixing source symlink |
256 |
if [ -L ${BINDIR}/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/source ] |
if [ -L ${BINDIR}/usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/source ] |
257 |
then |
then |
258 |
echo "fixing source symlink" |
echo "fixing source symlink" |
259 |
rm ${BINDIR}/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/source || die |
rm ${BINDIR}/usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/source || die |
260 |
mlink /usr/src/linux-${PVER}-${BRANCH}-${PBUILD} \ |
mlink /usr/src/linux-${PVER}-${BRANCH}-${PBUILD} \ |
261 |
/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/source \ |
/usr/lib/modules/${PVER}-${BRANCH}-${PBUILD}${KERNEL_ARCH_EXTENSION}/source \ |
262 |
|| die |
|| die |
263 |
fi |
fi |
264 |
|
|
265 |
# remove firmware bits if $LINUX_FIRMWARE was set |
# remove firmware bits if $LINUX_FIRMWARE was set |
266 |
if [[ ! -z ${LINUX_FIRMWARE} ]] && [[ ${LINUX_FIRMWARE} != internal ]] |
if [[ ! -z ${LINUX_FIRMWARE} ]] && [[ ${LINUX_FIRMWARE} != internal ]] |
267 |
then |
then |
268 |
if [[ -d ${BINDIR}/lib/firmware ]] |
if [[ -d ${BINDIR}/usr/lib/firmware ]] |
269 |
then |
then |
270 |
rm -rv ${BINDIR}/lib/firmware |
rm -rv ${BINDIR}/usr/lib/firmware |
271 |
fi |
fi |
272 |
fi |
fi |
273 |
|
|
406 |
if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
407 |
then |
then |
408 |
# remove old image entry from grub |
# remove old image entry from grub |
409 |
new-kernel-pkg -v --rminitrd --remove ${KPVER}-${KBRANCH}-${KPBUILD} |
new-kernel-pkg -v --rminitrd --rmmoddep --remove ${KPVER}-${KBRANCH}-${KPBUILD} |
410 |
fi |
fi |
411 |
} |
} |
412 |
|
|