Skip to content

Instantly share code, notes, and snippets.

@profOnno
Last active November 8, 2016 21:57
Show Gist options
  • Save profOnno/c761d10fe184148914939b0962d18d16 to your computer and use it in GitHub Desktop.
Save profOnno/c761d10fe184148914939b0962d18d16 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# docker run -ti --name sailfish-dev5 --privileged -v $PATH_ON_HOST:/var/fairphone_os/ jftr/fairphone2-build-env /bin/bash
adduser fp2
usermod -a -G sudo fp2
su fp2
cd /home/fp2
# Setting up system vars
export MER_ROOT=$HOME/mer/
cat <<'EOF' > $HOME/.hadk.env
export MER_ROOT="/path/to/mer"
export ANDROID_ROOT="$MER_ROOT/android/droid"
export VENDOR="lge"
export DEVICE="hammerhead"
# ARCH conflicts with kernel build
export PORT_ARCH="armv7hl"
EOF
cat <<'EOF' >> $HOME/.mersdkubu.profile
function hadk() { source $HOME/.hadk.env; echo "Env setup for $DEVICE"; }
export PS1="HABUILD_SDK [\${DEVICE}] $PS1"
hadk
EOF
cat <<'EOF' >> $HOME/.mersdk.profile
function hadk() { source $HOME/.hadk.env; echo "Env setup for $DEVICE"; }
hadk
EOF
# Setting up Mer SDK
export MER_ROOT=$HOME/mer
cd $HOME
TARBALL=mer-i486-latest-sdk-rolling-chroot-armv7hl-sb2.tar.bz2
curl -k -O https://img.merproject.org/images/mer-sdk/$TARBALL
mkdir -p $MER_ROOT/sdks/sdk
cd $MER_ROOT/sdks/sdk
sudo tar --numeric-owner -p -xjf $HOME/$TARBALL
echo "export MER_ROOT=$MER_ROOT" >> ~/.bashrc
echo 'alias sdk=$MER_ROOT/sdks/sdk/mer-sdk-chroot' >> ~/.bashrc
exec bash
echo 'PS1="MerSDK $PS1"' >> ~/.mersdk.profile
cd $HOME
sdk
# These commands are a tmp workaround of glitch when working with target:
sudo zypper ar \
http://repo.merproject.org/obs/home:/sledge:/mer/latest_i486/ curlfix
sudo zypper ref curlfix
sudo zypper dup --from curlfix
# FAILED RESULT dbus
#
# Mounting system directories...
# Directory /var/run/dbus is missing in SDK root - please report this bug
# mount: special device /var/run/dbus does not exist
# Mounting / as /parentroot
# mount: special device /lib/modules/4.4.0-38-generic does not exist
# Mounting home directory: /home/fp2
# Entering chroot as fp2
# Env setup for hammerhead
# use sdk -u fp2
# still the dbus errors.. but don't know why we need the mount_bind stuff
# Preparing the Mer SDK
sudo zypper in android-tools createrepo zip
# seems to work
# Setting up an Android Build Environment
# permission stuff... not in manual
sudo chown fp2.fp2 . -R
remove
/path/to/mer/android/droid
@profOnno
Copy link
Author

profOnno commented Nov 8, 2016

hmmm doesn't work in docker... not like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment