Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,729,749 Members 51,013 Now Online
XDA Developers Android and Mobile Development Forum

[KERNEL/MOD] [LINUX] [Rootbind] [Native EMMC/all TF101&TF101G/fast/tested] [2-Jul-13]

Tip us?
 
jrohwer
Old
(Last edited by jrohwer; 9th July 2014 at 08:16 PM.) Reason: new oc kernel released
#1  
Senior Member - OP
Thanks Meter 238
Posts: 373
Join Date: Mar 2011
Default [KERNEL/MOD] [LINUX] [Rootbind] [Native EMMC/all TF101&TF101G/fast/tested] [2-Jul-13]

UPDATE 2013/11/08: New kernel released with USB and framebuffer fixed. See post #3.
UPDATE 2014/05/16: New Ubuntu 14.04 filesystem. See point #2 below under Installation.
UPDATE 2014/06/03: New kernel released with USB and framebuffer fixed, OC to 1.5 GHz. See post #3 and #326.
UPDATE 2014/07/09: New kernel released with OC to 1.5 GHz fully working, boots every time. See post #3 and #334.

This is a kernel/initrd mod that allows you to run Linux (Ubuntu, Debian, Arch,...) on your TF101 from the internal EMMC (/data partition in Android) without repartitioning your tab.

Disclaimer:
This works on my tablet and I use it daily. However, I am not responsible for any bricks or if you damage your beloved TF. YOU ARE DOING THIS AT YOUR OWN RISK!


Features and advantages:
  1. Fast (and I mean about as fast as it's gonna get on this device). See post #2 for benchmarks.
  2. No need to repartition to get this. Previously TF101 users could run Linux on EMMC but they had to repartition with wheelie/nvflash, but it wasn't available to TF101G users (of which I'm one).
  3. Any free space on your /data partition is available to both Linux and Android. When you delete stuff on either operating system, the free space is available for both again, as they are running off the same partition. Previously, when you re-partitioned e.g. with OLiFE you had to allocate a certain space (8GB by default) for Linux, then this was not available for Android even if you're not using all of it in Linux.
  4. Way faster than loopmount, especially for disk writes.
  5. Way faster than running Linux off a MicroSD card ext4 partition (even with class 10).
  6. Dualboot is achieved just by flashing either the Android or the Linux kernel.

So how does this work?
The kernel/initrd is modded to take an extra parameter "bind=/path/to/linux/rootfs" on the command line. This will then bind-mound that path to the Linux root mount. It works pretty similar to the way a loop-mounted linux image is loaded and set up during boot, except that now bind-mount is used, not a loop-mount. This is possible because both Android and Linux use the ext4 filesystem, so they can actually share the same partition.

N.B. This thread is not a guide on how to get Ubuntu running on your TF101. There are plenty of guides for that, e.g.Make sure to read those threads to get an idea of how this works.

READ THESE INSTRUCTIONS CAREFULLY!

Installation:
  1. Take a Nandroid backup, just in case something goes wrong.
  2. Get a Linux root filesystem if you don't already have one.
    See this thread for a discussion of various filesystems available for rootbind.

    Alternatively roll your own using debootstrap as described by shaola:
    http://forum.xda-developers.com/show....php?t=1476835

    NEW! For a fully working Kubuntu 14.04 image (with graphics acceleration using the Nvidia drivers) see this post: http://forum.xda-developers.com/show...&postcount=303
    This is already an image in a tar file so it doesn't need to be mounted, so instead of the code below you can merely do the following:
    Code:
    mkdir -p /data/linuxroot
    busybox chmod 755 /data/linuxroot
    cd /data/linuxroot
    tar -xpjf /path/to/my/saved/kubuntu-14.04.tar.bz2
  3. Running Android, copy the root filesystem to a directory on your /data partition, preserving the permissions. The easiest is with the "tar" command (see below). The default install assumes that Linux lives in /data/linuxroot under Android.

    For a Linux image in a file that is used for loop-mount (assume it is in /sdcard/ubuntu.img, or edit accordingly), run the following in a terminal when running Android (make sure you are root):
    Code:
    busybox mount -o remount,rw /
    mkdir -p /data/linuxroot
    busybox chmod 755 /data/linuxroot
    mkdir -p /mnt/ubuntu
    busybox mount -o loop /sdcard/ubuntu.img /mnt/ubuntu
    cd /mnt/ubuntu
    tar -cvp * | tar -C /data/linuxroot -xp
    cd /
    busybox umount /mnt/ubuntu
    rmdir /mnt/ubuntu
    busybox mount -o remount,ro /
    (note in tar command first -c is lowercase, second -C is uppercase)

    For a Linux rootfs that lives on a separate partition (e.g. 2nd part. on MicroSD), run the following (assumes linux is in /dev/block/mmcblk1p2, otherwise edit accordingly):
    Code:
    busybox mount -o remount,rw /
    mkdir -p /data/linuxroot
    busybox chmod 755 /data/linuxroot
    mkdir -p /mnt/ubuntu
    busybox mount -t ext4 /dev/block/mmcblk1p2 /mnt/ubuntu
    cd /mnt/ubuntu
    tar -cvp * | tar -C /data/linuxroot -xp
    cd /
    busybox umount /mnt/ubuntu
    rmdir /mnt/ubuntu
    busybox mount -o remount,ro /
  4. Copy kernel modules to your rootfs. Download modules-3.1.10-9.tar.gz to your /sdcard. then:
    Code:
    cd /data/linuxroot/lib/modules
    tar -xzf /sdcard/modules-3.1.10-9.tar.gz
  5. Flash the Linux kernel. Either flash the zip from recovery or copy the kernelblob directly to the staging partition with dd (if you don't know what I'm talking about here, then use the recovery method).
  6. Reboot 'n enjoy! Remember to run "sudo depmod -a" after the first Linux boot, and reboot. Otherwise your modules won't load and wifi, etc., won't work.
  7. To re-boot into Android, simply flash the boot image/kernelblob from your Android ROM.

Notes:
  • The kernel is compiled from Jhinta's source with a few modifications to the config - http://forum.xda-developers.com/show....php?t=1683145
  • Make sure not to have a /host directory in your Linux rootfs - this interferes with the bind mount!
  • The Linux rootfs can live anywhere on your Android /data partition (the default is /data/linuxroot). If you want to change this, then you'll have to blobunpack the kernelblob-rootbind, unpack the boot image (kernelblob-rootbind.LNX) with abootimg, change the command line as desired, re-pack the boot image with abootimg, and re-pack the blob for flashing.
    The "bind" cmdline argument is the location of your Linux rootfs without the initial "/data". So if your Linux rootfs lives on /data/my/linux/path under Android, then you'd have to change the cmdline parameter to "bind=/my/linux/path".
    Make sure, however, not to put the Linux rootfs to the "internal storage" (/data/media) or any subdirectories thereof. This plays havoc with the Android media scanner when re-booting into Android and your tablet may slow down to a crawl.
  • Under Android your EMMC partitions are /dev/block/mmcblk0p1,2,3,....
    Under Linux, this is /dev/mmcblk0p1,2,3....

Thanks to:
lilstevie - for bringing Ubuntu to our tablet
Jhinta - for his 3.1.10 kernel
shaola - for his debootstrap guide
x3maniac - for his Tubuntu installer
transformador - for his mountloop instructions
TomTcom - for all his Ubuntu-related guides on xda
Kingzak34 - for his dualboot guide and general help/discussion
DjDill - for putting together the collection of rootbind filesystem images
(if your name should be here and I have forgotten you, please PM me...)
Attached Files
File Type: zip Ubuntu-3.1.10-9-rootbind.zip - [Click for QR Code] (4.93 MB, 483 views)
File Type: img kernelblob-rootbind.img - [Click for QR Code] (4.78 MB, 232 views)
File Type: gz modules-3.1.10-9.tar.gz - [Click for QR Code] (1.34 MB, 443 views)
The Following 20 Users Say Thank You to jrohwer For This Useful Post: [ Click to Expand ]
 
jrohwer
Old
(Last edited by jrohwer; 2nd July 2013 at 03:00 PM.)
#2  
Senior Member - OP
Thanks Meter 238
Posts: 373
Join Date: Mar 2011
Default Benchmarks

Using "fio" (available from Ubuntu repos). All speeds in kB/s.

