(→Use a Meego developer image) |
m (Build speed up note) |
||
| (43 intermediate revisions not shown) | |||
| Line 1: | Line 1: | ||
| - | == | + | == Introduction == |
| - | + | ||
| - | + | ||
| - | + | ||
| - | This | + | 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: | |
| - | '' | + | * NOTE: These instructions were tested on a Fedora 12 chroot (X86), your experience may vary with other distributions. |
| + | * Have access to 'root' on your development machine. | ||
| + | * [http://wiki.meego.com/Image_Creation#Requirements Satisfy the requirements for MIC2 installation] | ||
| + | * [http://wiki.meego.com/Image_Creation#Installation Download MIC2 from the git repository] (development tree) | ||
| + | * [http://wiki.meego.com/Image_Creation#Installation Install MIC2] | ||
| + | * For ARM, Install QEMU: Grab the qemu package for your system. Fedora one is at [http://build.moblin.org/build/devel:tools:building/Fedora_11/i586/qemu/qemu-arm-static-0.12.3-10.1.i386.rpm this url] | ||
| + | * After this, run 'qemu-binfmt-conf.sh' as root. This will enable your system to run ARM binaries and will have to be repeated at system startup. | ||
| + | * If you have Scratchbox and/or Maemo SDK installed, please follow [http://wiki.maemo.org/Mer/Build/Application_Building#Co-existing_with_Scratchbox these instructions to avoid conflicts] | ||
| + | * Download MeeGo development images for [http://repo.meego.com/MeeGo/devel/n900/images/meego-codedrop-ia32-developer-201003311106.img.bz2 MeeGo X86] and [http://repo.meego.com/MeeGo/devel/n900/images/meego-codedrop-arm-developer-201003311152.img.bz2 MeeGo ARM] and bzip2 -d them (they are 3GB loopback images) | ||
| + | * Or you can create your own development images with [[Media:Devel-ia32.ks|this kickstart file for X86]] or [[Media:Devel-arm.ks|this kickstart file for ARM]] and the instructions at [[Image_Creation_For_Beginners]] | ||
| - | + | == 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. | |
| - | '''Step | + | 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 === | ||
<pre> | <pre> | ||
| - | sudo | + | sudo mic-chroot <image-name> |
</pre> | </pre> | ||
| - | With this command, you are now transported into the root filesystem of the image. | + | 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 === | |
| - | + | You only need to do this once, but you may want to clean up the directory and remake it once in a while. | |
| - | You | + | <pre> |
| + | mkdir -p ~/rpmbuild | ||
| + | cd ~/rpmbuild | ||
| + | mkdir -p SOURCES SPECS BUILD RPMS SRPMS | ||
| + | </pre> | ||
| + | |||
| + | === Step 3: Staging source package for build === | ||
| + | |||
| + | You must change directory to the location of your sources. | ||
| + | |||
| + | <pre> | ||
| + | cd /parentroot/path/to/your/sources | ||
| + | </pre> | ||
| - | + | If you have a source rpm (.src.rpm), you will need to extract it: | |
<pre> | <pre> | ||
| Line 42: | Line 80: | ||
</pre> | </pre> | ||
| - | + | 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. | |
| - | You can | + | 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': | ||
<pre> | <pre> | ||
| - | + | yum install <package names> | |
</pre> | </pre> | ||
| - | + | === 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: | |
| - | + | <pre> | |
| + | rpmbuild -ba ~/rpmbuild/SPECS/package.spec | ||
| + | </pre> | ||
| + | |||
| + | === 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 [http://repo.meego.com/MeeGo/ from here] | ||
| + | |||
| + | Check the [http://repo.meego.com/MeeGo/ 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. | |
<pre> | <pre> | ||
| - | sudo | + | sudo mic-image-creator -c my-new-ks.ks -f livecd |
</pre> | </pre> | ||
| - | + | 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: | ||
<pre> | <pre> | ||
| - | + | $ mv *.rpms /home/user/my-local-repo | |
| - | + | ||
| + | $ createrepo -d /home/user/my-local-repo | ||
</pre> | </pre> | ||
| - | + | 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. | |
| - | + | <pre> | |
| - | + | sudo mic-image-creator -c my-new-ks.ks -f livecd | |
| + | </pre> | ||
| + | |||
| + | 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 : | ||
<pre> | <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> | </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 === | |
| - | + | Most likely cause: VDSO | |
| - | + | Do this as root: | |
| - | + | <pre> | |
| - | + | echo 0 > /proc/sys/vm/vdso_enabled | |
| - | + | echo 4096 > /proc/sys/vm/mmap_min_addr | |
| - | + | </pre> | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
Contents |
This guide is a way to build packages for the MeeGo 'day one' release, before more proper developer tools are introduced.
To begin developing for the MeeGo 'day one' release, you will need to follow these steps:
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.
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.
Prerequisites:
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
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
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.
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>
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
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.
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.
To create a standard MeeGo image, please follow the instructions in Image Creation For Beginners.
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.
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.
Most likely cause: You have Scratchbox1 installed and you need to follow instructions given in Prerequisites for ARM.
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
Most likely cause: VDSO
Do this as root:
echo 0 > /proc/sys/vm/vdso_enabled echo 4096 > /proc/sys/vm/mmap_min_addr