Meego Wiki
Views

SDK/Docs/1.0/Building a MeeGo chroot on Linux

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(Manually building Xephyr binaries)
(Building Wait4XephyrStart)
Line 189: Line 189:
</li>
</li>
<li>
<li>
-
[[#chroot into the MeeGo environment]]
+
[[Getting_started_with_the_MeeGo_SDK_for_Linux#Enter_the_MeeGo_chroot_environment|Enter the chroot]]
</li>
</li>
<li>Enter the ''src'' directory and build the binary:
<li>Enter the ''src'' directory and build the binary:

Revision as of 19:19, 26 May 2010


This is work in progress. It references handset images which are not available publicly, but will be made available around the time of the MeeGo 1.0 release for handsets (around June 2010).

This document describes how to run a MeeGo desktop inside Xephyr.

You'll do this by creating a MeeGo chroot consisting of:

  • An unpacked MeeGo image
  • A 3D-accelerated Xephyr server installed into the chroot
  • A couple of scripts/executables to manage a MeeGo desktop inside Xephyr

Note that the approach covered here uses an x86 CPU to build software for an x86 version of MeeGo (e.g. a netbook image).

If you want a really quick method for developing on MeeGo where you don't need to build the chroot, see Hello World - MeeGo x86 development on Linux.

Also note that people outside Intel won't be able to do this until we release MeeGo with a UX.

Contents

Pre-requisites

All that's required for this is a reasonably modern Linux distribution (e.g. Fedora 11, Ubuntu 9.10) running on Intel hardware. The hardware should meet the following specifications:

  • CPU: 32bit Intel(r) Atom(tm) or Intel(r) Core(tm) 2 CPU (support for SSSE3)
    • Note: MeeGo will not work on non-SSSE3 CPUs
  • A compatible Intel graphics chipset: GMA-500, Nvidia, and ATI chipsets are not supported

How to do it (the short version)

Basically, on the Linux machine (which should meet the above requirements):

  1. Download a standard MeeGo image and unpack it
  2. Install xephyr-utils (a set of scripts for creating a Xephyr-enabled chroot)
  3. chroot into the unpacked image
  4. From the chroot:
    1. Install Xephyr with 3D acceleration
    2. Install scripts for starting MeeGo inside Xephyr
    3. Start the Simulator

How to do it (the longer version)

Download and unpack a MeeGo image

Get an image or tarball (with a UX) from http://repo.meego.com/MeeGo/releases/; either a netbook or handset image.

The process for unpacking is slightly different, depending on the type of image.

Unpacking a netbook image

  1. Install MeeGo Image Creator (MIC): use the instructions at http://wiki.meego.com/Image_Creation#Installation
  2. Unpack the image using MIC:
    sudo mic-chroot --unpack-only -s ~/meego-chroot <image file>.usbimg

Unpacking a handset image

  1. Install kpartx (a tool for creating device maps from partition tables: because the handset images are raw disk images, this tool can be used to create a device map from the disk image, which can then be mounted on the filesystem)
    yum install kpartx

    or on non-RPM distros:

    apt-get install kpartx
  2. Unpack the tarball:
    tar jxvf meego-0.90-preview-shcdk-20100512-001.tar.bz2

    This leaves you with a directory which contains the raw disk image you're interested in.

  3. Create a device map from the raw image:
    cd meego-0.90-preview-shcdk-20100512-001
    sudo kpartx -a -v ./meego-0.90-preview-shcdk-20100512-001-sda.bin
    

    Note that this maps the first partition (p1) of the disk image onto the loop device /dev/loop0.

  4. Mount the device map and copy the filesystem into the chroot location:
    mkdir ~/tmp-mnt   # temporary mount point
    sudo mount /dev/mapper/loop0p1 ~/tmp-mnt -o loop,ro
    mkdir ~/meego-chroot
    sudo cp -a ~/tmp-mnt ~/meego-chroot
    sudo umount ~/tmp-mnt
    
  5. Remove the device map:
    sudo kpartx -d -v ./meego-0.90-preview-shcdk-20100512-001-sda.bin
    
  6. Remove the temporary mount point:
    rmdir ~/tmp-mnt
    

Set up and enter the chroot

Install Xephyr

Install Xephyr with GL 3D acceleration support:

zypper install http://sdk.download.location/xephyr.rpm

Install MeeGo SDK utils

Install the SDK utils, which consists of a script to start the MeeGo desktop inside Xephyr, plus some configuration files:

zypper install http://sdk.download.location/meego-sdk-utils.rpm

Run the Simulator etc.

With everything installed, you should now be able to run the Simulator.

You could also now continue with the "Hello World" tutorial, as the chroot you've built should fairly similar to packaged one (it may be missing a few libraries, but you can always install those yourself).

Building everything yourself

This is only recommended if the provided RPMs don't work

You can build a Simulator in the chroot by building the two main components from source:

  • Xephyr binaries
  • Scripts and configuration

Manually building Xephyr binaries

The chroot needs two binaries:

  • Xephyr
  • Wait4XephyrStart (a program which pauses until it detects that Xephyr is available)

Both can be built in the chroot (unless you'd rather build them using a cross-compiler on the host).

First, enter the chroot.

Then install some development tools into the chroot:

zypper install gcc xorg-x11-util-macros libtool xorg-x11-xtrans-devel libX*-devel xorg-x11-proto-* \
mesa-libGL-deve mesa-dri-drivers-devel libdrm-devel openssl-devel libxkbfile-devel make git

Building Xephyr

  1. Check out the Xephyr source code into the chroot:
    git clone git://gitorious.org/xserver-with-gl-accelerated-xephyr/xserver-with-gl-accelerated-xephyr.git
    cd xserver-with-gl-accelerated-xephyr/
    
  2. Build:
    ./autogen.sh --enable-debug --enable-kdrive --enable-dri2 --enable-xephyr --with-dri-driver-path=/usr/lib/dri/ \
    --disable-xorg --prefix=/usr
    make
    make install
    

Building Wait4XephyrStart

This is part of the xephyr-utils distribution (which we already checked out on the host); but you need to build it inside the chroot.

  1. Copy the source code to the MeeGo chroot environment:
    cd xephyr-utils
    sudo cp -a target/src ~/meego-chroot/
    
  2. Enter the chroot
  3. Enter the src directory and build the binary:
    cd src
    make install
    

Important note

The version of Xephyr included in the RPM is actually slightly different from the one you built above. The RPM is built directly from the X server sources on OBS, with some patches applied. These patches are on their way upstream, so hopefully you should soon be able to build Xephyr from the upstream X sources rather than from the gitorious project.

For the moment, the easiest way to build Xephyr yourself is to use the project linked to above.

Manually building MeeGo netbook SDK utils

The meego-netbook-sdk-utils package is generated from the MeeGo SDK utils project. This was started by Haitao Feng (Intel) and includes some scripts and documents to assist in the process of building a MeeGo chroot + Simulator. It is possible to install this into a chroot manually (if for some reason the packaged version doesn't work for your chroot).

The source code is here:

http://gitorious.org/xephyr-utils

You need to check these out into the chroot with:

git clone git://gitorious.org/xephyr-utils/xephyr-utils.git

The project includes some instructions in target/netbook/BUILD-MEEGO-NETBOOK-CHROOT-WITH-XEPHYR and target/shcdk/BUILD-MEEGO-SHCDK-CHROOT-WITH-XEPHYR.

Once you have checked out the source, and while still in the chroot, do:

  1. cd xephyr-utils/target
    • For netbook:
      make netbook
    • For handset:
      make shcdk
  2. For both netbook and handset:
    make install
Personal tools