Asus Transformer Infinity (TF700T)/Install

= Installing Gentoo Linux on Asus Transformer Infinity (TF700T) =

Since i bought the amazing Infinity (Asus TF700T) with the keyboard dock, i started wondering how to put a real OS on it, which is my beloved Gentoo.

Finally i managed to get to the point and achieve something usable.

In this wiki page i will be describing what i did and provide both instructions AND the final product.

= Preliminary notes =

A few preliminary notes.

You MUST have the keyboard dock, otherwise you must try to plugin some kind of USB keyboard, which i guess would be a pain to use. I have not tried bluetooth at the moment on Gentoo and the TF700T (it should work), but i guess getting to the point of pairing the keyboard would require the shitty on-screen keyboard, and X working, which still requires you to type a lot of stuff from command line before you can actually make it start automatically at boot.

I strongly recomand to install Gentoo on the microSD. The SD slot on the dock might work as well but do you trust yourself to never detach the dock itself? Or are you sure it will never happen by accident? If it does, well, at least a reboot + fsck is mandatory! Installing on the internal memory is also al option, but consider the wear and tear due to compilation! In this case you might want to move your portage build dir to the microSD.

The tables has only 1gb of ram. While it might seems a lot, and it surely was up to a few years ago, it's surprsingly small by today standards. Don't ask my wy Asus choose such a limited amount on a top-level device, just live with it. Couple it with the basic useless of swap space on this device: on the internal memory i strongly recomend to avoid, and on the microSD it's really a serial device, so putting swap on it causes the entire device to crawl as soon as it's being used. Given this considerations, i suggest a lightweight desktop like LXDE and memory saves wherever possible like don't run background services or memory-hogs.

= Before the first linux boot =

The Asus Infinity (TF700T) comes out of the box as an Android tablet, it's provided with android 4.2.1 or something similar but it is not so important because we want to install Linux on it, so these steps will provide information on how to enable dual boot on this device. You will need to do some steps on Android before starting with Linux.

Unlock and root
You must unlock your bootloader first, follow these instructions:

Go to this link: support page on Asus website, select OS Android and from utilities download the "Unlock Device App: Unlock boot loader". Now install, follow directions and enjoy your boot-unlocked tablet (yes, this will void your warranty, you have been warned).

For more directions, check this XDA thread: XDA on unlock TF700T

At this point you need root. My recomandation is to install a custom ROM which will do everything for you. Which one is on you, check this link on XDA how to root and custom ROMS for detailed instructions and a list of ROMS, but bear in mind that at the moment the multi boot has been tested only with a few ROMS: either CROMi-X, CROMBi-KK or ZOMBi-X latest versions, on insternal SD only, no rom2sd, data2sd or anything fancy. I suggest you to stick with one of these.

Making your tablet unbrickable
While there is basically no threat of briking your tablet, it's strongly advised to follow these steps here on how to make your tablet "safe" from any messing up you might do.

In short:
 * download this: flatline
 * install google's ADB and fastboot (from SDK) on oyur linux pc
 * flash the downloaded custom recovery: fastboot flash recovery flatline_device.im
 * reboot device to recovery, select "advanced" and "wheelie", select "Step 1: Flash AndroidRoot BL"
 * it will poweroff. Reboot to asndroid, let it boot, use a bit, then reboot to recovery again
 * select "Step 2: Generate wheelie blobs" from the same menu as before
 * when finished, reboot and save from the device the files it has created (check under /data or /tmp for AndroidRoot or similar)

Keep these files safe, they are your lifeline. (NOTE: these instructions are given with no warranty, use at your risk!)

Prepare the storage
As noted above, i suggest you install Gentoo on the microSD. In addition to that, since also microSD are subject to tear and wear damage, i suggest to disable logs (or put them on a ramdisk) and put the /tmp folder on ram. For additional safety you could also move the portage build dir to some other device, like an usb attached disk or network share (ok, this might be too much, i regularly build on my microSD).

I suggest to plug in a very fast microSD, but be aware that the TF700T microSD slot is a bit picky. I managed to get a Sandisk 32gb Class 10 microSD to work great, while no 64gb card so far: they seems to be working, but at some random point under heavy load will drop to read-only with no warning. It seems to be an hardware issue since moving the same card to the SD slot on the dock fix the issue.

Anyway, i assume we are using the microSD slot here on at least 16gb microSD card.

You need to format it, since i am aware of no good tools on Android for doing this, put the card in to your pc and prepare two partitions:
 * the first formated as EXT4, at lest 16gb (better 32gb)
 * the second as VFAT, for data exchange (not required, just optional if you have spare space)

I will not cover it here, but you could use the Android partition to store Gentoo, but this will get rid of your Android, or install Gentoo on the internal memory data partition, this is left to you to try.

(Repartitioning the internal memory is STRONGLY NOT ADVISED. I was thinking about it but was discouraged by the fact it does not use any common partition scheme and no linux tools are able to mess with it. Plus the fact that it can really brick your tablet requiring you to grab the lifeline from last paragraph)

Setting up dual-boot
Dual-booting the tablet is done using a kexec method which is just brilliant. The full thread on XDA is here.

In short, with the changes we need for Gentoo:
 * Check you have a supported ROM and recovery (CROMBi-KK and TRWP for me worked well)
 * boot into your ROM and make sure you have terminal emulator, root and busybox installed
 * download this: scripts
 * extract in the internal memory, you should get a folder called TF700t-AKBI-v2.6.5
 * don't download any rootfs, you will be making your own with Gentoo on it soon enough.
 * become root: su bash
 * run the script: sh firstintall.sh (it will install the multiboot blob).
 * When prompted, select the proper kernel for your android from the list (a mistake here will make your Android intallation unbootable, but you can fix it from the multiboot prompt later on, left as an exercise in patience)
 * When asked for the rootfs image, just terminate the script. We will not setup a rootfs image.
 * If the script gives an error (missing rootfs image, for example) just ignore it, all you need is the kexec blob for the multiboot to be installed and the android kernel to be copied.

(rememeber you are on Android here, not linux, so things are different. For once, you must run shell script by incoking the shell itself and not by directly run the script, as tany partition you have normally access to it's mounted as no-exec)

Very well, at this point we should have the multiboot installed and the android kernel restored for the multi-boot. We now need to configure the multiboot for booting linux from the microSD card: LABEL=CROMBi-KK BOOT=3 DEVICE=/dev/mmcblk0p1 DIR=/ KERNEL=/boot/zImage INITRD=/boot/initrd.img PRIORITY=10 LABEL=Gentoo on microSD partition 1 BOOT=3 DEVICE=/dev/mmcblk1p1 DIR=/ KERNEL=/boot/zImage INITRD=/boot/initrd.img PRIORITY=110
 * prepare to mount the multiboot partition: mkdir -p /data/media/0/kexecbootcfg/
 * mount the multiboot partition: mount -t vfat /dev/block/mmcblk0p5 /data/media/0/kexecbootcfg/
 * Create the config folder: mkdir -p /data/media/0/kexecbootcfg/multiboot/
 * Create/edit the file called boot.cfg in this directory, this is mine as an example:
 * 1) Android#
 * 1) Linux ext partition image on microsd partition 1 #
 * Adapt the example to your needs!
 * Unmount the multiboot partition: umount /data/media/0/kexecbootcfg/

The linux entry will not boot until we set up the kernel for it, but at least you should be able to reboot into Android. Try it out! The tablet will boot twice, the first time will show you the menu, the second will actually boot Android.

As Workdowg himself explains on XDA:

"What happens here is by flashing the kexecboot kernel blob (to mmcblk0p4) you are given a menu to choose a rootfs to boot from, ie Android, Linux image file, Linux on a partition... So in order for the kexecboot kernel to be of any use to you, you need to install Android and Linux kernels in your rootfs. It then reboots using the kernel you chose. The config file, boot.cfg, is installed to a small 5MB vfat partition (mmcblk0p5)

''ANDROID: Android mounts root (mmcblk0p1) "/" as /system. So we install a kernel (without modules, you did that when you installed your ROM) to a directory we make called /boot which needs to be in the mount /system directory. This kernel (zImage and initrc.img) is just extracted from _that's cm112 or _that9oc+ kernel blobs and a copied to the /boot directory.''

''LINUX: This kernel was especially compiled by JoinTheRealms from _that5 source using configs moreD_cn came up with. It needs to be installed in /boot of a Linux rootfs."''

At this point you have a working dual-boot on your tablet, we need to build gentoo so you also have something to dual-boot!

= Installing Gentoo: before first boot =

This is basically the standard Gentoo Handbook, so i will not bore you on the basics, but a few important things must be noted, so please keep reading.

Prepare for first Gentoo boot
I assume you want to install on the first partition of your microSD card. If not, just follow these instructions but perform them on the media you want to use (loopback image, internal memory, SD card, whatever)

These instructions will allow you to do everything from your tablet on Android, but if you prefer to make things easier, put the microSD into your linux PC and perform them there, then move the microSD to the tablet and skip to the reoot part.

I assume your microSD has already been formatted and that the first partition is the gentoo root partition. If you have a more complex partitioning scheme, have fun adapting these instructions for your case.

We need to mount the EXT4 partition, so:
 * From android, open your Android Terminal Emulator and become su: su bash
 * create a temporary folder: mkdir tmpGentoo
 * mount the microSD: mount -t ext4 /dev/mmcblk1p0 tmpGentoo (mmcblk1 is the microSD)

Download stage3 for ARM-hf
The tablet is an ARMv7 with hard floating point. The binary NVIDIA packages which we are forced to install do require you to install this architecture, so go to the gentoo ARM download page and download on your tablet the latest Stage3.

Extracting it into the mounted partition can be hard depending on your busybox, decompressing the stage3 is left to your exercise (if you are desperate, just decompress it on a linux pc then mount the microSD on the tablet).

Prepre your stage3 before first boot
(make sure to do these steps from your tablet and not from the PC) Follow the gentoo handbook to install it. In short, these are the steps:
 * cd into your gentoo mounted parttion: cd tmpGentoo
 * remount with bind dev, proc, run, sys: for i in dev proc run sys; do mount -o bind /$i $i; done
 * create your etc/resolv.conf, put inside your DNS server (Android does not have one, so you must create it from scratch)
 * chroot: chroot ./ /bin/bash
 * change the root password immediately: passwd
 * DO NOT INSTALL A KERNEL: you must use the provided that10 kernel.
 * DO NOT INSTALL GRUB OR ANY BOOTLOADER: you have multiboot already in place.
 * DO NOT INSTALL LOG MANAGERS: metalog, syslog-ng and the likes, will only slow down and add wear to your microSD.
 * Take a look at the Gentoo Handbook to see if you need something else which i clearly forgot here.
 * Don't forget to prepare your portage tree (emerge --sync) and update it as needed.

Mask and unmask packages
The provided tegra drivers works only with X up to 1.14 (which is not very stable) and since 1.13 has been masked due to security flaws, you must mask any xorg-server above or equal to 1.13. Also, many ebuilds are not yet classified as "stable" for ARM, but are nevertheless very much usable. You will need to unmask a lot of stuff, i am posting here my /etc/portage/packages.accept_keywords for you to copy: <=www-client/firefox-32 ~arm dev-libs/nss ~arm dev-libs/botan ~arm media-gfx/gimp ~arm net-analyzer/wireshark ~arm dev-libs/tinyxml ~arm x11-libs/wxGTK ~arm media-libs/babl ~arm sys-apps/texinfo ~arm net-libs/gnutls ~arm media-libs/gegl ~arm sys-devel/gettext ~arm =net-misc/networkmanager-1.0.0 ~arm =gnome-extra/nm-applet-1.0.0 =net-wireless/gnome-bluetooth-3.14.0 ~arm =x11-themes/gnome-icon-theme-symbolic-3.12.0 ~arm app-arch/p7zip ~arm
 * 1) Firefox after v.32 do not compile on ARM
 * 1) These works great:

As a rule of thumb, if a package has the ~arm keyword, try it out! They usually work very well (with Filezilla the only exception so far for me).

Then mask the packages for the NVIDIA blob to work, in your /etc/portage/package.mask: >=x11-base/xorg-server-1.13.0

Since the tablet has only WiFi, i suggest strongly to install NetworkManager and use it. Since i am going to use LXDE i have also unmasked the needed packages for the nm-applet which works great with LXDE.

This is my /etc/portage/make.conf: CFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard" CXXFLAGS="${CFLAGS}" CHOST="armv7a-hardfloat-linux-gnueabi" USE="bindist" PORTDIR="/usr/portage" DISTDIR="${PORTDIR}/distfiles" PKGDIR="${PORTDIR}/packages" USE="alsa opengl mp3 aacs v4l x264 consolekit neon minizip sqlite bluetooth truetype networkmanager gudev bindist X policykit jpg jpeg tiff png dbus pdf cups udev samba" MAKEOPTS="-j4" VIDEO_CARDS="v4l" INPUT_DEVICES="evdev keyboard" FEATURES="ccache -sandbox -usersandbox"

I have enabled ccache to speed up build times and help the microSD. Since we have a quad-core i have set the -j4 to speed up make. I had to disable sandbox because some packages will not build on ARM. The various useflags are just an example, adapt to your needs. Of course, you need to emerge ccache and enable it too.

Setup the kernel
No, you cannot recompile any sources provided by Gentoo nor i had any luck whatsoever with the NVIDIA provided kernel sources, according to what the NVIDIA devs say we should get an updated kernel from Asus itself. So at the moment we are stuck with kernel 3.1 (see links at the bottom of the page) which is the latest provided by Asus. Since we already have a good working kernel ready, there is no need to add also this strain to the tablet, let's go with the provided one.

What you have to do now is copy the same kernel your Android is using (or choose a kernel from the package which contains the multiboot loader) to the /boot folder of your Gentoo partition. I leave this as an exercise for you, you want to end up with these files: /boot/initrd.img /boot/zImage

So copy both from your Android system partition.

Since some packages needs the kernel sources to be built, we need to download the sources associated to your kernel:
 * Fetch any one of the kernel sources listed below and put it under /usr/src/linux.
 * Copy your current kernel config: cp /proc/config.gz /usr/src/linux
 * decompress: cd /usr/src/linux && gunzip config.gz
 * rename: mv config .config

You kernel sources tree is now configured.

To play around with the kernel
In case you want to experiment:
 * this is the link to the latest official Asus kernel sources (try also from the official Asus support page in the very unlikely case there might be an update)
 * this is the link to an already configured kernel for TF700T by "that" (XDA member)
 * this is the link to the CyanogenMod kernel sources for the TF700T

Install driver packages
At this moment the only way to get X to start is using the NVIDIA provided binary blob. It sucks, albeit it works, but since i am not able to recompile any 3.10 kernel and try OpenTegra, there is no other way to go.

Touch screen and trackpad works great but we need to download and install the proper drviers too.


 * Build Xorg, it will take some time, so you can sart building it while doing the rest of the steps: emerge xorg-server xorg-drivers
 * While it builds, download the NVIDIA package from here
 * then unpack it into your root user home folder in the gentoo partition (i suggest to keep it there in case you need some files later on)
 * Now doenload the trackpad drivers from this link (this is a patched version of the sources you can find here, which will not compile)
 * download the touch-screen drivers here (original package here in git repository

Now wait for Xorg to be completely built and installed.


 * decompress, build and install (make install is enough) both the touchpad and the touchscreen drivers.
 * Decompress the Linux 4 Tegra package
 * Decompress the archive nvidia_drivers.tbz2 found within /root/Linux_for_Tegra/nv_tegra, it will create some folders like usr, etc and lib, DO NOT EXPAND IN YOUR ROOT FOLDER! For the following instructions i assume you will expand it into the nv_tegra folder where the archive is.
 * Copy the xorg driver from /root/Linux_for_Tegra/nv_tegra/usr/lib/xorg/modules/drivers to /usr/lib/xorg/modules/drivers. Pick the right one (the ABI12 in our case) and copy to the destination folder and rename it to tegra_drv.so.
 * Copy MOST of the libraries from /root/Linux_for_Tegra/nv_tegra/usr/lib to /usr/lib but be VERY CAREFULL not to replace libjpeg.so, you want to keep your copy of it.
 * Poke around the /root/Linux_for_Tegra/nv_tegra folder, check if there are more files you want to copy to your filesystem (probably not).

Configure the dock keyboard
The dock keyboard is not exactly your standard keyboard and it requires a bit of fiddling to get it right. You can use it out of the box, but your top row of keys will be messed up badly and you will lack, among all function keys, also the ESC key, which comes pretty handy usually.

You need to fix the keyboard layout both for the console and for X. You might skip the console maybe, but it's so simple that it's a pity not to do it.

Fixing the keyboard layout in console
Create the following file (create also the missing tf700 folder, we will use it later)

Contents of file /etc/tf700/tf700.map: keymaps 0-15

keycode 158 = Escape keycode 238 = F1	shift keycode 238 = F13 control keycode 238 = F25 alt keycode 238 = Console_1 keycode 237 = F2	shift keycode 237 = F14 control keycode 237 = F26 alt keycode 237 = Console_2 keycode 60 = F3	shift keycode 60 = F15 control keycode 60 = F27 alt keycode 60 = Console_3 keycode 224 = F4	shift keycode 224 = F16 control keycode 224 = F28 alt keycode 224 = Console_4 keycode 225 = F5 	shift keycode 225 = F17 control keycode 225 = F29 alt keycode 225 = Console_5 keycode 61 = F6	shift keycode 61 = F18 control keycode 61 = F30 alt keycode 61 = Console_6 keycode 212 = F7	shift keycode 212 = F19 control keycode 212 = F31 alt keycode 212 = Console_7 keycode 150 = F8	shift keycode 150 = F20 control keycode 150 = F32 alt keycode 150 = Console_8 keycode 62 = F9	shift keycode 62 = F21 control keycode 62 = F33 alt keycode 62 = Console_9 keycode 165 = F10 shift keycode 165 = F22 control keycode 165 = F34 alt keycode 165 = Console_10 keycode 164 = F11 shift keycode 164 = F23 control keycode 164 = F35 alt keycode 164 = Console_11 keycode 163 = F12 shift keycode 163 = F24 control keycode 163 = F36 alt keycode 163 = Console_12 keycode 113 = F13 alt keycode 113 = Console_13 keycode 114 = F14 alt keycode 114 = Console_14 keycode 115 = F15 alt keycode 115 = Console_15
 * 1) Top row
 * 2) Back
 * 1) Wifi on/off
 * 1) Bluetooth on/off
 * 1) Touchpad off
 * 1) Brightness down
 * 1) Brightness up
 * 1) Auto brightness
 * 1) Camera
 * 1) Browser
 * 1) Settings
 * 1) Media: previous
 * 1) Media: play/pause
 * 1) Media: next
 * 1) Mute
 * 1) volume down
 * 1) Volume up
 * 1) Lock screen
 * 2) keycode 142 = SysRq

keycode 172 = Alt keycode 217 = Alt keycode 139 = Alt
 * 1) Bottom row
 * 2) Home
 * 1) Search
 * 1) Menu

Now edit your /etc/conf.d/keymaps and change the default keymap like this: keymap="/etc/tf700/tf700.map"

Done!

Fixing the keyboard layout in X (easy way)
This is a bit more complex, because we need to patch the xkeyboard-config package. I have prepared a pre-patched source for it that you can download from here. In case you want to grab and patch the latest sources, check the following paragraph.

We will be reinstalling it on top of the current portage ebuild, which is ugly and not very nice. Unless somebody more practical than me is willing to create an ebuild and, maybe, can share it with us, this what we are going to do.


 * Unpack the sources into /root (for example)
 * get into the source folder and configure it: ./configure --with-xkb-base="/usr/share/X11/xkb" --enable-compat-rules --disable-runtime-deps --with-xkb-rules-symlink=xorg
 * The usual: make && make install

We are done here too.

