Далее нужно выполнить простроение дерева rpm пакетов, но перед эти лучше выполнить следующие команды которые избавят вас от ошибок которые описаны ниже (для тех кто делает впервые лучше посмотреть будут ли выходить эти ошибки):
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper rm mesa-llvmpipe-9.2.5+git2-1.3.23.armv7hl
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper ar http://repo.merproject.org/obs/nemo:/devel:/hw:/common/sailfish_latest_armv7hl/ slf
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper in kf5bluezqt-bluez4*
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper rm bluez-configs-mer-4.101+git73-1.31.1.armv7hl
потом после исправление ошибко можете запускать скрипт:
MER_SDK $
cd $ANDROID_ROOT
rpm/dhd/helpers/build_packages.sh
This should compile all the needed packages, patterns, middleware and put them under local repository. If anything needs modified, just re-run this script.
Далее будут те ошибки с которыми я столкнулся при отработке скрипта rpm/dhd/helpers/build_packages.sh :
- Ошибка
MerSDK ilnur@ubuntu:~/to/mer/android/droid$ rpm/dhd/helpers/build_packages.sh
* Building rpm/droid-hal-Z00L.spec
/home/ilnur/to/mer/android/droid/system/core/include/private/android_filesystem_config.h:227:6: note: declared here
apply-permissions.c:117:9: warning: implicit declaration of function 'strerror' [-Wimplicit-function-declaration]
apply-permissions.c:117:9: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'int' [-Wformat]
apply-permissions.c:126:9: warning: format '%s' expects argument of type 'char *', but argument 6 has type 'int' [-Wformat]
apply-permissions.c: In function 'main':
apply-permissions.c:160:9: warning: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
apply-permissions.c:175:9: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
apply-permissions.c:175:33: warning: incompatible implicit declaration of built-in function 'strlen' [enabled by default]
apply-permissions.c:178:9: warning: implicit declaration of function 'strrchr' [-Wimplicit-function-declaration]
apply-permissions.c:178:16: warning: incompatible implicit declaration of built-in function 'strrchr' [enabled by default]
make: *** [apply-permissions] Error 1
+ echo Building uid scripts
Building uid scripts
+ rpm/dhd/helpers/usergroupgen add
/var/tmp/rpm-tmp.XMo6Xf: line 66: rpm/dhd/helpers/usergroupgen: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.XMo6Xf (%build)
RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.XMo6Xf (%build)
* Check /home/ilnur/to/mer/android/droid/droid-hal-Z00L.log for full log.
!! building of package failed
Исправление ошибки для cm-13.0: (спасибо https://github.com/ballock/droid-hal-device/commit/7d190e9060a4a9badea1fd18a13d7bf4d38fcaf5) Также https://github.com/mer-hybris/droid-hal-device/issues/126
$ANDROID_ROOT/rpm/dhd/helpers в файле makefile :
-TOOLS := apply-permissions usergroupgen
+TOOLS := usergroupgen
- Ошибка :
Resolving package dependencies... 
Resolving package dependencies... 
4 Problems: 
Problem: libhybris-0.0.0-1.armv7hl conflicts with mesa-llvmpipe provided by mesa-llvmpipe-9.2.5+git2-1.3.23.armv7hl 
Problem: mesa-llvmpipe-libglapi-9.2.5+git2-1.3.23.armv7hl requires mesa-llvmpipe = 9.2.5+git2-1.3.23, but this requirement cannot be provided 
Problem: mesa-llvmpipe-libGLESv2-9.2.5+git2-1.3.23.armv7hl requires mesa-llvmpipe = 9.2.5+git2-1.3.23, but this requirement cannot be provided 
Problem: mesa-llvmpipe-libEGL-9.2.5+git2-1.3.23.armv7hl requires mesa-llvmpipe = 9.2.5+git2-1.3.23, but this requirement cannot be provided 
Решение
Удаление пакета mesa-llvmpipe-9.2.5+git2-1.3.23.armv7hl
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper rm mesa-llvmpipe-9.2.5+git2-1.3.23.armv7hl 
Лог pulseaudio-modules-droid.log ошибка:
+ make 
make  all-recursive 
make[1]: Entering directory `/home/ilnur/to/mer/android/droid/hybris/mw/pulseaudio-modules-droid' 
Making all in src 
make[2]: Entering directory `/home/ilnur/to/mer/android/droid/hybris/mw/pulseaudio-modules-droid/src' 
Making all in common 
make[3]: Entering directory `/home/ilnur/to/mer/android/droid/hybris/mw/pulseaudio-modules-droid/src/common' 
  CC       libdroid_util_la-droid-util.lo 
In file included from droid-util.c:60:0: 
droid-util.h:49:2: error: #error "No valid ANDROID_VERSION found." 
Решение:
Проблема в том что нет поддержки андроида вверсии 6.0
Здесь указан временный способ поддержки android 6.0 в заголовке droid-util-60.h
https://github.com/mer-hybris/pulseaudio-modules-droid/issues/54
binli commented on Jun 7, 2016
Hi, Now I prepared to support android 6.0, I found there are droid-util-44.h, droid-util-44.h and droid-util-51.h headers file, and I compared these files, found a lot of different between each. So how do we generated the droid-util-xx.h files? I used a temp way to copy the droid-util-51.h to droid-util-60.h, it could be build successfully. What do I need to do to improve this header file for android 6.0? Thanks!
Закоментировал строки содержащие строки в которых содержатся ошибки:
droid-util-60.h:104:7: error: 'AUDIO_DEVICE_IN_FM_RX' undeclared here (not in a function) 
droid-util-60.h:104:53: error: 'AUDIO_SOURCE_FM_RX' undeclared here (not in a function) 
droid-util-60.h:105:7: error: 'AUDIO_DEVICE_IN_FM_RX_A2DP' undeclared here (not in a function) 
droid-util-60.h:105:53: error: 'AUDIO_SOURCE_FM_RX_A2DP' undeclared here (not in a function) 
droid-util-60.h:148:5: error: 'AUDIO_DEVICE_OUT_FM_TX' undeclared here (not in a function)
- Ошибка:
* Building rpm/droid-hal-version-Z00L.spec  
  Problem: nothing provides kf5bluezqt-bluez4 needed by droid-config-Z00L-bluez4-1-1.armv7hl 
   Solution 1: do not ask to install a solvable providing droid-config 
   Solution 2: break droid-config-Z00L-bluez4-1-1.armv7hl by ignoring some of its dependencies  
  Choose from above solutions by number or skip, retry or cancel [1/2/s/r/c] (c): c 
  error: Failed build dependencies: 
  droid-hal is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-config is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-config-sailfish is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-hal-kernel is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-hal-img-boot is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-hal-img-recovery is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-config-preinit-plugins is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-config-pulseaudio-settings is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  * Check /home/ilnur/to/mer/android/droid/hybris/droid-hal-version-Z00L.log for full log.  
  !! building of package failed
Решение
http://www.merproject.org/logs/%23sailfishos-porters/%23sailfishos-porters.2017-01-10.log.html
установить репозиторий и установить недостающий пакет:
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper ar http://repo.merproject.org/obs/nemo:/devel:/hw:/common/sailfish_latest_armv7hl/ slf 
sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper in kf5bluezqt-bluez4* 
Добавить новый репозиторий:  zypper ar 
См http://www.opennet.ru/tips/info/1762.shtml
- Ошибка:
```bash
  * Building rpm/droid-hal-version-Z00L.spec
  Problem: droid-config-Z00L-1-1.armv7hl requires Z00L-bluez-configs, but this requirement cannot be provided 
    uninstallable providers: droid-config-Z00L-bluez4-1-1.armv7hl[local-Z00L-hal] 
   Solution 1: Following actions will be done: 
    do not ask to install a solvable providing droid-config 
    do not ask to install a solvable providing droid-config-sailfish 
   Solution 2: replacement of bluez-configs-mer-4.101+git73-1.31.1.armv7hl with droid-config-Z00L-bluez4-1-1.armv7hl 
   Solution 3: break droid-config-Z00L-1-1.armv7hl by ignoring some of its dependencies 
Choose from above solutions by number or cancel [1/2/3/c] (c): c 
  error: Failed build dependencies: 
  droid-hal is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-config is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-config-sailfish is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-hal-kernel is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-hal-img-boot is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-hal-img-recovery is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-config-preinit-plugins is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  droid-config-pulseaudio-settings is needed by droid-hal-version-Z00L-0.0.1-1.armv7hl 
  * Check /home/ilnur/to/mer/android/droid/hybris/droid-hal-version-Z00L.log for full log.
  !! building of package failed
  ```
Решение
bash
  sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper rm bluez-configs-mer-4.101+git73-1.31.1.armv7hl
- Ошибка возникает если пересобираем заново:
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
/var/tmp/rpm-tmp.RA6BXM: line 204: 25812 Segmentation fault      (core dumped) /usr/lib/qt5/bin/kmap2qmap .//droid-configs-device/configs/droid.kmap .//droid-configs-device/configs/us.kmap $RPM_BUILD_ROOT//usr/share/qt5/keymaps/droid.qmap
error: Bad exit status from /var/tmp/rpm-tmp.RA6BXM (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.RA6BXM (%install)
Решение:
нужно выполнить заново 6. Установка SCRATCHBOX2
