Repository 32bit  Forum
Repository 64bit  Wiki

Compile

Da Slacky.eu.

Descrizione

Questo script effettua le operazioni necessarie alla ricompilazione del kernel dopo aver configurato lo stesso tramite make munuconfig. Va eseguito dalla cartella /usr/src/linux. Compila e installa kernel e moduli, elimina i vecchi file in /boot e vi mette quelli nuovi, lancia lilo quando ha finito

Script

#!/bin/bash

if [ ! -r .config ]; then
  echo "Cannot access .config (are you in /usr/src/linux?)"
  exit 1
fi

if [ `id -u` != "0" ]; then
  echo "You must be superuser to run this script"
  exit 1
fi

OLDVER=`uname -r`
VERSION=`cat .config|grep "version"|cut -c 25-`
VERSION=${VERSION}`cat .config|grep CONFIG_LOCALVERSION|cut -c 22-|head -c -2`

incorrectVersion() {
  echo "Invalid kernel version: $VERSION"
  exit 1;
}

if [ -z $VERSION ]; then
  echo -n "Type the kernel version you wish to compile: "
else
  echo -n "Type the kernel version you wish to compile [${VERSION}]: "
fi
read INPUT

if [ ! $INPUT ]; then
  if [ -z $VERSION ]; then
    incorrectVersion
  fi
else
  VERSION=$INPUT
fi

if [ `echo $VERSION | cut -c -3` == "2.6" ]; then
  echo "Compiling kernel $VERSION"
  make clean && make -j5 && make modules_install
elif [ `echo $VERSION | cut -c -3` == "2.4" ]; then
  echo "Compiling kernel $VERSION"
  make dep && make clean && make -j5 bzImage && make -j5 modules && make modules_install
else
  incorrectVersion
fi

rm -f /boot/config-$OLDVER /boot/vmlinuz-$OLDVER /boot/System.map-$OLDVER
rm -f /boot/config /boot/vmlinuz /boot/System.map

cp -v .config /boot/config-$VERSION
cp -v System.map /boot/System.map-$VERSION
cp -v arch/i386/boot/bzImage /boot/vmlinuz-$VERSION

ln -sv /boot/config-$VERSION /boot/config
ln -sv /boot/System.map-$VERSION /boot/System.map
ln -sv /boot/vmlinuz-$VERSION /boot/vmlinuz

/sbin/lilo -v
  • Data: 03 Jun 2006
  • Autore: Roberto
Strumenti personali
Namespace

Varianti