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.

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 a chroot
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. 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. Comment all serial consoles and ttyX where X > 1 in your.

Add to :

I found that mounting to  before you chroot allows tmux to work.

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 will also need to establish by hand, by adding "nameserver x.x.x.x" to it inside the chroot. You can get the in Android by running getprop.

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).

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):

Installing the kernel
There are at present two ways to install the kernel on the TFP: nvflash or fastboot. Once you have installed the kernel on the TFP and reboot, your machine should boot into Android (not Linux). In order to have it boot into Linux, you need to configure the rootchooser. See the next section. Instructions on how to regenerate a kernel, blob, and LNX file are given further below.

Fastboot method
In order to do fastboot, do the following:
 * Download the blob file to your computer: fastboot.blob
 * Check the md5sum of the downloaded file : md5sums
 * 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.

Fastboot method on device
In order to do fastboot directly from the TFP, do the following:
 * Download the blob file to your computer: fastboot.blob
 * Check the md5sum of the downloaded file : md5sums
 * 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: 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):

Configure rootchooser
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.

Generate a test.blob / modify initrd / compile the kernel
The are not steps, but pointers.

Unpack the blob (test.blob in git) to generate a .LNX file:

Extract the zImage and initrd from the .LNX file:

Extract the initrd:

Regenerate the initrd (from tmp):

Regenerate the zImage (kernel): you will want to apply the JB15.patch in our git kernel/ directory, fixing many problems. The kernel we used was the one from ASUS:. The patch also applies our file.

Regenerate the .LNX file:

Reblob pack: Use blobpack and when done add 28 bytes to the front of the file (see the fastboot method section above).

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