Fixing the keyboard layout in X (hard way)
If you prefer, go ahead and patch the sources yourself. // translation from evdev scancodes to something resembling xfree86 keycodes. default xkb_keycodes "tf700dock" { minimum = 8; maximum = 255;  = 94;  = 49;  = 10;  = 11;  = 12;  = 13;  = 14;  = 15;  = 16;  = 17;  = 18;  = 19;  = 20;  = 21;  = 22;  = 23; <AD01> = 24; <AD02> = 25; <AD03> = 26; <AD04> = 27; <AD05> = 28; <AD06> = 29; <AD07> = 30; <AD08> = 31; <AD09> = 32; <AD10> = 33; <AD11> = 34; <AD12> = 35; <BKSL> = 51; alias <AC12> = <BKSL>; <RTRN> = 36; <CAPS> = 66; <AC01> = 38; <AC02> = 39; <AC03> = 40; <AC04> = 41; <AC05> = 42; <AC06> = 43; <AC07> = 44; <AC08> = 45; <AC09> = 46; <AC10> = 47; <AC11> = 48; <LFSH> = 50; <AB01> = 52; <AB02> = 53; <AB03> = 54; <AB04> = 55; <AB05> = 56; <AB06> = 57; <AB07> = 58; <AB08> = 59; <AB09> = 60; <AB10> = 61; <RTSH> = 62; <LALT> = 225; // Search - Left Alt <LCTL> = 37; <SPCE> = 65; <RCTL> = 105; <RALT> = 108; <LWIN> = 180; // Home - Left Super <RWIN> = 134; <COMP> = 135; alias <MENU> = <COMP>; <ESC> = 166;  // Escape  - Back key <FK01> = 246; // F1      - Wifi <FK02> = 245; // F2      - Bluetooth <FK03> = 68;  // F3      - Touchpad <FK04> = 232; // F4      - Backlight less <FK05> = 233; // F5      - Backlight more <FK06> = 69;  // F6      - Backlight auto <FK07> = 220; // F7      - Screenshot <FK08> = 158; // F8      - Browser <FK09> = 70;  // F9      - Setting <FK10> = 173; // F10     - Previous track <FK11> = 172; // F11     - Start/Stop track <FK12> = 171; // F12     - Next track <MUTE> = 121; <VOL-> = 122; <VOL+> = 123; <UP> = 111; <LEFT> = 113; <DOWN> = 116; <RGHT> = 114; <NMLK> = 77; <KPDV> = 106; <KPMU> = 63; <KPSU> = 82; <KP7> = 79; <KP8> = 80; <KP9> = 81; <KPAD> = 86; <KP4> = 83; <KP5> = 84; <KP6> = 85; <KP1> = 87; <KP2> = 88; <KP3> = 89; <KPEN> = 104; <KP0> = 90; <KPDL> = 91; <KPEQ> = 125; <FK13> = 191; <FK14> = 192; <FK15> = 193; <FK16> = 194; <FK17> = 195; <FK18> = 196; <FK19> = 197; <FK20> = 198; <FK21> = 199; <FK22> = 200; <FK23> = 201; <FK24> = 202; };
 * grab the sources from [git://anongit.freedesktop.org/git/xkeyboard-config here (git)]
 * Decompress the sources
 * Create a file called tf700dock into the keycodes subfolder, with the following content:

tf700dock \ tf700dock = +tf700dock <configItem> tf700dock <_description>ASUS Transformer Prime TF700 Dock</_description> Asus </configItem>
 * Then modify the file keycodes/Makefile.am and add just before the README file:
 * Then modify the file rules/base.m_k.part and add anywhere you want the line:
 * Then modify the file rules/base.xml.in and add the following where you see fit:
 * now run autogen.sh to generate the configure scripts
 * go back to the previous paragraph and follow the instruction to configure, build and install.

Ready to reboot?
You can now reboot android and try out the dual boot, if all goes well, you will get to a grentoo login console prompt and you can login as root!

= First boot: setup network and X =

Our first boot will take us to the console prompt. The NVIDIA provided binary blob for the graphic driver has the nasty habit of not being able to go back to console after starting the X server, so if anything goes wrong you cannot go back. For this reason, it's better to do the first boot text-only and switch on the X server only after you have everythinf sorted out.

Setup networking
For the above mentioned issue, it's a good idea at this point to setup your network and your SSH server. If you followed all the instructions to setup the keyboard, you should have a working keyboard at this point in console, including the ESC key.

So, let's install and configure the network with NetworkManager (of course feel free to use any other method you prefer):
 * start ssh: /etc/init.d/sshd start
 * add sshd st boot: rc-update add sshd default
 * install network manager: emerge networkmanager
 * now use nmcli to connect to your preferred wifi: nmcli d wifi connect <your AP> password 

At this point if you loose the console for any reason you can always login remotely via SSH and reboot the tablet, no harm done to your microSD.

Try out X
First of all we need to setup a basic xorg.conf file which will work, this is mine as an example, copy it in a file called /etc/X11/xorg.conf:

Section "ServerLayout" Identifier   "Layout0" Screen     0 "ScreenLVDS" 0 0 EndSection

Section "Extensions" Option "Composite" "Enable" EndSection

Section "Module" Load "glx" Load "record" Load "i2c" EndSection

Section "Screen" Identifier   "ScreenLVDS" Device       "DeviceLVDS" Monitor      "MonitorLVDS" DefaultDepth  24 EndSection

Section "Device" Identifier   "DeviceLVDS" Driver       "tegra" Option       "ARGBHWCursor" Option	 "RenderAccel" "true" Option	 "AllowGLXWithComposite" "true" Option       "Monitor-HDMI-1"  "MonitorHDMI" EndSection

Section "Monitor" Identifier   "MonitorLVDS" VendorName   "Nvidia" ModelName    "T33 Tegra3" Option       "DPMS" "true" DisplaySize  218 136 EndSection

Section "Monitor" Identifier   "MonitorHDMI" VendorName   "Nvidia" ModelName    "T33 Tegra3" Option       "DPMS" "true" EndSection

Section "InputClass" Identifier      "catched touchpad" Driver          "multitouch" MatchDevicePath "/dev/input/event*" MatchProduct   "elantech_touchscreen"

Option "CorePointer" "true" EndSection

Section "InputClass" Identifier      "catched touchscreen" Driver          "mtev" MatchDevicePath "/dev/input/event*" MatchProduct   "elan-touchscreen"

Option "CorePointer" "true" EndSection

Section "InputClass" Identifier     "tf700 keyboard" Driver         "evdev" MatchDevicePath "/dev/input/event*" MatchIsKeyboard "true" MatchProduct   "asusdec"

Option "AutoRepeat"  "200 50" Option "XkbModel" "pc104" Option "XkbLayout" "us" EndSection

It will also configure the touchscreen and the trackpad. Yes you need also to specify the tegra driver as it will NOT be detected automatically.

At this point, type X and enjoy your first X server on the TF700T. If everything goes well, you should get an X working! Type CTRL+ALT+BACKSPACE (or type CTRL+ALT+F1 to switch back to console and then type CTRL+C). Of course your console will be borked and unsuable, but if you just type reboot it should reboot...

So if you got the working X, you can proceed. If, otherwise, you got errors check your /var/log/Xorg.0.log file for errors and fix them. If you got a garbled/unusable screen, well, check a few things:
 * you are using an ARMv7 hardfp Gentoo stage3 (a softfp will NOT work)
 * the tegra_drv.so you are using matches the same ABI of your xorg (ex. xorg v.12 requires the v.12 tegra_drv.so)
 * ... try to look for help, but it will be hard, since not many and playing with Gentoo on the TF700T. Still the Gentoo forums might be a good place to start at least to work out possible Gentoo-general issues.

Install LXDE and slim
I assume you can now start a working X server, well you now need somthing to use it with.

Due to the limited RAM and slow storage, my recomendation goes to a clean LXDE installation. As a bonus point LXTerminal seems to be basically the only terminal which adapts properly to the odd DPI size of the tablet!

Also we need a login manager. For some reason loggin in is a slow process, with at least one or two seconds delay between username and password... i guess it's due to the slow storage, but i find the best way to overcome this is setup an autologging display manager. Yes some of you might don't like it, just skip the "slim" part and propose here your valid alternative.

So, let's proceed, sfter you have your WiFi turned on of course:
 * Install LXDE, be patient, take a bath, have dinner and sleep a bit: emerge lxde-meta (you might have to unmask some packages here for arm)
 * Install slim: emerge slim
 * Set slim as your default XDM in /etc/conf.d/xdm
 * Configure slim for autologin by editing file /etc/slim.conf, check the two values default_user and auto-login

It's worth to do one last experiment before setting slim to start on boot, try it manually:
 * /etc/init.d/xdm start

If all goes well, you are in your new shimy LXDE session! At this point we can setup automatic X startup at boot:
 * rc-update add xdm default

Now you can play around with X... you will immediately notice a few things like, there is no battery indicator, then you close the lid strange things will start happening on the screen, and so on. Read on to fix these issues.

Lock screen and bind keys
You don't notice on Android, but then you close the lid Android will automatically lock your screen, which means actually it will lock your TOUCH screen. Linux does not do it for you, so you must set it up manually.

Also, it's handy to be able to use those "useless" volume keysm for example to regulare screen brightness... We can use xbindkeys to achieve all this, keep reading...

First of all install the tools: emerge xbindkeys xinput.

Now, create these two scripts under /etc/tf700:

Create /etc/tf700-lock-screen.sh: if [ $(xinput --list-props 8 | grep Enabled | cut -d: -f 2) -gt 0 ] then xinput disable 8 xinput disable 9 cat /sys/class/backlight/pwm-backlight/brightness > /tmp/.lock_touchscreen_last_brightness echo 0 >> /sys/class/backlight/pwm-backlight/brightness else LAST_BRIGHTNESS=100 if [ -e /tmp/.lock_touchscreen_last_brightness ] then LAST_BRIGHTNESS=$(cat /tmp/.lock_touchscreen_last_brightness) fi xinput enable 8 xinput enable 9 echo $LAST_BRIGHTNESS >> /sys/class/backlight/pwm-backlight/brightness fi
 * 1) !/bin/bash

This script will lock the screen by disabling touchpad and touchscreen, and turns off the screen by setting the brightness to zero.vBy the way this is the only way to turn your screen black, beware DO NOT use any screensaver, and DO NOT use any apm/dpms related methods to turn your diplay off, as 75% of the times this will hang your tablet and wil require an hard-reset to reboot!

And create /etc/tf700/brightness.sh: tf700t tf700 # ls brightness.sh lock_touchpad.sh  SpecialKeysX  tf700.map tf700t tf700 # cat brightness.sh CURRENT=$(cat /sys/class/backlight/pwm-backlight/brightness) MIN=5 MAX=$(cat /sys/class/backlight/pwm-backlight/max_brightness) if [ "$1" == "" ] then echo $CURRENT else if [ $1 -gt 0 ] then CURRENT=$(expr $CURRENT + $1 ) elif [ $1 -lt 0 ] then CURRENT=$(expr $CURRENT + $1 ) fi if [ $CURRENT -ge $MIN -a $CURRENT -le $MAX ] then echo $CURRENT >> /sys/class/backlight/pwm-backlight/brightness fi fi This script will let you turn up and down the screen brightness.
 * 1) !/bin/bash

To bind these scripts to the power button and the sound volume buttins, add this to your ~/.xbindkeys file: "/etc/tf700/lock_touchpad.sh" m:0x0 + c:124 XF86PowerOff

"/etc/tf700/brightness.sh -10" m:0x0 + c:122 XF86AudioRaiseVolume

"/etc/tf700/brightness.sh 10" m:0x0 + c:123 F12

Then add xbindkeys to LXDE startup, and now you can safely close yout lid, just remmber to press the lock button before!

Conky
The proprietary NVIDIA drivers provides you with many more details like battery status... We would like to know how much battery we have left! I find conky a nifty little tool, so let's use it here:



= References =
 * Previous attempt by Andrew Church
 * XDA discussion on TTF700T multiboot
 * Tegra3 cardhu release page
 * NVIDIA Tegra3 drivers download link