Thursday, October 25, 2007

UML on linux 2.4 kernel

Finally i was able to compile a 2.4 uml kernel on a 2.4 machine ( but it wasnt as easy as it sounds ). Picking up the right kernel version was a tough nut to crack . I had no earlier info on right gcc/kernel combination plays an important role while compling the kernel. Older gcc for older kernels would work fine but fail on newer kernels and vice versa. I always thought gcc was backward compatible , the code that compiled on older version of gcc wud still work on newer gcc.

I was on gcc 3.3 trying to build a 2.4.17 kernel with uml-patch-2.4.17.x which would compile fine but would fail eventually when trying to link the linux binary. After lot of trying, testing and reading at forums i finally landed on 2.4.24 kernel with uml-patch-2.4.24.1 which seemed to be the right combination and would complile flawlessly on gcc 3.3 , glibc-2.3.2-95.50 , binutils-2.14.90.0.4-42 i had on my CentOS 3 box . But If you really want to build an older kernel like 2.4.17 make sure your using gcc 2.9 or something older , i learnt that the hard way.

So everything worked well at the end , even the CentOS apm problem i was facing got resolved after tweaking a few things in the bios.


Wednesday, October 24, 2007

Compiling kernel 2.4 on 2.6

Not sure if its even possible to compile a 2.4 kernel on a 2.6 machine , but i still gave it a try on a my fedora 7 box. I tried to build a 2.4 kernel for ARCH=um but it failed almost all the time no matter how many different kernels and corresponding uml-patches i picked up.

My sole aim while doing all this was to check some specific functionalities 2.4 kernel offered , so i had no other choice but to setup a linux box with a native 2.4.x . Now all this boils down to finding an OS that still offered a 2.4 kernel & after a lot of searching online i picked up CentOS 3 which comes with 2.4.21.

CentOS came with its own set of problems and the worst being the apm or the advanced power management. Now i had newer problems to face , my new CentOS box will come to a standby/suspend mode after a definate period of inactivity. I tried uninstalling apmd , turned it off with chkconfig , disabled in the bios , even passed the apm=off to the boot loader , still nothing has changed.

Now I'm stuck with problems ive never thought of dealing with .

Tuesday, October 09, 2007

MPEG Standards

Whenever we're listening to music on the ipod or playing an audio cd or watching a movie on DVD we are making use of MPEG standards. The Motion Picture Experts Group or MPEG is responsible for the development of standards for Audio/Video Playback & Compression ( encoding ) . There are four such standards that MPEG has released so far namely MPEG1 , MPEG2 , MPEG4 and MPEG7.

MPEG1 (1992) ; Supports both Video and Audio, Video bitrates upto 1.5Mbps , 2 Channel Audio ( Stereo / Mono ) with sample rates 32,44,48 kHz.

MPEG2 (1994); Supports higher sampling rates up to 96khz and low bitrates , multi channel audio ( 5.1 surround sound , 5 audio channels and one channel for the woofer ). DVD’S , AAC ( Advanced Audio Coding ) are based on this standard.

MPEG Layers are supported by both MPEG2 and MPEG1 , each layer supports the features of the layers below. Higher layer provides better quality at higher bitrates.

MPEG Layer 1 ; relatively old standard designed for Digital Compact Discs.

MPEG Layer 2 or MP2 widely used within the broadcasting industry , offers high quality audio at higher bitrates.

MPEG Layer 3 or MP3 , decent ( not so bad ) audio quality at lower bitrates, this format has improved over the years. VBR and CBR are two such ways to handle bitrates improving the performance of the resulting audio.

MPEG4 (1998) ; This standard goes beyond the earlier two standards, it makes use of both MPEG1, MPEG2 standards and while adding a lot of newer features. MPEG4 is more of a audio/video encoding standard aimed for the future; providing support for a wide range of video/audio applications ( i.e web streaming , videophones , digital broadcasting ) with different bandwidth & performance requirements.

This standard is divided into parts , most notable being the

MPEG-4 Part 2 used by codecs like divX , Xvid , Quicktime 6

MPEG-4 Part 10 for next gen formats like HD-DVD and blu-ray

This standard is continuously improving

MPEG7 (2001) ; also called Multimedia Content Description Interface provides framework for managing audio data supported by past standards.

Thursday, July 26, 2007

Thursday, May 24, 2007

Proxy settings for APT

Just add the following lines into your /etc/apt/apt.conf if you require a proxy to connect to the internet.

Acquire {
Retries "0";
HTTP {
Proxy "http://www.yourproxyserver.com:port";
};
};

You can also export http_proxy variable and include the following in your .bashrc

http_proxy=http://username:password@yourproxyserver:port/
export http_proxy

Tuesday, May 22, 2007

Ubuntu 7.04 (Feisty Fawn) on an external USB drive

First of all make sure you're using an ubuntu alternate cd instead of a live cd. The alternate cd lets you do a lot more than the live cd , it also includes the rescue mode missing in live cd's.

The alternate cd can be downloaded from here .

Boot from the cd , and use the text mode to install. Follow the instructions till you reach the point where you are asked to choose to partition the harddrive .

1 - Do a ALT - F2 , and find out what is your external drive. Simpy execute fdisk -l.

2 - I didnt choose the LVM install , sometimes people face problems . Choose your usbdrive . it should be more like sda , sdb . Mine was the second drive so it was sdb.

3- Let the wizard do the package installation , you can do a ALT-F4 to see if its really installing the packages as at times it seems to get froze.

4- When you are asked to choose the location to install grub make sure you type/choose the name of your usbdrive . In my case it was /dev/sdb.

5 - You'll be asked to take the cd out and do a reboot after everything is done.

6- Dont take the cd out do the reboot , get into the rescue mode . You need to go through a few steps again like language settings , keyboard and all that. Finally you'll be presented with a screen to choose the partition where the root filesystem is installed / to be rescued.

Choose the correct partition , in my case it was /dev/sdb1. The installer will mount this partition can leave you at a Shell prompt . Do a ALT F 2 to open another shell and do su - t get a root shell.

7- vim /etc/initramfs-tools/modules add the following modules
ehci-hcd
usb-storage
scsi_mod
sd_mod

8-
vim /etc/mkinitramfs-tools/initramfs.conf , add the line
WAIT=12

9- Recompile the initrd.img
mkinitramfs -o /boot/initrd.img-kernal-version /lib/modules/kernel-version

10-
Edit the /boot/grub/menu.lst . Search for groot , change it to groot(hd0,0). Also just after the comment "End Default Options" change the root to (hd0,0) , repeat the same for rescue and memtest entries . Also change the entry for Windows incase you have a dual boot with windows , for this change root to (hd1,0).

Take the cd out , Reboot . Make sure you enabled boot from usb in the bios .
Modified from the original article from Ubuntu forums article for Ubuntu 5.10 Breezy Badger

Sunday, May 06, 2007

Ooty Greens


* Ooty Dec 2006

Saturday, May 05, 2007

Experimenting with VOIP

Recently i tried to bring up a small experimental Softphone setup on linux.

Installed linphone on two different linux distros and tried to establish connectivity , worked like a charm ; voice clarity was pretty decent as well. The most interesting thing was to see the packets captured through tcpdump/ethereal , the SIP messages and then the RTP packets with 20ms worth of payload data ( valid for ulaw/alaw).


Calculation of packet size for G.711 ( two versions alaw/ulaw )
bitrate(kbps) * packet size(ms) = packet size (bytes)
64kbps*20ms=1280bits=160bytes

This was my first experiment with voip , it went really well so im happy .

Mixed thoughts on FreeBSD

I was always curious to know what makes BSD different from linux, so i gave it a try last weekend.

I picked FreeBSD 6.2 and a spare HP Vectra box we had in our lab.The whole installation process was kinda different from most of the linux distros i have experienced so far.

The complete CLI based BSD installation can make you feel little uncomfortable if ur too used to Redhat's Anaconda. Sometimes i felt like im running in circles, configuring and choosing the same install parameteres twice, but well everything takes its little sweet time so in a few mins i got used to the interface. Harddrive partitioning was a little confusing but glad figured a way without getting messed and made a clean Standard Install. Choosing the packages is difficult , but worse was yet to come. Installer repeatedly asked for switching the cd's , i was kinda pissed with that part but then cant really help it.

The naming conventions for the drives are totally different in BSD , the same applies for the ethernet interfaces. Ethernet interfaces were named like dc01,dc0 , fxp0 .I had a single SATA hardrive on the HP box , BSD gave it a strange name /dev/ad0s1a unlike the usual hda0,hdb0 and so on.

The installation finally got completed now it was time boot up the box and put it on network. I struggled to bring the network , only after getting too disappointed i came to know about the "netif " , the network startup script in /etc/rc.d. So the network was up , now how to setup routes, again BSD has its own way of doing things, a different "route" syntax than usual linux box. Also BSD gives you a default csh instead of a regular bash.

Finally everything was set. The routes , IP Adresssing , DNS and i smiled , at least didnt had to switch the cd's again for something i had missed.

bsd01 # uname -a
FreeBSD bsd01 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 11:05:30 UTC 2007 root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP i386

Finally trying to learn Guitar

It took me such a long time to get started with guitar, i wish i did it when i was in highschool or university maybe. I hope its not too late now.

I go for guitar sessions twice a week. Its been like two months now since i started , i must say its not too hard to learn but again its not like learning some new programming language or reading a book. It really needs your quality time and attention on daily basis.

If you love music, there's no greater feeling than being able to make your own music, play your own songs . Just sitting in front of TV watching & listening songs like a passive observer doesnt even come closer to pleasure of actively playing it. Once you learn it , you'll be able to appreciate the music you experience in a lot better way , at least now i have a greater sense of respect for people who make music , its not easy at all .

Playing guitar is all about how nicely you can change the chords , its an art that you will only learn with time; there are no short cuts. But then its something that will remain a part of you forever , its worth all that hardwork . Right body posture and holding the notes correctly will always help you learn things quicky.

Well so far ive learned a few songs , and some chords like A, E, D . I hope i get past this A7 chord soon , been practising for a week and im not getting any better.

sleep walk

A while ago i came across a very beautiful guitar composition from the movie "Sleepwalkers" , i was so much in love with it . I didnt know who plays but at one time i really tried hard to find it. Only a few days back a friend of mine shared the same song.

Its beautiful , its called "Sleep Walk" by Johnny and Santo , Thanks a lot my good friend

Wednesday, February 07, 2007

Perldoc Perlmint

Ive been programming in perl for a while but never come across something like this until one day going through perldoc perlmint.
"From a thief you should learn: (1) to work at night;
(2) if one cannot gain what one wants in one night to
try again the next night; (3) to love one's coworkers
just as thieves love each other; (4) to be willing to
risk one's life even for a little thing; (5) not to
attach too much value to things even though one has
risked one's life for them - just as a thief will resell
a stolen article for a fraction of its real value;
(6) to withstand all kinds of beatings and tortures
but to remain what you are; and (7) to believe your
work is worthwhile and not be willing to change it."

-- Rabbi Dov Baer, Maggid of Mezeritch

Zen of Python

IDLE 1.1.3   
>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>>

User Mode Linux

If you wish you create test network configurations on a single linux box , uml can do a lot for you. Ive been running as many as 4 uml instances on my debian box without any problems.All you need to get started with is a root file system and a kernel.

Download the rootfs of your choice from the uml homepage and build the kernel with ARCH=um.

Apart from rootfs and kernel , you need to do some configurations on your system like creating virtual block devices(i.e ubd0) for the filesystem and creating a tap device for networking.

On debian you can install uml-utilities package which provides some uml specific programs which you might need later on to try different network configurations.