Meego Wiki
Views

Recompile kernel

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(Unpack rpm)
 
(16 intermediate revisions not shown)
Line 1: Line 1:
-
==Recompiling the MeeGo Kernel for the Beagleboard==
+
This page explains the [[kernel]] recompilation process. There is also information on how to [[MeeGo kernel documentation for contributors|configure the MeeGo kernel]]. There already is a guide on how to compile the kernel for [[MeeGo]], including links to [[packaging]] : [[Tips on compiling and packaging kernels in MeeGo]].
-
This page explains the kernel recompilation process. There is also information on how to [[MeeGo kernel documentation for contributors|configure the MeeGo kernel]]. There already is a guide on how to compile the kernel for MeeGo, including links to packaging: [[Tips on compiling and packaging kernels in MeeGo]]. This document is going to focus on the process I used to create a kernel, specifically for the Beagleboard for MeeGo IVI.
 
== Fetch the kernel source ==
== Fetch the kernel source ==
Line 8: Line 7:
<pre>
<pre>
-
wget http://repo.meego.com/MeeGo/releases/1.1/core/repos/source/kernel-2.6.35.3-10.3.src.rpm
+
wget http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/source/kernel-2.6.37.2-8.27.src.rpm
</pre>
</pre>
-
You can of course get your kernel directly from upstream at kernel.org for example or clone it from MeeGo's git repos;
+
You can of course get your kernel directly from upstream at kernel.org for example or clone it from MeeGo's git repos ( https://meego.gitorious.org/meego-os-base/kernel-source )
<pre>
<pre>
Line 17: Line 16:
</pre>
</pre>
-
I've chosen to build upon the work of others and am going to checkout a kernel build by Jan-Simon M&ouml;ller.
 
-
== Unpack rpm ==
+
== Unpack source rpm ==
 +
 
 +
If you take the packaged MeeGo kernel, then you'll need to unpack this rpm. You can do that this way :
-
If you take the packaged MeeGo kernel, then you'll need to unpack this rpm. You can do that this way;
 
<pre>
<pre>
-
rpm2cpio kernel-2.6.35.3-10.3.src.rpm | cpio -id
+
rpm2cpio kernel-2.6.37.2-8.27.src.rpm | cpio -id
</pre>
</pre>
 +
== Modify source code ==
== Modify source code ==
Line 32: Line 32:
* If you wan to remove patches, you just need to remove them in spec file.  
* If you wan to remove patches, you just need to remove them in spec file.  
* If you want to modify exist patch, you can modify the special patch and spec file need not to modify.
* If you want to modify exist patch, you can modify the special patch and spec file need not to modify.
 +
== Re-build kernel ==
== Re-build kernel ==
 +
Once you development work is done, you can use ‘build’ command to generate new RPM based on you changes. Command as follows:  
Once you development work is done, you can use ‘build’ command to generate new RPM based on you changes. Command as follows:  
-
build --repository http://YYY/repos/oss/ia32/packages/ --arch i686 XXX.spec
+
    build \
 +
    --repository http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/ \
 +
    --arch i686 kernel.spec \
 +
    --dist  /usr/lib/build/configs/meego-1.2.conf
 +
 
binary RPM package can be found in /var/tmp/build-root/home/abuild/rpmbuild/RPMS/.
binary RPM package can be found in /var/tmp/build-root/home/abuild/rpmbuild/RPMS/.
 +
==Trouble shooting==
==Trouble shooting==
=== rpm verify failed ===
=== rpm verify failed ===
 +
If you encounter "rpm verify failed" issue while executing build. You need to download the meego-release pacakge from repo, and import the gpg key in meego-release package.
If you encounter "rpm verify failed" issue while executing build. You need to download the meego-release pacakge from repo, and import the gpg key in meego-release package.
For example:
For example:
-
  wget http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/noarch/meego-release-1.2.0-2.1.noarch.rpm
 
-
  rpm2cpio meego-release-1.2.0-2.1.noarch.rpm | cpio -idmv
 
-
  rpm --import ./etc/pki/rpm-gpg/RPM-GPG-KEY-meego02
 
-
=== build kernel on MeeGo system ===
+
    wget http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/noarch/meego-release-1.2.0-2.1.noarch.rpm
-
If your host system is MeeGo, you should install some additional packages, including build, perl-XML-Parser.
+
    rpm2cpio meego-release-1.2.0-2.1.noarch.rpm | cpio -idmv
 +
    rpm --import ./etc/pki/rpm-gpg/RPM-GPG-KEY-meego02
 +
 
=== build kernel on 64 bit system ===
=== build kernel on 64 bit system ===
-
You may occur some issue while your host system is 64 bit, once you have encountered issue, you'd better chroot to the chroot env, and build it manually. for example: you may met the follow error while building kernel  
+
 
 +
