Commit 6d8eed2a authored by Björn Bidar's avatar Björn Bidar

changes so far, about 30% done

parent 65d55ca6
#!/usr/bin/bash
cat <<'EOF' > $HOME/.hadk.env
MERSDK_CHROOT_TAR=mer-i486-latest-sdk-rolling-chroot-armv7hl-sb2.tar.bz2
UBUNTU_ROOTFS_TAR=ubuntu-trusty-android-rootfs.tar.bz2
CONFDIR="${XDG_CONFIG_HOME-:$HOME/.config}/hadk"
CACHE_DIR=${XDG_CACHE_HOME:-$HOME/.cache}
verbose()
{
[ $be_chatty ] && echo "[email protected]"
}
warn()
{
echo "[email protected]" >&2
}
die()
{
warn "$1"
exit ${2:-1}
}
mer_sdk_run()
{
echo stub
echo "[email protected]"
}
init_conf()
{
# only init conf if not already done
mkdir $CONFDIR
if [ ! -e $CONFDIR/env ] ; then
cat <<EOF > $CONFDIR/env
export MER_ROOT="$HOME/mer"
export ANDROID_ROOT="$MER_ROOT/android/droid"
export VENDOR="sony"
export DEVICE="scorpion"
export PORT_ARCH="armv7hl"
EOF
cat <<'EOF' >> $HOME/.mersdkubu.profile
fi
if [ ! -e $CONFDIR/mersdkubu.profile ] ; then
cat <<EOF >> $CONFDIR/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
fi
if [ ! -e "$CONFDIR/mersdk.profile" ] ; then
cat <<EOF >> $CONFDIR/.mersdk.profile
function hadk() { source $HOME/.hadk.env; echo "Env. setup for $DEVICE"; }
hadk
EOF
export MER_ROOT=$HOME/mer
TARBALL=mer-i486-latest-sdk-rolling-chroot-armv7hl-sb2.tar.bz2
curl -k -O https://img.merproject.org/images/mer-sdk/$TARBALL
fi
}
mkdir $CACHE_DIR
curl -k -o https://img.merproject.org/images/mer-sdk/$MERSDK_CHROOT_TAR $CACHE_DIR/$MERSDK_CHROOT_TAR
mkdir -p $MER_ROOT/sdks/sdk
cd $MER_ROOT/sdks/sdk
if
Ubuntu then do sudo tar --numeric-owner -p -xjf $HOME/$TARBALL
elseif
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
echo -n Exiting the SDK
exit
echo -n Entering the SDK
sdk
echo -n Adding the curlfix repo
sudo zypper ar http://repo.merproject.org/obs/home:/sledge:/mer/latest_i486/ \
curlfix
echo -n Adding the common repo
sudo zypper ar http://repo.merproject.org/obs/nemo:/devel:/hw:/common/sailfish_latest_armv7hl/ \
common
echo -n Refreshing the curlfix repo
sudo zypper ref curlfix
sudo zypper dup --from curlfix
echo -n Refreshing the common repo
sudo zypper ref common
sudo zypper dup --from common
echo -n Installing android-tools createrepo and zip
sudo zypper in android-tools createrepo zip
TARBALL=ubuntu-trusty-android-rootfs.tar.bz2
echo -n Downloading the Rootfs tarball for Android
curl -O http://img.merproject.org/images/mer-hybris/ubu/$TARBALL
tar --numeric-owner -p -xjf $CACHE_DIR/$MERSDK_CHROOT_TAR
verbose "Adding the curlfix repo"
mer_sdk_run 'sudo zypper ar http://repo.merproject.org/obs/home:/sledge:/mer/latest_i486/ \
curlfix'
verbose "Adding the common repo"
mer_sdk_run 'sudo zypper ar http://repo.merproject.org/obs/nemo:/devel:/hw:/common/sailfish_latest_armv7hl/ \
common'
verbose "Refreshing the curlfix repo"
mer_sdk_run 'sudo zypper ref curlfix;sudo zypper dup --from curlfix'
verbose "Refreshing the common repo"
mer_sdk_run 'sudo zypper ref common sudo zypper dup --from common'
verbose "Installing android-tools createrepo and zip"
mer_sdk_run 'sudo zypper in android-tools createrepo zip'
verbose "Downloading the Rootfs tarball for Android"
curl -o http://img.merproject.org/images/mer-hybris/ubu/$UBUNTU_ROOTFS_TAR $CACHE_DIR/$UBUNTU_ROOTFS_TAR
UBUNTU_CHROOT=$MER_ROOT/sdks/ubuntu
sudo mkdir -p $UBUNTU_CHROOT
echo -n Unpacking the Rootfs tarball for Android into $UBUNTU_CHROOT
sudo tar --numeric-owner -xvjf $TARBALL -C $UBUNTU_CHROOT
echo -n Entering the HABUILD_SDK
mkdir -p $UBUNTU_CHROOT
verbose "Unpacking the Rootfs tarball for Android into $UBUNTU_CHROOT"
tar --numeric-owner -xvjf $CACHE_DIR/$UBUNTU_ROOTFS_TAR -C $UBUNTU_CHROOT
verbose "Entering the HABUILD_SDK"
ubu-chroot -r $MER_ROOT/sdks/ubuntu
echo -n Exiting the HABUILD_SDK
exit
verbose "Exiting the HABUILD_SDK"
git config --global user.name "Your name here please"
git config --global user.email "Your emailadress here please"
echo Making the bin directory for the repo command to be put into
mkdir ~/bin
echo -n Adding the bin directory to $PATH
PATH=~/bin:$PATH
echo -n Downloading the repo binary into ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
echo -n Making the repo binary executable
chmod a+x ~/bin/repo
echo -n Entering the HABUILD_SDK
if ! which repo > /dev/null ; then
die 'you need to install repo'
fi
ubu-chroot -r $MER_ROOT/sdks/ubuntu
echo -n Creating the Root directory for Android
verbose Creating the Root directory for Android
sudo mkdir -p $ANDROID_ROOT
echo -n Changing owner to the root directory for Android to your user
verbose Changing owner to the root directory for Android to your user
sudo chown -R $USER $ANDROID_ROOT
echo -n Entering the root directory for Android
verbose Entering the root directory for Android
cd $ANDROID_ROOT
echo -n Initialising the hybris repo into $ANDROID_ROOT
verbose Initialising the hybris repo into $ANDROID_ROOT
repo init -u git://github.com/mer-hybris/android.git -b hybris-12.1
echo -n Creating the local_manifests directory
verbose Creating the local_manifests directory
mkdir $ANDROID_ROOT/.repo/local_manifests
echo -n Entering the local_manifests directory
verbose Entering the local_manifests directory
cd $HOME/.repo/local_manifests/
echo -n Creating the scorpion.xml file
verbose Creating the scorpion.xml file
touch scorpion.xml
echo -n Putting relevant repos to sync in the scorpion.xml file
verbose Putting relevant repos to sync in the scorpion.xml file
cat > scorpion.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
......@@ -102,13 +125,13 @@ cat > scorpion.xml <<EOF
<project path="hybris/droid-hal-version-scorpion" name="Nokius/droid-hal-version-scorpion" revision="master" />
</manifest>
EOF
echo -n Entering $ANDROID_ROOT
verbose Entering $ANDROID_ROOT
cd $ANDROID_ROOT
echo -n Syncing the repos that you added to the scorpion.xml file
verbose "Syncing the repos that you added to the scorpion.xml file"
repo sync --fetch-submodules
echo -n Resyncing again to make sure that you're fully up-to-date.
verbose "Resyncing again to make sure that you're fully up-to-date."
repo sync --fetch-submodules
cat > /home/$USER/mer/android/droid/hybris/hybris-boot/fixup-mountpoints << EOF
cat > $MER_ROOT/android/droid/hybris/hybris-boot/fixup-mountpoints << EOF
#!/bin/bash
DEVICE=$1
......@@ -154,24 +177,24 @@ case "$DEVICE" in
esac
EOF
echo - Done!
echo -n Running source build/envsetup.sh
verbose Running source build/envsetup.sh
source build/envsetup.sh
export USE_CCACHE=1
echo -n Running breakfast for the device you told me to build for
verbose Running breakfast for the device you told me to build for
breakfast $DEVICE
echo -n Running make to build hybris-hal
verbose Running make to build hybris-hal
make -j4 hybris-hal
echo -n Running java -jar $HOME/mer/android/droid/out/host/linux-x86/framework/dumpkey.jar build/target/product/security/testkey.x509.pem build/target/product/security/cm.x509.pem build/target/product/security/cm-devkey.x509.pem > $HOME/mer/android/droid/out/target/product/$DEVICE/obj/PACKAGING/ota_keys_intermediates/keys in order for make to complete successfully
verbose Running java -jar $HOME/mer/android/droid/out/host/linux-x86/framework/dumpkey.jar build/target/product/security/testkey.x509.pem build/target/product/security/cm.x509.pem build/target/product/security/cm-devkey.x509.pem > $HOME/mer/android/droid/out/target/product/$DEVICE/obj/PACKAGING/ota_keys_intermediates/keys in order for make to complete successfully
java -jar $HOME/mer/android/droid/out/host/linux-x86/framework/dumpkey.jar build/target/product/security/testkey.x509.pem build/target/product/security/cm.x509.pem build/target/product/security/cm-devkey.x509.pem > $HOME/mer/android/droid/out/target/product/scorpion/obj/PACKAGING/ota_keys_intermediates/keys
echo -n Done!
echo -n Rerunning make to build hybris-hal once again
verbose Done!
verbose Rerunning make to build hybris-hal once again
make -j4 hybris-hal
echo -n Showing the kernel config file built by hybris
verbose Showing the kernel config file built by hybris
hybris/mer-kernel-check/mer_verify_kernel_config \
./out/target/product/$DEVICE/obj/KERNEL_OBJ/.config
echo -n Building hybris-boot and hybris-recovery for your device
./out/target/product/$DEVICE/obj/KERNEL_OBJ/.config
verbose Building hybris-boot and hybris-recovery for your device
make hybris-boot && make hybris-recovery
echo -n Exiting the HABUILD_SDK into the Mer SDK
verbose Exiting the HABUILD_SDK into the Mer SDK
exit
SFE_SB2_TARGET=$MER_ROOT/targets/$VENDOR-$DEVICE-$PORT_ARCH
TARBALL_URL=http://releases.sailfishos.org/sdk/latest/targets/targets.json
......@@ -184,17 +207,17 @@ cd $SFE_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 / $VENDOR-$DEVICE-$PORT_ARCH \
/opt/cross/bin/$PORT_ARCH-meego-linux-gnueabi-gcc
echo -n Rebuilding the rpm database
-c /usr/bin/qemu-arm-dynamic -m sdk-build \
-n -N -t / $VENDOR-$DEVICE-$PORT_ARCH \
/opt/cross/bin/$PORT_ARCH-meego-linux-gnueabi-gcc
verbose Rebuilding the rpm database
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R rpm --rebuilddb
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper ar \
-G http://repo.merproject.org/releases/mer-tools/rolling/builds/$PORT_ARCH/packages/ \
mer-tools-rolling
-G http://repo.merproject.org/releases/mer-tools/rolling/builds/$PORT_ARCH/packages/ \
mer-tools-rolling
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper ref --force
cd $HOME
echo -n Creating the Hello World-script...
verbose Creating the Hello World-script...
cat > main.c << EOF
#include <stdlib.h>
#include <stdio.h>
......@@ -203,9 +226,9 @@ printf("Hello, world!\n");
return EXIT_SUCCESS;
}
EOF
echo -n Compiling the Hello World script
verbose Compiling the Hello World script
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH gcc main.c -o test
echo -n Running the Hello World script which should show "Hello World!"
verbose "Running the Hello World script which should show \"Hello World!\""
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH ./test
sudo zypper ref; sudo zypper dup
cd $HOME
......@@ -213,9 +236,9 @@ sudo mkdir -p $MER_ROOT/devel
sudo chown -R $USER mer/devel
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -R -m sdk-install ssu ar common http://repo.merproject.org/obs/nemo:/devel:/hw:/common/sailfish_latest_armv7hl/
cd $ANDROID_ROOT
echo -n Running the build_packages script
verbose Running the build_packages script
rpm/dhd/helpers/build_packages.sh
echo -n Press Ctrl C to stop this process if you at some point end up with what looks as a freeze and rerun rpm/dhd/helpers/build_packages.sh
verbose "Press Ctrl C to stop this process if you at some point end up with what looks as a freeze and rerun rpm/dhd/helpers/build_packages.sh"
echo Creating a directory called tmp
mkdir -p tmp
HA_REPO="repo --name=adaptation0-$DEVICE[email protected]@"
......@@ -224,9 +247,13 @@ sed -e "s|^$HA_REPO.*$|$HA_REPO --baseurl=file://$ANDROID_ROOT/droid-local-repo/
RELEASE=2.0.1.11
EXTRA_NAME=-my1
sudo mic create fs --arch $PORT_ARCH \
--debug \
--tokenmap=ARCH:$PORT_ARCH,RELEASE:$RELEASE,EXTRA_NAME:$EXTRA_NAME \
--record-pkgs=name,url \
--outdir=sfe-$DEVICE-$RELEASE$EXTRA_NAME \
--pack-to=sfe-$DEVICE-$RELEASE$EXTRA_NAME.tar.bz2 \
$ANDROID_ROOT/tmp/[email protected]@[email protected]@.ks
\ No newline at end of file
--debug \
--tokenmap=ARCH:$PORT_ARCH,RELEASE:$RELEASE,EXTRA_NAME:$EXTRA_NAME \
--record-pkgs=name,url \
--outdir=sfe-$DEVICE-$RELEASE$EXTRA_NAME \
--pack-to=sfe-$DEVICE-$RELEASE$EXTRA_NAME.tar.bz2 \
$ANDROID_ROOT/tmp/[email protected]@-$DEVICE[email protected]@.ks
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment