Gentoo ebuild for linode-sources (supports future releases)

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.

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 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:

pvops 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 paravirtops 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 removed

Here's the ebuild:

#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"
}

2 Replies

You've been warned multiple times. Do NOT post SPAM/off-topic banter in your posts.

The other mods were told about the sublime 1 very short paragraph before you woke up and there wasn't a problem.

I told them I was merely conducting an experiment to see if a google data order on the topic would delete content from your site from Google's indexes. Some people think if it's banned it must be good. I'd like to see it un-redacted to see if we can get a second opinion from your userbase.

If I continue to talk about the topic I would have wrote more than I wrote in my paragraph. Ooops! I already have. I hope you don't censor my comment merely saying it's good enough for Google and governments to support you in your self-censorship.

Now moving on… ````

  • Sabayon/Gentoo Linux Genkernel; Version 3.4.10.907
  • Running with options: --real-root=/dev/xvda --bootloader=grub --install --postclear --lvm --luks --mdadm --iscsi --no-clean --no-mrproper --no-splash --oldconfig --makeopts=-j2 --no-ramdisk-modules all
You can now get the benefit of having an all LVM filesystem if you have a small boot filesystem. Maybe you could experiment with cluster lvm if you have multiple linode. iscsi or mdadm are ok too.

You could uncompress your gentoo initramfs and use it with caker's kernel (the ones you choose instead of pv_grub) and copy it to an initrd ext2 fs xvd? block device created initrd through Linode manager. ****Then you can have a root fs on LVM.**** Great for copying over whole linux distributions to your linode using finnix instead of waiting for caker's crew to get around to releasing a new distributions for you. (E.g. Sabayon linux-5.2-corecd). ****With a rootfs in LVM there is snapshotting and a DIY backup solution (the other Linode backup) <e>:)</e>**** With snapshotting you can also mount the file system and do atomic point-in-time accurate incremental backup's just like linode backup service which I presume uses the same method!

If you ever have a problem with your linode, be courteous to linode support and give them the results from this Of course you have to be running a linode kernel selected from the configuration editor (not pv_grub) when you type this. Save the output of this command before you boot into your new kernel for good measure

****zcat /proc/config.gz | diff - /usr/src/linux/.config > /root/mykernelisdifferent.diff****

My diff is a lot larger than some, because as you can see caker and I have a difference of opinion on many things. <e>:twisted:</e>

If you don't instruct gentoo to massage your /boot/grub/menu.lst then here is what mine looks like. You may need to copy it to /boot/grub/grub.conf if pv_grub does things differently.

This is a sample grub.conf for use with Genkernel, per the Gentoo handbook

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2

If you are not using Genkernel and you need help creating this file, you

should consult the handbook. Alternatively, consult the grub.conf.sample that

is included with the Grub documentation.

groot=(hd0)

default 0
timeout 5

splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title=Sabayon Linux (2.6.32-xen)
root (hd0)
kernel /boot/kernel-genkernel-x8664-2.6.32-xen root=/dev/ram0 realroot=/dev/xvda ro selinux=1 enforcing=1
initrd /boot/initramfs-genkernel-x86_64-2.6.32-xen

vim:ft=conf:

````

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct