The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)


Sailfish SDK Hacks

From Mer Wiki
Jump to: navigation, search

To build the actual arm rpm

The SDK will let you build against the ARM target but doesn't quite make the rpm (AFAICT).

Start by ssh'ing into the sdk:

 ssh mersdk@mersdk -i ~/SailfishOS/vmshare/ssh/private_keys/engine/mersdk

then go to your development src dir (has to be within home still) and run the mb2 rpm command:

 cd ~/src/myapp
 mb2 -t SailfishOS-armv7hl rpm

Note that a more general purpose all-in-one .spec build is done using:

 mb2 -t SailfishOS-armv7hl build

Setup ssh to deploy rpm to device : note device IP is hardcoded here

We need to do a one-time setup to make ssh from the SDK VM work; so a little background:

SDK uses a file called devices.xml to keep track of different devices with theirip, OS and version.

We first prepare some ssh keys to allow the SDK to login to the device (you wouldn't want it storing a password would you). Notice these should not be passphrase protected as there's no easy way to interact the agent.

Then choose a path to store the keys (the SDK uses /1,/2,/3 for emulators and d1,d2... for devices so don't use them - a simple name is fine). Then make a key for the nemo user:

mkdir -p ~/SailfishOS/vmshare/ssh/private_keys/Jolla/
ssh-keygen -t rsa -P "" -f ~/SailfishOS/vmshare/ssh/private_keys/Jolla/nemo
ssh-keygen -t rsa -P "" -f ~/SailfishOS/vmshare/ssh/private_keys/Jolla/root

Ensure the device has developer mode enabled, you have remote connection enabled and there is a password.

Then some ssh key magic to ensure these keys are authorised. Paste these lines one at a time into a normal shell. Set the IP of your device in the first one. You should need to enter your password twice.

IP=10.0.0.101
cat ~/SailfishOS/vmshare/ssh/private_keys/Jolla/nemo.pub | ssh nemo@$IP mkdir -p .ssh\; chmod 700 .ssh\; cat \>\> \~/.ssh/authorized_keys\; chmod 600 \~/.ssh/authorized_keys

scp ~/SailfishOS/vmshare/ssh/private_keys/Jolla/root.pub nemo@$IP:root.pub
ssh nemo@$IP
devel-su
mkdir -p /root/.ssh;chmod 700 /root/.ssh; cat /home/nemo/root.pub >> /root/.ssh/authorized_keys ;chmod 600 /root/.ssh/authorized_keys;rm -f /home/nemo/root.pub

There needs to be a root key for deploying using --zypper. --pkcon *should* use the nemo user but uses root which is a bug. The --rsync option just doesn't seem to work.

Windows users can probably login to the SDK as the nemo user to run the above commands and then move the resulting ssh files/paths to the right place (don't know where that is, please edit here if you fix it)

Now on your host edit ~/SailfishOS/vmshare/devices.xml and add the following (note the sshkeypath should use the device string used above). You need to keep the IP up to date if you're on dhcp. We use type="custom" as QtCreator is *still* a bit heavy handed when it comes to handling this file :)

 <device name="Jolla_custom" type="custom">
  <ip>10.0.0.101</ip>
  <sshkeypath>ssh/private_keys/Jolla</sshkeypath> 
  <version>1.0.0.5</version>
 </device>

Now you can ssh into the SDK and use the device name with the mb2 command:

ssh mersdk@mersdk -i ~/SailfishOS/vmshare/ssh/private_keys/engine/mersdk

Finally ... deploy

ssh in to the SDK VM again and change to the src directory

cd ~/src/myapp
mb2 -t SailfishOS-armv7hl -d Jolla_custom deploy --pkcon

Remember to edit ~/SailfishOS/vmshare/devices.xml if your device IP changes. The UI in QtCreator should address all this eventually.

Personal tools