Rebuilding OLPC kernel: Difference between revisions
(Fixed some directory names in the making a .config section) |
|||
Line 50: | Line 50: | ||
make ARCH=i386 -C linux-2.6.22 olpc_defconfig |
make ARCH=i386 -C linux-2.6.22 olpc_defconfig |
||
cp |
cp linux-2.6.22/.config $BASE/SOURCES/kernel-olpc-custom.config |
||
If building for a school server, make <tt>xs_defconfig</tt> instead: |
If building for a school server, make <tt>xs_defconfig</tt> instead: |
||
make ARCH=i386 -C linux-2.6.22 xs_defconfig |
make ARCH=i386 -C linux-2.6.22 xs_defconfig |
||
cp |
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: |
Now you can actually build the kernel and package it into an RPM: |
Revision as of 02:50, 23 August 2007
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.
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
Building the RPM (the easy way)
The simplest way to build the kernel RPM involves downloading the SRPM, installing it, and then running the rpmbuild command. The "dist", "olpc", and "head" macros should be defined when building:
- rpm -ivh kernel-2.6.*-20061026_dc5079fafb767e4olpc1.src.rpm
- rpmbuild -ba --define "dist olpc1" --define "olpc 1" --define "head dc5079fafb767e4" --target=i586 /usr/src/redhat/SPECS/olpc-2.6.spec
After the build finishes, the newly build RPMs will be in /usr/src/redhat/RPMS, and the build tree that was used will be in /usr/src/redhat/BUILD. To make quick changes to the source, for example you can:
# cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i586 # vi drivers/video/geode/gxfb_dcon.c # make # scp drivers/video/geode/gxfb_dcon.ko testboard: # ssh testboard "rmmod gxfb_dcon; insmod ./gxfb_dcon.ko"
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 linux.2.6., followed by two numbers identifying the sublevel. These must match the sublevel defined in olpc-2.6/Makefile. 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 xs_defconfig 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 do bootstrap the RPM. When complete, the RPMs will be in build/RPMS/i586/.