I think most people would agree with me that 64 bit Linux is not the greatest desktop right now. In fact 64 bit Operating Systems in general are out performed by 32 bit until you start to get into ram sizes above 4GB where native physical address extension will top out the 32 bit added physical address extension. Even then the 32 bit applications run faster so unless you are planning on running a enterprise level workstation or server the 64 bit version is not necessary. Also, it is easier to find games and programs to run natively in a 32 bit OS so I personally prefer to use it as a desktop. As you may know, a 32 bit Ubuntu installation out of the box will only support 2.7GB of ram without PAE. This is a limitation of the 32 bit kernel but can easily be overcome by a recompile. In this tutorial I will walk you though the installation of needed packages, the obtaining of the kernel source, the recompiling and the packaging of the .deb files so you can install this easily should you need a reload or want to share the kernel with a friend. I found very few resources on the net for doing a recompile in Ubuntu and those I did find never mentioned PAE which is probably the most desired kernel option. Let’s get started!
Do I need PAE?
The fastest way to determine this is knowing what size ram you have installed in the system.Either login as root or sudo su and you can do the following:
# dmidecode | grep Size | grep MB Maximum Memory Module Size: 4096 MB Maximum Total Memory Size: 8192 MB Installed Size: 2048 MB (Double-bank Connection) Enabled Size: 2048 MB (Double-bank Connection) Installed Size: 2048 MB (Double-bank Connection) Enabled Size: 2048 MB (Double-bank Connection) Size: 2048 MB Size: 2048 MB
As you can see above we have 4096 MB of ram installed for a total of 4GB. Now let’s see what the OS reports:
# free -m total used free shared buffers cached Mem: 2771 704 2066 0 98 320 -/+ buffers/cache: 285 2485 Swap: 2045 0 2045
Based on the output above we can now see that the system can only see roughly 2.7GB of the 4GB installed.
We will need some tools installed along with kernel sources so we can recompile. As sudo su or root issues the following commands:
# apt-get install linux-source-2.6.28 kernel-package libncurses5-dev fakeroot
Once these packages installed you will need to go to the source directory to extract the bzip file. A quick way of knowing where the source can be found is by issuing the below command:
# dpkg -L linux-source-2.6.28 /. /usr /usr/src /usr/src/linux-source-2.6.28.tar.bz2 /usr/share /usr/share/doc /usr/share/doc/linux-source-2.6.28 /usr/share/doc/linux-source-2.6.28/copyright /usr/share/doc/linux-source-2.6.28/changelog.Debian.gz
Based on this output we know the kernel source can be found in /usr/src. So lets cd to that directory:
# cd /usr/src/
Now we need to extract the contents of our kernel source with the following two commands:
# bunzip2 linux-source-2.6.28.tar.bz2 # tar xvf linux-source-2.6.28.tar
We now need to create a symlink in the src directory:
# ln -s linux-source-2.6.28 linux
The enter the symlinked directory:
# cd linux
Getting the recompile of the kernel going
To saves us some time from building a completely new config, let’s copy the old ( unless you want to build a new one) :
# cp /boot/config-`uname -r` /usr/src/linux/.config
Now let’s enable PAE support from make menu config:
# make menuconfig
Then scroll down and select –> load alternate config and load the .config and hit enter.
From this screen select –> Processor type and Features
Then –> High Memory Support (64GB) – note: It will say support for 4gb is there bit it is a lie!
Select –> 64GB
Select –> Exit
Once these steps are complete, we will now start the recompile ( This can take some time, so grab a beer and watch T.V. or something):
# make-kpkg --initrd --append-to-version=-mykernel kernel_image kernel_headers
Note: the append-to-version=-mykernel can contain whatever you want so you can change this to say im1337 or whatever.
When the recompile finally finishes, cd to /usr/src and there will be two .debs for your kernel, install them as shown below:
# dpkg -i linux-headers-184.108.40.206-mykernel_220.127.116.11-mykernel-10.00.Custom_i386.deb # dpkg -i linux-image-18.104.22.168-mykernel_22.214.171.124-mykernel-10.00.Custom_i386.deb
Reboot and you should now be good to go as the new kernel will default as #0 in the /boot/grub/menu.1st file. If anything goes wrong your old kernels will be there and you can boot back into them however any issues arising from this process is highly doubtful.