Friday, May 18, 2012

Compile Debian Kernel (Squeeze) 3.0 and Above with Aufs and squashfs

This tutorial is intended for all who are facing problem with patching the aufs modules using the old methods (2.6.x)

Prerequisites :

Debian (belief that same process holds for Ubuntu)
And again ABC of Linux


Open up a terminal

make a directory "linux":

mkdir /root/linux

Install all the packages required to build to kernel

aptitude update && aptitude install dkms kernel-package libncurses5-dev wget bzip2 fake-root build-essential 

Download the latest sources from (3.3.6 were the latest while this post was written) by typing the following in terminal

Step 4:

Extract the sources to the folder we made earlier

tar xvf linux-3.3.6.tar.bz2 /root/linux
Step5 :

Download the aufs modules and create a patch

mkdir /tmp/aufs
cd /tmp/aufs
git clone git:// aufs3-standalone.git
cd aufs3-standalone.git
git checkout origin/aufs3.3
mkdir ../a ../b
cp -r Documentation ../b
cp -r fs ../b
cp -r include ../b
rm ../b/include/linux/Kbuild
cd ..
diff -rupN a/ b/ > /root/linux/aufs.patch
cat aufs3-standalone.git/*.patch >> /root/linux/aufs.patch 

Step 6:

Apply the patch

cd /root/linux
patch -p1 < aufs.patch

 Step 7:

Now start the build process

make clean and make mrproper
Step 8 i: ( if you want to have the same config of your existing kernel)

Configuring the kernel :

If you wish to have the same config of your previous existing kernel follow the steps

cp /boot/config-`uname -r` ./.config
this will load the existing kernel config file

now type

make menuconfig
Step 8 ii : ( if you want to have a custom config of your own)

Configuring the kernel :

copy your custom made .config to the current directory

and type
make menuconfig

Step 9:

You will now be displayed with a screen

Go to Load an Alternate Configuration File and choose .config (this is the .config file we copied to our directory in step 8) and press OK.

Step 10:

Now we will make our own custom kernel

make-kpkg clean fakeroot make-kpkg --initrd --stem extraversion  --revision revision  --append-to-version=-customversion kernel_image kernel_headers

You need to give these 3 values of your own in the above command:
 "extraversion - give your own extraversion for kernel
 revision- the revision you want the kernel to be
customversion   - the custom revision of the kernel "

And sit back for a couple of hours since it takes time

After successful compilation of the kernel you will see two .deb packages in the ../ folder
1. Kernel image file .deb
2. Kernel Header file .deb

Step 11:

Install them by typing the following commands

dpkg -i linux-image-*
dpkg -i linux-headers-*
 (you may type the whole file name as dpkg -i linux-image-3.3.6-custom_3.3.6-custom-1.00.custom_i386.deb depending on whatever is generated in your case) .

Restart your system and you should see your kernel in the grub menu or else verify the kernel version with

uname -a

Congrats you have successfully compiled the Linux kernel for Debian and its derivatives :))

Note:If you face any issues comment this post and i will reply you. 

Monday, March 12, 2012

Ostinato - Wireshark in Reverse

This is a brief introduction on Ostinato, an open-source, network packet crafter/traffic generator and analyzer with a very easy to use GUI. Like it says, it aims to be reverse the ofWireshark. What could be done with Ostinato? Generate the traffic, craft and analyze Specify your own Hex Dump Create and configure multiple packet streams with stream rates, bursts, packets over multiple ports and computers using a single client Capture and view the packets alongside wireshark. Let's get started!! Ostinato can be found in MatriuxArsenal as Arsenal => Scanning => Ostinato
This starts up a GUI which is very quick and easy to use (Figure 2).
 Figure 2 

 Move around the port groups (either expand the list or create a new port group from the file menu) Right click over the column in the right side and create a new stream as shown in the figure below (Figure 3).
 Figure 3

  Click over the tools option and configure the packets to be generated. Go ahead and choose all the options you prefer. (protocols, data stream, source, destination).
 Figure 4 

Click OK and also Apply button over the top right corner of the window otherwise these settings would fail (Figure 5). 

 Figure 5 

 Now we are ready to go for generating the packet traffic. Click on the port you just applied and click the start button.. This will now start transmitting the traffic You can capture the traffic that is being transmitted my selecting the configured port group and clicking on the capture button (Figure 6). 
 Figure 6

 This traffic can be analyzed over wireshark by clicking the view captured files button over there (Figure 7).
 Figure 7 

 So I hope you go head and try all the options in the Ostinato tool and play around with it.

This article was published in CHmag as a part of Matriux Vibhag