Author Topic: rebuilding kernel  (Read 6771 times)

mhe

  • Guest
rebuilding kernel
« on: Sun Sep 28 15:53:10 2014 »
As I am almost finished rebuilding/upgrading the base of sekong to that of saravane, it is almost time to rebuild my kernel.
Could someone give me some input on howto change the Pkgfile so I do not use proprietary drivers and the linux-libre sources?

On LFS with lfspkg as package manager I use this script:
Code: [Select]
#!/bin/bash -e

. /usr/share/LFSPkg/LFSFunctions

TARNAME="linux"
PKGNAME="kernel"
VERSION="3.10.33"
BUILD=1
SECTION="KERNEL"
SUFFIX="LFSPKG"
TARBALL="${TARNAME}-libre-${VERSION}-gnu.tar.xz"
CONFIG=config-3.10.18

DEPENDS="linuxheaders-${VERSION}"
lfspkg -B "$DEPENDS"

PKG="${OUTPUT}/${PKGNAME}"

DOWHAT=${1:-"build"}
rm -rf "$PKG" || true
mkdir -p "$PKG"
tar -xvf "$TARBALL"

pushd "${TARNAME}-${VERSION}"
pkgname="linux"
mkdir -pv $PKG/{boot,usr/include,usr/src}
make $MAKEFLAGS mrproper
make $MAKEFLAGS headers_check
cp ../$CONFIG .config
make $MAKEFLAGS oldconfig
make $MAKEFLAGS bzImage
make $MAKEFLAGS modules
make $MAKEFLAGS modules_install INSTALL_MOD_PATH=$PKG INSTALL_PATH=$PKG
cp -L arch/x86_64/boot/bzImage $PKG/boot/bzImage-$VERSION
cp .config $PKG/boot/config-$VERSION
cp -v System.map $PKG/boot/System.map-$VERSION

make INSTALL_HDR_PATH=dest headers_install
find dest/include \( -name .install -o -name ..install.cmd \) -delete
cp -rv dest/include/* $PKG/usr/include

chown -R 0:0 .
cp -r . $PKG/usr/src/linux-$VERSION
cp  $PKG/usr/src/linux-$VERSION/usr/include/linux/version.h $PKG/usr/src/linux-$VERSION/include/linux
rm $PKG/lib/modules/$VERSION-gnu/build
rm $PKG/lib/modules/$VERSION-gnu/source||true
ln -sv /usr/src/linux-$VERSION $PKG/lib/modules/$VERSION/build
ln -sv /usr/src/linux-$VERSION $PKG/lib/modules/$VERSION/source
noblastlink "$PKG"
popd

if [ "$CHECKETC" -eq 1 ];then
checketc $PKG
fi

pushd "$PKG"
find | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
/usr/bin/lfspkg -n "$PKGNAME" -p "$VERSION" -d $SECTION -b $BUILD -s $SUFFIX -m
popd

case $DOWHAT in
up*)
lfspkg "^${PKGNAME}-[0-9][0-9]*" "${OUTPUT}/${PKGNAME}-${VERSION}-${BUILD}_${SECTION}_${SUFFIX}.tar.gz" -u
;;
"install")
lfspkg "${OUTPUT}/${PKGNAME}-${VERSION}-${BUILD}_${SECTION}_${SUFFIX}.tar.gz" -i
;;
"build")
echo "Just built"
;;
*)
echo "*** Unknown command ***"
exit 1
esac

rm -r "$PKG" "${TARNAME}-${VERSION}"
As config I use slackware huge, I don't care if my kernel contains unused stuff.

Thierry

  • Administrator
  • Hero Member
  • *****
  • Posts: 706
  • Karma: +13/-0
  • Gender: Male
    • NuTyX distribution
Re: rebuilding kernel
« Reply #1 on: Sun Sep 28 16:30:26 2014 »
Another article which has to be translate in english

http://nutyx.org/en/build-kernel.html

Have fun

Thierry

  • Administrator
  • Hero Member
  • *****
  • Posts: 706
  • Karma: +13/-0
  • Gender: Male
    • NuTyX distribution
Re: rebuilding kernel
« Reply #2 on: Thu Feb 26 20:18:40 2015 »
It has been translated :)