Community Workspace/Tegra3/Nexus7/PA installation

= Plasma Active for Nexus 7 =

Disclaimer
Please be warned that, by following the instructions stated here, you will lose the warranty on your Nexus 7. Furthermore, you might damage or destroy your Nexus 7 or even worse. You do all the things described here on your own responsibility.

Event though very much already works reasonably well, there are still some glitches. So, please don’t expect a 100% working system.

Installation Choices
There are two ways to install Plasma Active.
 * You can entirely replace Android and have Plasma Active as the sole operating system on the device
 * You can leave Android on the device and install Plasma Active as an additional operating system with Multirom.

Download Plasma Active image and MOSLO
You can get the current version of Plasma Active for Nexus 7 including the MOSLO at http://download.kde.org/unstable/active/3.0/images/nexus7/.

You will need the “plasma-active-*.tar.bz2″ as well as the “moslo-nexus7-*.tar.gz” files. The “*.ks” file is the file that was used to create the rootfs tarball (“*.tar.bz2″).

Extract moslo-nexus7-*.tar.gz

Unlock the bootloader
In order to install Plasma Active on the Nexus 7 you need first to unlock the bootloader. Warning: Unlocking the bootloader erases all data and resets the device to factory defaults. Note that you need the fastboot tool to perform the unlocking and further installation. You can get it from Android Platform Tools for example. Many Linux distributions already provide these tools in their repositories.

1. Reboot the Nexus 7 into the boot loader mode. To do this, first power down the device in the normal fashion (hold down the power button, then select power off and wait a few seconds). From the off state, hold the volume down button and press the power button. Continue holding the volume down and power buttons until you see the boot loader interface.

2. Plug in the device to your computer with a micro-USB cable.

3. Verify that fastboot lists the device:

$ sudo fastboot devices

You should see the device code shown.

4. Initiate the booltoader unlocking:

$ sudo fastboot oem unlock

You will be prompted on the tablet's screen to unlock the bootloader. Follow the on-screen directions to continue.

5. Complete the process by rebooting:

$ sudo fastboot reboot-bootloader

Or simply press the power button. When the device reboots back into the bootloader (fastboot mode), you should see "LOCK STATE - UNLOCKED" in small red print. At this point Nexus 7 is unlocked.

MOSLO
After you unlocked the bootloader (and rebooted keeping the volume down key pressed), you should see the Nexus 7 bootloader showing “Start”.

Makre sure you connected the Nexus 7 to your PC with the USB cable and that no other USB devices are plugged-in. Perform the flashing of MOSLO:

$ sudo fastboot -c "ro console=tty1 rootwait rootfstype=ext4" flash:raw boot zImage-moslo initrd-moslo

You could also specify options like “fbcon=rotate:1″ for rotating the kernel output into landscape or “quiet” for suppressing kernel output. Another way to suppress some but not all output is to set loglevel=4. For the first tests it is strongly suggested to keep the kernel command line as-is.

Install PA
When flashing of the MOSLO succeeded keep the Nexus 7 connected to your computer and press the power button in order to boot into MOSLO. With the Nexus 7 connected to your computer via USB, MOSLO should automatically export the userdata partition as USB storage device. You can check, e.g., via “dmesg | tail -n 30” that a new USB device showed up. This device can be /dev/sdb or something else depending on your system. Warning: pay close attention to what this device really is! Using a wrong device can be dangerous, since it will wipe the data it contains by rewriting it with the PA image. For the sake of example we use /dev/sdX below.

In this short guide we will use the entire userdata partition and don’t set up multiboot. At first we format the userdata partition as ext4 file system:

# /dev/sdX is where the exported userdata partition showed up. pa_partition=/dev/sdX sudo mkfs.ext4 $pa_partition

Next, we mount the userdata partition and extract the rootfs tarball to it:

sudo mount $pa_partition /mnt/foo cd /mnt/foo sudo tar xvf /path_to_pa_image/plasma-active-nexus7-*.tar.bz2 sync cd - sudo umount /mnt/foo

Boot PA
In order to boot into Plasma Active simply detach the Nexus 7 from your computer by pulling the USB cable. MOSLO should detect this and initiate the kexec hardboot procedure. You should see a notice that the device will reboot in 5 seconds. Do not press any key during reboot.

The device then reboots and the same bootloader “Start” screen should appear as at the beginning. This time simply press the power key. Your Nexus 7 should now boot into Plasma Active. Please note that I could successfully test this procedure with the 8GB model. However, it failed with the 3G 32GB model.

If there are problems booting into Plasma Active this way you can try to restart the device holding down the volume down key. When the bootloader screen appears you can then try to directly boot into Plasma Active with the MOSLO kernel as follows:

# For the non-3G models X is 9. $ X=9 # For the 3G model X is 10. $ X=10 $ sudo fastboot -c "root=/dev/mmcblk0p${X} ro console=tty1 rootwait rootfstype=ext4" boot zImage-moslo

Note that when you reboot Plasma Active your device will reboot twice. At first the MOSLO will be booted which then performs a kexec hardboot and reboots into the actual Plasma Active.

If you don’t need the MOSLO and want to boot directly into Plasma Active on reboot you can do this permanently by flashing the MOSLO kernel as follows:

# For the non-3G models X is 9. $ X=9 # For the 3G model X is 10. $ X=10 $ sudo fastboot -c "root=/dev/mmcblk0p${X} ro console=tty1 rootwait rootfstype=ext4" flash:raw boot zImage-moslo

You can re-install the MOSLO at any time later without any problem. You can also temporarily boot into MOSLO by following the MOSLO installation instructions above and leaving out “flash:raw”.

Choosing repositories
TODO: add info on testing / devel and etc. choice of Plasma Active Mer respositories

Installing Plasma Active as an Additional Operating System ( with MultiRom )
This installation method is pulled from tidbits on the following webpages. Please consult them if any of it is unclear.


 * http://www.geek.com/articles/mobile/how-to-unlock-and-root-the-nexus-7-2012081/
 * http://forum.xda-developers.com/showthread.php?t=2011403
 * http://forum.xda-developers.com/showthread.php?t=2093797
 * http://ruedigergad.com/2012/12/21/plasma-active-for-nexus-7-running-the-touch-optimized-plasma-active-linux-distribution-on-nexus-7/

Unlock the Boot Loader
Use the same instructions as above in the single operating system install section

Flash TWRP Recovery
Download a modified TWRP recovery from http://www.mediafire.com/?k9mb1135vi6760b (TWRP 2.4.4.0) onto your PC and flash it

$ sudo fastboot reboot-bootloader

$ sudo fastboot flash recovery TWRP_multirom_n7_20130312.img

Install MultiRom
Multirom will be installed from recovery, so download it from android.

MultiROM v9: http://www.mediafire.com/?ye4e435sck8phet

Multirom relies on kexec, so you'll need an android kernel that supports it.

http://www.mediafire.com/?2obaeg0bxbow4jo ( for 4.2)

Reboot into recovery and flash multirom and the new android kernel ( from twrp )

Reboot the tablet to make sure that multirom is working. It should boot into multirom every time. "Internal" is your android operating system.

Install Plasma Active
Clone the plasma multirom packer on your PC

git clone https://github.com/Tasssadar/plasma_multirom_packer.git

Change to the new directory and run the create.sh script as root with the plasma tarball as an argument

cd plasma_multirom_packer/ sudo ./create.sh URL   # Replace URL with plasma active tarball from http://files.kde.org/plasma/active/3.0/images/nexus7/

The new image will be created in the current directory. Copy it to the root of the Nexus 7's filesystem and reboot into recovery. Go to Advanced > MultiROM > Add ROM, choose "MultiROM installer (*.mrom files) and tap next. Choose the image you copied over, and follow the prompts.