Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
pre-built kernels -- the gentoo way?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
adsmith
Veteran
Veteran


Joined: 26 Sep 2004
Posts: 1386
Location: NC, USA

PostPosted: Sat Jul 21, 2007 2:04 pm    Post subject: pre-built kernels -- the gentoo way? Reply with quote

I manage many machines with nearly identical gentoo installations. I use distcc to build once quickly, and then I use tbz2 binary packages and "emerge -k" to install everywhere -- basically I have my own little binary distribution.

There is only one thing lacking:
Is there a "gentoo way" (or at least a "sane way") to use a pre-built kernel?

I have considered using "make targz-pkg" in /usr/src/linux and manually un-tarring it on all machines, but this seems a little hackish somehow, especially since installed third-party modules may not build correctly, since the /usr/src/linux on each client would not contain the right config, headers, et cetera. (kernel gurus, am I right about this?)

Is there a better method than this?

I am also somewhat loathe to write a new ebuild for each kernel version, but I suppose I could...
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54831
Location: 56N 3W

PostPosted: Sat Jul 21, 2007 2:45 pm    Post subject: Reply with quote

adsmith,

For a binary kernel, you need only /lib/modules/`uname -r`/ and the bzImage file.
You want the bzImage under its name in boot.
If the kernel is monolithic, you don't need /lib/modules/`uname -r`/ as its empty.

How about tarring them up into a single tarball and writing a kernel-bin ebuild to untar them ?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23091

PostPosted: Sat Jul 21, 2007 5:38 pm    Post subject: Reply with quote

The kernel Makefile supports the INSTALL_PATH and INSTALL_MOD_PATH variables to install the files into a temporary location, which may make it easier to install the files into a temporary location, so that you can tar them all up with a simple tar -c -f mykernel.tar -C /my/kernel/staging/area ..
Back to top
View user's profile Send private message
adsmith
Veteran
Veteran


Joined: 26 Sep 2004
Posts: 1386
Location: NC, USA

PostPosted: Sun Jul 22, 2007 2:07 am    Post subject: Reply with quote

Both,
Yes, that was generally my original though. I was hoping there was a better way.

What both you outline is exactly what "make targz-pkg" does in the standard kernel Makefile -- it just tars up everything that would come out of "make install" and "make modules_install", namely /boot/vmlinuz, /boot/config, /boot/System-map, and /lib/modules/ (all of these with version extensions)


So it looks like I do indeed have to write a kernel-bin ebuild to unpack the binary, and keep it up-to-date with my kernel version.



NeddySeagoon,

That is technically correct, but I think (?) just the vmlinuz and modules are not enough for some purposes. What if I were to do something like "emerge nvidia-drivers lirc madwifi", where it builds/installs kernel modules and need to check that dependencies are set properly in /usr/src/linux/.config (really /lib/modules/$(uname)/build)? Based on my (possibly false) recollection, it will fail unless the .config is OK.
Since the goal is to never really touch the /usr/src/linux directories on any client, such emerges may fail?

Maybe I'm just being too picky, and I should make sure ALL potential 3rd party modules are pre-built on the build master.
Back to top
View user's profile Send private message
dsd
Developer
Developer


Joined: 30 Mar 2003
Posts: 2162
Location: nr London

PostPosted: Sun Jul 22, 2007 3:59 am    Post subject: Reply with quote

genkernel might be able to help you here
_________________
http://dev.gentoo.org/~dsd
Back to top
View user's profile Send private message
adsmith
Veteran
Veteran


Joined: 26 Sep 2004
Posts: 1386
Location: NC, USA

PostPosted: Sun Jul 22, 2007 11:18 am    Post subject: Reply with quote

I thought genkernel still builds locally?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54831
Location: 56N 3W

PostPosted: Sun Jul 22, 2007 12:35 pm    Post subject: Reply with quote

adsmith,

If you use any 3rd party kernel modules, they are still put into /lib/modules/`uname -r`/....
After you have the binararies, the sources are no longer required.

You will have to do your own tarring to pick up the binaray 3rd party modules because make targz-pkg will only pick up offical kernel tree things.
As a minimum you need bzImage and /lib/modules/`uname -r`/ after all the 3rd party suff is installed.
System.Map is only needed for debugging

You may need /etc/modules.d/ as nvidia-drivers puts things there.
I'm not sure if you can make a binary package of nvidia-drivers that you can later use with emerge -K but I don't see why not.
That may be another option. Use make targz-pkg on the kernel and build binary packages of any 3rd party kernel additions.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
adsmith
Veteran
Veteran


Joined: 26 Sep 2004
Posts: 1386
Location: NC, USA

PostPosted: Mon Jul 23, 2007 1:03 am    Post subject: Reply with quote

OK, so something like this should do it

Code:

# Distributed under the terms of the GNU General Public License v2
# adsmith's ebuild for installing pre-built kernels

DESCRIPTION="admith's pre-built linux kernel image"
HOMEPAGE="http://tock.no-ip.org"

MY_PVR="${PV}-suspend2-${PR}-adsmith"
## the prebuild binary of /boot/* and /lib/modules/* is at
SRC_URI="http://tock.no-ip.org/portbin/linux-${MY_PVR}.tar.gz"

LICENSE="GPL2"
SLOT="0"
KEYWORDS="x86"
IUSE="nvidia madwifi lirc"

DEPEND="=sys-kernel/suspend2-sources-${PVR}"
PDEPEND="nvidia? ( || ( x11-drivers/nvidia-drivers
                        x11-drivers/nvidia-legacy-drivers
                        )
                )
        madwifi? ( net-wireless/madwifi-ng )
        lirc? ( app-misc/lirc )"


src_unpack(){
   unpack ${A}
}


src_install(){
    cd ${WORKDIR}
    # move symlinks that doins cannot handle
    mkdir -p ${D}/lib/modules/${MY_PVR}
    mv -v lib/modules/${MY_PVR}/{source,build} \
        ${D}/lib/modules/${MY_PVR}/
    # remove useless uncompressed kernel image
    rm boot/vmlinux-${MY_PVR}
    # install everything else normally
    doins -r boot || die "could not install kernel into /boot"
    doins -r lib  || die "could not install kernel modules into /lib"

}

pkg_postinst(){
    einfo
    einfo "Please remember to update your grub.conf as appropriate!"
    einfo "This kernel is installed as /boot/vmlinuz-${MY_PVR}"
    einfo
}



EDIT: whoops, I forgot a src_install, so the ebuild was useless... more-or-less fixed now.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum