Saturday, 30 October 2004

Dual Booting Windows XP/2000 and Red Hat Fedora Core 2

There are two ways in which you can dual boot between windowsXP/2000 and Linux.
  1. Install the boot loader in the Master Boot Record (MBR)
  2. Install the bootloader on the linux partition.
The first method is the easier of the two. But if by any chance, you descide to Hibernate your computer while in WindowsXP for example, then your MBR is overwritten by windowsXP and you will be unable to boot into linux using your bootloader.
Here I will explain how to overcome this setback by using the second method. That is installing the bootloader (LILO or Grub) on the linux partition . Here I am explaining the steps with respect to RedHat Fedora Core 2 distribution. But the steps are equally valid for any linux distribution.
The procedure is as follows:
  • Install WindowsXP/2000 first.
  • Now install Fedora core 2. I installed it in /dev/hda3 ; which was my linux ext3 partition.
  • While installing, enforce LBA32. This is necessary only if you intend to install the bootloader in a partition above 32GB. In my case (I have only 12 GB total) it was not necessary.
  • At the section where the installer asks whether you want to install a boot loader; select yes (Fedora comes with Grub as default boot loader) and in the advanced settings, select your linux partition as the place to install the bootloader. In my case it was /dev/hda3. Nowcomplete the Fedora core 2 install.
  • Reboot the computer and load again from the first CD in your Fedora Core 2 distribution.
  • At the boot prompt, type:
    boot: linux rescue
    ... And boot into rescue mode. Fedora will automatically try to detect your linux partition ;boot you into single user mode and mount your linux partition in the /mnt/sysimage directory.
  • Here when you get the root prompt, issue the following commands:
    # chroot  /mnt/sysimage
    # dd if=/dev/hda3 of=linux.bin bs=512 count=1
  • Now insert a floppy and copy the linux.bin file into it as follows:
    # mcopy linux.bin a:
  • Type exit 2 times - which will reboot your machine. Now remove the FC2 CD and boot into windows XP/2000.
  • Get to the command prompt and copy the linux.bin file into the C:\ drive.
    A:\> copy linux.bin  C:\
  • Finally add the following line to the boot.ini file residing in the C:\ drive.
    C:\linux.bin=" Red Hat Fedora Core 2"
  • Reboot machine and choose "Red Hat Fedora Core 2" from boot.ini menu, which will cause NTLDR to load first 512 kb from Fedora Core 2 boot partition.
  • Select from grub menu the desired kernel and press Enter.
Now even if you hibernate while in Windows XP, your bootloader will not be overwritten and you will be able to boot successfully into Linux.

Thursday, 28 October 2004

Configuring the Rockwell chipset based HSF winmodem in Linux

I have an Intel Celeron 333MHz, 98MB RAM @ 100MHz FSB, 12GB HDD computer. I had also brought an internal data/fax/voice modem with the brand name Ace for Indian Rs 750. At that time, I only had Windows 98 loaded on my machine; and the modem came with its own set of drivers for windows 98.

Recently, I decided to install the latest version of Linux. I got hold of Fedora core release 2 CDs having the latest kernel (2.6.5-1.358) and installed Linux on my machine to dual boot with windows 98. The installation went smoothly and within the hour, I was able to boot into the graphical Linux. But Linux was not able to detect my sound card (Aztec 2320 ISA) and my internal modem. I solved the sound card problem and was able to get the sound working smoothly, the details of which you can read here. Next I set out to find if there are any Linux specific drivers for my internal modem.

I googled for the same, giving the manufacturer's name but with no result. I also posted in Linux mailing lists; more specifically the Linux-India-Help mailing list.

I came to know that almost 95% of the internal modems are a striped down version of the external modems and are called winmodems because they work properly only on windows. These modems are not real modems as they depend on the software and the processor in your computer to do a part of its job. So finding a Linux driver for my internal modem depended on what kind of chipset it had. From the mailing list, I came to know that the site linmodems.technion.ac.il gave details on how to find out whether you can get your internal modem to work in Linux. I visited the site, and downloaded a Perl script called scanModem which helps you to detect the chipset of the modem; as the manufacturer's name didn't give much information.

I booted into Linux and executed the script. It probed the hardware and wrote its findings in a text file by name ModemData.txt. And it advised me to send this file as an attachment along with any query regarding my modem to discuss@linmodems.org mailing list.

I did as was suggested and within no time, I got the reply from them saying that my modem can indeed work in Fedora core 2. They told me that linuxant.com was providing a driver for my modem (which belongs to the Conexant (formerly Rockwell) HSF softmodem family). I visited their site and downloaded a zipped rpm of the driver ( hsfmodem-6.03.00lnxt04082400full_k2.6.5_1.358-1fdr.i686.rpm.zip ). They supplied precompiled version of their driver for fedora core 1 & 2 (rpm format) as well as for debian (deb format). You have to choose according to your distribution.

Then I booted into Linux and executed the following commands:

# unzip hsfmodem-6.03.00lnxt040....rpm.zip

# rpm -e hsfmodem....rpm
It installed with out any problem and created a device file named /dev/ttySHSF0 and created a soft link to /dev/modem.

Then I used kppp to set up my Internet connection. I found out that since this driver was a free version, it lets you connect at a max speed of only 14 kpbs (You have to pay $15 if you want the driver to be enabled to work at 56 kpbs speed); so you have to set the connection speed to something less than 14 kpbs if you want to browse the websites. Otherwise the modem will log in to your ISP but you will not be able to use the Internet. So I set the connection speed to 9600 in the kppp configuration dialog.

I also inserted two lines in the /etc/resolv.conf file as follows:

nameserver 215.123.12.12 #My ISP's Primary DNS server

nameserver 215.123.12.13 #Secondary DNS server
Having done this much,I was able to successfully connect to the net and browse.

Users who use Internet only to check their email and occasionally browse, can easily get by with the 14 kpbs speed. But if you are the kind who cannot do without chatting, downloading softwares and music files and heavy browsing; it is recommended that you pay them $15 and fully enable your modem driver. Or rather you should go for a broadband connection (via cable or DSL) which does not need any drivers.



My Machine Specifications

Celeron 333MHz, 98MB SDRAM @ 100MHz FSB,

440 LX Intel original motherboard,

12 GB HDD (2.1 GB Samsung HDD + 10 GB Segate HDD)

Aztec 2320 ISA sound card
Modem Specification

Rockwell International HSF 56k Data/Fax/Voice/Spkp (rev 01)

Class 0780: 127a:2015
Linux

Distribution : Red Hat Fedora Core release 2 (Tettnang)

Kernel : 2.6.5-1.358
Modem Driver Drawbacks

Max speed Limitation : 14 kpbs (for free version)

No Voice support available yet



Tuesday, 19 October 2004

Configuring Aztec 2320 chipset ISA sound card using ALSA

I have an old machine celeron 333MHz , 98 MB SDRAM 100MHz FSB, Intel 440LX motherboard and Aztec 2320 chipset ISA soundcard. Recently I installed Fedora core 2 with linux kernel 2.6 on my machine. The installation went quite smoothly other than a minor temporary glich that I couldn't move the mouse pointer while installing so had to navigate using the keyboard. But when I booted into linux after installation and tried playing a music file, It gave the error that no sound cards were detected. I know that my sound card is an Aztec 2320 based ISA card. So I went about finding out whether this sound card is supported by linux. I googled for the same, posted queries in linux mailing lists and visited comp.os.linux.hardware, alt.os.linux, alt.comp.linux newsgroups.

I found out that Alsa (Advanced Linux Sound Architecture) is a open standards group whose primary aim is to provide sound driver support for the sound cards in linux. And they are doing a commendable job. There is also another group called OSS (Open Sound System) which used to give sound support for linux. But because it had some limitations, it was not able to meet the demands of the linux community.And ALSA was able to meet those demands much better. From kernel 2.6 onwards ALSA support is compiled in the kernel by default. You can read more about it at alsa-project.org .

Coming back to my problem, I found out from their website (Thanks to Sishir Birmiwal - Ittiam Systems Ltd for pointing out this link) that Aztec 2320 is indeed supported by ALSA. The driver to be loaded is snd_azt2320.
So I logged in as 'root' and first executed the command to check if this module is loaded as follows:
# lsmod
This showed that the module is not loaded. Next I loaded the module as follows:
# modprobe snd_pcm_oss
# modprobe snd_azt2320
Then I did a lsmod and found that the module has successfully loaded. Also modprobe will load all other modules on which snd_azt2320 depends on. ie. it does a dependency check - so you don't have to worry about loading dependent modules. The module snd_pcm_oss is needed and had to be loaded seperatly because it didn't load otherwise.

For loading the snd_azt2320 module each time I boot my machine, I included the above lines in the /etc/rc.d/rc.local file. Though I wonder if there is a better way than that.

Then I included a few lines into my /etc/modules.conf file as given below.
# File: /etc/modules.conf
# ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-azt2320
# module options should go here

# OSS/Free portion
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0

# card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
The alsa website had suggested including a few more lines of code in the above file but It works for me with just the above lines. I guess you can include more lines of code if you have more than 1 sound card on your machine.

Alsa Mixer mutes all the channels by default. So you have to unmute and set channel values with a software mixer. I used alsamixer for the purpose but you may also use kmix for the same. Here I turned on the volume to max value, changed the PCM settings to max value and closed the program. Now I was able to hear the sound quite well.

Then I saved the settings using the command :
# alsactl store
The above command basically saves your alsa mixer settings to be retrieved for use later. Finally there was one more thing to do ie. retrieve the settings each time you reboot your machine. This I achieved by including the following line at the bottom of the /etc/rc.d/rc.local file.
# File: /etc/rc.d/rc.local file
alsactl restore
Now I optimised the alsa PCM plugins for use with alsa-aware applications. This is done in the .asoundrc file. This file has to reside in your $HOME directory. You may not have this file by default - in which case, you have to create it. My .asoundrc file contents are as follows:
// .asoundrc file
pcm.azt2320 {
type hw
card 0
}

ctl.azt2320 {
type hw
card 0
}

pcm.dsp0 {
type plug
slave.pcm "dmix"
}
In the .asoundrc file, I have included a section called pcm.dsp0 which is the dmix plugin. This is desirable as, only then will you be able to play multiple audio streams simultaneously (Which is impossible without dmix). If you don't include that section in your .asoundrc file, you will be able to hear sound from only one application at a time.

I also copied this file (.asoundrc) into my '/etc/skel' directory so that for each new user that is created, this file will be automatically copied into his/her $HOME directory.

Note: If you want to achieve some fancy stuff like adding a 5 sec delay to any of your audio streams, you may visit ladspa.org and use their plugins. You can also get a variety of plugins at plugin.org.uk . Remember, to use any plugins, you have to enter the necessary code in your .asoundrc file.

Even though the above steps are for the Aztec 2320 sound card, I believe they are valid for sound cards of any other make. Just replace snd_azt2320 module with the module of your respective sound card. Also don't forget to change the respective lines in the /etc/modules.conf file too.
Update : If you donot know the module of your sound card, you can get a clue if you browse the directories containing the modules. In Linux with kernel 2.4, the modules end with the extention '.o ' and in kernel 2.6 it is '.ko' . Just execute the following commands to check the sound modules you have on your machine:
find /lib/ -iname \*sound\*.ko
for kernel 2.6 and
find /lib/ -iname \*sound\*.o
for kernel 2.4 .