Raj Agrawal

Learnings from software and technology

  • Home
  • Technology
  • Software
  • Work
  • Play

Connect

  • GitHub
  • LinkedIn
  • YouTube

Powered by Genesis

You are here: Home / Archives for Raj Agrawal

Compile A Custom Linux Kernel – An Essential Guide

January 19, 2012 by Raj Agrawal 4 Comments

You might question – why compile a custom linux kernel when the distro vendor already provides you with one? The answer is simple, the kernel which ships with your distro is a generic kernel, it means it’s designed to run on any machine on which it’s installed, it supports almost all types of processors, graphic cards, storage devices, wired/wireless networking, etc. As the generic kernel has support for plethora of PC hardware, you might argue that it is better to use a generic kernel instead of custom built kernel, but that’s not the case. A generic kernel has all the features you want, more specifically, your hardware wants, but it also has many features that you may never need. A simple example would be of the processor support, suppose you have an Intel processor the generic kernel will support it but it also has support for AMD processors which is redundant as you will never run the same kernel on an Intel processor and an AMD processor simultaneously. Thus a custom compiled kernel is more suited to your PC requirements and thus is smaller in size. Smaller size means your kernel occupies less space than the generic one but supports all the hardware you have installed in your machine.

To sum it up you might want to compile your custom Linux kernel to/for:

  1. Build a kernel customized for your hardware setup
  2. Improved performance
  3. Learn how kernel works
  4. Fun 😀

Requirements

Kernel sources: These are the source files of the kernel. You will need to compile these source files later. The latest kernel sources can be downloaded from HYPERLINK “http://www.kernel.org/”www.kernel.org.

Build Tools: These are the tools which you will require for compiling the source files. The method to install these tools depend on your distribution.

The packages required on Ubuntu/Linux Mint can be installed be executing the following command in the terminal,

sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2

On Fedora, execute the following,

sudo yum -y install gcc ncurses-devel

The command begins with a “sudo” because root access is required for installing packages, if you do not have access to the root account then you cannot install these.

Once you have installed the build tools and downloaded the kernel sources you are ready to compile your custom kernel.

The kernel source you have downloaded is in an archive, first you will need to extract the sources. Execute the following command without the ‘quotes’:

tar -xjvf  ‘kernel archive file name’ ‘folder in which you want to extract the sources‘

Example, the command with the appropriate paths may look like:

tar -xjvf linux-2.6.25.tar.bz2 /home/casper/kernel/

After the kernel sources are extracted navigate into that directory and create a soft link named “linux”. Some Kernel sources require a path from the linux directory in order to compile, so the soft link needed. Run the following command to make a soft link,

ln -s ‘kernel source folder name’ linux

Example,

ls -s zen-stable linux

link
Screen 1

Now navigate to the linux directory and execute the following commands:

make clean && make mrproper

Screen 2

These commands clean the directory structure deleting any files from the previous builds.

Configure

Now we are ready to configure our kernel, but we have to choose whether we want to configure the kernel from scratch or use current kernel configuration as a base and develop on it. As we are beginners in the realm of kernel compilation we will stick with the easy method i.e. use the current configuration as a base. The current configuration can be found in “/boot/”.

Run the following command to copy the current configuration into your source folder,

cp /boot/’your config file name’ ‘your kernel source path/linux/.config

Example,

cp config-3.1.5-casper.kernel-v.1.1+ /home/nishikant/kernel/linux/.config

config
Screen 3

Now we need to compare the old configuration to the new one, so run the following command,

make oldconfig

oldconfig
Screen 4

In the screenshot the command doesn’t give any output because I am current running a custom kernel, but on your PC you might be prompted to select new features that are available.

Now run the following command,

make menuconfig

Screen 5

After executing “make menuconfig” a GUI interface will appear, here you can select the features you want. Say, processor type, cpu schedulers, IO schedulers, filesystem drivers, networking drivers, etc. Once you are done with the customization, select exit and then save the configuration.

save
Screen 6

Now you have finished customizing the kernel and it’s time to compile. The command to compile the kernel is,

make -j’number of cpu cores+1′

Example,

make -j3 (without spaces in between. Enter 3, if your processor is Intel core2duo)

If your processor supports hyper-threading then the number is twice the number of cpu cores,

Example,

make -j9 on Intel corei7 2600/2600k

The compilation process make take 15 minutes to an hour depending on your PC.

Once the compilation is over (without any errors), you are now ready to install your kernel, to install the kernel execute the following command,

sudo make modules_install install

After the kernel is installed you have to update your bootloader so that you can boot using your kernel.

On Ubuntu/Linux Mint the command is,

sudo update-grub

updategrub
Screen 7

While on Fedora, run,

su -c ‘grub2-mkconfig -o /boot/grub2/grub.cfg’

If you are using a different bootloader instead of grub then the above commands won’t work.

That’s it, you’re done compiling your custom kernel, after you restart your PC you’ll be able to boot into your kernel from the bootloader’s menu.

If your PC won’t boot into your kernel or some drivers don’t work then you can always boot into the generic kernel(that’s why having more than one kernel on your PC is always useful).

If you want to delete the kernel from your PC just delete the following file/directories(root access required):

/boot/’config-kernel name’

Example,

/boot/config-3.1.5-casper.kernel-v.1.1+

Next,

/boot/initrd.img-‘kernel name’

Example,

/boot/initrd.img-3.1.5-casper.kernel-v.1.1+

Next,

/boot/vmlinuz-‘kernel name’

Example,

 /boot/vmlinuz-3.1.5-casper.kernel-v.1.1

Next,

‘kernel name’ folder in /lib/modules

Example,

3.1.5-casper.kernel-v.1.1+

Finally update your bootloader,

On Ubuntu/Linux Mint the command is,

sudo update-grub

On Fedora run,

su -c ‘grub2-mkconfig -o /boot/grub2/grub.cfg’

So, this is it. Drop in your feedback/ questions about this tutorial. I’d be glad to hear/ answer them!

Filed Under: Technology Tagged With: linux, ubuntu

AfterShokz Headphones: Listening To Music With Your Bones, Not Eardrums

January 13, 2012 by Raj Agrawal Leave a Comment

If you like listening to music on the go; whether you are an audiophile or not, this technology will pique your interest!

A new way of listening to music is available now, without having the need to stuff things in your ear. AfterShokz Headphones (using Bone Conduction Technology) deliver sound directly to the inner ear, bypassing the eardrum. Bone conduction headphones were originally created for military use. But, now you can experience it too!

aftershokz
AfterShokz Headphones

What makes these headphones different than the conventional ones?

When you are using regular headphones/ earphones, the sound waves travel via ‘air’ to finally reach your eardrums. Whereas, in case of headphones using Bone Conduction Technology, all sounds are delivered through your skull to the inner ear, without interference from air; not to mention the crystal clear accuracy that the headphones shall provide.

The main intent of creating this technology was clearly to allow the user to be able to communicate through media while still being able to hear what is going on around. The earphones in use today have major drawbacks – when the surroundings are too loud, the users have to pump up the volume; on and around-ear headphones are just ‘unwieldy’ and make the dork in you stand out; and the in-ear ones, though providing good quality, block the user from the outside world.

Watch the video talking about AfterShokz Headphones, from CES 2012,

Bone Conduction Technology

To those who find it hard to believe, try holding a watch between your teeth, the ticking is audible. A tuning fork held to your forehead will also do. Bone conduction simply is, passing of frequencies through the skull plates to the inner ear. A high frequency makes parts of the skull vibrate, so as to put it in layman’s terms. Correspondingly, low frequencies make the skull vibrate as a whole. From this, the inner ear can deduce the frequency being passed.