You may encounter some issue while your host system is 64 bit, in this case, you'd better go into the [[chroot]] env, and [[build]] it manually. for example: you may met the follow error while building kernel  
   -----------------------------------------------------------------
   -----------------------------------------------------------------
   ----- building kernel.spec (user abuild)
   ----- building kernel.spec (user abuild)
Line 60: Line 68:
   + exec rpmbuild -ba --define '_srcdefattr (-,root,root)' /home/abuild/rpmbuild/SOURCES/kernel.spec
   + exec rpmbuild -ba --define '_srcdefattr (-,root,root)' /home/abuild/rpmbuild/SOURCES/kernel.spec
   error: Architecture is not included: x86_64
   error: Architecture is not included: x86_64
-
You should follow the steps to solve this :
+
You can follow the steps to solve this :
   [root@xq-desktop development]# chroot /var/tmp/mybuildroot/
   [root@xq-desktop development]# chroot /var/tmp/mybuildroot/
   bash-3.2# su abuild
   bash-3.2# su abuild
   bash-3.2$ exec rpmbuild -ba --define '_srcdefattr (-,root,root)' /home/abuild/rpmbuild/SOURCES/kernel.spec --target=i686
   bash-3.2$ exec rpmbuild -ba --define '_srcdefattr (-,root,root)' /home/abuild/rpmbuild/SOURCES/kernel.spec --target=i686
 +
 +
You may also meet compiling error as follows:
 +
  sorry, unimplemented: 64-bit mode not compiled in
 +
 +
To solve this issue, you still need to go into chroot, and exclude -m64 options in CFLAGS CXXFLAGS and CPPFLAGS.

Latest revision as of 23:23, 26 July 2011

This page explains the kernel recompilation process. There is also information on how to configure the MeeGo kernel. There already is a guide on how to compile the kernel for MeeGo, including links to packaging : Tips on compiling and packaging kernels in MeeGo.


Contents

Fetch the kernel source

The first thing you'll need to do to recompile the MeeGo kernel is to download and unpack the MeeGo kernel package. To get that package you can download it with wget like this;

wget http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/source/kernel-2.6.37.2-8.27.src.rpm

You can of course get your kernel directly from upstream at kernel.org for example or clone it from MeeGo's git repos ( https://meego.gitorious.org/meego-os-base/kernel-source )

git clone git://gitorious.org/meego-os-base/kernel-source.git


Unpack source rpm

If you take the packaged MeeGo kernel, then you'll need to unpack this rpm. You can do that this way :

rpm2cpio kernel-2.6.37.2-8.27.src.rpm | cpio -id


Modify source code

Your development work should be in the kernel source code directory, you may do the follow modification:

  • If you want to add a patch, you need copy the patch to current directory and add this patch in spec file.
  • If you wan to remove patches, you just need to remove them in spec file.
  • If you want to modify exist patch, you can modify the special patch and spec file need not to modify.


Re-build kernel

Once you development work is done, you can use ‘build’ command to generate new RPM based on you changes. Command as follows:

   build \
    --repository http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/ \
    --arch i686 kernel.spec \
    --dist  /usr/lib/build/configs/meego-1.2.conf 

binary RPM package can be found in /var/tmp/build-root/home/abuild/rpmbuild/RPMS/.


Trouble shooting

rpm verify failed

If you encounter "rpm verify failed" issue while executing build. You need to download the meego-release pacakge from repo, and import the gpg key in meego-release package.

For example:

   wget http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/noarch/meego-release-1.2.0-2.1.noarch.rpm
   rpm2cpio meego-release-1.2.0-2.1.noarch.rpm | cpio -idmv
   rpm --import ./etc/pki/rpm-gpg/RPM-GPG-KEY-meego02


build kernel on 64 bit system

You may encounter some issue while your host system is 64 bit, in this case, you'd better go into the chroot env, and build it manually. for example: you may met the follow error while building kernel

 -----------------------------------------------------------------
 ----- building kernel.spec (user abuild)
 -----------------------------------------------------------------
 -----------------------------------------------------------------
 + exec rpmbuild -ba --define '_srcdefattr (-,root,root)' /home/abuild/rpmbuild/SOURCES/kernel.spec
 error: Architecture is not included: x86_64

You can follow the steps to solve this :

 [root@xq-desktop development]# chroot /var/tmp/mybuildroot/
 bash-3.2# su abuild
 bash-3.2$ exec rpmbuild -ba --define '_srcdefattr (-,root,root)' /home/abuild/rpmbuild/SOURCES/kernel.spec --target=i686

You may also meet compiling error as follows:

 sorry, unimplemented: 64-bit mode not compiled in

To solve this issue, you still need to go into chroot, and exclude -m64 options in CFLAGS CXXFLAGS and CPPFLAGS.

Personal tools