Sunday, October 18, 2015

ubuntu14.04 Android build environment in Debian Jessie

While attempting to build up my 1 year old android beagleboard-x15 image back again to verify functionality, well.. I had left ubuntu behind and had moved on to debian. Unfortunately, I dont seem to have the patience to get debian android build stable... so chroot of ubuntu 14.04 and build of android in that environment.

sudo apt-get install schroot dchroot debootstrap
sudo vim /etc/schroot/schroot.conf
description=Ubuntu Trusty Android build env
users=USER #update with your user
groups=GROUP #update with your user group

sudo mkdir -p /opt/android-build
sudo debootstrap --arch amd64 trusty /opt/android-build

sudo vim /opt/android-build/etc/apt/sources.list
###### Ubuntu Main Repos
deb trusty main restricted universe multiverse 

###### Ubuntu Update Repos
deb trusty-security main restricted universe multiverse 
deb trusty-updates main restricted universe multiverse 
deb trusty-backports main restricted universe multiverse 

sudo vim /etc/fstab
 proc /opt/android-build/proc proc defaults 0 0
 /dev/ /opt/android-build/dev none rbind 0 0
 sysfs /opt/android-build/sys sysfs defaults 0 0

sudo cp /etc/resolv.conf /opt/android-build/etc/
sudo mount -a

sudo cp /etc/sudoers /opt/android-build/etc/
sudo cp /etc/passwd /opt/android-build/etc/
sudo sed 's/\([^:]*\):[^:]*:/\1:*:/' /etc/shadow | sudo tee /opt/android-build/etc/shadow
sudo cp /etc/group /opt/android-build/etc/
sudo cp /etc/hosts /opt/android-build/etc/
sudo mkdir /opt/android-build/home/$(USER); sudo chown $(USER).$(USER)  /opt/android-build/home/$(USER)

sudo chroot /opt/android-build/
 apt-get update
 apt-get --no-install-recommends install wget debconf devscripts gnupg vim nano  ctags cscope gcc-arm-linux-gnueabi bc linux-generic #For package-building
 apt-get update  #clean the gpg error message
 apt-get install locales dialog  #If you don't talk en_US
 locale-gen en_US.UTF-8  # or your preferred locale
 tzselect; TZ='Continent/Country'; export TZ  #Configure and use our local time instead of UTC; save in .profile
 dpkg --add-architecture i386
 wget -q -O - | sudo apt-key add -;sudo rm -rvf /var/lib/apt/lists/* -vf;sudo apt-get update && sudo apt-get dist-upgrade -y && sudo apt-get autoclean -y && sudo apt-get autoremove -y && sudo apt-get --purge --reinstall -y install flashplugin-installer;sudo apt-get update;dpkg --list | grep linux-image|grep -v 'Generic'|head --lines=-3|sed -e 's/\s\s*/ /g'|grep -v `uname -r`|cut -d ' ' -f2|xargs sudo apt-get purge -y
 apt-get purge openjdk-\* icedtea-\* icedtea6-\* 
 apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng
 apt-get install openjdk-7-jdk

dchroot -c android -d
 cd ~
 mkdir ~/bin ; curl > ~/bin/repo && chmod a+x ~/bin/repo

Building for BeagleBoard-X15 (still to be completed)
Lollipop: mkdir ~/android-lollipop-build;cd ~/android-lollipop-build;repo init -u -b x15-loli-dev
Marshmallow: mkdir ~/android-marshmallow-build;cd ~/android-marshmallow-build;repo init -u -b x15-marshy-dev

repo sync