2017年8月13日星期日

tmux shortcut key

General Operation:
ctrl-b ? List combination key, press q to quit
ctrl-b x Exit curent panel / window

Panel Operation:
ctrl-b % Split panel (horziontal)
ctrl-b “ Split panel (vertical)
ctrl-b (arrow key) Switch panel
ctrl-b ctrl-(arrow key) Adjust panel size per 1 unit
ctrl-b alt-(arrow key) Adjust panel size per 5 unit
ctrl-b z Maximize current panel (restore to original panel size if issue this key again)
ctrl-b (page up | page down) Scroll up / scroll down
ctrl-b alt-o Rotate panel clockwise
ctrl-b ctrl-o Rotate panel anti-clockwise

Window Operation:
ctrl-b c Create window
ctrl-b , Rename window
ctrl-b . Rename window ID
ctrl-b (num key) Switch window according to window ID
ctrl-b p Switch to previous window
ctrl-b n Switch to next window

apt-get install is locked

https://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process 
 
sudo apt-get install ???
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
 
Issue below command to solve the problem: 
$sudo rm /var/lib/apt/lists/lock

2017年8月8日星期二

Build Android from Source

1) Establish build environment
https://source.android.com/source/initializing

Ubuntu-16.04 64bit in VirtualBox
Increase swap size if system memory is small (e.g.: 3GB system memory with 18GB swap)
Recommend 180GB or above disk space

$sudo apt-get update
$sudo apt-get install openjdk-8-jdk

$sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip

[ Optional ] Install openjdk-7 for old ver AOSP (e.g. 5.x - lollipop)
$sudo add-apt-repository ppa:openjdk-r/ppa
$sudo apt-get update
$sudo apt-get install openjdk-7-jdk
$sudo update-java-alternatives -l
##set jname
$sudo update-java-alternatives -s java-1.7.0-openjdk-amd64

2) Download the source
https://source.android.com/source/downloading

$mkdir ~/bin
$PATH=~/bin:$PATH

$curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$chmod a+x ~/bin/repo 

$mkdir -p android
$cd android
$git config --global user.name "Your Name"
$git config --global user.email "you@example.com"
$repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.2_r27
$repo sync

[ Remark] Please ignore the following error message:
*curl: (22) The requested URL returned error: 404* *Server does not provide clone.bundle; ignoring.*

3) Preparing to Build
https://source.android.com/source/building

$. build/envsetup.sh

[ Remark ] Increase heap size to avoid the following error message.
Cannot connect to jack-server / heap size is small.
$export PATH=$PATH:~/.jack-server
$export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
$./prebuilts/sdk/tools/jack-admin kill-server
$./prebuilts/sdk/tools/jack-admin start-server


[ Remark ] Apply the patch first if using lolllipop version:
https://stackoverflow.com/questions/36048358/building-android-from-sources-unsupported-reloc-43/36073635

[Remark] Remember to clean the project after the makefile (*.mk) or configuration is changed
$make clean

$lunch
$make -j4


[ Remark ] Since pre-built libwebviewchromium.so module does NOT exist in the lollipop or previous version, it takes long time to build this module.

After success, the img can be found at:
<aosp>/out/target/product/<target>/