View previous topic :: View next topic |
Author |
Message |
adsmith Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 26 Sep 2004 Posts: 1386 Location: NC, USA
|
Posted: Sat Jul 21, 2007 2:04 pm Post subject: pre-built kernels -- the gentoo way? |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54830 Location: 56N 3W
|
Posted: Sat Jul 21, 2007 2:45 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23091
|
Posted: Sat Jul 21, 2007 5:38 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
adsmith Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 26 Sep 2004 Posts: 1386 Location: NC, USA
|
Posted: Sun Jul 22, 2007 2:07 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
dsd Developer
![Developer Developer](/images/ranks/rank-dev.gif)
Joined: 30 Mar 2003 Posts: 2162 Location: nr London
|
Posted: Sun Jul 22, 2007 3:59 am Post subject: |
|
|
genkernel might be able to help you here _________________ http://dev.gentoo.org/~dsd |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
adsmith Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 26 Sep 2004 Posts: 1386 Location: NC, USA
|
Posted: Sun Jul 22, 2007 11:18 am Post subject: |
|
|
I thought genkernel still builds locally? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54830 Location: 56N 3W
|
Posted: Sun Jul 22, 2007 12:35 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
adsmith Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 26 Sep 2004 Posts: 1386 Location: NC, USA
|
Posted: Mon Jul 23, 2007 1:03 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
|