Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/bash
- cat <<'EOF' > $HOME/.hadk.env
- export MER_ROOT="$HOME/mer"
- export ANDROID_ROOT="$MER_ROOT/android/droid"
- export VENDOR="motorola"
- export DEVICE="titan"
- 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
- 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
- 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 'sdk=$MER_ROOT/sdks/sdk/mer-sdk-chroot' >> ~/.bashrc
- echo 'PS1="MerSDK $PS1"' >> ~/.mersdk.profile
- cd $HOME
- sdk
- echo Exiting the SDK
- echo Entering the SDK
- sdk
- echo Adding the curlfix repo
- sudo zypper ar http://repo.merproject.org/obs/home:/sledge:/mer/latest_i486/ \
- curlfix
- echo Adding the common repo
- sudo zypper ar http://repo.merproject.org/obs/nemo:/devel:/hw:/common/sailfish_latest_armv7hl/ \
- common
- echo Refreshing the curlfix repo
- sudo zypper ref curlfix
- sudo zypper dup --from curlfix
- echo Refreshing the common repo
- sudo zypper ref common
- sudo zypper dup --from common
- echo Installing android-tools createrepo and zip
- sudo zypper in android-tools createrepo zip
- TARBALL=ubuntu-trusty-android-rootfs.tar.bz2
- echo Downloading the Rootfs tarball for Android
- curl -O http://img.merproject.org/images/mer-hybris/ubu/$TARBALL
- sudo mkdir -p $MER_ROOT/sdks/ubuntu
- echo Unpacking the Rootfs tarball for Android into $UBUNTU_CHROOT
- sudo tar --numeric-owner -xvjf $TARBALL -C $MER_ROOT/sdks/ubuntu
- echo Entering the HABUILD_SDK
- echo Exiting the HABUILD_SDK
- echo "Enter your full name to present yourself to git"
- read name ; git --global douglasbritox $name
- +verbose And now enteerrrrr
- read email git --global douglasbritox@outlook.com $name
- echo Making the bin directory for the repo command to be put into
- mkdir ~/bin
- echo Adding the bin directory to $PATH
- PATH=~/bin:$PATH
- echo Downloading the repo binary into ~/bin
- sudo curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
- echo Making the repo binary executable
- chmod a+x ~/bin/repo
- +verbose Entering the HABUILD_SDK
- cd $MER_ROOT/sdks/ubuntu
- echo Creating the Root directory for Android
- sudo mkdir -p $ANDROID_ROOT
- echo Changing owner to the root directory for Android to your user
- sudo chown -R $USER $ANDROID_ROOT
- echo Entering the root directory for Android
- cd $ANDROID_ROOT
- echo Initialising the hybris repo into $ANDROID_ROOT
- repo init -u git://github.com/mer-hybris/android.git -b hybris-12.1
- echo Creating the local_manifests directory
- mkdir $ANDROID_ROOT/.repo/local_manifests
- echo Entering the local_manifests directory
- cd $HOME/.repo/local_manifests/
- echo Creating the titan.xml file
- touch titan.xml
- echo Putting relevant repos to sync in the titan.xml file
- cat > titan.xml <<EOF
- <?xml version="1.0" encoding="UTF-8"?>
- <manifest>
- <project path="device/motorola/titan" name="CyanogenMod/android_device_motorola_titan" revision="cm-12.1" />
- <project path="device/motorola/msm8226-common" name="CyanogenMod/android_device_htc_scorpion_windy" revision="cm-12.1" />
- <project path="device/motorola/msm8226-common" name="CyanogenMod/android_device_htc_shinano-common" revision="cm-12.1" />
- <project path="device/motorola/msm8226-common" name="CyanogenMod/android_device_htc_msm8974-common" revision="cm-12.1" />
- <project path="device/motorola/msm8226-common" name="CyanogenMod/android_device_htc_common" revision="cm-12.1" />
- <project path="device/qcom/common" name="CyanogenMod/android_device_qcom_common" revision="cm-12.1" />
- <project path="hardware/motorola/thermanager" name="CyanogenMod/android_hardware_htc_thermanager" revision="cm-12.1" />
- <project path="kernel/motorola/msm8226" name="Nokius/android_kernel_htc_msm8974" revision="hybris-12.1" />
- <project path="vendor/motorola" name="TheMuppets/proprietary_vendor_htc" revision="cm-12.1" />
- <project path="rpm/" name="Nokius/droid-hal-titan" revision="master" />
- <project path="hybris/droid-configs" name="Nokius/droid-config-titan" revision="master" />
- <project path="hybris/droid-hal-version-endeavoru" name="Nokius/droid-hal-version-titan" revision="master" />
- </manifest>
- EOF
- echo Entering $ANDROID_ROOT
- cd $ANDROID_ROOT
- echo Syncing the repos that you added to the titan.xml file
- repo sync --fetch-submodules
- echo Resyncing again to make sure that you
- repo sync --fetch-submodules
- cat > /home/$USER/mer/android/droid/hybris/hybris-boot/fixup-mountpoints << EOF
- #!/bin/bash
- DEVICE=$1
- shift
- echo "Fixing mount-points for device $DEVICE"
- case "$DEVICE" in
- "titan")
- sed -i \
- -e 's block/platform/msm_sdcc.1/by-name/fsg mmcblk0p21 ' \
- - -e 's block/platform/msm_sdcc.1/by-name/firmware mmcblk0p1 ' \
- + -e 's block/platform/msm_sdcc.1/by-name/modem mmcblk0p1 ' \
- -e 's block/platform/msm_sdcc.1/by-name/persist mmcblk0p29 ' \
- -e 's block/platform/msm_sdcc.1/by-name/userdata mmcblk0p38 ' \
- -e 's block/platform/msm_sdcc.1/by-name/system mmcblk0p36 ' \
- "$@" ;;
- *)
- exit 1
- ;;
- esac
- EOF
- echo Done!
- echo Running source build/envsetup.sh
- source build/envsetup.sh
- export USE_CCACHE=1
- echo Running breakfast for Titan
- breakfast $DEVICE
- echo Running make to build hybris-hal
- make -j4 hybris-hal
- echo 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 Done!
- echo Rerunning make to build hybris-hal once again
- make -j4 hybris-hal
- echo 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 Building hybris-boot and hybris-recovery for your device
- make hybris-boot && make hybris-recovery
- echo Exiting the HABUILD_SDK into the Mer SDK
- SFE_SB2_TARGET=$MER_ROOT/targets/$VENDOR-$DEVICE-$PORT_ARCH
- TARBALL_URL=http://releases.sailfishos.org/sdk/latest/targets/targets.json
- TARBALL=$(curl $TARBALL_URL | grep "$PORT_ARCH.tar.bz2" | cut -d\" -f4)
- echo Downloading the SDK tarball for Sailfish OS
- curl -O $TARBALL
- echo Making a directory called SFE_SB2_TARGET
- sudo mkdir -p $SFE_SB2_TARGET
- echo Unpacking the downloaded tarball to the SFE_SB2_TARGET directory
- sudo tar --numeric-owner -pxjf $(basename $TARBALL) -C $SFE_SB2_TARGET
- echo Changing user priveligies to every file in the $SFE_SB2_TARGET directory
- sudo chown -R $USER $SFE_SB2_TARGET
- echo Entering the $SFE_SB2_TARGET directory
- 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 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
- sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper ref --force
- cd $HOME
- echo Creating the Hello World-script...
- cat > main.c << EOF
- #include <stdlib.h>
- #include <stdio.h>
- int main(void) {
- printf("Hello, world!\n");
- return EXIT_SUCCESS;
- }
- EOF
- echo Compiling the Hello World script
- sb2 -t $VENDOR-$DEVICE-$PORT_ARCH gcc main.c -o test
- echo Running the Hello World script as a test which should show "Hello World!"
- sb2 -t $VENDOR-$DEVICE-$PORT_ARCH ./test
- sudo zypper ref; sudo zypper dup
- cd $HOME
- echo Making the directory called devel in $MER_ROOT
- sudo mkdir -p $MER_ROOT/devel
- echo Changing user priveligies to the devel directory
- 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 Running the build_packages script
- rpm/dhd/helpers/build_packages.sh
- echo 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-@RELEASE@"
- KS="Jolla-@RELEASE@-$DEVICE-@ARCH@.ks"
- sed -e "s|^$HA_REPO.*$|$HA_REPO --baseurl=file://$ANDROID_ROOT/droid-local-repo/$DEVICE|" $ANDROID_ROOT/hybris/droid-configs/installroot/usr/share/kickstarts/$KS > tmp/$KS
- 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/Jolla-@RELEASE@-$DEVICE-@ARCH@.ks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement