5,601,062 Members 46,000 Now Online
XDA Developers Android and Mobile Development Forum

[HOW TO] linux native in sbk2 devices, purelinux and pseudo-dualboot methods

Tip us?
 
shaola
Old
(Last edited by shaola; 13th March 2012 at 10:50 AM.)
#1  
shaola's Avatar
Senior Member - OP
Thanks Meter 61
Posts: 156
Join Date: Dec 2010
Default [HOW TO] linux native in sbk2 devices, purelinux and pseudo-dualboot methods

This is a guide for installing and running natively any linux distribution on tf101 devices with sbk2 bootloader, but with some tweeks it would work also in tfp devices.


What is needed? you will need a rooted device with cwm recovery installed microsd for purelinux and a good microsd is recommended for one of the pseudo-dualboot options.
This guide is also prepared to execute all the commands in a computer running linux and with adb prepared to work, but you can also do it in windows, just google a bit for abootimg, blobpack and adb.

The binarys provided are precompiled for x86 system.

I am going to use as example ubuntu but you can install any linux distibution making some tweaks that i am not going to explain in this thread because i already opened another one explaining this.

DISCLAIMER: This is as safe as flashing custom roms (even a little bit less) you will always have a risk to brick your devices, I have a sbk1 device and in all my tests i haven't brick my device but i have the option of use nvflash so use it at your own risk

There are two basic options, running purelinux and pseudo-dualboot, and this last one has different variants.


Purelinux
YES: you will have the option to go to stock with cwm recovery

This will install ubuntu in the internal ssd in the data partition wich in tf101 is /dev/block/mmcblk0p7

With this method you will lose all the data in your android rom so make backups if necesary.

First of all we have to prepare the boot.img with the kernel and initrd, for that we will need abootimg, and a kernel already compiled, you either can compile your own kernel following lilsteive's, wiki instructions or use the one in OLIFE script. The initrd needed it's a bit diferent from OLIFE's one so i will attach the files needed at the end of this post.

We have kernel image: 2636-zImage
We have initd: initrd.img
and we need a boot.cfg file with this inside:

Code:
bootsize = 0x800000
pagesize = 0x800
kerneladdr = 0x10008000
ramdiskaddr = 0x11000000
secondaddr = 0x10f00000
tagsaddr = 0x10000100
name = 
cmdline = nvmem=128M@384M mem=1024M@0M vmalloc=128M gpt video=tegrafb console=tty0 usbcore.oldscheme_first=1 lp0_vec=8192@0x1fbed000 root=/dev/mmcblk0p7 ro quiet splash
Now we can build boot.img with abootimg with this command.

Code:
./abootimg-i686 --create boot.img -f boot.cfg -k 2636-zImage -r initrd.img
Now we have created boot.img wich is ready to blobpack. It's VERY important to blobpack it to LNX partition to not overwrite cwm recovery.

Code:
./blobpack kernelblob LNX boot.img
Now we have kernelblob file and ubuntu.img. This is al we need to flash our device, but we can use a zip file suitable for cwm to flash the kernelblob. I will explain later in the pseudo-dualboot options.

So now we place those files in a microsdcard and we reboot into cwm.

Once in there we have to get a shell trough adb

In some version of cwm you cannot see microsd but you see the sdcard, in that case you will have to manually mount the microsd.

I don't remember right now if in cwm shell you are already root or not, but if not just su to gain permissions.

Now this is the most risky part we have to dd the kernel blob to the correct partition, in this case is /dev/block/mmcblk0p4. As i said before we can flash the kernel blob also through a zip file.

assuming we are in the folder where both files are:

Code:
dd if=kernelblob of=/dev/block/mmcblk0p4
and now we flash ubuntu.img over data partition, but we have to be sure is unmounted, depending wich version of cwm recovery you may need to do it manually

the command mount will show you if is mounted or not and if it is, umount it

Code:
umount /dev/block/mmcblkop7
and then dd

Code:
dd if=ubuntu.img of=/dev/block/mmcblk0p7
This will take some time, so be patient.

And that's it, just reboot and go through oem instalation procedure and you have it.

To go back to android you will only need to boot into cwm wipe everything to avoid problems reboot again into cwm and flash any rom wanted.

With the last cwm version i had some trouble accesing to sdcard or microsd so i needed to delete a symbolik link (/sdcard was a symbolik link to /media/data and i don't know why) and create /sdcard folder, mount /dev/block/mmcblk0p7 over sdcard create a microsd folder and mount microsd manually over that folder.

Pseudo-dualboot
We have two options here, we can install over a microsdcard or put the image file in the internal sdcard.
If you have a good 10 class microsd for me that's the best option if not, it will be much slower than the other option.

Pseudo-dualboot over microsd

The process here is almost the same than in pure linux, the diference is only that in the boot.cfg file rootfs parameter will be diferent partition:
Code:
bootsize = 0x800000
pagesize = 0x800
kerneladdr = 0x10008000
ramdiskaddr = 0x11000000
secondaddr = 0x10f00000
tagsaddr = 0x10000100
name = 
cmdline = nvmem=128M@384M mem=1024M@0M vmalloc=128M gpt video=tegrafb console=tty0 usbcore.oldscheme_first=1 lp0_vec=8192@0x1fbed000 root=/dev/mmcblk1p1 ro quiet splash
instead of /dev/mmcblk0p7 (wich is data partition of the internal sdcard) it will be /dev/mmcblk1p1 wich is the microsdcard)

and instead of dd-ing ubuntu.img over internal sdcard we will dd to the microsd, we can do this also in cwm recovery or in a computer with sdcard reader.

As i think it's less risky to dd things in your computer instead in cwm and you will need an ubuntu.zip and android.zip to change your operating system flashing the kernel trough cwm i've attached Ubuntu.zip to do that. It's already prepared for microsd instalation.

If you compile the latest kernel (wich have some patches like the sound working) or you want to use it to purelinux instalation just do all the abootimg and blobpack proces and open ubuntu.zip and delete kernelblob and add your own one.

You will also need an android.zip file with the android kernel you prefer to choose again android system to boot.

I think it is aslo posible to do this with a pendrive is you have a dock, but i haven't tested it and i don't know if the kernel reads the usb devices soon enough to mount rootfs.

If you want to try, just boot linux, see wich device in /dev/ is asigned to the usb and place the correct device in root=/dev/XXXX in the boot.cfg

Pseudo-dualboot with loopmounted image placed in the internalsd

Just place ubuntu.img in the internal sdcard and flash ubuntu-mountloop.zip to boot into ubuntu and flash android.zip to boot into android.

There still are a couple of fixes to do, but i have no time right now and i am not using this configuration because i have sbk1 device so i won't be able to test and develop this but i will be glad to answer the questions i am able to.

I've also added the latest kernel and modules compiled from git but i haven't test them.



abootimg, blobpack and blobunpack files:
http://dl.dropbox.com/u/60048492/tra...s-abootimg.zip

ubuntu asus kernel (the OLIFE one, the git kernel has some fixes as sound enabling), initrd and boot.cfg
http://dl.dropbox.com/u/60048492/tra...d-boot.cfg.zip

Unbutu-sdcard.zip (with kernelblob prepared for microsd installation)
http://dl.dropbox.com/u/60048492/tra...ntu-sdcard.zip

Android.zip (with revolver 3.1 default kernel)
http://dl.dropbox.com/u/60048492/tra...er/Android.zip

Ubuntu-mountloop.zip for pseudo-dual boot with ubuntu.img placed in the internal sdcard
http://dl.dropbox.com/u/60048492/tra...-mountloop.zip

Latest git kernel and modules precompiled
http://dl.dropbox.com/u/60048492/tra...s-from-git.zip

Thanks to rdnetto, Jhinta and of course lilstevie
The Following 20 Users Say Thank You to shaola For This Useful Post: [ Click to Expand ]
 
outpox
Old
#2  
Member
Thanks Meter 4
Posts: 43
Join Date: Nov 2010
Location: France
Awesome! Waiting for the dualboot
 
jozka.1
Old
(Last edited by jozka.1; 6th June 2012 at 02:53 PM.)
#3  
jozka.1's Avatar
Senior Member
Thanks Meter 91
Posts: 214
Join Date: Apr 2011
How To - Step by step

A few notes:
  • pseudo-dualboot over external microsd >> deletes all data on your external microsd card, but doesn't delete files on internal storage
  • pseudo-dualboot with loopmounted image placed in the internal storage >> doesn't delete files on internel storage (internal microsd)
  • how to resize img file (this you don't do in Ubuntu in TF):
    Code:
    dd if=/dev/zero bs=1G count=1 >> ubuntu.img
    e2fsck -f ubuntu.img
    resize2fs ubuntu.img
    bs=1G >> how much large, new size is 3GB
  • mount data from Android in Ubuntu:
    Code:
    mkdir ~/Android/; mount /dev/block/mmcblk0p7 ~/Android/
    after you find data in your home directory in folder Android

I recommend use the last CWM > http://forum.xda-developers.com/show....php?t=1213723 you need option flash package from internal storage

For work all components follow here: http://forum.xda-developers.com/show...postcount=1973 and http://forum.xda-developers.com/show...postcount=2048
You don't must nothing compile only apply change!




Dualboot with loopmounted image placed in the internal storage (I recommend, it is faster and smoother than sdcard version)

1. download http://lilstevie.geek.nz/ports/ubuntu.img.gz and extract ubuntu.img from .gz package to internal storage on /sdcard/
(second mirror > http://www.ulozto.net/xyFaPBA/ubuntu-img-gz)

2. download http://www.mediafire.com/?7f5fpatmgmg01ha and place to internal storage on /sdcard/

3. download from http://www.mediafire.com/?labcx60jowrdx one package for back to Android(by the ROM you use) and place to internal storage on /sdcard/ *

4. reboot into CWM recovery and flash the package Ubuntu.zip from 2. point

5. reboot and you booting to Ubuntu

6. you must add to /lib/modules/ this > http://www.2shared.com/file/843Sq6-J/3110tar.html

Code:
mkdir 3.1.10; tar -xzf 3.1.10.tar.gz -C 3.1.10; sudo cp -r 3.1.10 /lib/modules/
7. reboot and enjoy

When you want back to Android so reboot into recovery and flash your package from 3. point.


Dualboot over external mirco sd:

- your microsd card must have capacity more than 2GB (4GB is optimal)

1. download http://lilstevie.geek.nz/ports/ubuntu.img.gz and extract ubuntu.img from .gz package to internal storage on /sdcard/

2. open terminal emulator or run adb shell from your PC and enter the command:
Code:
dd if=/sdcard/ubuntu.img of=/dev/block/mmcblk1p1
(mmcblk1p1 is external microsd card)

- wait a few minutes
- after succesful finished you can delete ubuntu.img
- you don't see files in microsd card, but this is normal

3. download http://dl.dropbox.com/u/60048492/tra...ntu-sdcard.zip and place to internal storage on /sdcard/

4. download from http://www.mediafire.com/?labcx60jowrdx one package for back to Android(by the ROM you use) and place to internal storage on /sdcard/ *

5. reboot into CWM recovery and flash the package Ubuntu-sdcard.zip from 3. point

6. reboot and you booting to Ubuntu

7. you must add to /lib/modules/ this > http://www.2shared.com/file/843Sq6-J/3110tar.html

Code:
mkdir 3.1.10; tar -xzf 3.1.10.tar.gz -C 3.1.10; sudo cp -r 3.1.10 /lib/modules/
8. reboot and enjoy


When you want back to Android so reboot into recovery and flash your package from 4. point.

* when you can't find the package for your ROM or latest version so extract blob file from your ROM package .zip, rename to kernelblob and replace in Android-xxx.zip package

Original post:
Very thanks!

A few questions:
Sorry for my english
The Following 7 Users Say Thank You to jozka.1 For This Useful Post: [ Click to Expand ]
 
shaola
Old
(Last edited by shaola; 9th March 2012 at 09:58 AM.)
#4  
shaola's Avatar
Senior Member - OP
Thanks Meter 61
Posts: 156
Join Date: Dec 2010
Quote:
Originally Posted by jozka.1 View Post
Very thanks!

A few questions:

Thanks, already corrected, and yes, that's an option, but the last version of ubuntu.img i think it's 2.0 GB and that one is 535MB or something like that, for all my tests i've used the 2GB one i think is inside OLIFE prime. But you can also build your own one with another distro. The question is wich type of instalation are you going to use, because in the native (internal or external) the image will be automatically resizes to fit the partition in the first boot so it doesn't matter, but in the loopmount one will keep the same size. So either of them would be a bad option.

I will explain this later and wich options we have to increase the space.

EDIT:
http://forum.xda-developers.com/show....php?t=1476835

i have to rewrite that to correct grammar but it will help you understanding a couple of things
The Following 2 Users Say Thank You to shaola For This Useful Post: [ Click to Expand ]
 
jozka.1
Old
#5  
jozka.1's Avatar
Senior Member
Thanks Meter 91
Posts: 214
Join Date: Apr 2011
And I can't this process without microsdcard (I can't have the ubuntu.img in internal memory), because dd if=ubuntu.img of=/dev/block/mmcblk0p7 deletes all files on /data/media. Is it right?
Sorry for my english
 
shaola
Old
#6  
shaola's Avatar
Senior Member - OP
Thanks Meter 61
Posts: 156
Join Date: Dec 2010
Quote:
Originally Posted by jozka.1 View Post
And I can't this process without microsdcard (I can't have the ubuntu.img in internal memory), because dd if=ubuntu.img of=/dev/block/mmcblk0p7 deletes all files on /data/media. Is it right?

Yes, installing in the internal sdcard will erase all your data, and with the microsd even if you have a good one it will be a bit laggy sometimes.

The loopmount option it's another option, but i haven't try it yet and i will not write a guide for that until i do it, but basically is the same, we put the img file in the internal sd we modify the boot.cfg to mountloop and we'll need to tweak up the initrd to mount over loop device the image.
I don't know if that precompiled kernel support that, i think it does, but i am not sure if it's necesary recompile it.

In the other way, we would also need to resize the image to have a system with more than 2gb and that also would require editing the fstab.

I think i remember from time ago working with qemu there was two types of images qcow and raw. One of them had a good feature, you could create a 10gb image but it only weigth the space ocupied inside the image and not the all 10gb, but i don't know if we could use that feature in the mountloop option.
The Following 2 Users Say Thank You to shaola For This Useful Post: [ Click to Expand ]
 
jozka.1
Old
#7  
jozka.1's Avatar
Senior Member
Thanks Meter 91
Posts: 214
Join Date: Apr 2011
Do we have to compile again kernel with a new modules? Or how to mounts virtual disk?
Sorry for my english
 
shaola
Old
#8  
shaola's Avatar
Senior Member - OP
Thanks Meter 61
Posts: 156
Join Date: Dec 2010
Quote:
Originally Posted by jozka.1 View Post
Do we have to compile again kernel with a new modules? Or how to mounts virtual disk?
I don't know yet, i don't think so but i have not compile the kernel myshelf. I have to take a look to init file in the initrd and figure where to put mount comands for the rootfs, i can't give you more information right now because i've never done that before, but here is "again" how the process i think it would be:

in boot.cfg root=/dev/loop0

and inside the initrd there is a file call init where whe have to mount /dev/mmcblk0p7 over somewhere, for example /media/data and then loopmount with losetup /media/data/ubuntu.img

That's what i think, but i am not sure
The Following User Says Thank You to shaola For This Useful Post: [ Click to Expand ]
 
outpox
Old
#9  
Member
Thanks Meter 4
Posts: 43
Join Date: Nov 2010
Location: France
Just a point which is still not really clear for me, following those instructions, it will erase EVERYTHING on my ssd ? Or it's just a wipe like when we flash a new rom ?
 
shaola
Old
#10  
shaola's Avatar
Senior Member - OP
Thanks Meter 61
Posts: 156
Join Date: Dec 2010
Quote:
Originally Posted by outpox View Post
Just a point which is still not really clear for me, following those instructions, it will erase EVERYTHING on my ssd ? Or it's just a wipe like when we flash a new rom ?
This process (the first one, purelinux option) will erase /data partition not the entire sdcard
it doesn't either erase android system wich is another partition. So (and this is a guess, when i test it i didn't have just a kernel blob to flash so i flashed the entire revolver rom) if you reboot into cwm recovery wipe data and install android.zip (wich i'll upload a bit later) . you would be able to boot into android like if it was a clean instalation.

So, yes, is like a full wipe. But only in the first option, the other two options don't touch your data.

But all this is yet to be confirmed, i am quite new in android systems i ony have experience in linux systems. I am pretty sure it is like a say but i would not bet my life on it

Tags
linux, native, pseudo-dualboot, sbk2, ubuntu
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes