Asus Transformer Prime

Installing Gentoo on the Asus Transformer Prime (TF201)

This is an introduction to installing gentoo on the Asus Transformer Prime (TF201). At the moment, we can get it to boot and launch X, but there are quite a few problems. Hopefully, this site will invite others to share their own experiences, and maybe even generate some solutions to these problems.

News
Created a mailing list: linux-tf201. Please join! Discussion is not limited to just Gentoo.

The formerly called programm root_chooser has been renamed to kernel_chooser. kernel_chooser is installed via blob as bootloader to the TF201 and can start android directly. If you want to start to linux you need root_chooser in addition. That means kernel_chooser starts root_chooser and root chooser starts linux. Thats it. There is another loader programm android_chooser. Which should start to android.

State of this site: 2.3.1 configure rootchooser is OUT-OF-DATE

Updates: 02.2015 * 2.2 Create Gentoo chroot * 2.4 Generate a test.blob * 2.3.2 flashing the boot.blob (minor changes)

Installation instructions
The basic steps are as follows:

Preliminaries
This guide requires the Jelly Bean bootloader from ASUS, and will assume you already have it installed. This guide is a work in progress: check back often for updates! (Check the history.)

Create Gentoo chroot
We describe how you set up a Gentoo for your TF201.

Create from stage 3
The first thing you'll want to do is generate a gentoo "rootFS". You can either do this by using a cross-compiler on another computer or on the TFP within a chroot environment. This guide assumes that you are doing the latter. It further assumes that you will be installing the rootFS on the microSD card (mmcblk1p1) which you have mounted on the TFP in the directory /sdcard/gentoo.

Follow the standard Gentoo Installation Guide. You should use the armv7a-hardfp stage3.

This the method if you will do it on your TP via chroot.

Do the chroot
Changeroot to gentoo on the microSD card. You will also need to establish by hand, by adding "nameserver x.x.x.x" to use it inside the chroot. You can get the in Android by running getprop. I found that mounting to  before you chroot allows tmux to work.

Mount all you may need.

Configure all files to have a connection to the internet.

Do the chroot and source the profile

Configure Gentoo via chroot
This is how you configure a gentoo which runns standalone on the TF201 without X.

Download and extract root_patch.tar.gz inside your chroot. This will install some configuration files and the kernel modules and the (binary) firmware.

If you don't trust us, then run:

Or just:

Outside chroot:

TODO: Not all of these files are necessary. We should weed out the ones that aren't. AFAIK, just the bcm4329 firmware is required. See make menuconfig for more information.

Compile your own kernel (see below) to populate. The kernel sources for the "all linux" kernel are from tux-mind TF201 kernel

Comment all serial consoles and ttyX where X > 1 in your and in, if you use syslog-ng

Add to :

You can either add -userfetch to FEATURES (to fix an emerge error about the user being unable to fetch packages) or add the portage user to the 3003 group. See AndroidSecurityUserAndGroups. See also CONFIG_ANDROID_PARANOID_NETWORK=y.

You must install, , and and add them to the default run-level. It would be easiest to disable qt4 USE flag with respect to wpa_supplicant (for now).

Adjust the to your needs. At least deactivate the qt4 flag.

TODO: Configure, , etc.

Verify if you have the right profile.

Configure your timezone:

Enabling US and DE locales with the appropriate character formats

Generare the locales.

Print the locales which were generated.

Selest your locales.

Now reload the environment:

Adjust the :

See the Tips-Section at the end and create a 2G swap partition.

In Gentoo you need to choose a syslogger like sysklogd, syslog-ng, metalog, etc. Here is the example how to install syslog-ng:

You need to uncomment the ttyX > tty1. For me it was quickfix to uncomment these lines complete so you will not get any syslogs. If you use /dev/tty1 you will get syslog on tty1, which could be annoying.

Exit the chroot environment and umount devices.

smaller problem solving tips:

If you get a "sandbox violation" error while emerging, you have to emerge the single package that cause you this as follows (ideally, these should be reported as bug reports to Gentoo Bugzilla):

If you have emerge errors like "/dev/fd/ file or directory not found", needs to be done after every chroot:

If you have emerge errors because you have no internet connection:

Configure root_chooser
The blob and LNX files we provide in git include a modified initrd. What we did is overwrite 'init' with root_chooser. Rootchooser will mount the 8th (/data) partition of your eMMC, read the first line of the root-level file '.root', which will be parsed as "blkdev:root_directory_or_image:init_path init_args" where: If anything goes wrong, rootchooser will boot into Android.
 * 'blkdev' is the block device to mount, e.g., , or.
 * 'root_directory_or_image' is the directory inside the previous device where your installation lives, e.g. or . It can also be the path to an ext4 formatted image to use.
 * 'init_path' is the init script location in your rootfs, usually.
 * 'init_args' are optional arguments for the init program.

Hence, if you have gentoo on the microSD card, .root will be: /dev/mmcblk1p1:/:/sbin/init If it is on /data/gentoo, then: /dev/mmcblk0p8:/gentoo:/sbin/init If on the usb stick: /dev/sda1:/:/sbin/init If from a ext FS image file in /data/media: /dev/mmcblk0p8:/media/ubuntu.img:/:/sbin/init

If you would like to test a configuration, or boot into another system once the .root.tmp file may be used instead. It follows the same syntax as .root, and will be removed upon the next reboot.

Once you have created this file, reboot and it should boot into Linux. However, unless you have configured your Gentoo to automatically start Xorg, you will see nothing but the ASUS logo. In order to verify that it worked, either ssh in or reboot back into Android and check. You can debug problems by checking root_chooser.log which is generated in the root (/) of the Android filesystem.

flashing the boot.blob
There are at present three ways to install the bootloader on the TF201: nvflash and fastboot from another computer and diskdump from internal. Once you have installed the new bootloader (which includes kernel_chooser) on the TFP and reboot, per default your machine will not boot into Android or any other OS. In order to have it boot into Android or Linux, you need to configure the kernel_chooser.

See the section above.

Fastboot method
In order to do fastboot, do the following:
 * Download the blob file to your computer: latest_fastboot.blob
 * Put the TFP in 'fastboot' mode: connect it to the computer via a usb cable, install ClockworkModRecovery app on the TFP, reboot the TFP and hold down VOLUMEDOWN upon reboot until some text shows up about going into recovery. Release VOLUMEDOWN and wait, then select the USB ICON (VOLUMEDOWN to move, VOLUMEUP to select).  This is all standard, and documented elsewhere.
 * Flash the blob to your TFP:


 * NB: 'flashboot devices' will claim there is no device. But it is there.

diskdump method on device
In order to do fastboot directly from the TFP, do the following:
 * Download the blob file to your computer: latest_fastboot.blob
 * Run:


 * reboot
 * NB: you should see a blue bar after rebooting

