Difference between revisions of "Building Apps and Kernels"

From WebOS Internals
Jump to navigation Jump to search
(Added info for libraries.)
m
Line 61: Line 61:
 
cd /srv/preware/cross-compile/packages/common/x
 
cd /srv/preware/cross-compile/packages/common/x
 
ls
 
ls
<pre>
+
</pre>
 
Each directory here is a separate library. The library folder contains a Makefile, which links to other make files for both downloading source for the library and various dependencies of your project.  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.
 
Each directory here is a separate library. The library folder contains a Makefile, which links to other make files for both downloading source for the library and various dependencies of your project.  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.
  

Revision as of 05:49, 3 September 2011

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 here: http://www.webos-internals.org/wiki/WebOS_Internals_PDK

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.

You might also be interested in using additional libraries in your projects. Your best bet is to locate source for your code in some of the existing libraries used in other packages. Let's start by simply compiling libxcb and take a look at the different pieces involved in getting the library to compile properly.

First, you might want to take a look at the directories for all of the common libraries already 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 make files for both downloading source for the library and various dependencies of your project. 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.

If you crack open the Makefile for xproto you should see the name of the project, the version number for xproto (this is used to download the package from the tar) and the SRC_BZ2 url (you can change this URL to point to the package that you're looking to compile:

nano /srv/preware/cross-compile/packages/common/x/libxcb/Makefile
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. Just 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 it into your target architecture /usr/lib and include folder like we mention above), just type:

make stage package

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!

Notes

If you already have the correct version of the toolchain installed for the device you are targeting you can symlink it to the proper location (e.g. the touchpad needs the Sourcery G++ Lite 2009q1-203 toolchain).

If it is already installed you can symlink it into the build area:

cd toolchain/cs09q1armel
mkdir build
cd build
ln -s <location of toolchain> arm-2009q1

Samples

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