[Galaxy S III Original Android Development] Umeaboy:
I made a more stripped version of the HADK (if anyone should be interested in helping out with the port)

$HOST
cat <<'EOF' > $HOME/.hadk.env
export MER_ROOT="$HOME/mer"
export ANDROID_ROOT="$MER_ROOT/android/droid"
export VENDOR="Replace this text with the name brand name of your device"
export DEVICE="Replace this text with the modelname of your device"
EOF
cat <<'EOF' >> $HOME/.mersdkubu.profile
function hadk() { source $HOME/.hadk.env${1:+.$1}; echo "Env setup for $DEVICE"; }
export PS1="HABUILD_SDK [\${DEVICE}] $PS1"
hadk
EOF
cat <<'EOF' >> $HOME/.mersdk.profile
function hadk() { source $HOME/.hadk.env${1:+.$1}; echo "Env setup for $DEVICE"; }
hadk
EOF
export MER_ROOT=$HOME/mer
cd $HOME && curl -k -O https://img.merproject.org/images/mer-sdk/mer-i486-latest-sdk-rolling-chroot-armv7hl-sb2.tar.bz2
sudo mkdir -p $MER_ROOT/sdks/sdk
cd $MER_ROOT/sdks/sdk
sudo tar --numeric-owner -p -xjf $HOME/mer-i486-latest-sdk-rolling-chroot-armv7hl-sb2.tar.bz2
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
sudo zypper in android-tools createrepo zip nano
TARBALL=ubuntu-trusty-android-rootfs.tar.bz2
curl -O http://img.merproject.org/images/mer-hybris/ubu/$TARBALL
UBUNTU_CHROOT=/parentroot/$MER_ROOT/sdks/ubuntu
sudo mkdir -p $UBUNTU_CHROOT
sudo tar --numeric-owner -xvjf $TARBALL -C $UBUNTU_CHROOT
ubu-chroot -r /parentroot/$MER_ROOT/sdks/ubuntu
exit
git config --global user.name Replace this text with your name without using non-english letters.
git config --global user.email Replace this text with your email-adress
mkdir ~/bin
PATH=~/bin:$PATH
PATH=~/usr/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
ubu-chroot -r /parentroot/$MER_ROOT/sdks/ubuntu
hadk
sudo mkdir -p $ANDROID_ROOT
sudo chown -R $USER $ANDROID_ROOT
cd $ANDROID_ROOT
repo init -u git://github.com/mer-hybris/android.git -b hybris-10.1
repo sync
source build/envsetup.sh
export USE_CCACHE=1
breakfast $DEVICE
rm .repo/local_manifests/roomservice.xml
make -j4 hybris-hal
exit
hadk
cd $HOME
SFFE_SB2_TARGET=/parentroot/$MER_ROOT/targets/samsung-i9305-armv7hl
TARBALL_URL=http://releases.sailfishos.org/sdk/latest/targets/targets.json
TARBALL=$(curl $TARBALL_URL | grep 'armv7hl.tar.bz2' | cut -d\" -f4)
curl -O $TARBALL
sudo mkdir -p $SFFE_SB2_TARGET
sudo tar --numeric-owner -pxjf $(basename $TARBALL) -C $SFFE_SB2_TARGET
sudo chown -R $USER $SFFE_SB2_TARGET
cd $SFFE_SB2_TARGET
grep :$(id -u): /etc/passwd >> etc/passwd
grep :$(id -g): /etc/group >> etc/group
sb2-init -d -L "--sysroot=/" -C "--sysroot=/" \
-c /usr/bin/qemu-arm-dynamic -m sdk-build \
-n -N -t / samsung-i9305-armv7hl \
/opt/cross/bin/armv7hl-meego-linux-gnueabi-gcc
sb2 -t samsung-i9305-armv7hl -m sdk-install -R rpm --rebuilddb
sb2 -t samsung-i9305-armv7hl -m sdk-install -R zypper ar \
-G http://repo.merproject.org/releases/mer-tools/rolling/builds/armv7hl/packages/ \
mer-tools-rolling
sb2 -t samsung-i9305-armv7hl -m sdk-install -R zypper ref --force
cd $HOME

Now add the text between the two EOF's without spaces
cat > main.c << EOF

#include <stdlib.h>
#include <stdio.h>
int main(void) {
printf("Hello, world!\n");
return EXIT_SUCCESS; }

EOF

sb2 -t samsung-i9305-armv7hl gcc main.c -o test
sb2 -t samsung-i9305-armv7hl ./test
cd $ANDROID_ROOT
sudo rpm -U http://repo.merproject.org/obs/mer-tools:/stable/latest_armv7hl/noarch/sdk-utils-0.64-1.3.1.noarch.rpm
mb2 -t samsung-i9305-armv7hl -s rpm/droid-hal-device.inc build