Home page of this blog

Showing posts with label ubuntu lucid. Show all posts
Showing posts with label ubuntu lucid. Show all posts

Saturday, September 11, 2010

Configuring rpmfusion kernel module for ASUS N13 Wifi USB adapter in Ubuntu Lucid

Recently I bought ASUS USB Wifi N adapter after seeing it had linux support.

The details of this adapter as printed by lsusb is as follows

Bus 001 Device 002: ID 0b05:1784 ASUSTek Computer, Inc.


I thought it will be detected straight away by Ubuntu when I plugged in. That was not the case. The model required rt3070sta kernel module. This I came to know from searching Ubuntu forums. The module is in staging and it is still rt2870sta and did not work.

Now that it did not work for me, I compiled the source code bundled in the CD and connected to my home router. But it was not the latest source code. So I went to ralink site and downloaded the source and compiled it. But the code had debug prints to log to systemlog and it kept filling syslog. oops

To my surprise Windows 7 pulled the driver from net, autoconfigured and no need to tell it is way ahead of the curve. Now back to Ubuntu

I wanted to get the latest rt3070sta driver source compiled for 2.6.35 kernel in Lucid, and I ended up in compilation errors. Then came an idea, that rpmfusion would have compiled the driver for 2.6.34 for Fedora 13 and 2.6.35 for Fedora 14 rawhide, so I went straight to rpmfusion website and downloaded the source code

Then I experimented patched driver source from rpmfusion.org in Ubuntu. And the experiment worked extremely well to my delight. There was no compilation errors, not with 2.6.32 or 2.6.35 kernel, wow, Fedora and its community rocks as always

There was no flooding debug prints, no unncessary tftpboot configuration, support for 2.6.34 kernel ... the signal was good and everything seemed to work well with the patched source code from rpmfusion.org



Here is the summary of what I did to configure the ASUS Wifi module step by step, as this may help someone


Step 1

Download rt3070-kmod src rpm from rpmfusion updates for Fedora 13, http://download1.rpmfusion.org/free/fedora/updates/13/SRPMS/repoview/index.html

http://download1.rpmfusion.org/free/fedora/updates/13/SRPMS/rt3070-kmod-2.3.0.2-1.fc13.5.src.rpm


Step 2

Install p7zip-full if it is not already installed, this is to extract the source rpm

sudo aptitude install p7zip-full


Step 3

Extract the source rpm, by right clicking the downloaded rpm





Step 4

Change to extracted directory and extract DPO_RT3070_LinuxSTA_V2.3.0.2_20100412.tar.bz2





Step 5

Copy all the patch files into the newly extracted directory

cp rt3070-*.patch DPO_RT3070_LinuxSTA_V2.3.0.2_20100412/




Step 6

Installing the patches

Change to extracted folder where the patches have been copied (see previous step 5)




Brief explanation of what the patches does

rt3070-2.6.34.patch --> To avoid errors when compiling with kernel version 2.6.34 and above (this is due to the function usb_buffer_alloc and usb_buffer_free is not there from 2.6.34 and changed to usb_alloc_coherent and usb_free_coherent)
rt3070-no2.4-in-kernelversion.patch --> This patch removes kernel 2.4 support from the makefile
rt3070-Makefile.x-fixes.patch --> Fixes makefile installation rule
rt3070-strip-tftpboot-copy.patch --> This patch removes configuring tftpboot while installing the driver
rt3070-suppress-flood.patch --> To avoid numerous debug logs. This patch comments out debug logs

Install the patches in the correct order as mentioned below

1.To apply rt3070-2.6.34.patch run the following command --> patch -p1 <rt3070-2.6.34.patch
2.To apply rt3070-no2.4-in-kernelversion.patch run the following command --> patch -p1 <rt3070-no2.4-in-kernelversion.patch
3.To apply rt3070-Makefile.x-fixes.patch run the following command --> patch -p1 <rt3070-makefile.x-fixes.patch
4.To apply rt3070-strip-tftpboot-copy.patch run the following command --> patch -p1 <rt3070-strip-tftpboot-copy.patch
5.To apply rt3070-suppress-flood.patch run the following command --> patch -p1 <rt3070-suppress-flood.patch






Step 7

To avoid possible conflict with 2870 driver

Run this command (just copy the following and paste in the command line)


for sta in common/rtmp_init.c include/rt_ate.h include/os/rt_linux.h README_STA* RT2870STACard.dat ; do
sed 's|RT2870STA|RT3070STA|g' $sta > tmp.sta
touch -r $sta tmp.sta
mv tmp.sta $sta
done










Step 8

Build the kernel module

CFLAGS="-march=native -O2" make -j8

change -j8 to -j2 if you have core2duo, and -j4 if you have quadcore






Step 9

Copy the data file after creating the data directory for the module

sudo mkdir -p /etc/Wireless/RT3070STA

sudo cp RT2870STA.dat /etc/Wireless/RT3070STA/RT3070STA.dat



Step 10

Insert the module into the running kernel after copying into some directory which is common to all users

sudo cp os/linux/rt3070sta.ko /usr/local/bin/rt3070sta-rpmfusion-lucid.ko

sudo insmod /usr/local/bin/rt3070sta-rpmfusion-lucid.ko

Now configure networkmanager to connect to whichever wireless accesspoint you want to join and save it

Step 11

To automatically detect your wireless driver from next boot, add the following line before last line to /etc/rc.local by editing it as root



Upon reboot, your network adapter should be autodetected and connected (if you configured network manager to do so)


Step 12

Whenever there is a new kernel or kernel change rebuild the module, by following above steps

Saturday, July 24, 2010

Breaking the mental barrier and installing latest softwares in linux distributions

When there is a release of my favorite software, it is easy for me to install in Windows. When firefox is released, I don't have to wait for another release of Ubuntu to get it running

I want my latest VLC, latest firefox, latest nvidia, latest software running in my current version of Ubuntu, Is it possible ?

Yes, there are three ways without waiting for next release of Ubuntu/openSUSE to get latest software

1. Install latest binary manually without using system's default package management tool synaptic/aptitude/apt/zypper/pacman ...

2. Download latest source and compile/run yourself

3. Install from a PPA (personal packaging archive) or community packages (for openSUSE) or AUR (here arch linux is rolling distribution and does not require waiting if it is not unusual software which is in main repository)

Obviously, it is the third way which is the most easiest and attractive

I am happily using the 3rd step and I am using the latest softwares I love.

To install VLC latest (1.1.1 as of now) from PPA, sudo add-apt-repository ppa:c-korn/vlc && sudo apt-get update and install vlc from synaptic

To install latest version of nvidia/ati/intel drivers PPA, sudo apt-add-repository ppa:ubuntu-x-swat/x-updates && sudo apt-get update and upgraded my graphics drivers (nvidia 256.35 I got now instead of old version which is there in default updates)

To install latest XBMC from PPA, sudo apt-add-repository ppa:team-xbmc && sudo apt-get update and installed xbmc from synaptic

The above are just some three softwares I am quoting here, there are another 30 thousand s/w in ubuntu PPA to be searched and to be installed in your computer. To know how to search PPA, follow this ubuntugeek article

http://www.ubuntugeek.com/where-to-search-ubuntu-personal-package-archives-ppa.html

To search for software in openSUSE is equally easy, go to the following link, type your favorite software name and install from there

http://software.opensuse.org/113/en

To search and install in archlinux, follow http://aur.archlinux.org/

and we can go one step further and even install next version of kernel

For e.g, to install 2.6.34 version of linux kernel in Ubuntu lucid http://usablesoftware.wordpress.com/2010/05/26/switch-to-a-newer-kernel-in-ubuntu-10-04/

If it is arch linux, I would have compiled it myself or used a pkgbuild script from AUR repository to get another kernel


Every part of GNU/Linux system can be modified at will, if we really want to do so, by breaking the mental barrier which is there only in name and in our mind as fear of the unknown


Saturday, May 8, 2010

Benchmark of Windows 7 vs Ubuntu comparision may be flawed under uneven environments

I read the following interesting benchmark between Windows 7 vs Ubuntu 10.04

http://www.phoronix.com/scan.php?page=article&item=linux_windows_part1&num=1

I agree, for games Windows 7 is one of the best, but still

The benchmarks may be  flawed due to the following assumptions which is not ideal setup for Ubuntu

Reasons

1. Compiz is enabled by default in Ubuntu, whereas the games in Windows disable Aero to gain that extra FPS. I doubt if the games in Ubuntu  disable compiz before running

2. Biggest flaw is cpufrequency is controlled by Ubuntu to run as ondemand instead of utilizing full processor power. The ideal Ubuntu Setup would be to run all the cores with cpufrequency governor performance. Windows 7 by default runs in full gear and kudos to it. But that does not answer this question, why the benchmarks were done when running ondemand governor in Ubuntu Lucid?

How do I assume cpufrequency has something to do with performance, well I will try to prove it ( though you may try for yourself by changing cpufrequency to run with different performance governors and check simple benchmarks)

I run three benchmarks on google-chrome when cpufrequency is running ondemand and ran the same when cpufrequency is performance (you can see the result visually)

First screenshot shows cpufrequency is 1.60 GHz though core i7 920 frequency is 2.66 GHz due to ondemand governor



See the line

 current CPU frequency is 1.60 GHz (asserted by call to hardware)


this is due to ondemand governor

Under ondemand governor (all 4 cores (8 threads of core i7) running under ondemand governor)

By default ubuntu runs with ondemand governor, but to change it manually use


for i in 0 1 2 3 4 5 6 7; do sudo cpufreq-set -c $i -g ondemand; done


here change 0 1 2 3 for quad core and 0 1 for core 2/atom

[Ubuntu by default does not have cpufrequtils installed, to install it click the link

cpufrequtils

or goto command line and install it using the following command

sudo apt-get install cpufrequtils

cpufrequtils provides the commands cpufreq-set and cpufreq-info]


Google v8 benchmark result  is 5622 (higher is better)
Sunspider benchmark score is 443.6 milliseconds (lower is better) Sunspider benchmark results detailed link
Peacekeeper benchmark score is 8129 (higher is better)

Images of results under ondemand governor

Google v8


Sunspider



Peacekeeper Browser Benchmark (rank and in detail)




Under performance governor (all 4 cores (8 threads of core i7) running under performance governor)


To change all cores to performance I used the following commandline


for i in 0 1 2 3 4 5 6 7; do sudo cpufreq-set -c $i -g performance; done

here change 0 1 2 3 for quad core and 0 1 for core 2/atom

Google v8 benchmark result  is 5641 (higher is better)
Sunspider benchmark score is 323.3 milliseconds (lower is better) Sunspider benchmark results detailed link
Servicemark peacekeeper browser benchmark score is 8365 (higher is better)


Images of results under performance governor

Google v8


Sunspider




Peacekeeper Browser Benchmark (rank and in detail)




Here are charts I created for easy viewing of the comparision when running in ondemand and performance






3. By default gnome/Ubuntu is bent towards power saving like spinning down hard disk and cpu frequency, whereas windows 7 professional is geared towards performance

4. The kernel used by Ubuntu 64 bit is a fancy 100 Hz kernel which is unsuitable for any game with high frame rate. Why not use a different kernel suitable for game? Maybe it should have used preempt kernel which is 1000 Hz with kernel preemption or an rt kernel(http://packages.ubuntu.com/lucid/linux-image-2.6.32-21-preempt) linux-preempt

Ask any gamer, he would undergo the pain to recompile kernel even above 1000Hz for getting high FPS and he would not use a 100 Hz kernel

Monday, April 12, 2010

Installing and running nvidia inside Ubuntu Lucid

Recent Ubuntu Lucid uses nouveau driver for nvidia cards. The driver is a reverse engineered graphics driver and it still has some bugs (like making the screen freeze with a display corruption, after which nothing except reboot works)

This is how I started Ubuntu in vesa mode and installed nvidia proprietary driver

1. Boot in vesa mode instead of nouveau

To start Ubuntu in vesa mode instead of nouveau, add the following to boot menu

nouveau.blacklist=true xvesa


If the above combination did not work try

nouveau.blacklist=true rdblacklist=nouveau


even if the above two failed and you want to give another try, use the following boot param

nouveau.blacklist=true rdblacklist=nouveau xvesa


You can also try nomodeset along with any of  the above combinations if nouveau is arrogant and loading to irk you. It may work

2a. Easy Way to enable nvidia drivers in Ubuntu


2a.1 Install nvidia proprietary drivers from Ubuntu repositories


Enable universe and multiverse repository inside synaptic. Then reload and close synaptic

Goto System --> Administration --> Hardware drivers --> Choose the recommended nvidia proprietary driver and enable it


If this did not work properly, go the following command line way


2b. Command Line Way to nvidia drivers

2b.1 Command line way to install nvidia proprietary drivers

Now from command line

sudo apt-get install nvidia-current nvidia-settings nvidia-common nvidia-current-modaliases


3a Easy Way to restart X server to enable nvidia

3a.1 Enable Ctrl + Alt + Backspace and restart X server


Goto System --> Preferences --> Keyboard --> Layouts --> Options --> Expand Key sequence to kill X server --> Check Ctrl + Alt + Backspace




And restart X by pressing Control, Alt and Backspace simultaneously

Give your login credentials and your nvidia card driver should be in full swing when you login back

If this does not work for you, try the command line way below

3b Command Line Way to restart X server to enable nvidia

3b.1 Stop GDM

Press Ctrl + Alt + F1 and stop gdm by using sudo service gdm stop

3b.2 Insert nvidia kernel module

Ubuntu has changed the module name from nvidia to nvidia-current, due to which I struggled for half an hour, until I went into dkms directory to figure out the actual name of the module. From the command line in virtual console 1 use the following command to insert nvidia driver into kernel

sudo modprobe nvidia-current



Please use nvidia kernel driver instead of nvidia-current as Ubuntu Lucid release changed it back to nvidia from nvidia-current


sudo modprobe nvidia

3b.3 Configure X server using nvidia-xconfig



I tried again and without calling nvidia-xconfig, nvidia drivers are not working! {May work for you though :) }



sudo nvidia-xconfig

3b.4 Start GDM

From the command line in virtual console 1

sudo service gdm start

and you should be inside gdm with nvidia driver in full swing. If you followed this guide and running with nvidia driver, then a Congrats to you

Here are two screenshots showing nvidia-settings



glxgears is away until after installing mesa-utils

Running prerelease 64bit flashplayer in Ubuntu Lucid

By default Ubuntu Lucid offers to install 32 bit flash player in a 64 bit system. This is fine, but it installs all the 32 bit compatible libraries along with it. Below screenshot shows the offered 32 bit libs by ubuntu for installing flashplayer


The prerelease version of 64 bit flash player is fine and does not require 32 bit libraries to run in linux. Here is the URL for downloading 64bit flashplayer from Adobe site

http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz






To install it, we need to extract the .so and copy it into /usr/lib/mozilla/plugins/

Step by step

1. Extract flashplugin from the downloaded tarball

tar xvzf libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz

2. Copy into plugins folder to install it

sudo cp libflashplayer.so /usr/lib/mozilla/plugins/

Below you can see both the above commands one by one in action



After this restart firefox and you can see 64bit flash player in action


Saturday, March 20, 2010

5 tips to make ubuntu lucid beta really lucid

1. Disable nouveau driver from loading
while booting into ubuntu press tab and add the following text to disable nouveau

 nouveau.blacklist=true

This will disable the nouveau driver from getting loaded. nouveau driver when booting into ubuntu corrupts display and the session becomes unusable with a hang. This option will force ubuntu to avoid loading buggy nouveau driver

2. Minimize, Maximize and Close buttons on right of titlebar

To move the titlebar icons  minimize, maximize and close buttons to right

gconftool-2 --set /apps/metacity/general/button_layout --type string :minimize,maximize,close   



If you want to do it graphically, rather than command line, launch gconf-editor (from quick launch by pressing Alt +F2) and search for metacity then edit the textbox button_layout under general to have value :minimize,maximize,close



for more see

http://www.ubuntugeek.com/quick-and-easy-title-bar-button-side-switching-in-ubuntu-10-04-lucid9-10-karmic.html

3. Control Alt Backspace to kill X server

To enable ctrl + alt + backspace to restart X server, goto System --> Preferences --> Keyboard --> Layouts --> Options --> Key sequence to kill the X server and tick the checkbox

Control + Alt + Backspace

After this pressing Control + Alt + Backspace will restart X server




for more see

http://www.ubuntugeek.com/how-to-enabledisable-ctrlaltbackspace-in-ubuntu-9-10-karmic.html

4. Enable icons in menus

To enable icons in menus,

gconftool-2 --set /desktop/gnome/interface/menus_have_icons --type boolean True

See the icons in the context menu in desktop below after enabling menus


5. Disable update notifier from popping on your face

gconftool-2 --set /apps/update-notifier/auto_launch --type boolean False







Here ends the tips, the following are some general screenshots under Ubuntu Lucid beta after customizations from above tips







Screenshot of nautilus with Ubuntu ambiance theme

Screenshot of nvidia-settings after enabling nvidia from Hardware Drivers and pressing control + alt + backspace to restart X server (to enable control + alt + backspace to restart X server, see 3rd tip above)



After restarting X, the user name in live session is ubuntu and password is blank password

Enjoy Ubuntu Lucid though it is in beta now

:)