Meego Wiki
Views

Developing in a MeeGo Environment

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
m (Build speed up note)
 
(3 intermediate revisions not shown)
Line 50: Line 50:
With this command, you are now transported into the root filesystem of the image. It is possible to exchange files with your normal file system through the /parentroot directory. You can also conduct yum install, yum remove and any other network related operations.
With this command, you are now transported into the root filesystem of the image. It is possible to exchange files with your normal file system through the /parentroot directory. You can also conduct yum install, yum remove and any other network related operations.
 +
 +
Note: You can install the cross-compiler in order to speed up the build procedure (Basically that is what the OBS also uses):
 +
<pre>
 +
zypper install cross-armv7l-binutils-accel-armv7l cross-armv7l-gcc-accel-armv7l glibc-x86-arm
 +
</pre>
=== Step 2: Setting up the build directories ===
=== Step 2: Setting up the build directories ===
Line 177: Line 182:
Most likely cause: You have not run qemu-binfmt-misc.sh as root.
Most likely cause: You have not run qemu-binfmt-misc.sh as root.
 +
 +
Maybe qemu-arm is not right set,try :
 +
<pre>
 +
rpm -i http://download.opensuse.org/repositories/home:/dl9pf:/qemu/Fedora_12/i386/qemu-devel-0.13git2010.06.24.1826-8.1.i386.rpm
 +
</pre>
 +
(the package maybe changes,so you can go the web address to get it ,then install it )
 +
see here:[[Local_Build_Without_OBS_Needed]]
=== mmap: permission denied ===
=== mmap: permission denied ===

Latest revision as of 12:57, 6 March 2011

Contents

Introduction

This guide is a way to build packages for the MeeGo 'day one' release, before more proper developer tools are introduced.

Setting up your development environment

To begin developing for the MeeGo 'day one' release, you will need to follow these steps:

Introducing the tools

mic-chroot

mic-chroot is a tool that allows you to 'chroot' into an existing MeeGo image in order to develop within it, without contaminating your developer machine's environment. Chroot simply means to 'change the root' to a new location (so instead of your root being / on your dev machine, it will be the new root directory within the image).

This restricts access to your real root and your real file system, and instead, uses the image filesystem as its root and filesystem. No contamination, and no effect on your development machine.

With mic-chroot, you will effectively be able to modify and manipulate the image's filesystem as if you were running a shell within an installed image, without having to install the image. When finished, you can also create a new MeeGo image based on your changes.

Developer images

The developer images contain the exact same packages as is installed when you try to build a package in the MeeGo OBS without any dependencies, along with some helper packages (vim, nano) to make chroot usage easier. The list of these packages can be seen in the kickstart file mentioned above.

This is because, in the end, it will save you time when you want to upload your application into a builder system because it will make sure that you specify your package build dependencies correctly.

You can in the development image chroot run 'yum install <package names>' and that way install your package build dependencies to the chroot to compile your package.

Building your package: Step by step

Prerequisites:

  • It is assumed you have already made either a source rpm (.src.rpm) or a package (.spec and attached files) before these steps. For a guide how to create packaging for MeeGo, see Packaging.
  • You have already chosen an architecture to build your package towards in these steps. That is the development image <image-name>, either meego-codedrop-ia32*.img (X86) or meego-codedrop-arm*.img (ARM)

Step 1: Chrooting into the development image

sudo mic-chroot <image-name>

With this command, you are now transported into the root filesystem of the image. It is possible to exchange files with your normal file system through the /parentroot directory. You can also conduct yum install, yum remove and any other network related operations.

Note: You can install the cross-compiler in order to speed up the build procedure (Basically that is what the OBS also uses):

zypper install cross-armv7l-binutils-accel-armv7l cross-armv7l-gcc-accel-armv7l glibc-x86-arm

Step 2: Setting up the build directories

You only need to do this once, but you may want to clean up the directory and remake it once in a while.

mkdir -p ~/rpmbuild
cd ~/rpmbuild
mkdir -p SOURCES SPECS BUILD RPMS SRPMS

Step 3: Staging source package for build

You must change directory to the location of your sources.

cd /parentroot/path/to/your/sources

If you have a source rpm (.src.rpm), you will need to extract it:

rpm2cpio <MyPkg>.src.rpm | cpio -idmv --no-absolute-filenames 

This will result in a .spec file and maybe some attached files (patches, source tarball, etc). The .spec file is in this guide called package.spec.