AfterShokz Headphones have been designed such that they press on the cheekbones and have good grip. And you do get to experience high fidelity and stereo quality sound. Normal earphones are irritating when used for long durations; the in-ear ones block air access to the ear canal, the other ones simply hurt since people tend to use them at high volumes. Joggers and active people have to keep adjusting them from falling away.

Drawbacks

Whether this technology has any drawbacks is not known. However, a skeptic may point that making a person’s skull vibrate all the time may be harmful in the long run.

Availability

Three models of AfterShokz Headphones are available: AfterShokz Sport Headphone, AfterShokz Mobile with In-Line Mic, and AfterShokz Game Headphone.

Filed Under: Consumer Technology Tagged With: bone conduction

What Is The Best FPS Of All Time?

January 10, 2012 by Raj Agrawal 3 Comments

The first person shooter genre is probably the most popular in gaming. Even after almost 10 years after its release, people still play Counter Strike. Call of Duty and Battlefield series of games are breaking sales records year after year. There have been enough FPS games in the past ten years to eclipse all the other genres in gaming. So the obvious difficulty i’m having in choosing the best FPS game ever made shouldn’t come as a surprise to many.


call of duty 4
Call of Duty 4

The FPS genre has undergone a severe transition over the years from being single player focused to multiplayer focused. Call of Duty and Battlefield 3 both have single player campaigns, but they’re an afterthought when compared to the excellent multiplayer offerings. This makes the decision to find the best game even more difficult. One side you have games which rely heavily on single player such as Half life 2. On the other side you have multiplayer games like Modern Warfare which have changed the scope of multiplayer games.

Off the top of my head I can list the following games that thoroughly deserve the crown:-

  • Half Life
  • Half Life 2
  • Bioshock
  • Halo
  • Halo 2
  • Unreal Tournament 2004
  • Doom
  • Call of Duty 4 : Modern Warfare
  • Battlefield 2
  • Call of Duty

All of the above are shining examples of what a good FPS must be. Games like Unreal Tournament and Modern Warfare have changed the multiplayer landscape, whereas Bioshock and Halo have redefined single player gameplay. To choose one best game out of these would be to seriously insult the others since the competition is so close. But, to not chose even one would completely betray the purpose of writing this article. Hence I shall pick two best games which i think have defined FPS gaming. And when I say defined FPS gaming, I do not imply popularity, in which case Modern Warfare and Halo would be runaway winners; it’s how much they have affected FPS game development on an evolutionary scale, and how they have changed the way players look at first person shooters.

Half Life 2

half life 2
Half Life 2

The original half life was sort of an evolution in the FPS landscape. It did nothing special, but whatever it did, it did perfectly. Well almost perfectly, otherwise I wouldn’t pick the sequel above it. Half Life 2 was something completely different. It’s an unrelenting campaign from start to finish. It pauses without stopping and rushes without hurrying. Couple this perfect pacing with a good story and some new fantastic gimmicks such as the gravity gun and physics puzzles, and you have a winner. But HL2 was much more than that; one which relies more on versatility than anything else. What i most remember the game for is its variety in levels. You won’t play the same time of environment in this game for more than 3-4 hours. And it’s a long game which will last you almost 20-25 hours. How can a game have all of these features and not be one of the best games of all time. I thought the same, and frankly I couldn’t come up with one reason about why it deserves anything less.

Bioshock

Bioshock

I was torn between Bioshock and Modern Warfare for this spot, but in the end Bioshock just about managed to nudge ahead. Storytelling in videogames have never been good enough to compete with movies, but this game come scarily close. And the story has a very deep impact on the game world and the characters. There’s much to talk about this game, but most of it will serve as a spoiler. This is one game which will constantly surprise and awe you, and I intend to keep it that way. And as far as twists go, this one is right up there with the best.


Well thats my two cents. What do you people think about these choices? Whats your favorite FPS of all time?

Filed Under: Gameology Tagged With: Call of duty, half life, halo

  • « Previous Page
  • 1
  • …
  • 26
  • 27
  • 28
  • 29
  • 30
  • …
  • 79
  • Next Page »