Difference between revisions of "WebOS Internals PDK"

From WebOS Internals
Jump to navigation Jump to search
m (add mandriva part)
Line 97: Line 97:
 
  cd /srv/preware/cross-compile/toolchain/arm-2007q3/arm-none-linux-gnueabi/libc
 
  cd /srv/preware/cross-compile/toolchain/arm-2007q3/arm-none-linux-gnueabi/libc
 
  PATH=/srv/preware/cross-compile/toolchain/arm-2007q3/bin:${PATH} sb2-init -c /usr/bin/qemu-arm armv7 arm-none-linux-gnueabi-gcc
 
  PATH=/srv/preware/cross-compile/toolchain/arm-2007q3/bin:${PATH} sb2-init -c /usr/bin/qemu-arm armv7 arm-none-linux-gnueabi-gcc
 +
cd /srv/preware/cross-compile
 +
 +
Then:
 +
 +
make stage
 +
 +
Once this setup is complete, compiling sdl apps for webOS is very simple.
 +
 +
== Installation on Mandriva Linux for WebOS PDK cross compiling ==
 +
 +
===Toolchain===
 +
 +
===Prequisites===
 +
 +
Your Mandriva installation will need the following installed.  If you do not have them, run the command after the package name. You can test if they are found by just typing the command name.  If it says command not found, you need to install it.
 +
 +
With the root account :
 +
 +
{| border="1"
 +
|+
 +
|'''git''' || urpmi git-core
 +
|          || urpmi git-prompt
 +
|-
 +
|'''gcc''' || urpmi gcc
 +
|-
 +
|'''curl''' || urpmi curl
 +
|-
 +
|'''unzip'''|| urpmi unzip
 +
|-
 +
|'''autoconf'''|| urpmi autoconf
 +
|-
 +
|'''subversion'''|| urpmi subversion
 +
|-
 +
|'''libtool'''|| urpmi libtool
 +
|-
 +
|'''wget'''|| urpmi wget
 +
|-
 +
|'''pkg-config'''|| urpmi pkgconfig
 +
|-
 +
|'''gettext'''|| urpmi gettext
 +
|-
 +
|'''fakeroot'''|| urpmi fakeroot
 +
|-
 +
|'''javac'''|| urpmi java-1.6.0-sun
 +
|          || urpmi java-1.6.0-sun-devel
 +
|-
 +
|'''ant'''|| urpmi ant
 +
|}
 +
 +
 +
'''Note:''' The ''make toolchain'' command and later steps will download approximately a half-gig of tools and sources from various locations.  Do not start this if you do not have time for a large download.  Additionally, if you already have downloaded a copy of the correct version of the WebOS doctor, you can reduce the download time by copying the doctor file into cross-compile/doctors/ with the correct name.  This will cause the appropriate command to skip that download.  Note that codesourcery rate limts downloads and at a minimum this process will take 10 to 15 minutes irrespective of your connection speed.
 +
 +
====Start setup====
 +
 +
Create a preware folder, copy the cross-compile tools into it (if you have not installed git, urpmi git-core), and use a make script to begin the set up of the compilation toolchain.
 +
 +
sudo mkdir -p /srv/preware
 +
cd /srv/preware
 +
sudo chmod 777 .
 +
git clone git://git.webos-internals.org/preware/cross-compile.git
 +
cd cross-compile
 +
make toolchain
 +
 +
==== Setup Scratchbox ====
 +
 +
Because we need the command line /usr/bin/qemu-arm for Scratchbox, install the Qemu packages :
 +
urpmi qemu
 +
urpmi cyrus-sasl
 +
urpmi qemu-img
 +
 +
 +