Nvflash method
In order to do the nvflash method, do the following:
 * Download the LNX file: lastest_nvflash.LNX
 * Put the TFP in nvflash APX mode (reboot + VOLUMEUMP; this will yield a blank screen, but check dmesg to see that it is in APX mode).
 * Run wheelie ( is the blob you created when you installed wheelie):


 * Flash the LNX file to your TFP:


 * Reboot the TFP (this sometimes won't reboot the machine):

Generate a test.blob
To generate a blob you need to compile a kernel with kexec hardboot capabilities, an initial ramdisk which contains the kernel_loader as init and the kernel, and put all together in a flashable blob.

Compile the host kernel
Regenerate the zImage (kernel): you will want to apply the JB15.patch (update: not any more in tux-minds git repo). The kernel we used was the one from ASUS:. The patch also applies our file.

Now unzip and untar the kernel sources. Go to the directory and insert the patch and configure it to your needs. The patch contains a '.config' which should fit your needs. In addition there are more features and 'problem solvers' for example kexec hardboot, keyboard layout, ...

The kernel needs the property of hardboot and is called host kernel. It can load and start another kernel a so called guest kernel. At least you will need following configurations. The configuration has these flags set, just check it. Well you see it's experimental, but seems to work. You can find additional infos at XDA KexecHardboot guest kernel

Now compile the kernel.

If all went fine your kernel is at

compile kernel_chooser and create initrd
You need the sources of tux-minds repository. You will get it via git.

The kernel_chooser is made very comfortable. With 'make' you start the compile process and the packing to an initial ramdisk. In the Makefile you can change the flag 'Development' to '1' to get a rescue shell for the kernel_chooser. The filesystem is in the directory initramfs. It contains busybox and mdev as binraies. If you would like to have additional programms, feel free to add what you need. The Blob has an maximum size of ~8MB.

The result will be the ready to use initrd.gz, which is an gz-packed initial ramdisk. Rename it to

make the blob
You need your already generated files, these are  from, the  , and an old unpacked test.blob, also. You will find blobpack at AndroidRoot TODO: link for blobunpack.

Unpack the blob and regenerate the .LNX file:

Pack the new blob:

Now you have  and you can flash it via fastboot.

Network / Wifi
The wifi is configured via wpa_supplicnat if you use WPA2 in your network. Add to :

Configure wpa_supplicant with WPA2:

Test if the configuration works:

If your configuration establishes a connection, you can add an init script and start wifi:

A wifi-connection which starts automatically is done by a rc-update:

With this configuration your connection will be esablished on boot.

Keyboard
It is possible to change the keyboard layout to be similar to a normal desktop's. If you are using at least the v3 kernel you're able to modify the kernel keyboard layout using setkeycodes. Give a look to the /etc/local.d/00-setkeycodes.start script installed from the root_patch. Otherwise you have to change the way Xorg translate keycodes throught xmodmap (it's slower, do it only if you have a kernel version minor than the v3).

Create a config file:

Edit the key bindings.

Add the following to to automatically apply this configuration

Graphics / Video / Xorg
The tegra xorg driver (from L4T RC16.2) works! Be sure to use at least the v2 images.

Install X11:

Download the latest Cardu driver package from Nvidia (https://developer.nvidia.com/linux-tegra).

Extract the package and copy and  from  to the device.

Extract (using --backup!) the two tars to.

Remove (unnecessary; and in the wrong place).

Place the contents in an local.d/mystart.start (I'm not sure what these do, but they cause cpufreq-set to not work and give us wonderful new messages in messages).

Add "vt01" to the end of the command line in (see FAQ below for details).

Run "startx". If no window/desktop manager is configured but everything is working you'll get a usual X output log and then dumped back at the command prompt; if you have configured a window/desktop manager (e.g. "echo startxfce4 > ~/.xinitrc") it should start; if the system is misconfigured a hang followed by reboot is possible.

Recently (December 2012 / January 2013), Stephen Warren and Thierry Reding have been working on getting an open tegra implementation in the kernel and also an xorg driver associated with that. Purportedly, this will be in the 3.8 kernel. We'll be keeping an eye on this over the next few weeks! If anyone has given it a go, drop me a line! Thierry's git is: https://gitorious.org/thierryreding/xf86-video-opentegra

Atmel Maxtouch touchscreen
I'll be busy over the next few weeks, so here's a status quaestionis:

The nvidia tegra drivers (Linux For Tegra RC16.2, documented on the wiki) seem to work. There will be conflicts with two files, and it would be nice to package things in an ebuild.

As a result, xrandr -o left/right/normal/inverted work!

But xinput set-prop 8 "Evdev Axis Inversion" 1, 1 && xinput set-prop "Evdev Axes Swap" 1 don't (i.e. I can't get the input to switch its coordiantes when I rotate the screen).

The problem must be with the Atmel-Maxtouch code. I did some digging around and comparison to other atmel_maxtouch.c files located in:


 * https://github.com/EnJens/kernel_tf201_stock: this seems to have an older version, although Rayman doesn't document where he patched it from.
 * https://github.com/AndroidRoot/android_kernel_asus_tf201/tree/10.4.2.17-mr1: Rayman recommended this as the latest and greatest, and it has the latest Asus kernel_V10_4_2_17.zip (We should probably upgrade at some point!), but the files in question related to atmel_maxtouch are the same as Asus 10.4.2.15 (our version).
 * https://github.com/atmel-maxtouch/linux/tree/maxtouch-v3.0/drivers/input/touchscreen: this looks promising. CFR http://forum.xda-developers.com/showthread.php?t=1496246

And that's where I am at. So if you ever get around to thinking about this problem -- and solve it or have more hints --- let me know.

Battery
I had no problems with the battery. If do you have any trouble with this try installing your DesktopEnvironment's power manager. For those curious, the battery information files are stored in /sys/class/power_supply/

Touchpad
Please install the v1 kernel. Use touchpad_control to enable and disable the touchpad.

Sound
Sound now works, but must be manually configured to use the correct card. Write the following to :

Known bugs

 * Problem: After I launch X and I kill X, the screen is blank. Solution: There is none. Make sure you have sshd installed.
 * Problem: X goes blank and won't go unblank. Solution: Disable X blanking. xset -dpms or xset s off or xset s noblank (or all three)
 * Problem: xrandr -o left/right/normal/inverted don't work. Solution: Install the tegra_drv (xorg driver) from RC16.2 of their Linux For Tegra release (see above)
 * Problem: With Tegra Drivers (RC16.2) installed, xinput set-int-prop 8 "Evdev Axes Swap" 8 1 and xinput set-int-prop 8 "Evdev Axis Inversion" 8 1 0 get registered in, e.g., xinput list-props but fail to have an actual effect on the input x/y coordinates. Solution: None yet. (See above)
 * My messages is spammed up with asusdec_kp_key and asusdec_keypad_processing debugging statements in . Solution: install at least the v2 kernel.
 * With Tegra Drivers (RC16.2) installed, I also get some further cpu spam messages. Solution: None yet.
 * The touchpad (on the ASUS Keyboard Dock) doesn't work. Solution: See above.
 * Sound doesn't work. Solution: See above.
 * Compositing doesn't work due to unavailable graphics shared memory. Solution: Upgrade to Tegra Drivers (RC16.2)
 * In login screen keyboard has a wrong layout. Solution: add that line 'Option "XkbLayout" "$YOUR_KEYBOARD_LAYOUT"' to in the InputClass with "evdev keyboard catchall" as Identifier.
 * Xorg crash with v3 kernel. Solution: append vt01 to to make X always use vt1. Other vt's will cause a crash.
 * Cannot emerge firefox. Solution: you have to upgrade gcc to 4.6.*, emerge firefox with a swapfile, you'll get an error on install. swapoff. ebuild /usr/portage/www-client/firefox-17.0.3/firefox-....ebuil install qmerge celan

Tips
Here are some tips:
 * if you are using a kernel previous then the v3 one edit and comment out the c* and s* entries.
 * mount and  as tmpfs
 * make a 2G swapfile
 * /dev/mmcblk0p1,2,8 are ext4; mount these in /mnt as system, cache, data respectively.
 * sudo -u yourusername startx in /etc/local.d/mystuff.start for a quick and dirty test
 * cpufreq-set -c 0 -g performance|powersave (do this for 0-3) (For some reason, placing contents in local.d/start.start causes cpufreq-set to stop working,s o whatever those things do, they broke this.)

Contribute
Please feel free to add new problems! Even better: new solutions!

The current TODO list is on github.

Please contact peter period hartman at utoronto period ca a.k.a. wart_ in #gentoo-embedded (and elsewhere)

Or contact massimo period dragano at gmail period com a.k.a tux_mind all over the internet