Home page of this blog

Friday, December 21, 2012

Unlock Xperia S bootloader from Ubuntu 12.04

Introduction


I tried to unlock bootloader from Windows 8 and in vain. Windows 8 installed some drivers for fastboot and never allowed an option

Now it became interesting, I came to my Ubuntu system and started exploring



After getting the unlock key from sonymobile, I tried in Windows 8. It did not work, then came to Ubuntu 12.04 and it worked happily.

To get the unlock key for your Xperia S (or some other xperia mobile) follow upto 7 steps

http://unlockbootloader.sonymobile.com/instructions

From 8th step, instructions for applying the unlock key to unlock your phone in Windows, but no explanation of how it is done in Ubuntu. So here I explain what I tried and what worked

Before going into what I am talking, see my earlier article on how to install Flashtool in Ubuntu 12.04

and come here. In brief, download flashtool, extract. Have ia32-libs installed and have udev rules 

SUBSYSTEM=="usb", ACTION=="add", SYSFS{idVendor}=="0fce", SYSFS{idProduct}=="*", MODE="0777"

Using Fastboot from Ubuntu to Unlock 


After extracting Flashtool, go into flashtool folder from file browser, it should look like



Double click x10flasher_lib which should take you inside x10flasher_lib folder. 

[[[Note if you don't have open in terminal, proceed after ending square brackets if you already have this or if you use Linux Mint

If you do not have Open in Terminal install it from command line using 

sudo apt-get install nautilus-open-terminal

Logout and login again to enable nautilus open terminal. If you have Linux Mint, this is already installed and enabled and you do not need to do this!!]]]

Now from inside x10flasher_lib right click blank space and select Open in Terminal





You should be inside x10flasher_lib in command line. 

Become root (this is very important)

sudo su



Backup your phone data (contacts, sms, images, songs ...), switch off phone

Entering your phone into fastboot mode 


Step 1:

After switching off, Connect one end of your usb cable to phone and do not plug other end of usb cable to your PC/Laptop

Step 2: 

Press and hold Volume up button and plug other end of usb cable into your ubuntu system (Your phone led should glow in blue color)

Step 3: 

From inside x10flasher_lib directory as root, execute the following command to test the version

            ./fastboot.linux -i 0x0fce getvar version


You can see from the above screenshot, fastboot.linux displays version as 0.5. It means we are good to go and unlock the phone

Step 4:

To unlock your phone (fingers crossed), do this (paste the unlock key you got from email after 0x)

          ./fastboot.linux -i 0x0fce oem unlock 0x

It should unlock, now unplug usb cable and switch on your phone.

Step 5:

Happily install recovery and install custom ROM of your choice, 

for e.g, I tried this combination and it worked!

Install Advanced Stock Kernel and install XTXperience 7



For installing custom kernel, you can run Flashtool in fastboot mode




From here, it is fairly straightforward, flash the kernel using "Select Kernel to Flash" button

If you flash Advanced Stock Kernel, it will be prerooted and have recovery installed. Custom rom can be installed from recovery

Saturday, December 8, 2012

Paradigm shift

I have upgraded windows 8 release preview to Windows 8 Pro in one system

Till now I was not open to this sort of ideas, but it is mind-blowing

It is a paradigm shift, kudos Windows 8

It is not the speed which is different from other OS, it is the way we operate with apps which makes it look like a science fic movie, I am not joking, it is more true, the bigger your monitor is!

Say for e.g, I search something in search engine, 10 results are displayed in a screen and page numbers for moving to next page, and I scroll down to bottom click next or the page number

Now see how the same thing in Bing app in windows 8, it displays all results continuous, just a scroll of mouse moves result after result from right to right, the more you scroll the more results all flowing from left to right, shocking you with deluge of data, truly looks like a science fic movie.


Just a tap on images and lakhs of images just to be seen on your mouse scroll

There is no distraction, the more you a concentrated guy, the more you will get immersed in your task completely
 
 




Then another eye opener, panorama in Places app, wow

No amount of seeing the tiles screenshot can justify the beauty of Windows 8, it is to be experienced, period.


After using fullscreen apps and coming to desktop makes me think why are apps so small!

It is marketing guys who try to stop you from using and getting this science fic feel of UI, break your mind barrier and openly approach Windows 8 and you are there for a pleasant shock

Tuesday, December 4, 2012

After 2 months of slackware 14 use


This blog is in praise of Slackware 14

These are my views

Slackware 14 is one of the most powerful operating systems

After 2 months of use, I am finding slackware 14 to be still awesome. It still has lots of surprises

I have not seen a single crash all this long, how did they do it (After I wrote this blog post, Amarok crashed, oops ... updating blog)

Throw whatever load at it and it handles as if it is nothing. Even I moved harddisk to a new motherboard and there it ran without questions

It is super fast, I have not compiled kernel, but I can tell no kernel compilation can bring this much speed

The same system when I am running other distributions seems to take loads of time to even launch apps, this one blows the speed competition away

Slackware 14 is a beast and can handle very powerful systems/hardware with super ease!

So I am thinking of installing this linux in my main computer and push ubuntu into virtualbox, :)

Saturday, November 24, 2012

KDE over ssh

OMG

OMG, unbelievable

I am stunned, KDE is running over ssh

See the below screenshot

You can see ubuntu's violet terminals, ubuntu's global menu (close button on the left), Slackware 14 taskbar at the bottom, Ubuntu dashbar towards the left, Kinfocenter of KDE running from slackware, gnome system monitor of ubuntu running, KDE system settings running

Wondering, how it is possible? read ahead


Slackware KDE menu, ubuntu dash bar, KDE desktop

Slackware 14's firefox running in the right, Ubuntu's firefox running in the left, though KDE is running via ssh, it is surprising, titlebar, action bar (close, minimize and maximize) are using native ubuntu's


Another thing very surprising is, KDE over ssh using my powerful PC with nvidia card as x server and able to do 3d graphical effects!! whereas when I directly connect KDE slackware to monitor, it does not

 I love linux, :)

I recently assembled a low powered i3 system (just processor and a motherboard), swapped 4 GB from my old system(old system with i7 920 got 12 GB RAM upgrade) into new motherboard.

Removed a 500 GB hard disk from old system and swapped it to new system

OMG, slackware harddisk just booted into the new system

Now, I am having a single monitor so wanted to use both systems and don't want to keep swapping hdmi cables between two systems,

So here is what I experimented

To understand this see the following two important things on the setup (consider this assumptions applicable for my setup, which will vary with yours)

1. Slackware 14 on i3 3220 box is a headless ssh server (headless means no monitor, keyboard or mouse is connected) connected to home router through LAN cable with an ip address 192.168.1.5

2. Ubuntu 12.04 on i7 920 is a ssh client but has full fledged monitor, keyboard and mouse connected to it (as my Ubuntu box has nvidia GTX 460 card, it can handle tremendous GUI load), this box  is also connected to home router through LAN cable with an ip address 192.168.1.6


SSH Server Setup for X Forwarding

Now to enable X over ssh, this needs to be done in the ssh server which is slackware 14 box

Booted slackware 14 box, (while installing slackware I had enabled ssh). After that I opened  /etc/ssh/sshd_config

and changed X11Forwarding to yes from no and uncommented it


To do this, as a super user in slackware, where the ssh server is running I did this

vi /etc/ssh/sshd_config


 X11Forwarding yes

it should look like this



Then rebooted slackware 14 box


Testing X on SSH Client 

My ssh client is  ubuntu box.

To connect to ssh server I opened terminal and used ssh, gave my slackware credentials

ssh -X sankaran@192.168.1.5

You can see from the above, there is a capital X option after ssh, which indicates X to be forwarded/tunneled through ssh connection (ssh is considered secure)

192.168.1.5 is the ssh server which is my slackware 14 box

sankaran is the username in slackware 14 box

to check if the display is set correctly, tested this

echo $DISPLAY

it displayed


localhost:10.0


Now I ran xterm to check if X is forwarded properly

xterm

You can see from the below screenshot, how xterm is launched from slackware but its output got displayed in Ubuntu

Also observe the titlebar with left side close button, minimize button and maximize button


To show the difference between ssh session, I have given uname -a

you can see all these from below screenshot


Running KDE from inside ssh session

now that I showed how the ssh client and ssh server are configured and tested, it is time to put it to test

Just give startkde in ssh session, wow , wow, OMG

it runs a full fledged kde, unbelievable, isn't it

startkde

see the screenshots

KDE is starting from inside ssh session


See the kde taskbar at the bottom with kde icons and ubuntu dash icons in the left, omg


To show how KDE differs, I just clicked the folder applet and took the following screenshot


Observe network manager is showing a red colored x button in kde, who cares, as slackware is already connected to LAN and WAN, :)

To speed up things, we can do the following while doing ssh connection

ssh -XC -c blowfish sankaran@192.168.1.5

in the above C means compression is used while transfering data over LAN

-c blowfish tells the compression to use blowfish which is according to ssh manual a fast cipher for compression

All done, now slackware 14 does not have pulseaudio installed. I did not get any audio over ssh, though I guess if pulseaudio is installed it could piggyback audio through ssh

which means the audio through ssh will be my next experiment

Conclusion

One good thing about slackware 14 is it is an extremely powerful distribution, born to be a server (indeed a king of servers),

you may think,

Is Ubuntu or any other distribution can't do this?,
it can, but they launch desktop environment as soon as you boot, Ubuntu uses network manager to configure dhcp negotiation which works only after logging into gui.

All this means, I need to install Ubuntu server, which is a double work for me and I dont want to leave slackware anytime(fanboy, yes,  common, I am a  diehard slackware fan )

So so, Slackware 14, this flexible god of distributions does what you say, nothing less, nothing more, it exactly runs what you want. Just that

Whereas Ubuntu as a gui distribution helps my lazy mentality (LOL), now when the king of server distribution is plugged to Ubuntu client via ssh x forwarding, it is wonderful indeed

(Fedora, opensuse ... all these runs into gui ... so either ubuntu server or slackware 14 acts as a perfect headless box, slackware 14 has edge, it runs gui beautifully, as and when you want it to)

Reader of this blog, Hope you liked my exciting experiment

Enjoy

My slackware desktop screenshot



I put beach sand photo taken by phone as wallpaper for my slackware box, as it looked lovely

If you would like to get such photos and think it fits good enough to be a wallpaper for your desktop, go ahead

download from here

https://plus.google.com/u/0/photos/106224123724317246178/albums/5814357202337737873


Thursday, November 22, 2012

Custom Ubuntu 64 bit Kernel 3.6.7 optimized for i3/i5/i7


This time my experiment is bit different, interesting and ambitious!

I upgraded my i7 RAM to 12 GB (Corsair Vengence 4 GB X 3) and running in triple channel mode (will tell what I did to the old RAM in another story :) )

I ran the kernel compilation in RAM mounted directory so that none of the files are read/written from/to harddisk while doing intensive kernel compilation. Infact processor scaled so well that kernel compilation took just under 19 mins which used to be 25 mins with harddisk. The real advantage is not the speed, but avoiding lots of read/writes to harddisk

To achieve this, I used tmpfs

The built script to build kernel 3.6.7 and utilize 10 GB of RAM for compilation is here

Use the above script only if you have above 10 GB of RAM

If you have less RAM use the script here

First, I created a directory and mounted that as a tmpfs. I gave a size of 10 GB RAM max for the newly mounted tmpfs.

The commands I used to create a directory and mount tmpfs is as follows

mkdir -p ~/BuildTmp
sudo mount -t tmpfs -o size=10G tmpfs ~/BuildTmp



To check the disk file size and monitor how the tmpfs is filling up, I used df -k

df -k


Calling df -k at various points of kernel compilation



 Towards the end of kernel compilation df -k reports 79 percent of 10 GB tmpfs, which is nearly 7.9 GB of RAM used!!



See the compilation time, not much gain in speed but small gain is a gain (a gain of 6 minutes)



Copying the compiled kernel debian files to harddisk






Installing the built kernel files


Unmounting tmpfs before rebooting

sudo umount ~/BuildTmp




Installing nvidia drivers for the newly built kernel, I downloaded 310.19 driver from nvidia.co.in




Here is a video of how I built nvidia kernel module using recovery kernel, (video is shot using my phone and I am not a professional photographer, it is just for learning purpose I uploaded this video to youtube)


or



It is simple, reboot and select recovery kernel, install nvidia driver using nvidia provided shell script, reboot into normal kernel

Here are the photographs explaining the same which was shown in video. (sorry for poor images with photo flash)


Select recovery kernel (second one usually in the boot loader screen)


 Booting into recovery...

Scroll down and select root Drop to root shell prompt

mount root filesystem read/write (and mount home if you have a separate home system) as root in recovery is mounted read only

mount -o remount,rw /
mount /home

Change to home directory where the nvidia driver is downloaded

run the driver using sh (replace the below file with whatever the driver filename using tab, :) )

sh ./NVIDIA-Linux-x86_64-310.19.run

Let nvidia installer launch

Accept nvidia license termns

Opt to uninstall previous drivers

Continue installation anyway? yes (Sorry it is blurred ...)

Register for dkms (what, no I say)

And that is it, rest by the installer ...

Install 32 bit compatibility openGL libs? yes of course


Let it run its way (won't you)

run nvidia-xconfig, yes man, yes, do it

Ah, give ok

cd
sync
unmount /home
mount -o remount,ro /
reboot

Unmount home and remount root read only, then reboot

From the boot loader, select the regular kernel (the first one, second is usually recovery kernel)


Now you should be into the gui with nice nvidia drivers, enjoy


Sunday, October 14, 2012

Build script for kernel 3.6.2 optimized native for Ubuntu

Here is the script to build ubuntu (debian) packages optimized for the native processor

https://docs.google.com/open?id=0B_nTbpzPbbNJU0h1RzFLMG1lR2s


The following tries to dissect the script and how it works

Build dependencies

The portion below is used to install build environment in ubuntu, if the following are already installed, script just does not install it again(thanks to apt)



sudo apt-get install fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge libncurses5 binutils-dev libelf-dev libdw-dev libnewt-dev libncurses5-dev

sudo apt-get install flex

sudo apt-get install bison

sudo apt-get  --no-install-recommends install asciidoc xmlto


Downloading kernel source and patching it with ubuntu patches to build ubuntu package



mkdir -p ~/Builds/Kernel362 
cd ~/Builds/Kernel362 


wget -c http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.6.2.tar.bz2
wget -c http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6.2-quantal/0001-base-packaging.patch
wget -c http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6.2-quantal/0002-debian-changelog.patch
wget -c http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6.2-quantal/0003-default-configs.patch

rm -rf linux-3.6.2
rm -rf linux

tar xvjf linux-3.6.2.tar.bz2
ln -s linux-3.6.2 linux

cd linux

patch -p1 < ../0001-base-packaging.patch 
patch -p1 < ../0002-debian-changelog.patch 
patch -p1 < ../0003-default-configs.patch




Creating new flavor and giving execute permissions to debian build scripts



chmod -Rv +x debian/rules

chmod -Rv +x debian/scripts/

cp debian.master/config/amd64/config.flavour.generic debian.master/config/amd64/config.flavour.native

fakeroot debian/rules clean
fakeroot debian/rules updateconfigs




Changing kernel config based on stable config



#copy existing config from rock stable 12.04 kernel using uname -r, do not save it in .config, as this file is heavily modified when calling editconfigs
cp /boot/config-`uname -r` stableconfig
#cp /boot/config-3.2.0-31-generic stableconfig

#give y to native config
#Load alternate config and choose stableconfig which is untouched by editconfigs, save alternate config and save .config after changing processor type and kernel frequency
fakeroot debian/rules editconfigs





This step needs a bit more explanation on how to base kernel config based on stable config, to do this I just put screenshots explaining briefly how this is done

When the script is running and comes to asking if we want to edit config, choose Y for native flavor

see below (I am giving n for every other flavor)


When the kernel config screen comes, scroll down and select Load an Alternate Configuration File


In the dialog, erase .config using backspace and type stableconfig



Following screens show, that I change processor type and kernel frequency, the old and new

Processor type old

Processor type new



Kernel frequency old


Kernel frequency new


After finishing all configuration changes, do not just exit!

Scroll down to Save an Alternation Configuration File


In the popped up dialog, erase stableconfig and type .config


Now choose exit in the main configuration screen


ABI  entries for new flavor and makefile changes



ABI_DIR=`ls debian.master/abi/`

cp debian.master/abi/$ABI_DIR/amd64/generic debian.master/abi/$ABI_DIR/amd64/native
cp debian.master/abi/$ABI_DIR/amd64/generic.modules debian.master/abi/$ABI_DIR/amd64/native.modules

sed -i s/getall\ amd64\ generic/getall\ amd64\ generic\ native/g debian.master/etc/getabis
grep native debian.master/etc/getabis

sed -i s/\=\ generic/\=\ generic\ native/g debian.master/rules.d/amd64.mk
grep native debian.master/rules.d/amd64.mk

cp debian.master/control.d/vars.generic debian.master/control.d/vars.native
sed -i s/\"Generic\"/\"core\ native\"/g debian.master/control.d/vars.native
grep native debian.master/control.d/vars.native


sed -i s/\=\ gcc/\=\ gcc\ \-march\=native\ \-pipe/g Makefile
sed -i s/\=\ g++/\=\ g++\ \-march\=native\ \-pipe/g Makefile
grep "march=native" Makefile


sed -i s/core2/native/g arch/x86/Makefile
sed -i s/core2/native/g arch/x86/Makefile_32.cpu
grep native arch/x86/Makefile_32.cpu
grep native arch/x86/Makefile





you can see above, I have given march=native you can choose whichever is your processor architecture

Building headers and kernel flavor



fakeroot debian/rules clean
skipabi=true skipmodule=true fakeroot debian/rules binary-headers
time skipabi=true skipmodule=true no_dumpfile=yes fakeroot debian/rules binary-native

The above builds kernel headers and kernel image for our new flavor

Just install the newly built packages using 

sudo dpkg -i *.deb






Core i7 optimized Ubuntu Kernel 

Kernel Headers All
Kernel Header corei7
Kernel Image


SHA256SUMS of the above in order


537e87a7c3200aab82624810526d25031ffd5093f406b32bc0f2e053e6213477  linux-headers-3.6.2-030602_3.6.2-030602.201210121823_all.deb

adf8fc79df2974622762f7e7ff84b8804f0b91f4927a70e3115d6326a2872bc2  linux-headers-3.6.2-030602-corei7_3.6.2-030602.201210121823_amd64.deb

001b05ffd6377b1f18d58704f850128f6b73525a9fb5c2744c30583b84b639e0  linux-image-3.6.2-030602-corei7_3.6.2-030602.201210121823_amd64.deb