F11 kernel for XO-1

Martin Dengler martin at martindengler.com
Sun Apr 5 13:53:36 UTC 2009


Hi,

I've rebuilt a patched F11 kernel for my XO-1 in order to:

1) get it booting without an initrd and with compcache/ramzswap patch

2) get the olpc-specific patches merged into an F11-based kernel (for
   my personal use and testing, others' use/testing, and any help it
   could provide in upstreaming the OLPC-specific patches)

3) convince myself it could be done by mere mortal - note an issue I
   ran into in step #10 of the process I document below

The benefits of this kernel are:

1) it boots on the XO-1 without an initrd (I've compiled in jffs2)

2) it does not use an extra ~22MB of memory like the current F11/SoaS
   kernels

3) compcache/ramzswap is compiled in

This kernel is for XOs.  It, like past OLPC kernels, lacks some of the
more general (esoteric?) modules that get built by default.

The packages are available here:

http://www.martindengler.com/proj/soas/kernel-2.6.29-16soas.fc10.i586.rpm
http://www.martindengler.com/proj/soas/kernel-headers-2.6.29-16soas.fc10.i586.rpm
http://www.martindengler.com/proj/soas/kernel-devel-2.6.29-16soas.fc10.i586.rpm

They were built using these config and .spec files:

http://www.martindengler.com/proj/soas/config-i586.2.6.29.soas
http://www.martindengler.com/proj/soas/kernel.spec-2.6.29-16soas

If anyone has the OLPC-specific patches lying around I would be very
happy to apply them and build a new kernel.

Martin



Steps to prepare a F11 kernel for XOs following the instructions at:
https://fedoraproject.org/wiki/Building_a_custom_kernel#Copy_the_Source_Tree_and_Generate_a_Patch

0) Find a F10 box. Install rpm build tools and directories:
su -c 'yum install yum-utils rpmdevtools'
rpmdev-setuptree


1) download kernel src rpm from koji:
page: http://koji.fedoraproject.org/koji/buildinfo?buildID=95660
srpm: http://kojipkgs.fedoraproject.org/packages/kernel/2.6.29/16.fc11/src/kernel-2.6.29-16.fc11.src.rpm


2) install it as non-root user:
su -c 'yum-builddep kernel-2.6.29-16.fc11.src.rpm'
rpm -Uvh kernel-2.6.29-16.fc11.src.rpm


3) extract pristine sources:
cd ~/rpmbuild/SPECS
rpmbuild -bp --target=i386 kernel.spec


4) creat pristine copy:
export ver=29
export arch=i386
cp -r ~/rpmbuild/BUILD/kernel-2.6.$ver/linux-2.6.$ver.$arch ~/rpmbuild/BUILD/kernel-2.6.$ver.orig
cp -al ~/rpmbuild/BUILD/kernel-2.6.$ver.orig ~/rpmbuild/BUILD/kernel-2.6.$ver.new


5) patch in compcache / ramzswap:

cd ~/rpmbuild/SOURCES
wget http://compcache.googlecode.com/files/ramzswap_patch_2.6.29_take4.diff
cd ~/rpmbuild/BUILD/kernel-2.6.$ver.new
patch -p1 < ../../SOURCES/ramzswap_patch_2.6.29_take4.diff
cd ~/rpmbuild/BUILD
diff -uNrp kernel-2.6.$ver.orig kernel-2.6.$ver.new > ../SOURCES/linux-2.6-ramzswap_patch_2.6.29_take4


6) patch in the sugarlabs logo:
cd ~/rpmbuild/SOURCES
wget http://www.martindengler.com/proj/soas/linux-2.6-soas-sugarlabs-logo.patch

This patch was prepared by:
cd ~/rpmbuild/BUILD/kernel-2.6.$ver.new/drivers/video/logo
rm logo_linux_clut224.ppm
wget http://www.martindengler.com/proj/soas/Logo_black_02-indexed-ascii.ppm logo_linux_clut224.ppm
cd ~/rpmbuild/BUILD
diff -uNrp kernel-2.6.$ver.orig kernel-2.6.$ver.new > ../SOURCES/linux-2.6-soas-sugarlabs-logo.patch

...and the Logo_black_02-indexed-ascii.ppm is just http://wiki.sugarlabs.org/go/Image:Logo_black_02.svg opened in the GIMP and saved as indexed (223 colours) ASCII.


7) configure the kernel
cd ~/rpmbuild/BUILD/kernel-2.6.$ver/linux-2.6.$ver.$arch/
wget http://www.martindengler.com/proj/soas/config-i586.2.6.29.soas
cp config-i586.2.6.29.soas .config
setarch $arch make silentoldconfig


8) add the buildarch-comment that rpmbuild expects (note we don't use $arch)
echo "# i586" > .config.rpm
cat .config >> .config.rpm
mv .config.rpm .config


9) copy the config to SOURCES (note we don't use $arch):
cp .config ~/rpmbuild/SOURCES/config-i586


10) update the build files:
cd ~/rpmbuild/SPECS
sed -e 's/#% define buildid .local/%define buildid soas/' < kernel.spec > kernel.spec.soas && mv kernel.spec.soas kernel.spec
# add the two sets of lines for Patch9900/Patch9901 and ApplyPatch:
$ diff -uw kernel.spec~ kernel.spec
--- kernel.spec~        2009-04-05 12:51:29.000000000 +0100
+++ kernel.spec 2009-04-05 12:55:07.000000000 +0100
@@ -697,6 +697,12 @@
 # fix locking in ipsec (#489764)
 Patch9101: linux-2.6-net-xfrm-fix-spin-unlock.patch
 
+# add ramzswap
+Patch9900: linux-2.6-ramzswap_patch_2.6.29_take4
+
+# add SoaS splash for non-pretty-boot prettiness
+Patch9901: linux-2.6-soas-sugarlabs-logo.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1249,6 +1255,9 @@
 ApplyPatch linux-2.6-net-fix-gro-bug.patch
 ApplyPatch linux-2.6-net-xfrm-fix-spin-unlock.patch
 
+ApplyPatch linux-2.6-ramzswap_patch_2.6.29_take4
+ApplyPatch linux-2.6-soas-sugarlabs-logo.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif


11) you'll need to hack out the conflation of i386, i586, and i686 because it breaks the make oldconfig part of the redhat kernel spec file.  Do this by adding:

%ifarch i586
%define all_arch_configs kernel-%{version}-i586*.config
%endif

...to kernel.spec at around line 282, right after the "%ifarch %{all_x86}" section ends.  You need to do this if you get an error like this when you build the kernel (the next step):

+ mv kernel-2.6.29-i686-PAE.config .config
++ head -1 .config
++ cut -b 3-   
+ Arch=i386
+ make ARCH=i386 nonint_oldconfig
CONFIG_BLK_DEV_RAMZSWAP
make[1]: *** [nonint_oldconfig] Error 1
make: *** [nonint_oldconfig] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.hHU6u8 (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.hHU6u8 (%prep)


12) build the kernel (note this is not $arch)
setarch $arch rpmbuild -bb --with baseonly --without debuginfo --target=i586 kernel.spec
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-olpc-list/attachments/20090405/f9650364/attachment.sig>


More information about the Fedora-olpc-list mailing list