When you have a .spec file you need to place it in ~/rpmbuild/SPECS and the remaining files in ~/rpmbuild/SOURCES.

Step 4: Installing your build dependencies

You can see your build dependencies in the package.spec file, which is the lines starting with BuildRequires. Those packages can then be installed using 'yum install':

yum install <package names>

Step 5: Building your package

To build your package, you must then run the following command, where package.spec is the name of your spec file:

rpmbuild -ba ~/rpmbuild/SPECS/package.spec 

Step 6: Enjoying your built package

Provided the build completed without errors, you can now see the resulting rpms in ~/rpmbuild/RPMS/. You can transfer these back to your filesystem through the /parentroot directory and you can then transfer these to your MeeGo device, virtual machine, etc and install them there.

Including your packages in a MeeGo image

Before reading these sections, we suggest to first read Image Creation For Beginners and Image Creation

This will give you the basics of what you need to generate a basic MeeGo image.

Specifically, there are important details about how to modify a .ks file here: Image_Creation#Modifying_your_.ks

KickStart .ks files are the main configuration file that the Image Creator uses to create images, and the brunt of what is talked about in this section has to do with modifying your .ks file.

Recreating a standard MeeGo Image

To create a standard MeeGo image, please follow the instructions in Image Creation For Beginners.

Adding more MeeGo packages to a MeeGo Image

Here is a scenario where you want to add additional MeeGo packages to the standard MeeGo image.

First, obtain a standard MeeGo .ks file from here

Check the MeeGo repos and make sure that the packages you're looking doesn't already exist in MeeGo

Now within the .ks file, add the MeeGo package names that you want included in this new image. For more on how add packages in a .ks file, please read this important section here: Image_Creation#Modifying_your_.ks

Run this modified .ks file through the Image Creator MIC.

sudo mic-image-creator -c my-new-ks.ks -f livecd

For more options and details on image creation and MIC, go here: Image_Creation

Your new image will now be a standard MeeGo image including the new packages you've added.

Again, this wiki is of great value to you when manipulating and navigating through .ks files: Image_Creation#Modifying_your_.ks It is the key to mastering the art of creating custom-made MeeGo images.

Adding your own code & and non-MeeGo packages to a MeeGo Image

If you have your own packages on your developer machine that you want to test out by creating a new MeeGo image with them.

First obtain a standard MeeGo .ks file. This is possible through the repository.

To add a new repo to your .ks file, go here for easy and detailed steps: Image_Creation#Modifying_your_.ks

Once you add the new repo(s) that the Image Creator will pull from, you now have to list the packages you want to pull down from these repos. For instructions on adding packages to your .ks file, go here: Image_Creation#Modifying_your_.ks

If you have local rpms on your local machine that you would like to include, you need to first create a local repo on your machine. Move your rpms into a directory. Then create a local repo with that directory like so:

$ mv *.rpms /home/user/my-local-repo

$ createrepo -d /home/user/my-local-repo

This turns /home/user/my-local-repo into a local repository that you can point your .ks file to. For steps on how to add a new repo, go here: Image_Creation#Modifying_your_.ks

And again, make sure you have listed in your .ks all the packages you would like to include in your new MeeGo Image.

Now, simply run this new .ks file through MIC, the Image Creator.

sudo mic-image-creator -c my-new-ks.ks -f livecd

For more options and details on image creation and MIC, go here: Image_Creation

Your new image will now be a standard MeeGo image including the new packages and repos you've added.

Again, this wiki is of great value to you when manipulating and navigating through .ks files: Image_Creation#Modifying_your_.ks It is the key to mastering the art of creating custom-made MeeGo images.

Troubleshooting (ARM)

Error: chroot: cannot run command X: No such file or directory

Most likely cause: You have Scratchbox1 installed and you need to follow instructions given in Prerequisites for ARM.

Exec format error

Most likely cause: You have not run qemu-binfmt-misc.sh as root.

Maybe qemu-arm is not right set,try :

rpm -i http://download.opensuse.org/repositories/home:/dl9pf:/qemu/Fedora_12/i386/qemu-devel-0.13git2010.06.24.1826-8.1.i386.rpm

(the package maybe changes,so you can go the web address to get it ,then install it ) see here:Local_Build_Without_OBS_Needed

mmap: permission denied

Most likely cause: VDSO

Do this as root:

echo 0 > /proc/sys/vm/vdso_enabled
echo 4096 > /proc/sys/vm/mmap_min_addr
Personal tools