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.

Sunday, 25 April 2010

Joggler as DVB-T mini TV

Just a little eyecatcher: Joggler with Ubuntu and fully configured dvb-t stick.



There's no big howto. Just compile the modules for your tv stick, install an app like kaffeine and let it rock!

Saturday, 24 April 2010

Running the original Software out from your linux distro!

Ok another smart how to, so you will be able to start the original software from your linux distro:

starting here:

1. mount mmcblk0p2 somewhere, if not already done:
"sudo mount /dev/mmcblk0p2 /mnt"

2. copy the whole openpeak folder to your root:
"sudo mkdir /openpeak"
"sudo cp -r /mnt/openpeak/* /openpeak"

3. unmount (if you want..)
"sudo umount /mnt"

4. mount mmcblk0p4, if not yet done:
"sudo mount /dev/mmcblk0p4 /mnt"

5. copy all its contents to /media:
"sudo cp -r /mnt/* /media"

6. copy and edit localrun:
"sudo cp /openpeak/tango/localrun /openpeak/tango/starto2"

7. edit starto2:
"sudo vi /openpeak/tango/starto2"

8. uncomment "export SDL_AUDIODRIVER=alsa":
move to the concerning line,
type "i" for insert mode,
type an "#"
type ESC, type ":wq" to save&quit

9. now you can run the software by double clicking on "starto2".
You can also create a shortcut to this. Quit the app typing "ALT+F4"

Note, that also mouse + keyboard are working this way :-)
No way yet to quit the app withouht keyboard.

-gforums-

Dual Boot on the Joggler

How-To Setup a Dual Boot on the Jogger!


I prepared a little package for you to have a nice dual boot screen at bootup on your Joggler.

Without a USB stick plugged in, it boots the internal System after 5 seconds.

With a USB stick on the Joggler, the boot screen shows you two icons, one for the o2 Software and one for your USB linux, which will then be the default system!

All this can be controlled by a plugged kayboard after the 2nd boot!

Here we go:

1. Grab the following archive:
http://daten.gforums.de/joggler/efi_mmcblk0p1.tar.gz

2. Start your distro on the joggler, then mount mmcblk0p1, e.g.
"sudo mount /dev/mmcblk0p1 /mnt"

3. Copy and extract the archive onto /mnt, make a backup of your mmcblk0p1 partition if you want!
"sudo cp efi_mmcblk0p1.tar.gz /mnt"
"tar -xzvf efi_mmcblk0p1.tar.gz"
"sudo rm efi_mmcblk0p1.tar.gz"
"sudo mv boot.efi boot.efi.bak"

4. Reboot.

5. On booting, press several times "ESC" to stop autoboot. Now enter "fs0:boot" blindly and you should see refit coming up.

6. Choose the icon "EFI shell", press Enter, then ESC.

7. Now type:
bcfg boot add 01 fs0:\efi\refit\refit.efi "Refit"

(thanks to: TonyHoyle, http://hackthejoggler.freeforums.org/booting-from-different-sources-t72.html)

This way, Refit is added to the internal (nvram) bootloader list. That's needed to have a working keyboard.

8. Type "bcfg boot dump" and look if Refit is located on top.

9. Type "exit"

That's it - Refit now should always load automatically. In case, you have a USB stick plugged in, you can choose between USB and internal system. Otherwise, it just shows the internal system and boots it after 5 seconds!

Good luck :-)

-gforums-

A patch for the IEGD kernel part to make it build and work in 2.6.33.2

I just spent some time getting IEGD kernel module working on 2.6.33.2 and got some fancy glxgears on my Xorg now.

For patching into a kernel:

Kernel patch

A patch against IEGD original sources (10.3.2) to make it work and build on 2.6.33.2

Have fun with it!

Tuesday, 6 April 2010

GRUB2 on Joggler

We have been having some issues with ELILO and large initrds in the #mer channel on irc.freenode.net, so we started investigating GRUB2.

The problem with GRUB2 was that it did not initialize video correctly and hence did now show the framebuffer console when booting. Another problem was that it did not have a TextModeHack.

For the technical side of these problems: GRUB2 did not pass correct video information in the linux kernel parameters due to it only supporting UGA video. Thanks to 'bean''s patch, I was able to construct a working GRUB2. UPDATE: now with adq's updated patch, we no longer need to use screen.efi as it contains a TextModeHack now - thanks to him for the great hack!

To compile GRUB2:

  • Grab the source and untar it
  • Patch it with this patch (grub-gop-video-v1.patch, patch -p1 it)
  • ./configure --with-platform=efi
  • Run 'make'
  • Make a .efi file: ./grub-mkimage -d . -o grub.efi part_msdos hfsplus fat ext2 normal sh chain boot configfile linux
  • If you're too lazy or incapable of building, use this grub.efi

To use it in practice:
  • Make a efi\grub directory and put grub.efi in there
  • Put in the root of the FAT partition, file boot.nsh:

    fs1:
    cd \efi\grub
    grub

    And file startup.nsh:

    fs1:boot2
    fs0:boot
  • Put in a grub.cfg file in \efi\tools (sample one linked, not working, you need to edit it). See elilo config in the other post for inspiration.
  • If you do not need interactivity with the menu (letting it time out to the default item), you do not have to press ESC at bootup.

Enjoy - if you're a Joggler hacker, come to #mer on irc.freenode.net, a good bunch of us there by now. Webchat here.

Sunday, 4 April 2010

From the past: How to dump the BIOS (EFI) on Joggler

This was originally discovered by JimboJones. You will need to be on 2.6.24 (the original OS).

modprobe fh
dd if=/dev/fh of=/tmp/bios.bin

The file /tmp/bios.bin will then be the BIOS.