Hi Guys and Gals,
I had a problem with my git xen kernel so whilst I was waiting for support to find out what went wrong with pv_grub on my new host on fremont I thought I'd do something useful.
Here is an ebuild that will help gentoo users install linode's patches kernel sources using Gentoo's package management too portage.
If you are new to gentoo and you don't yet have a local portage overlay for custom ebuilds (scripts that install software) then read
this guide to know how to install the ebuild.
Step 1) Make a directory sys-kernel/linode-sources in your $PORTDIR_OVERLAY (in /etc/make.conf) location.
Step 2) Put the ebuild file below in that directory. You should name it after your kernel version. You should see
the list of available linode kernels to see what you can rename/copy this ebuild to. If you are running the latest 64 bit pv_ops kernel like the example given in this ebuild follow this example.
Code:
cd $PORTDIR_OVERLAY/sys-kernel/linode-sources
cat > linode-sources-2.6.32-r12.ebuild
(paste from the ebuild example below and press control-d)
Step 3) Edit the EXTRAVERSION line in your ebuild
Step 4) run
ebuild digest <ebuild name from step 2> Portage will download the kernel source from
www.linode.com.
Step 5) Type emerge linode-sources. You will have a copy of linode's source put in /usr/src
Step 6) Use genkernel to cook up your new kernel and initrd. Remember to symlink your linode sources (ln -s /usr/src/linux-*linode* /usr/src/linux) before compiling.
Why go to all the trouble? Well now portage will recognise you have valid kernel sources installed and it wont keep downloading and installing gentoo-sources/sabayon-sources on you eating up 300+ megs of precious linode storage. I think it's worth the little effort.
Once you have booted up your new kernel and it works, you can remove the stock standard sources with
emerge -C gentoo-sources. Now you can also install kernel modules using emerge without leaving gentoo kernels in there.
Note to geeks:pv_ops is the way of the future with xen. Gentoo can't keep up-porting 2.6.12 sources that are the "xen-sources" forever. Other distributions that use these OpenSuse based patchset are looking to incorporate paravirt_ops as soon as possible. If and when linode goes to xen-4.0 hypervisor it will be highly recommended to use caker's sources ebuild here over the included xen-sources.
The default configuration installed will be the same as what caker set up for production kernels - so you only need to change what you need to with
make menuconfig before running
genkernel. Also initrd's work on some linode. If they don't try the --integrated-initramfs to make a kernel and ramdisk in the one file.
Tip: xen historically doesn't always like bzipp'ed kernels. Choose gzip compression for good luck.
linux-2.6.32.12-x86_64-linode12 # zcat /proc/config.gz | diff .config -
(returns nil if you haven't changed your configuration from what is normally used on a linode) Good for tracking where you
differ.
MODERATED: spam crap removedHere's the ebuild:
Code:
#cat /usr/local/portage/coo-custom/sys-kernel/linode-sources/linode-sources-2.6.32.12-r12.ebuild
# Copyright 1999-2010 Gentoo Foundation
# modified 2010 hojuruku for linode.com kernels
K_NOUSENAME="yes"
K_NOSETEXTRAVERSION="yes"
K_SECURITY_UNSUPPORTED="0"
K_PREPATCHED="yes"
ETYPE="sources"
inherit kernel-2
detect_arch
DESCRIPTION="Full sources for the Linux kernel supported by Linode.com"
HOMEPAGE="http://www.linode.com/kernels/"
# If you are modifying this ebuild to work with a different linode kernel
# you need to:
# 1) rename the ebuild to linode-sources-MAJOR-MINOR-PATCH-rLINODERELEASE
# eg linode-sources-2.6.32.12-r12.ebuild for 2.6.32
# 2) edit EXTRAVERSION below to match what comes after the kernel version
# eg 2.6.32-x86_64-linode12.tar.bz2 on http://www.linode.com/src/
# ^^^^^^^^^^^^^^^^ goes to EXTRAVERSION
EXTRAVERSION="-x86_64-linode12"
OKV="${PV}${EXTRAVERSION}"
KERNEL_URI="http://www.linode.com/src/${OKV}.tar.bz2"
SRC_URI="${KERNEL_URI}"
KEYWORDS="alpha amd64 arm hppa ia64 ppc ~ppc64 sh sparc x86"
IUSE=""
universal_unpack() {
cd "${WORKDIR}"
unpack ${OKV}.tar.bz2
#OKV="${PV}${EXTRAVERSION}"
mv ${OKV} linux-${OKV}
S="${WORKDIR}/linux-${OKV}"
cd "${S}"
# remove all backup files
find . -iname "*~" -exec rm {} \; 2> /dev/null
}
unipatch() {
debug-print "linode kernels are prepatched skipping unipatch()"
}
pkg_postinst() {
kernel-2_pkg_postinst
einfo "Now put your custom configuration in if required and compile your "
einfo "kernel with genkernel. Happy linoding"
}