Home page of this blog

Saturday, August 13, 2011

Optimizing libc6 package for core2 in Ubuntu/Mint


Disclaimer: The following is only for who would love to take risks. Rebuilding/Resinstalling libc6 may make the system totally unrecoverable. Use the following at your own risk and hence I am not uploading the packages I built optimized for core2


This is how I fetched and built libc6 package optimized for core2. 


Install build dependencies for libc6

sudo apt-get build-dep libc6


Create a directory for building libc (preferably inside /usr/src/)



cd /usr/src/
mkdir -p glibcbuilds
cd glibcbuilds

Get the source package of libc6 from Ubuntu/Debian repository (deb-src should be enabled for getting source packages)

apt-get source libc6


Enter into eglibc folder extracted

cd eglibc-2.13/




Edit debian/rules  and modify CFLAGS


#edit the required cflags like march and mtune
#modify run test suite to no
vi debian/rules


BUILD_CC = gcc-4.5 -fno-stack-protector -U_FORTIFY_SOURCE -march=core2 -mtune=core2
BUILD_CXX = g++-4.5 -fno-stack-protector -U_FORTIFY_SOURCE -march=core2 -mtune=core2

RUN_TESTSUITE = no

The above are the changed in debian/rules for targeting/optimizing to core2

Enable parallel build

#set 8 for a i7, 4 for a quadcore, 2 for a core2, 1 for others
export DEB_BUILD_OPTIONS="parallel=8"


Clean before building

#clean
fakeroot debian/rules clean


Build

#build
time fakeroot dpkg-buildpackage -uc -us

Install the built packages

cd ..

sudo dpkg -i libc6_2.13-0ubuntu13_amd64.deb libc6-dev_2.13-0ubuntu13_amd64.deb libc6-i386_2.13-0ubuntu13_amd64.deb libc6-dev-i386_2.13-0ubuntu13_amd64.deb



0 comments:

Post a Comment