Search:  
Gentoo Wiki

TIP_Kernel_Autobuild

This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other
This page is a candidate for deletion 
Reason given: Encouraging users to autobuild a kernel is a bad idea. Anyone who should be autobuilding kernels would be able to create this script themselves. Script is setup specific with no explanations of what needs to be changed.
If you disagree with its deletion, please explain why on its discussion page.
If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
Make sure no other pages link here and check the page's history before deleting.

Solution 1 - portage download + config from current + installation

This is a simple script that downloads current version of the kernel and fires make, make modules_install and make install (installs new image under /boot/vmlinuz).

File: updatekernel.sh
#!/bin/bash
cd /usr/src/linux
# save your .config file
echo "[NEWKERNEL] Old .config file saved in ~/config-bak."
cp -i .config ~/config-bak
# clean the linux sources
echo "[NEWKERNEL] Cleaning old kernel out..."
make mrproper
cd ..

# download the kernel and patches
echo "updating your portage tree..."
emerge --sync
echo "[NEWKERNEL] Merging new sources..."
emerge gentoo-sources

# delete old version (the directory can remain)
emerge -P gentoo-sources

# make a new link to actual linux sources
echo "[NEWKERNEL] Creating new link..."
SRC=`ls -t --format=single-column | grep linux- | head -n 1`
ln -sf $SRC linux

# prepare config
echo "[NEWKERNEL] Grabbing new config..."
cd $SRC
# original line is: 
# zcat /proc/config.gz > .config
# 
cp -f ~/config-bak .config
echo "[NEWKERNEL] Delete the backup of the kernel configuration?"
rm -i ~/config-bak

# compile and install it (with ccache)
echo "[NEWKERNEL] Building new kernel..."
PATH="/usr/lib/ccache/bin:$PATH"
make && make modules_install && make install

# merge all necessary modules
echo "[NEWKERNEL] Installing necessary modules..."
emerge ipw2200 alsa-driver
emerge -u alsa-lib alsa-utils

This simple script is useful for those who have hand-configured kernel and do not change this configuration with new versions and who have already configured /boot/vmlinuz as a default booting kernel. From time to time it is good to delete old directories with temp files which havent been pruned or cleaned with Mr. Proper. Enjoy.


---

This script makes a lot of assumptions and is not suitable for an automated build system. First, you blindly assume that we want gentoo-sources. :-) why not simply use virtual/kernel-sources  ?? you can use virtuals in other packages listed in your script also.

External Links

http://wiki.kaspersandberg.com/doku.php?id=projects:scripts:installkernel - A more advanced, and accomodating kernel installation script. with nice output :)

Retrieved from "http://www.gentoo-wiki.info/TIP_Kernel_Autobuild"

Last modified: Sat, 30 Aug 2008 10:49:00 +0000 Hits: 17,709