Difference between revisions of "Getting Started With Development"

From WebOS-Ports
Jump to navigation Jump to search
(Top Tip: Take a look at adb shell)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
=== Help Develop LuneOS ===
 
=== Help Develop LuneOS ===
 
==== Build and Install LuneOS ====
 
==== Build and Install LuneOS ====
For an easy life, develop on Linux. Ubuntu 12.04 LTS 64-bit works well.
+
For an easy life, develop on Linux. Ubuntu 18.04 LTS 64-bit works well. You'll need 18.04 to be able to re-use sstate cache generated by jenkins builds (enabled here https://github.com/webOS-ports/webos-ports-setup/blob/master/conf/local.conf#L61 otherwise just comment out this line to save a lot of http requests during the build and speed things up a bit).
  
 
The [https://github.com/webos-ports/ source code] is on GitHub so you need a copy of [http://git-scm.com/ git] for a start.
 
The [https://github.com/webos-ports/ source code] is on GitHub so you need a copy of [http://git-scm.com/ git] for a start.
Line 34: Line 34:
 
You could change something in there and bitbake again to see what happens. (Will your change be incorporated or overwritten?)
 
You could change something in there and bitbake again to see what happens. (Will your change be incorporated or overwritten?)
 
If you have made a worthwhile change, our [[Submitting_Contributions|Submitting Contributions]] instructions tell you how to get it pulled into the main line.
 
If you have made a worthwhile change, our [[Submitting_Contributions|Submitting Contributions]] instructions tell you how to get it pulled into the main line.
 +
 +
===== Development Tools =====
 +
The free version of QtCreator is a popular IDE for writing and testing many of the newer LuneOS applications.
 +
 +
One pattern: Have QtCreator and cloned QML repos as well as luneos-components on the same level as cloned repos such as org.webosports.app.phone, org.webosports.app.firstuse etc and luneos-components.
 +
 +
luneos-components is basically a central location for reusable stuff. We try to push stuff here as much as possible so we maintain common components only once.
 +
 +
C++: Modify it using geany or qtcreator and then build only the corresponding (ipk) package and (adb push and opkg) install it on device. Each loop takes a couple of minutes. It's not that fast, but still OK.
  
 
=== Help Develop the Core LuneOS Applications / Develop Your Own Applications ===
 
=== Help Develop the Core LuneOS Applications / Develop Your Own Applications ===

Latest revision as of 09:41, 28 February 2019

Help Develop LuneOS

Build and Install LuneOS

For an easy life, develop on Linux. Ubuntu 18.04 LTS 64-bit works well. You'll need 18.04 to be able to re-use sstate cache generated by jenkins builds (enabled here https://github.com/webOS-ports/webos-ports-setup/blob/master/conf/local.conf#L61 otherwise just comment out this line to save a lot of http requests during the build and speed things up a bit).

The source code is on GitHub so you need a copy of git for a start.

Instructions for building (or just downloading) and installing an image can be reached by selecting a target device from the Devices page. Notice that there is a LuneOS VirtualBox Emulator which you can use instead of a target device.

Build System Overview

I assume that the build system is based on the Open webOS one.

Set-up is automated

$ wget https://raw.github.com/webOS-ports/webos-ports-setup/testing/Makefile
$ make setup-webos-ports

(but do follow the proper instructions for your device).

The build itself is based on the OpenEmbedded (oe) build framework for embedded Linux and is driven by the BitBake (bb) build engine (rather than make).

You bitbake a "recipe". This is a simple text file of metadata with the extension .bb indicating how to fetch, build and install something. The system is very modular. One recipe depends on another and there are hundreds of recipes involved in our build.

The particularly interesting recipes for our purposes, such as luneos-dev-package, are in webos-ports/meta-webos-ports/meta-luneos/recipes-core/images.

Repository Layout might make some sense to you now!

The Porting Guide sheds quite a lot of light on this too.

Develop!

So let's say you have built luneos-dev-package, installed it on a device and had a play around with it. How can you change it?

Start with a browse around the meta-webos-ports/meta-luneos layer folder (on your build machine). Its conf/distro/luneos.conf is interesting. This is where we pick up Open webOS from LG and then customise it. (Pretty sure about that, anyway.) The luneos "distro platform codename" gets set in the file luneos.inc for example.

You could change something in there and bitbake again to see what happens. (Will your change be incorporated or overwritten?) If you have made a worthwhile change, our Submitting Contributions instructions tell you how to get it pulled into the main line.

Development Tools

The free version of QtCreator is a popular IDE for writing and testing many of the newer LuneOS applications.

One pattern: Have QtCreator and cloned QML repos as well as luneos-components on the same level as cloned repos such as org.webosports.app.phone, org.webosports.app.firstuse etc and luneos-components.

luneos-components is basically a central location for reusable stuff. We try to push stuff here as much as possible so we maintain common components only once.

C++: Modify it using geany or qtcreator and then build only the corresponding (ipk) package and (adb push and opkg) install it on device. Each loop takes a couple of minutes. It's not that fast, but still OK.

Help Develop the Core LuneOS Applications / Develop Your Own Applications

If you are looking to improve the bundled apps (or add new ones), the recipes are in meta-luneos/recipes-luneos/apps. Make some sense of those and you will definitely be winning. Can you find the fetched source code? Do you understand why it is where it is?

Enyo 1.0 apps (Touchpad/Pre 3/Veer) should work on LuneOS since Enyo 1.0 is included in our build and is used by the core apps like Email as well. However there hasn't been extensive testing of legacy Enyo 1.0 apps by the project team. Enyo 2.0 apps should work without too many issues, because Enyo 2.0 is included automatically when you build an app :)

In LuneOS you can also run QML applications out of the box (unlike legacy webOS where you needed some modifications before you can get them running). A good example is FingerTerm which is included in our build and which was borrowed from the Jolla/Nemo/Sailfish project. Currently the following applications are written in QML: Browser, Phone App and First Use. QML is a rapidly developing language with an easy syntax to learn and has good tools for testing on the desktop as well.

The distributed apps are located in /usr/palm/applications/myappname, so for example /usr/palm/applications/org.webosports.app.settings Non-distributed (user/externally installed) apps are located in /media/cryptofs/apps/usr/palm/applications/myappname, so for example /media/cryptofs/apps/usr/palm/applications/net.minego.phnx

You can test the apps on device or in the VirtualBox emulator. Enyo 2 apps can be tested in a modern browser too. Chrome or another webkit/chromium based browser is recommended. This however will only work properly for apps that don't require services and luna calls on the device etc.

There are various ways to install your application to the device:

  1. Use Preware 2 to install the IPK file. You can create the IPK file with the palm-package command found in the webOS SDK. For Enyo 2 apps, please make sure to add the appinfo.json to your app. See also http://forums.webosnation.com/palm-pre-2/328145-development-pre-2-a.html#post3421312 for more info.
  2. You can use ADB to push your application to the device. For example, if you have written a new version of the built in calculator app you would type something like

adb push ~/org.webosports.app.calculator/deploy/org.webosports.app.calculator /usr/palm/applications/org.webosports.app.calculator

Top Tip - Run adb shell

  1. Connect your device with a LuneOS developer mode build on it to your development machine with a USB cable.
  2. Run adb shell in a terminal on your development machine.

That will give you a terminal session inside your LuneOS device.

  • Take a look around the filesystem.
  • Run journalctl to see what is in the system log.
  • This is where to run the various luna-send commands you'll see people talking about around here.