Thursday 15 July 2010

Making a MeeGo kernel package for the Joggler

This is a guide to how to make a kernel package for MeeGo for a given device, in this example we are using the Joggler, a Atom-based 7" touchscreen computer and hackable to run Linux.

This is highly technical and you're supposed to know what you're doing :) It is expected you know at least about git and have a OBS account with access to MeeGo weekly or daily Trunk. It is also assumed we cannot send these patches for official inclusion (let's play that we're under NDA) or get help to add new configurations to the MeeGo kernel packaging from the kernel guys.

This text is similarly licensed with that of wiki.meego.com as to enable inclusion of things from here eventually.

Starting out - we have a device, some patches to add board support and a kernel config.

First off, clone the MeeGo kernel source (this git tree represents what is in MeeGo trunk at this instant) on gitorious:

http://meego.gitorious.org/meego-os-base/kernel-source

Now that we have cloned it (and I assume you have it in your kernel-source directory in your homedir), we can start adding support. The important thing to remember is that *.spec is automatically generated in this repository. If it was up to me, these wouldn't be part of the git tree, and just automatically generated.

First, we have to add the joggler specific kernel package. You have to do this in multiple places.

You can see how I did this for the Joggler in this commit and this errata commit and another errata commit.

Now you can do 'make joggler' to get a kernel-joggler.spec. You'll need to regenerate this in a bit, but take a look if it's been done right.

We have a configuration for the Joggler kernel, let's call it joggler-defconfig. What we now need to do is to find the differences between the generic configuration (config-generic) and our Joggler specific configuration.

In the git tree there is a tool called configdiff.pl which is excellent for this kind of thing.

Run: perl configdiff.pl config-generic joggler-defconfig > config-joggler

Then go through it and see if there's any options that really needs to be there.

Then you have to add your new configuration file to the system. In a small bunch of places, where, you can see in this commit. After this, make generic joggler; make -f Makefile.config kernel-joggler.config and verify everything looks fine in kernel.spec, kernel-joggler.spec and kernel-joggler.config.

Now, we want to try to make our first test compile in OBS. Make a package 'kernel-joggler' in your OBS, point the build target towards something containing MeeGo Trunk/Core. Check out your kernel-joggler project and grep Source kernel.spec.

These files are the ones (along with everything in patches/, kernel.spec and kernel-joggler.spec), you will want to drop into your OBS package. Grab a Linux kernel version while you're at it and put it there, URL is in Source0.

osc addremove; osc commit -m "Initial commit"

Kernel starts building.. Occasionally you might run into things like:

CONFIG_CFG80211_INTERNAL_REGDB
CONFIG_RT2800USB_RT30XX
CONFIG_RT2800USB_RT35XX
CONFIG_RT2800USB_UNKNOWN
CONFIG_TOUCHSCREEN_USB_NEXIO
CONFIG_HID_PICOLCD_LCD
make[1]: *** [nonint_oldconfig] Error 6

This usually means there is some kernel options in the resulting merge that aren't set - ordinarily this would be asked interactively, but since we're building inside a OBS, this isn't happening.

I fixed this in my config-joggler like in this commit.

With this fixed, I was able to have my first kernel-joggler built :)

In order to add patches, this is another tale, but scripts/sequence-patch.sh --quilt will set up a tree for you. The 'series' file is the one you need to use, and then re-make *.spec files. There is a guide in README.workflow how to deal with this.

If you git pull from the kernel source, you might get conflicts in *.spec, - just get everything that comes from kernel-source upstream and re-make. kernel.spec.in is what is important.

Have fun porting MeeGo to your device! If you can, work upstream in Linux kernel and submit patches mainline. Work as if you would eventually include patches in upstream.

For ARM devices, you can come by and contribute to the effort in #meego-arm on irc.freenode.net. Approach on ARM to kernel packages there is quite similar.

2 comments:

  1. Any chance you could just release a USB image for this and save us all the hassle of making a build?

    ReplyDelete
  2. Seconded. Would be nice to run Meego on the joggler. But most of us need prebuilt files. Either a USB image or a zip with files we can copy to USB.

    BTW, You're posts are great. Very informative and well written. Thanks.

    ReplyDelete