The scratchbox2 .deb package is available for Ubuntu but noot Mandriva, we need to [http://rotateright.com/forum/index.php?topic=42.0 compile] it :
 +
 +
cd /srv/
 +
mkdir sb2
 +
cd sb2
 +
wget http://cgit.freedesktop.org/sbox2/snapshot/sbox2-2.0.tar.gz
 +
tar xzvf sbox2-2.0.tar.gz
 +
cd sbox2-2.0
 +
 +
Because of the errors:
 +
 +
In file included from luaif/sb_log.c:49:                                                   
 +
/srv/webos-cross-compiling/sb2/sbox2-2.0/preload/exported.h:505: erreur: conflicting types for ‘scandir’
 +
/usr/include/dirent.h:252: note: previous declaration of ‘scandir’ was here                           
 +
/srv/webos-cross-compiling/sb2/sbox2-2.0/preload/exported.h:521: erreur: conflicting types for ‘scandir64’
 +
/usr/include/dirent.h:275: note: previous declaration of ‘scandir64’ was here                           
 +
make[1]: *** [luaif/sb_log.o] Erreur 1
 +
 +
There is a fix [http://www.my-own-road.com/archives/145 here]
 +
 +
Edit the file preload/interface.master
 +
 +
Line 410, replace
 +
SCANDIR_TYPE_ARG3, int(*compar)(const void *, const void *)) : \
 +
by
 +
SCANDIR_TYPE_ARG3, int(*compar)(const struct dirent **, const struct dirent **)) : \
 +
 +
Line 414, replace
 +
WRAP: int scandir(const char *dirname, struct dirent ***namelist, int (*select)(struct dirent *), int (*compar)(const void *, const void *)): map(dirname)
 +
by
 +
WRAP: int scandir(const char *dirname, struct dirent ***namelist, int (*select)(struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)): map(dirname)
 +
 +
Line 420, replace
 +
int(*compar)(const void *, const void *)) : \
 +
by
 +
int(*compar)(const struct dirent64 **, const struct dirent64 **)) : \
 +
 +
./autogen.sh
 +
make install prefix=/usr/local
 +
 +
 
 +
After setup scratchbox, set it up for compiling for webOS.
 +
 +
cd /srv/preware/cross-compile/toolchain/arm-2007q3/arm-none-linux-gnueabi/libc
 +
export PATH=/srv/preware/cross-compile/toolchain/arm-2007q3/bin:/usr/local:${PATH}
 +
sb2-init -c /usr/bin/qemu-arm armv7 arm-none-linux-gnueabi-gcc
 
  cd /srv/preware/cross-compile
 
  cd /srv/preware/cross-compile
  

Revision as of 21:59, 25 May 2010

Palm's binary sdk the "Plugin Developer Kit" will not be available until March 2010.

In the mean time, WebOS Internals has released a full "WIDK" (WebOS Internals Development Kit) for you using Scratchbox2.

We strongly urge the community to standardize on this WIDK until Palm releases theirs. We believe that it uses the same underlying technologies, and that it will give you both a means to port games now, and a head-start to development against the official Palm PDK in the future.

Scratchbox 2 is a cross-compilation engine, it can be used to create a highly flexible SDK.

As installed below, the install process uses a script which extracts the required Palm provided files from a copy of webos doctor, and downloads from other sources, and builds a complete compilation environment automatically which can compile SDL and openGLES apps for webOS.

SB2 itself is totally distribution neutral but the webOS cross-compile environment is designed and tested on Ubuntu 9.10 32 bit. (At least one user in #webos-internals reports complete success running the cross compile environment in Ubuntu 9.10 64 bit after installing curl via apt-get.)

The webOS Internals team strongly suggest apt-get install into that environment only for this purpose. The same installation of Sun Virtualbox which hosts the Palm SDK emulator can host an Ubuntu 9.10 server with very little effort.

SB2 Homepage

http://www.freedesktop.org/wiki/Software/sbox2pdk

License

Scratchbox 2 is distributed under LGPL version 2.1, portions are under GPL version 2. Some minor stuff is under MIT style license.

Installation on Ubuntu for WebOS PDK cross compiling

VirtualBox tips for Windows users

If you are running your Ubuntu server in a VirtualBox client on a Windows desktop host, there are a few tricks you should know.

If you run the various commands below from the ubuntu console in VirtualBox, you can not cut and paste into and out of the console. It is to your benefit then, to use PUTTY to control the VirtualBox console instead of running in it directly.

To reach your VirtualBox Ubuntu with Putty, you will need to do some set up steps.

  • From the ubuntu server console apt-get install openSSH-server
  • shut down the ubuntu server
  • In the VirtualBox manager, choose your ubuntu server and pick setup.
  • In setup choose the network adaptor 1, and change it's type from NAT to bridged.

Now, restart your ubuntu server and log into it from the regular console. At prompt after logging in, type ifconfig eth0 . The server will reply with the ip address of the virtualbox server.

Now, go to putty, and create a new login to your ubuntu server with that IP address, type ssh port 22.

Now, you can log into your server, and cut and paste commands and output, you can scroll back and see things that have scrolled off the screen etc. etc.

This is strongly advised.

Toolchain

Prequisites

Your Ubuntu installation will need the following installed. If you do not have them, run the command after the package name. You can test if they are found by just typing the command name. If it says command not found, you need to install it.

git sudo apt-get install git-core
gcc sudo apt-get install build-essential
curl sudo apt-get install curl
unzip sudo apt-get install unzip
autoconf sudo apt-get install autoconf
subversion sudo apt-get install subversion
libtool sudo apt-get install libtool
wget sudo apt-get install wget
pkg-config sudo apt-get install pkg-config
gettext sudo apt-get install gettext
fakeroot sudo apt-get install fakeroot
javac sudo apt-get install sun-java6-jdk
ant sudo apt-get install ant


If you're uncertain at all, just cut and paste the following. If they are already installed, they'll be skipped.

 sudo apt-get install git-core build-essential curl unzip autoconf subversion libtool wget pkg-config gettext fakeroot sun-java6-jdk ant

Note: The make toolchain command and later steps will download approximately a half-gig of tools and sources from various locations. Do not start this if you do not have time for a large download. Additionally, if you already have downloaded a copy of the correct version of the WebOS doctor, you can reduce the download time by copying the doctor file into cross-compile/doctors/ with the correct name. This will cause the appropriate command to skip that download. Note that codesourcery rate limts downloads and at a minimum this process will take 10 to 15 minutes irrespective of your connection speed.

Start setup

Create a preware folder, copy the cross-compile tools into it (if you have not installed git, apt-get install git-core), and use a make script to begin the set up of the compilation toolchain.

sudo mkdir -p /srv/preware
cd /srv/preware
sudo chmod 777 .
git clone git://git.webos-internals.org/preware/cross-compile.git
cd cross-compile
make toolchain

Fix mmap errors

The following commands appear redundant. They are not. The install this fixes your mmap config to fix an mmap: permission denied error, but we don't need the package itself.

sudo apt-get install qemu-arm-static
sudo apt-get remove qemu-arm-static
OR As a workaround, if this package is not available,
the following commands can be executed in a root shell (sudo -s) to fix the mmap configuration to enable qemu-arm to work.
echo "vm.mmap_min_addr = 4096" > /etc/sysctl.d/mmap_min_addr.conf
/etc/init.d/procps restart

(note that the value should not be "0". 4096 is chosen to avoid null pointer attacks.)


Setup Scratchbox

Now, use apt-get to setup scratchbox...

sudo apt-get install scratchbox2 qemu-kvm-extras

...and set it up for compiling for webOS.

cd /srv/preware/cross-compile/toolchain/arm-2007q3/arm-none-linux-gnueabi/libc
PATH=/srv/preware/cross-compile/toolchain/arm-2007q3/bin:${PATH} sb2-init -c /usr/bin/qemu-arm armv7 arm-none-linux-gnueabi-gcc
cd /srv/preware/cross-compile

Then:

make stage

Once this setup is complete, compiling sdl apps for webOS is very simple.

Installation on Mandriva Linux for WebOS PDK cross compiling

Toolchain

Prequisites

Your Mandriva installation will need the following installed. If you do not have them, run the command after the package name. You can test if they are found by just typing the command name. If it says command not found, you need to install it.

With the root account :

git urpmi git-core urpmi git-prompt
gcc urpmi gcc
curl urpmi curl
unzip urpmi unzip
autoconf urpmi autoconf
subversion urpmi subversion
libtool urpmi libtool
wget urpmi wget
pkg-config urpmi pkgconfig
gettext urpmi gettext
fakeroot urpmi fakeroot
javac urpmi java-1.6.0-sun urpmi java-1.6.0-sun-devel
ant urpmi ant


Note: The make toolchain command and later steps will download approximately a half-gig of tools and sources from various locations. Do not start this if you do not have time for a large download. Additionally, if you already have downloaded a copy of the correct version of the WebOS doctor, you can reduce the download time by copying the doctor file into cross-compile/doctors/ with the correct name. This will cause the appropriate command to skip that download. Note that codesourcery rate limts downloads and at a minimum this process will take 10 to 15 minutes irrespective of your connection speed.

Start setup

Create a preware folder, copy the cross-compile tools into it (if you have not installed git, urpmi git-core), and use a make script to begin the set up of the compilation toolchain.

sudo mkdir -p /srv/preware
cd /srv/preware
sudo chmod 777 .
git clone git://git.webos-internals.org/preware/cross-compile.git
cd cross-compile
make toolchain

Setup Scratchbox

Because we need the command line /usr/bin/qemu-arm for Scratchbox, install the Qemu packages :

urpmi qemu
urpmi cyrus-sasl
urpmi qemu-img

The scratchbox2 .deb package is available for Ubuntu but noot Mandriva, we need to compile it :

cd /srv/
mkdir sb2
cd sb2 
wget http://cgit.freedesktop.org/sbox2/snapshot/sbox2-2.0.tar.gz
tar xzvf sbox2-2.0.tar.gz
cd sbox2-2.0

Because of the errors:

In file included from luaif/sb_log.c:49:                                                     
/srv/webos-cross-compiling/sb2/sbox2-2.0/preload/exported.h:505: erreur: conflicting types for ‘scandir’
/usr/include/dirent.h:252: note: previous declaration of ‘scandir’ was here                             
/srv/webos-cross-compiling/sb2/sbox2-2.0/preload/exported.h:521: erreur: conflicting types for ‘scandir64’
/usr/include/dirent.h:275: note: previous declaration of ‘scandir64’ was here                             
make[1]: *** [luaif/sb_log.o] Erreur 1 

There is a fix here

Edit the file preload/interface.master

Line 410, replace

SCANDIR_TYPE_ARG3, int(*compar)(const void *, const void *)) : \