In the below, loopmount refers to a loopmounted image on internal storage, MicroSD refers to running linux from an ext4 partition off a class-10 MicroSD card, and rootbind refers to the method described in this thread.

Test: sequential read (64 MB)
rootbind 31906
loopmount 29088
MicroSD 15312

Test: random read (64 MB)
rootbind 5605
loopmount 11340
MicroSD 1620

Test: sequential write (8 MB)
rootbind 9694
loopmount 1373
MicroSD 3040

Test: random write (8 MB)
rootbind 4659
loopmount 1102
MicroSD 722
The Following 4 Users Say Thank You to jrohwer For This Useful Post: [ Click to Expand ]
 
jrohwer
Old
(Last edited by jrohwer; 9th July 2014 at 08:44 PM.) Reason: new kernel released
#3  
Senior Member - OP
Thanks Meter 238
Posts: 373
Join Date: Mar 2011
Default New kernel

New kernel for Linux rootbind:
  • based on kernel source from @Sni
    See here: http://forum.xda-developers.com/show...&postcount=569
    N.B. If you use this kernel you will have to copy new firmware for the wifi driver into /lib/firmware. Get it from Sni's post (link above).
  • USB hotplug fixed and fully working!
  • framebuffer fixed (Ctrl-Alt-F1 to F6 for console access)
  • hardware graphics acceleration now fully working with the latest Nvidia Linux-4-tegra drivers. es2gears no longer throws errors.

Two versions: one clocked to standard 1.0 GHz, the other one overclocked to 1.2GHz. Remember to extract the relevant modules to your linux root filesystem. For installation, I have provided a CWM or TWRP flashable zip, or a blob that you can flash directly with dd to the staging partition (if you don't know how to do this, use the recovery method).

I have tried at great length to overclock to higher frequencies but could not succeed. For some reason the TF just froze with a black screen after booting. I tried many combinations of voltages and frequencies. At least it's oc'ed to 1.2 and stable (in my hands), but if you are experiencing problems you can revert to the 1.0GHz or keep using the previous kernel which is oc'ed to 1.6 but USB is broken.

If anyone wants to take a stab at this you are more than welcome
My sources: https://github.com/jmrohwer/TF101-GNU-kernel

EDIT: New kernel 3.1.10-15 overclocked to 1.5GHz. Boots every time! Needs configuration of your overlock speeds with cpufrequtils. Read this post:
http://forum.xda-developers.com/show...&postcount=334
MD5SUM:
3aee8cacf9037dfc3c8ef0363780254f Ubuntu-3.1.10-15-rootbind-oc1.5.zip
Want to run Ubuntu linux on your TF101 from native EMMC without repartitioning?
Use rootbind! - http://forum.xda-developers.com/show....php?t=2347581
The Following 5 Users Say Thank You to jrohwer For This Useful Post: [ Click to Expand ]
 
prog19
Old
#4  
Senior Member
Thanks Meter 85
Posts: 330
Join Date: Apr 2012
Seems to be great, and very very easy to dual boot, as TWTR will be always avaible to flash the kernels.

The reason I left linux behind on my TF is that team EOS has a plenty of updates and I like to keep up with the devs and the dual boot method i used overwrites the custom recovery.

Now it seems to be perfect forme.
 
Kingzak34
Old
#5  
Kingzak34's Avatar
Senior Member
Thanks Meter 998
Posts: 2,115
Join Date: Jan 2011
Location: South
Simply amazing, an other victory for TF101 ! And in addition of more speed than mountloop it's even easier to manage.

Thanks once again, I think my mounltoop will became a full install
 
smokesignals
Old
(Last edited by smokesignals; 2nd July 2013 at 10:12 PM.)
#6  
Junior Member
Thanks Meter 6
Posts: 11
Join Date: Feb 2008
Forgive my ignorance, but I've googled and searched the TF101 forums to no avail; what is TWTR? With Google I only found a video of someone running what looked like regular CWM touch on a TF101...

Edit: Nevermind, I figured out that it must be referring to the TeamWin recovery, which until now I've only ever seen referred to as "TWRP".
 
brgroover
Old
#7  
brgroover's Avatar
Senior Member
Thanks Meter 103
Posts: 372
Join Date: Oct 2010
Thanks! I will test this tomorrow.
 
*Detection*
Old
(Last edited by *Detection*; 2nd July 2013 at 11:58 PM.)
#8  
*Detection*'s Avatar
Senior Member
Thanks Meter 510
Posts: 2,125
Join Date: Dec 2011
Quote:
Originally Posted by smokesignals View Post
Forgive my ignorance, but I've googled and searched the TF101 forums to no avail; what is TWTR? With Google I only found a video of someone running what looked like regular CWM touch on a TF101...

Edit: Nevermind, I figured out that it must be referring to the TeamWin recovery, which until now I've only ever seen referred to as "TWRP".
It is TWRP, but I guess TWTR = Team Win Touch Recovery

---------- Post added at 11:52 PM ---------- Previous post was at 11:23 PM ----------

I am root, but this command says read only file system

mkdir -p /mnt/ubuntu

Made the folder using a file manager instead

Next step
mount -o loop /sdcard/ubuntu.img /mnt/ubuntu

Fails and just gives me a list of possible options for the mount command
Droid: TF101
HW: B4O
ROM: KatKiss KitKat



KatKiss Dev / Stable
Kat Kernel
Kat App
Gapps
-----
EasyFlasher Root / Recovery
Peri Root/Recovery
-----
The Following User Says Thank You to *Detection* For This Useful Post: [ Click to Expand ]
 
smokesignals
Old
#9  
Junior Member
Thanks Meter 6
Posts: 11
Join Date: Feb 2008
Quote:
Originally Posted by *Detection* View Post
It is TWRP, but I guess TWTR = Team Win Touch Recovery

---------- Post added at 11:52 PM ---------- Previous post was at 11:23 PM ----------

I am root, but this command says read only file system

mkdir -p /mnt/ubuntu

Made the folder using a file manager instead

Next step
mount -o loop /sdcard/ubuntu.img /mnt/ubuntu

Fails and just gives me a list of possible options for the mount command
I had that problem too. Not sure how to fix it on the tablet, I just copied the image I wanted to use (in this case the Arch Linux ARM one -- about which more later) to my Linux box, loop mounted it, tar'd up the files there, copied that to an SD card, and extracted it on the tablet.

However, about Arch Linux ARM, I learned not to bother using the image from the Tubuntu thread and instead just get the latest version from the ALARM downloads page. Use the "NVIDIA Tegra2 TrimSlice" one. The default root password is "root".

The reason not to use the one from the Tubuntu thread is that it is out of date -- Arch has merged /bin and /sbin into /usr, but the image in the Tubuntu thread predates that, and it's a huge pain to upgrade it properly.
The Following 2 Users Say Thank You to smokesignals For This Useful Post: [ Click to Expand ]
 
*Detection*
Old
#10  
*Detection*'s Avatar
Senior Member
Thanks Meter 510
Posts: 2,125
Join Date: Dec 2011
Quote:
Originally Posted by smokesignals View Post
I had that problem too. Not sure how to fix it on the tablet, I just copied the image I wanted to use (in this case the Arch Linux ARM one -- about which more later) to my Linux box, loop mounted it, tar'd up the files there, copied that to an SD card, and extracted it on the tablet.

However, about Arch Linux ARM, I learned not to bother using the image from the Tubuntu thread and instead just get the latest version from the ALARM downloads page. Use the "NVIDIA Tegra2 TrimSlice" one. The default root password is "root".

The reason not to use the one from the Tubuntu thread is that it is out of date -- Arch has merged /bin and /sbin into /usr, but the image in the Tubuntu thread predates that, and it's a huge pain to upgrade it properly.

Thanks for that, at least I know I'm not doing something wrong my end, I was trying the Ubuntu 12.04 netinstall from the Transformazing thread, I`ll no doubt try a few until I find one I like

I don't have a Linux box atm, but a quick fix with a wubi or VM install tomorrow and I`ll give your method a shot

Cheers
Droid: TF101
HW: B4O
ROM: KatKiss KitKat



KatKiss Dev / Stable
Kat Kernel
Kat App
Gapps
-----
EasyFlasher Root / Recovery
Peri Root/Recovery
-----

Tags
linux, native emmc, tf101, ubuntu
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes