User:Jebba/SDK

=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.

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:
 * SDK Installation
 * Maemo 5 SDK on Fedora 12
 * Maemo 5 SDK on Fedora on Maemo talk.

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! :)

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.

deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ squeeze main contrib
 * 1) Etch
 * 2) deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ etch main contrib
 * 1) Etch Backports
 * 2) deb-src http://www.backports.org/debian etch-backports main contrib
 * 1) Stable Lenny
 * 2) deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ stable main contrib
 * 3) deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ lenny main contrib
 * 1) Testing Squeeze
 * 2) deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ testing main contrib
 * 1) Unstable sid
 * 2) deb-src http://ftp.ccc.uba.ar/pub/linux/debian/debian/ unstable main contrib
 * 3) 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  Jeff Moe  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 README

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

 * Uploading to extras-devel - I got permission to upload to extras. Yee haw.


 * builder logs

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

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/

Free Development Box
I have set up a server for folks to use that don't have access to a /scratchbox, can't set one up, want a faster one, etc. If you would like access to it, drop me a note at moe@blagblagblag.org

Website

 * Free devel box

The website has subdirs for users if they want to share the .debs they make. I have made mine a repository so packages can be grabbed with the Hildon Application Manager or apt-get.

buildrepo
This is my buildrepo script. I think I may change the repository setup so I have fremantle, harmattan, etc. sub-directories. It is not generating .diffs, which would make `apt-get update`s faster, but then again, it's a teeny repo right now so that probably doesn't matter. Tips welcome.

dpkg-scanpackages dists/unstable/main/binary-armel /dev/null | gzip -9c > dists/unstable/main/binary-armel/Packages.gz dpkg-scansources dists/unstable/main/source /dev/null | gzip -9c > dists/unstable/main/source/Sources.gz
 * 1) !/bin/sh
 * 1) Binary Packages
 * 1) Source Packages

QEMU
The build server is running as a qemu guest. It is launched from the host thusly:

/usr/local/bin/qemu-system-x86_64 \ -drive \ file=/kvm/flauta.qcow2,index=0,if=virtio,cache=writeback,boot=on \ -drive \ file=/kvm/www-freemoe.qcow2,index=1,if=virtio,cache=writeback \ -drive \ file=/kvm/scratchbox1.qcow2,index=2,if=virtio,cache=writeback \ -cpu qemu32 \ -m 2048 \ -vnc :5 \ -daemonize \ -enable-kvm \ -name flauta \ -net nic,vlan=0,model=virtio \ -net user,hostfwd=tcp:63.247.92.155:22-:22,hostfwd=tcp:63.247.92.155:80-:80 \ -smp 8 \ -runas jebba
 * 1) !/bin/sh


 * It is running the "current" QEMU git (d0be2513d5eefb47a83f9a303fe142dd8ef72848).


 * Host kernel is custom 2.6.32.


 * Guest is running Debian Lenny with stock Lenny kernel.


 * The guest is running a custom 2.6.32 kernel now. A good sample .config optimized for qemu would be fantastic. Currently only seeing 883M (before seeing 2G) likely due to turning off 4G/4G which I turned off for speed per QEMU docs. Not sure if lots of memory will speed things up anyway--the filesystem will just get cached on the host.


 * The guest panicked once (when building a kernel.deb for ARM running `dpkg-buildpackage -j8 -rfakeroot -b`...), hence the drive to run a more recent guest kernel.