Thursday, July 13, 2017

Flash Slim7 Rom to my Nexus 9

Due to the very lagging of my Nexus9, I decide to flash a new custom ROM into it.

1. Backup necessary files.

2. Download slim7 and open Gapps from official webpage, Keep them zipped files and do not unzip them.
The version I used is
Slim-flounder-7.1.2.build.1.0-STABLE-20170629-0835.zip
open_gapps-arm64-7.1-stock-20170713.zip
Make sure you choose arm64 for Nexus9 in open Gapps webpage.


3. Install ADB and Fastboot tools and google driver
3.1 I consulted this post
https://forum.xda-developers.com/showthread.php?p=67779874#post67779874
but only find the google driver is working, for the adb, fastboot tools I cannot find them, nor run them from cmd.

3.2 Then I consulted this post
https://forum.xda-developers.com/google-nexus-5/general/guide-nexus-5-how-to-unlock-bootloader-t2507905
actually, you don't really need to download the whole sdk, in the download webpage whick is :
https://developer.android.com/studio/index.html#download
scroll down to "Get just the command line tools", download windows version and place it in a proper fold.

3.3 Unzip the file,( rename it to sdk-tools) and enter sdk-tools/tools/bin. In this fold, open a cmd window, type
>.\sdkmanager.bat --listyou shall see all available packages you can install. You can read how to use this command line tool from here
https://developer.android.com/studio/command-line/sdkmanager.html
or just follow my steps.
>.\sdkmanager.bat "platform-tools"
>.\sdkmanager.bat "extra;android;m2repository"
>.\sdkmanager.bat "extra;google;usb_driver" //I didn't install it since I have it installed from step 3.1. If you have any problem please refer to the post I mentioned in step 3.2.
After this, you shall see adb.exe, fastboot.exe tools in /sdk-tools/platform-tools fold.

4. Unlock bootloader
4.1 Power off device, then hold vol+ and power button together to turn on the device into bootloader/fastboot mode.

4.2 connect device to PC via USB, then under /sdk-tools/platform-tools fold, open a cmd window, type
>.\fastboot.exe devicesthen you shall see it lists your device there, otherwise please check the post above to detect questions.
Then type
>.\fastboot.exe oem unlockOn the device screen, you shall use vol+ to choose yes and confirm. It shall show "erasing" on the screen then. After this process, you shall type this command
>.\fastboot.exe rebootIt will take some time, you just wait until it finishes booting to android.

5. Root and install custom recovery image TWRP
For this step I consulted the post here
https://forum.xda-developers.com/nexus-9/general/how-to-install-custom-recovery-root-t3200361
and the one in step 3.2.
A custom recovery image is used to replace system recovery tool. It has more powerful functions than default one, in my understanding.

5.1 Download TWRP and SuperSU.zip from these links:
https://dl.twrp.me/flounder/
https://download.chainfire.eu/696/SuperSU
put them into the fold where fastboot.exe is. Rename TWRP file as recovery.img

5.2 Power off device and enter bootloader/fastboot mode by holding vol+ and power button at start. Open a cmd window, type
>.\fastboot.exe boot recovery.imgWait until you enter TWRP, then you will see internal storage pops up in your PC and you can access the storage now. Move SuperSU.zip into device storage from PC.
Then in TWRP, press install option, select SuperSU.zip to install.

5.3 Reboot back into bootloader/fastboot mode, then in the PC cmd window, type
>.\fastboot flash recovery recovery.imgYou are now rooted and have TWRP installed.

6. We need to also flash matched vendor image and bootloader image. (I did not know this step at first, but had to do it after flashing the ROM, so I decide to put it this step)
Reference post here:
https://forum.xda-developers.com/nexus-9/development/rom-t3451480
http://nougatroms.blogspot.se/2017/06/nexus-9-anroid-7-nougat-rom.html

6.1 Download the vendor image and bootloader image from the second link above or just google the name

vendor-volantis-n9f27c.img
bootloader-flounder-3.50.0.0143.img

Put them into fastboot.exe located fold.

6.2 In cmd window, we first flash bootloader, type
>.\fastboot.exe flash bootloader bootloader-flounder-3.50.0.0143.img
>.\fastboot.exe reboot-bootloaderThen we flash vendor image, type
>.\fastboot.exe flash vendor vendor-volantis-n9f27c.img
7. Now we back up the system and flash ROM.
Again, reference post is
http://www.android.gs/install-slim6-alpha-marshmallow-rom-for-google-nexus-9/

7.1 Boot device into recovery mode.
Hold vol+ and power button to power it on and enter fastboot mode, on the screen you can choose HBOOT using vol button, then press power button to confirm, now you enter recovery mode and you can see TWRP interface.

7.2 Set backup
In TWRP, use "backup" option to do this.

7.3 Factory Reset
In TWRP, use "wipe" option to do this. Use the default set, only wipe the cache, data and Divky.

7.4 Install ROM and Gapps
Like before, you will see internal storage window pops up in PC. Please copy previously downloaded Slim and open Gapps zip files into device storage. Then in TWRP, use "install" option to choose the ROM file and then install until it finishes.
Then continue to install Gapps zip file until it finishes.

7.5 Reboot to normal mode. The first time Slim starts up shall take some time, just wait.
Now everything is done, just enjoy.


Monday, November 14, 2016

Install teamviewer 11 in ubuntu 16.10

There are problems when I try to install teamviewer in ubuntu 16.10, due to dependencies.
step 1. Download teamviewer 11 from official website.

step 2. In terminal, execute these commands:
            $sudo dpkg -i teamview*.deb
there will be errors appearing, and $sudo apt-get install -f does not solve the problem.

step 3. Manually install lost libraries in this way:
           $sudo apt-get install libdbus-1-3:i386 libasound2:i386 libexpat1:i386 libfontconfig1:i386 libfreetype6:i386 libjpeg62:i386 libpng12-0:i386 libsm6:i386 libxdamage1:i386 libxext6:i386 libxfixes3:i386 libxinerama1:i386 libxrandr2:i386 libxrender1:i386 libxtst6:i386 zlib1g:i386 libc6:i386

still it will remind you libpng12-0:i386 does not have a candidate to install. so we just skip this one, install the others.

step 4. Install libpng12-0
          It seems in ubuntu 16.10 they changed libpng12-0 to libpng16-16, but teamviewer relies on libpng12-0, so we manually install this one.
          download libpng12-0 from here: http://packages.ubuntu.com/xenial/i386/libpng12-0/download
then install it.
           $sudo dpkg -i libpng12-0*.deb
step 5. Reinstall teamviewer
           Now we can redo step 2 command, it shall work this time.

Sunday, October 4, 2015

prime-indicator problem

Machine: Ubuntu 14.04.3

Problem description:
When I start my Ubuntu today, I come across a problem that prime-indicator crashes with the error "TabError: inconsistent with tabs and spaces" something like this. prime-indicator is a tool used to switch between Intel graphics card and Nvidia graphics card.

Solves:
I guess this problem is related to python, and since I changed the default python to python3.4 and the original python version is python2.7. I did a command like this:

/usr/bin $ sudo rm python
/usr/bin $ sudo ln -s python3.4 python

now I know I shouldn't change the system's python version, instead, I can use alias command to change the default python version only in my account. So first of all I change back to default python which is linked with python2.7 and reboot, prime-indicator comes back!
Then I add this line to my .bashrc file

alias python='python3.4'

and then source .bashrc

Saturday, June 20, 2015

Install SimpleScalar in Ubuntu 12.04

This tutorial is based on Ubuntu 12.04.5LTS.
Reference links are :
http://www.cse.iitd.ernet.in/~drajeswari/ss_installn.html
https://zealoct.wordpress.com/2011/04/19/install-simplescalar-on-ubuntu-10-10-with-gcc-4-4/
http://harryscode.blogspot.de/2008/10/installing-simplescalar.html

I checked a lot of tutorials online and finally managed to install simplescalar3.0 on my Ubuntu 12.04, to save time for those who haven't find a successful way to install that , I just post my installing process here. It just worked for me and I am not sure if it would work for you. If you find any mistakes please tell me.


Step1:  install flex and bison
$ sudo apt-get install flex bison


Step2: Download the source code here:

SimpleScalar source package: http://csrl.unt.edu/downloads/simplescalar.tgz

ar tool:  http://www.ict.kth.se/courses/IS2202/ar
ranlib tool: http://www.ict.kth.se/courses/IS2202/ranlib

Step3: create directory and uncompress source code
$mkdir -p ~/opt/simplescalar

copy all the source packages to ~/opt fold and uncompress them, you should get simpletools-2v0.tgz; simpleutils-990811.tar.gz; simplesim-3v0d.tgz; gcc-2.7.2.3 and flex-2.5.4a. In this tutorial I don't use gcc-2.7 and flex-2.5.4a.

Extract simpletools-2v0.tgz and move all the folds into ~/opt/simplescalar
which includes f2c-1994.09.27; glibc-1.09; gcc-2.6.3; ssbig-na-sstrix and sslittle-na-sstrix.

Extract simpleutils-990811.tar.gz to ~/opt

Extract simplesim-3v0d.tgz to ~/opt


Step4: Set up installation
$ export HOST=i386-pc-linux
$export TARGET=sslittle-na-sstrix
$export IDIR=/home/yourname/opt/simplescalar            //path you want to install

Step5: We need to modify some source code
 
  • binutils-2.5.2/libiberty/functions.def Line: 36
    Action: comment out
    Line: 56
    Action: comment out
  • binutils-2.5.2/ld/ldlex.l
    Line: 476
    Action: change yy_current_buffer to YY_CURRENT_BUFFER
  • binutils-2.5.2/ld/ldmisc.c
    Line: 24
    Action: change varargs.h to stdarg.h Line: 343 356 388 400
    Action: change all four functions info_msg() einfo() minfo() finfo() like this:

    343 void info_msg(const char* fmt, va_list ap)
    344 //va_dcl
    345 {
    346 char *fmt;
    347 va_list arg;
    348 /* va_start(arg);
    349 fmt = va_arg(arg, char *);
    350 vfinfo(stdout, fmt, arg);
    351 va_end(arg); */
    352 }
  • gcc-2.6.3/cccp.c
    Line: 194
    Action: comment out
  • gcc-2.6.3/cp/g++.c
    Line: 90
    Action: comment out
  • gcc-2.6.3/sdbout.c
    Line: 56
    Action: replace the whole line with ”#if 0”
  • gcc-2.6.3/gcc.c
    Line: 172
    Action: comment out

  • cp ./patched/sys/cdefs.h ../sslittle-na-sstrix/include/sys/cdefs.h  (To avoid error looking like "Fix these errors in the source :").
  • cp $IDIR/sslittle-na-sstrix/lib/libc.a $IDIR/lib/
  • cp $IDIR/sslittle-na-sstrix/lib/crt0.o $IDIR/lib/
  • Copy files ar & ranlib into $IDIR/sslittle-na-sstrix/bin (To avoid "buffer overflow" error involving ar or ranlib)

Step6: Install simplescalar utils
$cd ~/opt/simpleutils-990811
$./configure --host=$HOST --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$IDIR
$make
$make install

Step7: Install simplescalar
$cd  simplesim-3.0
$make config-pisa
$make
You will see "my work is done!" here.
$mv ../simplesim-3.0 ~/opt/simplescalar

Step8: Install gcc2.6
$export PATH=$PATH:$IDIR/sslittle-na-sstrix/bin
$cd ~/opt/gcc-2.6.3

Edit Makefile and add -I/usr/include to the end of line 130.

$./configure --host=$HOST --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$IDIR
$make LANGUAGE=c

after this, you would receive an error that lies in insn-output.c, here, once again you need to modify the source file of gcc-2.6.3
  • gcc-2.6.3/insn-output.c
    Line: 675 750 823
    Action: and a ‘\’ to the end of the line, and it will be

    675 return "FIXME\n\
    750 return "FIXME\n\
    823 return "FIXME\n\
note that insn-output.c is generated by flex automatically, and your modification would be lost every time you make clean
now, finally the gcc was able to compiled with no errors and there are two more steps.
$$IDIR/simplesim-3.0/sim-safe ./enquire -f >! float.h-cross
$ make install


Step9:Test
$opt/simplescalar/bin/sslittle-na-sstrix-gcc hello.c
$opt/simplescalar/simplesim-3.0/sim-safe a.out