by

SCANDIR_TYPE_ARG3, int(*compar)(const struct dirent **, const struct dirent **)) : \

Line 414, replace

WRAP: int scandir(const char *dirname, struct dirent ***namelist, int (*select)(struct dirent *), int (*compar)(const void *, const void *)): map(dirname)

by

WRAP: int scandir(const char *dirname, struct dirent ***namelist, int (*select)(struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)): map(dirname) 

Line 420, replace

int(*compar)(const void *, const void *)) : \

by

int(*compar)(const struct dirent64 **, const struct dirent64 **)) : \

./autogen.sh
make install prefix=/usr/local


After setup scratchbox, set it up for compiling for webOS.

cd /srv/preware/cross-compile/toolchain/arm-2007q3/arm-none-linux-gnueabi/libc
export PATH=/srv/preware/cross-compile/toolchain/arm-2007q3/bin:/usr/local:${PATH} 
sb2-init -c /usr/bin/qemu-arm armv7 arm-none-linux-gnueabi-gcc
cd /srv/preware/cross-compile

Then:

make stage

Once this setup is complete, compiling sdl apps for webOS is very simple.

Errors during make stage (Feb 27 8:45 UTC)

Confirmed by 2 people:

Ecore

  • TRUE and FALSE are not defined

Manually add the definition:


#ifndef TRUE
# define TRUE 1
#endif
#ifndef FALSE
# define FALSE 0
#endif


Sample build of Application:Doom

Now, go to Building DOOM with scratchbox2 and follow the simple directions.

In Process Enhancements

Extracting the PDK on Linux