Building Apps and Kernels

If you are looking for instructions for building apps and kernels for WebOS, you have come to the right place. If you have not run through the WebOS Internals PDK wiki page, you should start there.

Setup
Depending on what you're building you might need some of the prereq's from WebOS Internals PDK installation.

Create the directory structure for the source: sudo mkdir -p /srv/preware cd /srv/preware sudo chmod 777.

Pull down the app source with git. git clone git://git.webos-internals.org/preware/build.git

After you have the source, you need to build the toolchain — this can take some time or if you already have the toolchain installed, please see below cd build make toolchain

Please see the notes if you already have the correct toolchain installed and do not want to download it again.

Apps
Package up preware. cd /srv/preware/build/apps/preware make package

Kernels
Package up UberKernel. cd /srv/preware/build/kernels/uber-kernel-touchpad make package

Testing your kernel you will find your kernel in build/src-3.0.2-22/linux-2.6.35/arch/arm/boot you can boot it using memboot. to do this do the following 1) turn off the touchpad 2) connect it to your machine 3) press the Volume Up key and power on the device, you should see a giant USB logo on the device 4) novacom boot mem:// < uImage

Libraries
Once you have your toolchain configured and you have had a chance to get your SB2 cross compiler working with one of the applications above, you might be looking to add libraries or compile libraries and "stage" them into your cross compiler /usr directory. The /usr directory in your toolchain is the directory that contains the lib files and include files necessary to compile libraries or applications against the toolchain. Since the TouchPad is targeting armv7, we have to compile libraries to target the armv7 architecture and stage them into the architecture's root /usr/lib and include directories.

Don't worry, once you get the hang of it, it's pretty straight forward. You just have to trust that this is the fastest and easiest way to pull down code, compile dependencies, and get the ball rolling on your own library or application.

You might also be interested in using additional libraries in your projects. Your best bet for getting the latest source is to look in the locations of the existing libraries used in other packages.

It's a good idea to first take a look at the directories for all of the common libraries that were downloaded when you setup your toolchain: cd /srv/preware/cross-compile/packages/common/x ls Each directory here is a separate library. The library folder contains a Makefile, which links to other Makefiles. The Makefiles download source for the library and compile the various dependencies of the library that kicked off the make command.

Let's start by simply compiling libxcb and take a look at the different pieces involved in getting the library to compile properly. If you crack open the Makefile for libxcb: nano /srv/preware/cross-compile/packages/common/x/libxcb/Makefile

You should see the name of the project, the version number for libxcb (this is used to download the package from the tar) and the SRC_BZ2 url. The SRC_BZ2 url can be changed to point to the package that you're looking to compile. NAME = libxcb VERSION = 1.7

DEPENDS = x/xcbproto        \ x/libpthread-stubs \ x/xau

SRC_BZ2 = http://xcb.freedesktop.org/dist/${NAME}-${VERSION}.tar.bz2 ...

For most instances, the above text is the only text you will need to modify (for most cases where you need to compile your own library folder in the packages directory). The process is pretty straight forward from here. Keep in mind, any folder you list in the DEPENDS section will need to exist and have a Makefile containing similar logic as the makefile you created for the library that lists it in its Makefile depends section.

If you want to test out compiling and staging (installing the library into your target architecture /usr/lib and include folder like we mention above), just type: make stage package Note: some packages might need additional work to compile (e.g. compiling libxcb requires that you create the full path for the documentation before it will install properly /usr/local/share/doc/libxcb/tutorial).

Now when you want to configure your own application or library outside of the toolchain or preware directory (such as a library or application you downloaded or are using Eclipse to develop) simply cd into that source directory and enter the toolchain: sb2 -M /srv/preware/cross-compile/staging/mapping-armv7 ./configure make all or cmake. make

Making and packaging builds the goods, packages them for you in a neat little ipkg and places the code where it needs to go for other apps and libraries to link to. That's about all there is to it!

Samples
After you run through the WIDK and setup your toolchain, take a look at How_To_Build_Xecutah for details on building X Server and the process for building an application.