Skip to content

Instantly share code, notes, and snippets.

View bhavanavadodariya1's full-sized avatar

bhavanavadodariya1

View GitHub Profile
@bhavanavadodariya1
bhavanavadodariya1 / java_ubuntu_diff_version_set.js
Last active March 6, 2019 10:16
Set different Java versions on different Terminals on Ubuntu 14.04 LTS
Bhavana@Ubuntu:~$ update-alternatives --list java
// Output will be: List of all installed Java versions
// Copy path of Java 7 and add it to PATH variable
Bhavana@Ubuntu:~$ export PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin:$PATH
// Now for this current window, Java version will be 7
// Open second Terminal
Bhavana@Ubuntu:~$ export PATH=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:$PATH
// For this second Terminal, Java version will be 8
@bhavanavadodariya1
bhavanavadodariya1 / java_ubuntu_set_ver_curr_session.js
Last active March 6, 2019 10:14
Set default Java version for current session until you shutdown the system, on Ubuntu 14.04 LTS
Bhavana@Ubuntu:~$ java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-2~14.04-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
Bhavana@Ubuntu:~$ sudo update-alternatives --config java
[sudo] password for Bhavana:
There are 4 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
@bhavanavadodariya1
bhavanavadodariya1 / java_ubuntu_set_default.js
Last active March 6, 2019 10:02
Set default Java versions on Ubuntu 14.04 LTS
// Suppose default java version is 7
Bhavana@Ubuntu:~$ java -version
java version "1.7.0_181"
OpenJDK Runtime Environment (IcedTea 2.6.14) (7u181-2.6.14-0ubuntu0.2)
OpenJDK 64-Bit Server VM (build 24.181-b01, mixed mode)
// Now you want to change it to 8.
Bhavana@Ubuntu:~$ sudo nano ~/.bashrc
// It could be bash or bashrc or any other file, as you have set
// in bashrc file; search JAVA_HOME, create if variable doesn't exist
@bhavanavadodariya1
bhavanavadodariya1 / java_ubuntu_list.js
Last active March 20, 2019 09:33
Display list of installed Java versions with details on Ubuntu 14.04 LTS
// Simply show list of installed versions in single line
Bhavana@Ubuntu:~$ update-alternatives --list java
/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
/usr/lib/jvm/java-6-openjdk-i386/jre/bin/java
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
// To see information like; current default Java version,
// all installed Java versions with there location details, best version etc...
Bhavana@Ubuntu:~$ update-alternatives --display java
@bhavanavadodariya1
bhavanavadodariya1 / repo_git_install.js
Last active March 26, 2019 09:41
To download AOSP source code, first we need to install repo tool.
// Install repo
Bhavana@Ubuntu:~$ mkdir ~/bin
Bhavana@Ubuntu:~$ PATH=~/bin:$PATH
Bhavana@Ubuntu:~$ curl https://storage.googleapis.com/git-repo-downloads/repo > repo
Bhavana@Ubuntu:~$ mv repo ~/bin/
// Install git
Bhavana@Ubuntu:~$ sudo apt-get install git
@bhavanavadodariya1
bhavanavadodariya1 / initialize_aosp.js
Created March 26, 2019 09:43
Initialize downloading AOSP source code for Marshmallow - android- 6.0.1_r77
$ mkdir nexus5
$ cd nexus5
$ repo init -u https://android.googlesource.com/platform/manifest -b android- 6.0.1_r77
// You might prompt for email authentication, use the following command: 
// git config --global user.email "you@domain.com"
// git config --global user.name "FName LName"
$ repo sync
// it will take looooong time…and more bandwidth too
@bhavanavadodariya1
bhavanavadodariya1 / aosp_driver.js
Last active March 26, 2019 09:48
Download driver for respective AOSP source code for h/w
$ mkdir nexus5_driver
$ cd nexus5_driver
$ wget https://dl.google.com/dl/android/aosp/broadcom-hammerhead-m4b30z-21cf8433.tgz (Copied Link address)
$ wget https://dl.google.com/dl/android/aosp/lge-hammerhead-m4b30z-520d054d.tgz
$ wget https://dl.google.com/dl/android/aosp/qcom-hammerhead-m4b30z-d6c0fe26.tgz
$ ls → You will get three zipped files; feed one by one to below commands
$ tar xvzf broadcom-hammerhead-m4b30z-21cf8433.tgz
$ tar xvzf lge-hammerhead-m4b30z-520d054d.tgz
$ tar xvzf qcom-hammerhead-m4b30z-d6c0fe26.tgz
$ ls → will show you 3 .sh files
@bhavanavadodariya1
bhavanavadodariya1 / drive_sh.js
Created March 26, 2019 09:51
Add driver into AOSP source code
$ cd ~/nexus5
$ sh /FULL_PATH/nexus5_driver/extract-broadcom-hammerhead.sh
// This will redirect you to licensing page, click enter, enter….at the end you have to type I ACCEPT. Follow for all three .sh files.
$ sh /FULL_PATH/nexus5_driver/extract-lge-hammerhead.sh
$ sh /FULL_PATH/nexus5_driver/extract-qcom-hammerhead.sh
@bhavanavadodariya1
bhavanavadodariya1 / build_aosp.js
Created March 26, 2019 09:51
Build AOSP source code
$ source build/envsetup.sh
$ lunch → aosp_hammerhead-userdebug (Choose as per requirement)
$ make clobber
$ make