Skip to content

Instantly share code, notes, and snippets.

@drhuffman12
Last active August 29, 2015 14:07
Show Gist options
  • Save drhuffman12/59c0a355a70feaddca1b to your computer and use it in GitHub Desktop.
Save drhuffman12/59c0a355a70feaddca1b to your computer and use it in GitHub Desktop.
Upgrade gnuroot wheezy on android x86 to jessie and add Java, JRuby, Android SDK, and Ruboto gem
#
apt-get update | apt-get upgrade
# Install ant and dependancies. [Ignore errors about "libjli.so" missing; it appears to be a soft vs hard float java issue. We will replace Java in a later step.]
apt-get install ant -y
# Download Oracle Jdk 8 for Linux 32bit from: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
# ... The download should be a file like: jdk-8u20-linux-i586.tar.gz
# Download JRuby from: http://www.jruby.org/download
# ... The download should be a file like: jruby-bin-1.7.16.tar.gz
# Download Android JDK from: https://developer.android.com/sdk/installing/index.html
# ... The download should be a file like: android-sdk_r23.tar
# Install 'GNURoot' and 'GNURoot Wheezy x86' from app store, see:
# [gnuroot app](https://play.google.com/store/apps/details?id=champion.gnuroot&hl=en)
# [gnuroot repo](https://github.com/corbinlc)
# Launch GNURoot, create Wheezy x86 image, and launch wheezy as 'fake root'
# Prep dev folder:
mkdir /_dev_
cd /_dev_
# Pull in JDK:
cp /sdcard/Download/jdk-8u20-linux-i586.tar.gz .
tar -zxvf jdk-8u20-linux-i586.tar.gz
# chmod 777 jdk1.8.0_20/bin/*
# Pull in JRuby:
cp /sdcard/Download/jruby-complete-1.7.16.jar .
cp /sdcard/Download/jruby-bin-1.7.16.tar.gz .
tar -zxvf jruby-bin-1.7.16.tar.gz
# chmod 777 jruby-1.7.16/bin/*
# Pull in Android SDK:
cp /sdcard/Download/android-sdk_r23.tar .
tar -zxvf android-sdk_r23.tar
# Verify JRuby:
/_dev_/jdk1.8.0_20/bin/java -jar jruby-complete-1.7.16.jar -v
# jruby 1.7.16 (1.9.3p392) 2014-09-25 575b395 on Java HotSpot(TM) Server VM 1.8.0_20-b26 +jit [linux-i386]
# Append path variables:
# /etc/environment
echo "DEV_HOME=/_dev_" >> /etc/environment
echo "JAVA_HOME=\$DEV_HOME/jdk1.8.0_20" >> /etc/environment
echo "JRUBY_HOME=\$DEV_HOME/jruby-1.7.16" >> /etc/environment
echo "PATH=\$PATH:\$JAVA_HOME/bin:\$JRUBY_HOME/bin" >> /etc/environment
#... doesn't seem to work, so set your terminal's intial command to:
_JAVA_OPTIONS="-Xms256m -Xmx256m" && JRUBY_OPTS=--2.0 && DEV_HOME=/_dev_ && JAVA_HOME=$DEV_HOME/jdk1.8.0_20 && JRUBY_HOME=$DEV_HOME/jruby-1.7.16 && ANDROID_HOME=$DEV_HOME/android-sdk-linux && PATH=$JAVA_HOME/bin:$JRUBY_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platforms:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/19.1.0:$ANDROID_HOME/build-tools/19.0.0:$PATH && export _JAVA_OPTIONS && export JRUBY_OPTS && export DEV_HOME && export JAVA_HOME && export JRUBY_HOME && export ANDROID_HOME && export PATH
# log out and log back in
# Verify Java:
# cd jdk1.8.0_20/bin
# ./java -version
java -version
# java version "1.8.0_20"
# Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
# Java HotSpot(TM) Server VM (build 25.20-b23, mixed mode)
# Verify JRuby
jruby -v --2.0
# jruby 1.7.16 (2.0.0p195) 2014-09-25 575b395 on Java HotSpot(TM) Server VM 1.8.0_20-b26 +jit [linux-i386]
# Verify RubyGems version:
jgem -v
# 2.1.9
# Install Android SDK packages:
# android update sdk --no-ui --all --filter "sysimg-19"
# List available packages:
android list sdk --all
# ... review the list and use applicable package number. [e.g.: 1,2,8,16,57,71]
android update sdk -u -a -t 1,2,8,16,57,71
# sdk build tools 19.1.0:
android update sdk -u -a -t 4
# ...
# Installing Archives:
# Preparing to install archives
# Downloading Android SDK Platform-tools, revision 20
# Installing Android SDK Platform-tools, revision 20
# Stopping ADB server failed (code -1).
# Installed Android SDK Platform-tools, revision 2099%)
# Downloading Android SDK Build-tools, revision 19
# Installing Android SDK Build-tools, revision 19
# Installed Android SDK Build-tools, revision 1999%)
# Downloading SDK Platform Android 4.4.2, API 19, revision 4
# Installing SDK Platform Android 4.4.2, API 19, revision 4
# Installed SDK Platform Android 4.4.2, API 19, revision 497%)
# Downloading Android SDK Tools, revision 23.0.5
# Installing Android SDK Tools, revision 23.0.5
# Installed Android SDK Tools, revision 23.0.599%)
# Downloading Intel x86 Atom System Image, Android API 19, revision 2
# Installing Intel x86 Atom System Image, Android API 19, revision 2
# Installed Intel x86 Atom System Image, Android API 19, revision 299%)
# Downloading Google APIs (x86 System Image), Android API 19, revision 8
# Installing Google APIs (x86 System Image), Android API 19, revision 8
# Installed Google APIs (x86 System Image), Android API 19, revision 899%)
# Updated ADB to support the USB devices declared in the SDK add-ons.
# Stopping ADB server succeeded.
# Starting ADB server succeeded.
# null Done. 6 packages installed.
# android create avd
# You can create an AVD for API level 10 (which 'ruboto setup' gives you by default) via:
# android -s create avd -f -n Android_2.3.3 -t android-10 --sdcard 64M --abi armeabi
android -s create avd -f -n Android_4.4.2 -t android-19 --sdcard 256M --abi x86 -t 1
# Android 4.4.2 is a basic Android platform.
# Do you wish to create a custom hardware profile [no]no
# Created AVD 'Android_4.4.2' based on Android 4.4.2, Intel Atom (x86) processor,
# with the following hardware config:
# hw.lcd.density=240
# hw.ramSize=512
# hw.sdCard=yes
# vm.heapSize=48
android list target
# Available Android targets:
# ----------
# id: 1 or "android-19"
# Name: Android 4.4.2
# Type: Platform
# API level: 19
# Revision: 4
# Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
# Tag/ABIs : default/x86
# ----------
# id: 2 or "Google Inc.:Google APIs (x86 System Image):19"
# Name: Google APIs (x86 System Image)
# Type: Add-On
# Vendor: Google Inc.
# Revision: 8
# Description: Android x86 + Google APIs
# Based on Android 4.4.2 (API level 19)
# Libraries:
# * com.android.future.usb.accessory (usb.jar)
# API for USB Accessories
# * com.google.android.media.effects (effects.jar)
# Collection of video effects
# * com.google.android.maps (maps.jar)
# API for Google Maps
# Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
# Tag/ABIs : default/x86
android list avd
# Available Android Virtual Devices:
# Name: Android_4.4.2
# Path: /root/.android/avd/Android_4.4.2.avd
# Target: Android 4.4.2 (API level 19)
# Tag/ABI: default/x86
# Skin: WVGA800
# Sdcard: 256M
# Pull in Ruboto
gem install ruboto
# Fetching: chronic-0.10.2.gem (100%)
# Successfully installed chronic-0.10.2
# Fetching: fattr-2.2.2.gem (100%)
# Successfully installed fattr-2.2.2
# Fetching: arrayfields-4.9.2.gem (100%)
# Successfully installed arrayfields-4.9.2
# Fetching: map-6.5.5.gem (100%)
# Successfully installed map-6.5.5
# Fetching: coderay-1.1.0.gem (100%)
# Successfully installed coderay-1.1.0
# Fetching: slop-3.6.0.gem (100%)
# Successfully installed slop-3.6.0
# Fetching: method_source-0.8.2.gem (100%)
# Successfully installed method_source-0.8.2
# Fetching: spoon-0.0.4.gem (100%)
# Successfully installed spoon-0.0.4
# Fetching: pry-0.10.1-java.gem (100%)
# Successfully installed pry-0.10.1-java
# Fetching: main-5.3.2.gem (100%)
# Successfully installed main-5.3.2
# Fetching: rubyzip-1.1.6.gem (100%)
# Successfully installed rubyzip-1.1.6
# Fetching: ruboto-1.1.2.gem (100%)
# Successfully installed ruboto-1.1.2
# 12 gems installed
ruboto setup
# .. will prompt for license agreement .. accept
# .. will prompt for installation of android sdk level 15 [4.0.3] if not installed .. accept
# Java runtime : Found
# Java Compiler : Found
# Apache ANT : Found
# Android Package Installer: Found
# Android Emulator : Found
# Android SDK Command adb : Found
# Android SDK Command dx : Found
# Platform SDK android-15 : Found
#
# *** Ruboto setup is OK! ***
# gen sample app per "https://github.com/ruboto/ruboto/wiki/Creating-Your-First-Ruboto-Application"
mkdir /_dev_/my_ruboto_apps
cd /_dev_/my_ruboto_apps
ruboto gen app --package org.ruboto.example.quick_start
cd quick_start
rake
# copy the apk file to writable folder:
cp bin/QuickStart-debug.apk /sdcard/Android/obb/champion.gnuroot.wheezy.x86/
cp -avr ../quick_start /sdcard/Android/obb/champion.gnuroot.wheezy.x86/quick_start
# Enable Android setting for installing from unknown sources...
# Install Sanos editor [or vi, etc]:
wget http://www.jbox.dk/downloads/edit.c
gcc -o edit edit.c -Os
./edit edit.c
# Upgrade to Jessie [will take a while]:
sed -i 's/wheezy/jessie/g' /etc/apt/sources.list
apt-get update && apt-get dist-upgrade
# ...
# Failed to read /proc/cmdline. Ignoring: Permission denied
# chfn: PAM: System error
# adduser: `/usr/bin/chfn -f systemd Bus Proxy systemd-bus-proxy' returned error code 1. Exiting.
# dpkg: error processing package systemd (--configure):
# subprocess installed post-installation script returned error exit status 1
# Errors were encountered while processing:
# systemd
# E: Sub-process /usr/bin/dpkg returned an error code (1)
# Verify version:
cat /etc/debian_version
# jessie/sid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment