User:Jebba/SDK

Contents

SDK

There are a couple different SDKs (at least) that can be used. I have the main/standard SDK up and running on Fedora 12 x86_64. It is based on Scratchbox 1. There is another SDK, Maemo SDK+, which is based on Scratchbox 2, but I don't have that working yet.


Installing Maemo 5 SDK on Fedora 12 x86_64

Prepare host system

Add "vdso32=0" to your kernel bootline so it looks something like this (I also have selinux disabled). Edit /boot/grub/grub.conf. You have to reboot for it to take effect.

kernel /vmlinuz-2.6.31.6-145.fc12.x86_64 ro root=/dev/sda2 selinux=0 quiet rhgb nompath nodmraid SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 KEYTABLE=la-latin1 vdso32=0

Install Xephyr

sudo yum -y install Xephyr

Download and patch wizard

Grab the wizard script.

wget http://repository.maemo.org/stable/5.0/maemo-sdk-install-wizard_5.0.py
chmod +x maemo-sdk-install-wizard_5.0.py

Apply this patch to maemo-sdk-install-wizard_5.0.py:

--- maemo-sdk-install-wizard_5.0.py.orig    2009-11-16 08:16:39.000000000 -0300
+++ maemo-sdk-install-wizard_5.0.py    2009-12-04 17:29:00.905719892 -0300
@@ -2308,7 +2308,7 @@
        tries = 2
        while (True):
            try:
-                exec_cmd(sb_installer_fn + opt)
+                exec_cmd(sb_installer_fn + opt + "-s " + SB_PATH)
            except:
                tries -= 1
                if tries:
@@ -2348,7 +2348,7 @@


        # do the installation thing
-        cmd = "%s -d -m %s" % (sdk_installer_fn, self.__sdk_inst_m_opt_arg)
+        cmd = "%s -d -m %s -s %s" % (sdk_installer_fn, self.__sdk_inst_m_opt_arg, SB_PATH)

        if self.__targets_exist:
            if self.__remove_targets:

Run wizard, run

Then start up the install wizard:

sudo ./maemo-sdk-install-wizard_5.0.py

In SDK install wizard GUI:

  1. Next
  2. Custom Installation, Commit
  3. Gar, Next
  4. Install anyway, Next
  5. User jebba, Next
  6. Install options, Next
  7. VDSO suport, I accept, Next (though I did boot with vdso=32 ...)
  8. Development environment, Next
  9. Accept barf, Next (gah)
  10. It will then download everything and install. Perhaps a couple Nexts and it is done.


"No dpkg" error

If you get the following error, it is because your maemo-sdk-install-wizard_5.0.py script didn't get patched correctly, as above.

which: no dpkg in (/usr/bin:/bin)
dpkg tool in path... no
E: This script requires dpkg to install .deb files.
V [17:19:35 04.12.2009]: Installer execution failed
V [17:19:35 04.12.2009]: ----- Begin logging exception -----
Traceback (most recent call last):
 File "./maemo-sdk-install-wizard_5.0.py", line 2705, in run
   task( )
 File "./maemo-sdk-install-wizard_5.0.py", line 2318, in __taskInstallScratchbox
    raise Exception("Installer execution failed")
Exception: Installer execution failed
V [17:19:35 04.12.2009]: ----- End logging exception -----
V [17:19:35 04.12.2009]: Executor set exit status to (status_error)


See also:

Running Maemo 5 SDK on Fedora 12 x86_64

Now that the SDK is happily installed, you can run it.

New Group sbox

In the terminals where you will be running commands you need to run this to show up in the sbox group. Any subsequent times you log out and in you don't need to run it again (in other words, you just have to run this when you first set things up):

newgrp sbox

Start Scratchbox & Xephyr & Login

After installation scratchbox is "booted" up. Subsequently (e.g. after a reboot of your laptop) you will need to start it thusly:

sudo ~/devel/maemo/scratchbox/sbin/sbox_ctl start


Get Xephyr going, which is the X server. Note the Fedora 12 version doesn't have the "-kb" optioned mentioned in other docs.

Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac


Log in to Scratchbox:

~/devel/maemo/scratchbox/login

This should give you a prompt like this:

[sbox-FREMANTLE_X86: ~] > 

Then to launch the emulated GUI, run this at the above prompt:

af-sb-init.sh start

Then you should have the emulator up and running! :)

Using SDK

Frequently Used Commands

Build binary package:

cd foo-1.2.3
dpkg-buildpackage -rfakeroot -b -uc

Build source package:

cd foo-1.2.3
dpkg-buildpackage -rfakeroot

Switch to build for ARM:

sb-conf select FREMANTLE_ARMEL

Switch to build for x86:

sb-conf select FREMANTLE_X86

Kill off things running if it won't let you switch between ARM/x86:

sb-conf killall

Grab and start building a source package:

apt-get -b source foo

File that describes package being built:

vim foo-1.2.3/debian/control

File that has build rules (e.g. where ./configure is):

vim foo-1.2.3/debian/rules

File that lists patches to be used:

vim foo-1.2.3/debian/patches/series


Source Repositories

One of the "easiest" ways to get things built is to just check to see if it is in any of the Debian repositories and just pillage it from there. Grabbing it from an "old" repository and building it will be easiest because the dependencies are more likely to be the same. Grabbing it from the latest and greatest repository means you will get the most recent version of the package, but will probably have to go through and sort out more dependencies.

Note, you (or I) probably don't want to add the binary repositories to your build environment or you may cause some total chaos in your system. In this case, I am only adding the source repositories.

These are the source repos I added to /etc/apt/sources.list. Note that you have to do this within both architectures (x86/ARM) as they don't share the same sources.list.

# Etch
#deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ etch main contrib

# Etch Backports
#deb-src http://www.backports.org/debian etch-backports main contrib

# Stable Lenny
#deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ stable main contrib
#deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ lenny main contrib

# Testing Squeeze
#deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ testing main contrib
deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ squeeze main contrib

# Unstable sid
#deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ unstable main contrib
#deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ sid main contrib

Some of the same repos above are listed twice, just to help me keep straight all of Debian's releases. For example "sid" and "unstable" are the same thing. Explanation:

  • Etch - This is what the SDK is based on. It was released in 2007. Version 4.0. ("oldstable").
  • Etch Backports - These are packages which aren't in Etch, or at least not updated to the latest and greatest in Etch, but people "outside" of the Debian project maintain more recent packages. For example, they may have a more recent version of a web browser when Debian's Etch just backports patches to an ancient version.
  • Lenny - This is the "stable" version of Debian. Version 5.0. Released February 2009.
  • Squeeze - This is the "testing" version of Debian and when it is fully done will be the "stable" release and will be version 6.0.
  • Sid - This version will never be stable nor "released" and is always on the bleeding edge. The latest, most recent packages are in this repository. This is like "rawhide" in Fedora and -current in OpenBSD.

maemo-optify

ANOTHER NOTE: I'm not using maemo-optify anymore since VDVsx said it wasn't the real proper way... Now just doing --prefix=/opt and such...

QUICK NOTE (XXX FIX):

From: Marius Vollmer <marius.vollmer@nokia.com> 
Jeff Moe <moe@blagblagblag.org> writes: 

> I installed the maemo-optify 0.2 package from extras-devel but it is missing 
> the  maemo-optify-buildpackage script. I see it in git. 

Ahh, right.  The maemo-optify-buildpackage script is not used any
longer.  I have removed it from Git to reduce the confusion.

The real dpkg-buildpackage in the SDK has been modified directly to call
maemo-optify.


Tools to make using /opt convenient for Debian packages.

git clone git://gitorious.org/maemo-af/maemo-optify.git

Maemo-optify is available in the repos and you can apt-get it from within scratchbox, but the .deb is missing the maemo-optify-buildpackage script. I emailed the author to let him know. In the interim, grab it from git, and:

cp -p maemo-optify-buildpackage /usr/local/bin

To use it is super-simple, and worked for me without hassle with asterisk:

echo auto > asterisk-1.6.1.11/debian/optify
maemo-optify-buildpackage -rfakeroot -b -uc
maemo-optify-buildpackage -rfakeroot -S


Uh, I also want files of all sizes to be moved to /opt, not just ones above 2048 bytes. Asterisk has 600k of files still, since it has lots of sound files smaller than 2k. There is a forthcoming option to define this in debian/optify, but that feature isn't in place yet. So in the interim remove the maemo-optify packages (from both X86 and ARM), and use this "patch":

--- maemo-optify/maemo-optify    2009-12-04 21:30:51.770927951 -0300
+++ /usr/local/bin/maemo-optify    2009-12-06 17:39:22.000017316 -0300
@@ -127,7 +127,7 @@
        dbg "link, nope\n";
    } elsif (! ($entry eq "." || $entry =~ /^.\/usr/)) {
        dbg "not in /usr, nope\n";
-    } elsif ($size >= 2048) {
+    } elsif ($size >= 0) {
        if (!blacklisted ($entry)) {
            dbg "yes, saved $size bytes\n";
            $total_count += 1;

Upload to extras-devel

Maemian

Lint tool for Maemo packages. Gotta do no ssl verify to clone things from git.maemo.org

GIT_SSL_NO_VERIFY=0 git clone https://git.maemo.org/projects/maemian

See also


Configure Scratchbox environment

Within scratchbox:

echo ":syntax on" > ~/.vimrc
echo ":set paste" >> ~/.vimrc
echo ":set nobackup" >> ~/.vimrc
echo "export TERM=xterm-color" >> ~/.bashrc

I still feel like a total noob sometimes in that I don't even know how to get my fkn Home/End keys to work in the scratchbox. heh. Hint anyone? :)

SDK Errors

If you get this:

ERROR: Scratchbox is not properly set up!

Run this:

sudo /scratchbox/sbin/sbox_ctl start

SDK+

This is the "alternative" SDK based on Scratchbox 2. I don't have it working yet on Fedora 12 x86_64. It complains and says it just works on i386 ARCH.

Maemo SDK+ - Alternative SDK for Maemo based on Scratchbox 2.

http://maemo-sdk.garage.maemo.org/maemo-sdk-installer.py
chmod +x maemo-sdk-installer.py
sudo ./maemo-sdk-installer.py install -g

Hmm. Well, this is crashing and burning on x86_64:

$ sudo ./maemo-sdk-installer.py install -g
Operating system's machine or word size (x86_64) is not supported.
These are supported: ['i386', 'i686']
System check failed!


Things possibly needed:

yum -y install redhat-lsb

debootstrap

Perhaps I should install this sucker in an etch chroot...

yum -y install debootstrap
debootstrap --arch=i386 etch /home/jebba/devel/etch-i386 http://ftp.ccc.uba.ar/pub/linux/debian/debian/