Rebuilding OLPC kernel: Difference between revisions

From OLPC
Jump to navigation Jump to search
(FIELD_OTHER)
(Redirected page to Kernel)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
#REDIRECT [[Kernel]]
{{OLPC}}
[[Category:Developers]]
[[Category:Software]]
{{Merge | Kernel}}

This document describes building an OLPC kernel from the olpc-2.6 git repository or SRPM. You will want to do this on a Fedora Core 6 machine. These instructions do not work for FC8, but reportedly work on FC7.

== The OLPC kernel sources ==

The first step involves grabbing the kernel sources; either do a 'git clone' of the kernel git repository, or install the kernel SRPM. Both steps are described on the [[Kernel]] page.

Installing the SRPM will place the sources in /usr/src/redhat/SOURCES/olpc-2.6.tar.bz2

FIELD_MESSAGE_dardomro

== Building the RPM (from scratch) ==

This is the way that the official kernel RPMs are built. Note that this allows you to build within a subdirectory somewhere (rather than using /usr/src/redhat).

First, grab the kernel sources:

git clone --quiet git://dev.laptop.org/olpc-2.6 linux-2.6.22

Note that the name of the directory these sources are cloned into is important. It must start with <tt>linux.2.6.</tt>, followed by two numbers identifying the sublevel. These must match the sublevel defined in <tt>olpc-2.6/Makefile</tt>.
Optionally check out a particular branch using:

git checkout origin/stable

Now construct the build directory structure:

BASE=`pwd`/build; CUR=0
git clone --quiet git://dev.laptop.org/users/dilinger/olpc-2.6-rpm $BASE
(cd $BASE && mkdir -p BUILD RPMS SOURCES SPECS SRPMS)
tar -jc --exclude=.git -f $BASE/SOURCES/olpc-2.6.tar.bz2 linux-2.6.22

You need to build a config file for the kernel. This is done in the source directory checked out using git:

make ARCH=i386 -C linux-2.6.22 olpc_defconfig
cp linux-2.6.22/.config $BASE/SOURCES/kernel-olpc-custom.config

If building for a school server, make <tt>xs_defconfig</tt> instead:

make ARCH=i386 -C linux-2.6.22 xs_defconfig
cp linux-2.6.22/.config $BASE/SOURCES/kernel-olpc-custom.config

Now you can actually build the kernel and package it into an RPM:

rpmbuild -ba --define "dist 1.olpc" --define "olpc 1" --define "head `echo $CUR|cut -b1-15`" --target=i586 --define "_topdir $BASE" $BASE/SPECS/olpc-2.6.spec

The git://dev.laptop.org/users/dilinger/olpc-2.6-rpm repository contains the RPM SPEC file and other things necessary to bootstrap the RPM. When complete, the RPMs will be in build/RPMS/i586/.

===Upgrading your kernel build===

You will first need to pull down the newest kernel sources, and tar them up:

BASE=`pwd`/build; CUR=0
pushd linux-2.6.22; git pull ; popd
tar -jc --exclude=.git -f $BASE/SOURCES/olpc-2.6.tar.bz2 linux-2.6.22

You need to build a new config file for the kernel. This is done in the source directory checked out using git:

make ARCH=i386 -C linux-2.6.22 olpc_defconfig
cp linux-2.6.22/.config $BASE/SOURCES/kernel-olpc-custom.config

Don't forget to delete the directory from a previous build!

rm -r $BASE/BUILD/*

Now you can actually build the kernel and package it into an RPM:

rpmbuild -ba --define "dist 1.olpc" --define "olpc 1" --define "head `echo $CUR|cut -b1-15`" --target=i586 --define "_topdir $BASE" $BASE/SPECS/olpc-2.6.spec

==Fedora 8 (FC8) Notes==
On May 1, 2008, Chris Ball [http://lists.laptop.org/pipermail/devel/2008-May/013539.html mentioned] that FC6 is still being used on the build server. He had also built an FC8 core by making these two changes:
*GNU tar no longer allows you to (e.g.) "tar xf foo.tar '*.h'" without
adding a --wildcards before the pattern. In the specfile, change:
'linux-2.6.[0-9][0-9]/Makefile'
to
--wildcards 'linux-2.6.[0-9][0-9]/Makefile'

* The debuginfo packaging failed. Adding:
%define _enable_debug_packages 0
to the top of the specfile disables that part of the build, and
produced a working kernel package.



[[Category:Software development]]
[[Category:Developers]]
[[Category:OS]]
[[Category:Build system]]

Latest revision as of 14:52, 21 February 2011

Redirect to: