Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.59 KB | None | 0 0
  1. Platform SDK Installation
  2. Attention: These instructions are only valid for Platform SDK versions newer than or equal to 2.1.3. If you have an older Platform SDK, please upgrade it or use the old instructions. If you are doing a fresh installation, please ignore this note.
  3.  
  4. The SailfishOS platform SDK contains Development Tools like Scratchbox2, MIC (Image Creation), Spectacle, osc, qemu, etc, to make it easier for a developer to work with SailfishOS.
  5. Quick start
  6.  
  7. If you're in a hurry then this should get you going (if it doesn't work then read the full instructions carefully!) :
  8. export PLATFORM_SDK_ROOT=/srv/mer
  9. curl -k -O http://releases.sailfishos.org/sdk/installers/latest/Jolla-latest-SailfishOS_Platform_SDK_Chroot-i486.tar.bz2 ;
  10. sudo mkdir -p $PLATFORM_SDK_ROOT/sdks/sfossdk ;
  11. sudo tar --numeric-owner -p -xjf Jolla-latest-SailfishOS_Platform_SDK_Chroot-i486.tar.bz2 -C $PLATFORM_SDK_ROOT/sdks/sfossdk ;
  12. echo "export PLATFORM_SDK_ROOT=$PLATFORM_SDK_ROOT" >> ~/.bashrc
  13. echo 'alias sfossdk=$PLATFORM_SDK_ROOT/sdks/sfossdk/mer-sdk-chroot' >> ~/.bashrc ; exec bash ;
  14. echo 'PS1="PlatformSDK $PS1"' > ~/.mersdk.profile ;
  15. echo '[ -d /etc/bash_completion.d ] && for i in /etc/bash_completion.d/*;do . $i;done' >> ~/.mersdk.profile ;
  16. sfossdk
  17. Once you've installed the Platform SDK you'll need to installation a Platform SDK Target.
  18.  
  19. It's recommended that you read sections below for pre-requisites, options and details on installing extra architecture toolchains, tools etc.
  20. Contents [hide]
  21. 1 Quick start
  22. 2 Platform SDK
  23. 3 Installing the Platform SDK
  24. 3.1 SDK Requirements
  25. 3.2 Installation / setup
  26. 3.3 Platform SDK control script
  27. 3.4 Entering Platform SDK
  28. 3.5 Useful Alias
  29. 3.6 Basic tasks
  30. 3.6.1 Compiling with the Platform SDK
  31. 4 Next Steps
  32. 5 Updating the Platform SDK
  33. 6 Removing the Platform SDK
  34. 7 Extras
  35. 7.1 Multiple Platform SDKs
  36. 7.2 Known Issues
  37. 7.2.1 work around bug #554 : mic failure
  38. 7.2.2 "not enough disk space left" or similar
  39. Platform SDK
  40.  
  41. The default download contains:
  42. Development tools
  43. Image creation tools
  44. OBS development tools
  45.  
  46. You can also install :
  47. Debugging tools
  48. Testing tools
  49. Python development
  50. Ruby development
  51.  
  52. Installing the Platform SDK
  53.  
  54. SDK Requirements
  55. The Platform SDK will run on most modern Linux machines. It needs:
  56. Linux distribution (one in a virtual machine works well), running 2.6.37 or newer kernel
  57. about 400Mb free space to install
  58. The SDK must be installed on a standard filesystem and "nosuid" must not be set. (Note: recent ecryptfs will automatically use and enforce nosuid. Automounted usb drives typically have "nosuid" set too.)
  59. hundreds of Mb for rpm caches for osc and mic as well as for SB2 targets
  60. Generic x86 CPU
  61. user must have sudo rights
  62. Installation / setup
  63. The Platform SDK is provided as a rootfs tarball that contains essential tools for Sailfish OS platform development along with a helper script to enter the rootfs.
  64.  
  65. Filesystem requirements:
  66. The Platform SDK can be installed to any location with enough space - we'll use /srv/ as per the Linux FHS (feel free to adapt the commands to use any other location).
  67. The installation path must contain an intermediate directory called 'sdks' which only has Platform SDKs inside. eg /srv/mer/sdks/sfossdk/...
  68.  
  69. To setup the Platform SDK:
  70. Download the latest stable Platform SDK rootfs tarball with the common armv7hl toolchain preinstalled:
  71. curl -k -O http://releases.sailfishos.org/sdk/installers/latest/Jolla-latest-SailfishOS_Platform_SDK_Chroot-i486.tar.bz2
  72. Optionally, you can check the release notes from the Application SDK Release Notes. The SDK Build Engine section also contains the latest changes to the Platform SDK.
  73. Create a directory for the Platform SDK rootfs and extract the tarball as root or with sudo:
  74. sudo mkdir -p /srv/mer/sdks/sfossdk
  75. sudo tar --numeric-owner -p -xjf Jolla-latest-SailfishOS_Platform_SDK_Chroot-i486.tar.bz2 -C /srv/mer/sdks/sfossdk
  76. Platform SDK control script
  77. The Platform SDK rootfs contains a helper script to enter the chroot named 'mer-sdk-chroot'. The helper script is located in the root directory (/) of the rootfs. It requires you to have sudo ability.
  78.  
  79. As mentioned, the Platform SDK is location independent so it uses the location of the helper script to determine which Platform SDK to enter.
  80. Entering Platform SDK
  81. Before entering the Platform SDK you may want to make an Platform SDK equivalent of ".profile" to give you a nice prompt to remind you that you are in the Platform SDK. This also reads the bash autocompletion scripts from inside the chroot.
  82.  
  83. cat << EOF >> ~/.mersdk.profile
  84. PS1="PlatformSDK \$PS1"
  85. if [ -d /etc/bash_completion.d ]; then
  86. for i in /etc/bash_completion.d/*;
  87. do
  88. . \$i
  89. done
  90. fi
  91. EOF
  92.  
  93. If you use multiple Platform SDK instances, you can utilise the MERSDK shell variable to determine the absolute path to the Platform SDK chroot in use (since Sailfish OS release 2.1.3).
  94.  
  95. To enter the Platform SDK rootfs with the helper script run
  96. /srv/mer/sdks/sfossdk/mer-sdk-chroot
  97.  
  98. You should find that you are operating under your normal username and that your home directory is available as /home/<username> and any other mountpoints are mounted under /parentroot/*
  99.  
  100. You have sudo rights automatically. If sudo fails within the sdk, make sure that the filesystem the sdk is on is not mounted with the "nosuid" parameter. "mount" on the host system gives you this information, add "suid" as parameter in fstab, if necessary.
  101. Useful Alias
  102. If you tend to use a single instance of the Platform SDK then this alias is useful
  103. echo alias sfossdk=/srv/mer/sdks/sfossdk/mer-sdk-chroot >> ~/.bashrc ; exec bash
  104. Basic tasks
  105. Compiling with the Platform SDK
  106.  
  107. Platform SDK can be used to compile code as well, e.g., you can compile simple applications within the Platform SDK:
  108. mkdir ~/src
  109. cat <<EOF >~/src/hello.c
  110. #include <stdio.h>
  111. int main(int argc, char **argv)
  112. {
  113. printf("Hello World\n");
  114. return 0;
  115. }
  116. EOF
  117. gcc ~/src/hello.c -o ~/src/hello
  118.  
  119. and run it:
  120. ~/src/hello
  121.  
  122. Note that this compilation is strictly for compiling code for use in the Platform SDK itself - i.e. it's not terribly useful for writing code for SailfishOS devices; for that you need a suitable Target ... keep reading.
  123. Next Steps
  124.  
  125. The next step is to look at setting up the Platform SDK Targets and installing and using more Development Tools
  126. Updating the Platform SDK
  127.  
  128. Attention: Sailfish OS Platform SDK before Sailfish OS release version 2.1.3 did not support simultaneous installation of SDK Targets for multiple Sailfish OS versions. If you are using such an older SDK you should ensure that the Platform SDK release version matches the SDK Target release versions and you should only update your Platform SDK after all SDK Targets are updated.
  129.  
  130. You can check your current release version by executing ssu re in the SDK. For a newer SDK release version check out the Application SDK Release Notes. In this example we will use Jolla release 2.0.2.48.
  131.  
  132. sudo ssu re 2.0.2.48
  133. sudo zypper ref
  134. sudo zypper dup
  135. Removing the Platform SDK
  136.  
  137. Remove all SDK Targets and Toolings, then simply exit all chroot instances and, using sudo, remove /srv/mers/sdks/sfossdk.
  138. Extras
  139.  
  140. Multiple Platform SDKs
  141. You should be able to install and connect to multiple Platform SDKs at the same time.
  142. Known Issues
  143. work around bug #554 : mic failure
  144.  
  145. To work around a bug #554 add the following to ~/.mersdk.profile (e.g. Fedora >= 17 needs that):
  146. export PATH=$PATH:/sbin
  147. "not enough disk space left" or similar
  148.  
  149. If you do actually have enough disk then the problem is possible that the kernel on your host is too old. To run Platform SDK you should be running kernel 2.6.37 or newer on your host.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement