zoukankan      html  css  js  c++  java
  • How to build Sailfish OS for Samsung Galaxy S7

    https://codedream.me/2018/02/02/how-to-build-sailfish-os-for-samsung-galaxy-s7/


    This manual based on HADK 2.0.1.

    4.1 Setting up required environment variables

    cat <<'EOF' > $HOME/.hadk.env
    export PLATFORM_SDK_ROOT="/srv/mer"
    export ANDROID_ROOT="$HOME/hadk"
    export VENDOR="samsung"
    export DEVICE="herolte"
    # 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"; }
    export PS1="PlatformSDK [${DEVICE}] $PS1"
    [ -d /etc/bash_completion.d ] && for i in /etc/bash_completion.d/*;do . $i;done
    hadk
    

    4.2 Setup the Platform SDK

    export PLATFORM_SDK_ROOT="/srv/mer"
    curl -k -O http://releases.sailfishos.org/sdk/installers/latest/Jolla-latest-SailfishOS_Platform_SDK_Chroot-i486.tar.bz2 ;
    sudo mkdir -p $PLATFORM_SDK_ROOT/sdks/sfossdk ;
    sudo tar --numeric-owner -p -xjf Jolla-latest-SailfishOS_Platform_SDK_Chroot-i486.tar.bz2 -C $PLATFORM_SDK_ROOT/sdks/sfossdk ;
    echo "export PLATFORM_SDK_ROOT=$PLATFORM_SDK_ROOT" >> ~/.bashrc
    echo 'alias sfossdk=$PLATFORM_SDK_ROOT/sdks/sfossdk/mer-sdk-chroot' >> ~/.bashrc ; exec bash ;
    sfossdk
    

    4.3 Preparing the Platform SDK

    PLATFORM_SDK $
    sudo zypper in android-tools createrepo zip
    

    4.4 Setting up an Android Build Environment

    4.4.1 Downloading and Unpacking Ubuntu Chroot

    PLATFORM_SDK $
    TARBALL=ubuntu-trusty-android-rootfs.tar.bz2
    curl -O http://img.merproject.org/images/mer-hybris/ubu/$TARBALL
    UBUNTU_CHROOT=$PLATFORM_SDK_ROOT/sdks/ubuntu
    sudo mkdir -p $UBUNTU_CHROOT
    sudo tar --numeric-owner -xjf $TARBALL -C $UBUNTU_CHROOT
    

    4.4.2 Entering Ubuntu Chroot

    PLATFORM_SDK $
    
    ubu-chroot -r $PLATFORM_SDK_ROOT/sdks/ubuntu
    # FIXME: Hostname resolution might fail. This error can be ignored.
    
    # Can be fixed manually by adding the hostname to /etc/hosts
    sudo apt-get update
    sudo apt-get install bsdmainutils rsync vim unzip imagemagick software-properties-common python-software-properties
    sudo add-apt-repository ppa:openjdk-r/ppa
    sudo apt-get update
    sudo apt-get install openjdk-8-jdk
    sudo update-alternatives --config java
    sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
    # choose openjdk-8-jdk
    

    5.1 Checking out CyanogenMod Source

    Configure git:

    git config --global user.name "Your Name"
    
    git config --global user.email "you@example.com"
    
    HABUILD_SDK $
    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-14.1
    

    5.2 Device repos

    HABUILD_SDK $
    cd $ANDROID_ROOT/.repo
    git clone https://github.com/Driim/local_manifests
    cd ../
    
    repo sync --fetch-submodules
    

    5.3 Configure Mountpoint Information

    Nothing to do here

    5.4 Building Relevant Bits of CyanogenMod

    HABUILD_SDK $
    source build/envsetup.sh
    export USE_CCACHE=1
    breakfast $DEVICE
    make -j<XX> hybris-hal libcameraservice_32 libdroidmedia_32 minimediaservice minisfservice libaudioflingerglue_32 miniafservice
    
    <XX> - number of cores
    

    Next we are going to build droid-hal-device

    7.2.1 Building the droid-hal-device packages
     

    PLATFORM_SDK $
    
    cd $ANDROID_ROOT
    
    sdk-assistant create SailfishOS-latest http://releases.sailfishos.org/sdk/latest/Jolla-latest-Sailfish_SDK_Tooling-i486.tar.bz2
    sdk-assistant create $VENDOR-$DEVICE-$PORT_ARCH http://releases.sailfishos.org/sdk/latest/Jolla-latest-Sailfish_SDK_Target-armv7hl.tar.bz2
    sdk-assistant create SailfishOS-latest-i486 http://releases.sailfishos.org/sdk/latest/Jolla-latest-Sailfish_SDK_Target-i486.tar.bz2
    
    sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper rm ngfd-plugin-native-vibrator
    rpm/dhd/helpers/build_packages.sh --mw=ngfd-plugin-droid-vibrator --spec=rpm/ngfd-plugin-droid-vibrator.spec
    
    sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper rm qt5-feedback-haptics-native-vibrator
    rpm/dhd/helpers/build_packages.sh --mw=qt5-feedback-haptics-droid-vibrator --spec=rpm/qt5-feedback-haptics-droid-vibrator.spec
    
    # build droidmedia
    DROIDMEDIA_VERSION=$(git --git-dir external/droidmedia/.git describe --tags | sed 
    -r "s/-/+/g")
    rpm/dhd/helpers/pack_source_droidmedia-localbuild.sh $DROIDMEDIA_VERSION
    mkdir -p hybris/mw/droidmedia-localbuild/rpm
    cp rpm/dhd/helpers/droidmedia-localbuild.spec 
    hybris/mw/droidmedia-localbuild/rpm/droidmedia.spec
    sed -ie "s/0.0.0/$DROIDMEDIA_VERSION/" 
    hybris/mw/droidmedia-localbuild/rpm/droidmedia.spec
    mv hybris/mw/droidmedia-$DROIDMEDIA_VERSION.tgz hybris/mw/droidmedia-localbuild
    rpm/dhd/helpers/build_packages.sh --build=hybris/mw/droidmedia-localbuild
    rpm/dhd/helpers/build_packages.sh --droid-hal --mw=https://github.com/sailfishos/gst-droid.git
    
    # build audioflingerglue
    rpm/dhd/helpers/pack_source_audioflingerglue-localbuild.sh
    mkdir -p hybris/mw/audioflingerglue-localbuild/rpm
    cp rpm/dhd/helpers/audioflingerglue-localbuild.spec 
    hybris/mw/audioflingerglue-localbuild/rpm/audioflingerglue.spec
    mv hybris/mw/audioflingerglue-0.0.1.tgz hybris/mw/audioflingerglue-localbuild
    rpm/dhd/helpers/build_packages.sh --build=hybris/mw/audioflingerglue-localbuild
    rpm/dhd/helpers/build_packages.sh --droid-hal 
    --mw=https://github.com/mer-hybris/pulseaudio-modules-droid-glue.git
    
    # build libgrillio
    rpm/dhd/helpers/build_packages.sh --mw=https://git.merproject.org/mer-core/libgrilio.git
    
    # build ofono
    rpm/dhd/helpers/build_packages.sh --mw=https://git.merproject.org/mer-core/ofono.git
    

    I had problems with ngfd-plugin-droid-vibrator and qt5-feedback-haptics-droid-vibrator packages, os we build then before everything else. Also audio package builded from different source. So When we start build another packages we need to choose Y for every packet(not all) and wait then builded, but for the ngfd-plugin-droid-vibrator, qt5-feedback-haptics-droid-vibrator, pulseaudio-modules-droid choose n.

    rpm/dhd/helpers/build_packages.sh
    

    8.3 Creating and Configuring the Kickstart File

    PLATFORM_SDK $
    
    HA_REPO="repo --name=adaptation-community-common-$DEVICE-@RELEASE@"
    HA_DEV="repo --name=adaptation-community-$DEVICE-@RELEASE@"
    KS="Jolla-@RELEASE@-$DEVICE-@ARCH@.ks"
    sed "/$HA_REPO/i$HA_DEV --baseurl=file://$ANDROID_ROOT/droid-local-repo/$DEVICE" $ANDROID_ROOT/hybris/droid-configs/installroot/usr/share/kickstarts/$KS > $KS
    

    8.5 Building the Image with MIC

    PLATFORM_SDK $
    
    RELEASE=2.1.3.7
    EXTRA_NAME=-s7
    
    hybris/droid-configs/droid-configs-device/helpers/process_patterns.sh
    #Command fail, but that's ok
    sudo mic create fs --arch=$PORT_ARCH --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/Jolla-@RELEASE@-$DEVICE-@ARCH@.ks
    

    Folder sfe-herolte-2.1.3.7-s7 has zip-file ready to install from TWRP

    Audio begin to work if comment tms and playback_record in /system/etc/audio_policy.conf but it sound terribly.

    dreamway89

    dreamway89 wrote 27 posts

    Post navigation


    Comments

    • albne

      13.03.2018 at 08:55

    HELP
    PlatformSDK [ido] bash-3.2$ rpm/dhd/helpers/build_packages.sh —droid-hal —mw=https://github.com/sailfishos/gst-droid.git
    * Building rpm/droid-hal-ido.spec
    + export CXXFLAGS
    + FFLAGS=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector —param=ssp-buffer-size=4 -Wformat -Wformat-security -fmessage-length=0 -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb -Wno-psabi -I/usr/lib/gfortran/modules’
    + export FFLAGS
    + LD_AS_NEEDED=1
    + export LD_AS_NEEDED
    + echo _target_cpu is armv7hl
    _target_cpu is armv7hl
    + grep -q ‘^TARGET_ARCH := arm64’ ./device/xiaomi/ido/BoardConfig.mk
    + echo -e ‘ ’ ‘IMPORTANT: some devices in your Android tree are 64bit targets. If your device is aarch64, ’ ‘ please define droid_target_aarch64 in your .spec, otherwise define droid_target_armv7hl ’ ‘NOTE: Currently there is no Sailfish OS ARM 64bit target, so leave PORT_ARCH as armv7hl ’ ‘ Mixed builds of 64bit Android+Linux Kernel and 32bit Sailfish OS work just fine.’

    IMPORTANT: some devices in your Android tree are 64bit targets. If your device is aarch64,
    please define droid_target_aarch64 in your .spec, otherwise define droid_target_armv7hl
    NOTE: Currently there is no Sailfish OS ARM 64bit target, so leave PORT_ARCH as armv7hl
    Mixed builds of 64bit Android+Linux Kernel and 32bit Sailfish OS work just fine.
    + exit 1
    error: Bad exit status from /var/tmp/rpm-tmp.FHpPig (%build)

    RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.FHpPig (%build)
    * Check /home/ya/hadk/droid-hal-ido.log for full log.
    !! building of package failed

    • dreamway89

      19.03.2018 at 10:38

    IMPORTANT: some devices in your Android tree are 64bit targets. If your device is aarch64,
    please define droid_target_aarch64 in your .spec, otherwise define droid_target_armv7hl

    Try define droid_target_aarch64 in droid-hal-ido.spec.


  • 相关阅读:
    POJ 1273:Drainage Ditches(EK 最大流)
    牛客假日团队赛6 H:Charm Bracelet (01背包)
    牛客假日团队赛6 F:Mud Puddles
    牛客假日团队赛6 E:对牛排序
    牛客假日团队赛6 D:迷路的牛
    牛客假日团队赛6 C:Bookshelf 2
    牛客假日团队赛6 B:Bookshelf
    牛客假日团队赛6 A:Card Stacking (模拟)
    UVA
    (转载)Mysql查找如何判断字段是否包含某个字符串
  • 原文地址:https://www.cnblogs.com/ztguang/p/12644401.html
Copyright © 2011-2022 走看看