Meego Wiki
Views

Developing in a MeeGo Environment

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(Using build command)
(Use a Meego developer image)
Line 109: Line 109:
</pre>
</pre>
-
Develop away.
+
Develop away...
During the development process, you can compile the source using normal build tools: gcc, g++, etc.  These can be downloaded from the MeeGo repositories.  Before submitting patches to the mailing list, it is a good idea to build rpms with rpmbuild and test them out on your development system.
During the development process, you can compile the source using normal build tools: gcc, g++, etc.  These can be downloaded from the MeeGo repositories.  Before submitting patches to the mailing list, it is a good idea to build rpms with rpmbuild and test them out on your development system.

Revision as of 03:22, 7 March 2010

Contents

Building code in a Meego environment

There are a few ways to develop your code in a Meego environment, and ensure your code is being compiled and built using the current Meego environment, toolchain, and libraries.

Using moblin-chroot

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

Here are the steps:

Step 1 - Download and install moblin-chroot

For details on downloading and installing moblin-chroot, go here: Image_Creation#Running_moblin-chroot

Step 2 - Download a Meego developer image

You can go here to download the latest Meego images: TO-DO-LINK

Alternatively, you can also follow this wiki to create your own Meego standard images: Image_Creation_For_Beginners

Step 3 - moblin-chroot into the image

sudo moblin-chroot <image-name>.iso

With this command, you are now transported into the root filesystem of the image. Developers can easily exchange files to and from this chroot environment using the host /parentroot. Developers can also conduct yum install, yum remove and any other network related operations.

Step 4 - Build a Meego pkg

If you would like to write a Meego package from scratch, or modify an existing Meego package and submit the change to the Meego trunk, please first read the packaging guidelines here: Packaging/Guidelines

Download the source code of the Meego package(s) you would like to modify. You can download the latest source rpms from here: TO-DO-LINK

You can also clone the source of the package (if available) from the git tree here: TO-DO-LINK

Un-pack the source rpm. There are a few ways to do this, here is one:

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

You can now modify the package contents, and compile code as you would normally.

You can also compile and rebuild the package like so:

rpmbuild -ba <pkg-name>.spec

Remember to check the Meego packaging guidelines if you would like to submit your code back to Meego: Packaging/Guidelines

For information about how to submit your code to be included in Meego, go here: TO-DO-LINK

Step 5 (optional) - Create new image

You can use moblin-chroot to make changes within an image's filesystem, and create a new image with these new modifications.

Simply use the "-c" flag when calling moblin-chroot like so:

sudo moblin-chroot  -c livecd <image-name>.iso

Make your modifications within the image, then type "exit". This will prompt the creation of a new image based on the changes you made within the image's filesystem. Alternatively, you can also pass "-c liveusb" to create a liveusb version.

You can also following this part of the wiki that explains how to create custom-made images: Developing_in_a_Meego_Environment#Scenarios_of_Making_your_own_Meego_Image

Using build command

The 'build' tool sets up a build environment in a given location and then builds the package in that environment. The build environment consists of a base system and any additional packages you specify in the RPM spec file.

Step 1 - Install the 'build' package for your distribution Go here to download the latest 'build' package for your distribution: TO-DO-LINK

Step 2 - Mirror the development tree locally Mirror the following Meego core repo to your local dev machine: TO-DO-LINK

Step 3 - Download Meego's build configuration file You can obtain Meegos' build configuration file here: TO-DO-LINK

As root, copy this configuration file into /usr/lib/build/configs/meego.conf. Super user privileges are required due to usage of chroot. In the directory containing the package files and the spec file, run the following command as root to start the build:

$ export BUILD_DIST=meego
$ build --repo /path/to/repo/mirror --target i586

The options --repo should point to the top tree of the repository (The directory that has repodata sub-directory).

Here is a good resource for the 'build' tool: Beginner's Guide to Using Novell SUSE Linux's Build Utility

Use a Meego developer image

This method entails downloading a Meego developer image, installing it on a machine, and using that as your main developer machine when developing for your Meego-related projects.

Go here to download and install the latest Meego developer images: TO-DO-LINK

Or else you can build and install your own image using the instructions from the Image_Creation page.

Ensure your repositories are pointing the latest sources. Go here to download the correct .repo file(s) to insert in your /etc/yum.repos.d/ directory: TO-DO-LINK

Update your system to be sure the packages are up-to-date.

sudo yum update

Develop away...

During the development process, you can compile the source using normal build tools: gcc, g++, etc. These can be downloaded from the MeeGo repositories. Before submitting patches to the mailing list, it is a good idea to build rpms with rpmbuild and test them out on your development system.

Remember to check the Meego packaging guidelines if you would like to submit your code back to Meego: Packaging/Guidelines

For information about how to submit your code to be included in Meego, go here: TO-DO-LINK

Scenarios of Making your own 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: TO-DO-LINK

Check the Meego repos and make sure that the packages you're looking for exist in Meego: TO-DO-LINK

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 moblin-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

Let's say you need to add a package that doesn't exist in the Meego repos, as you've already check there: TO-DO-LINK

Or 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 from here: TO-DO-LINK

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

Kernel Building and Development

Personal tools