RFC: adding post build comments to kernels

Leisner, Martin Martin.Leisner at xerox.com
Wed Apr 16 07:47:23 EST 2008


I'm a big proponent of marking kernels with their characteristics during
development -- instead of trying to  coordinate multiple pieces of
information and hope you get it right (I don't like to try)
I've been lobbying for /proc/config for a decade (that's one of the
first
things I enable when I'm doing kernel hacking).

I have a strategy to put "patch comments" into a kernel which you can
easily 
extract at runtime (I use a separate elf section for now, is there a
subsystem which already had the capability -- I have a macro

PATCH_ENTRY(string)

which puts this string wherever you want in the source(marging it with
the file/line,date).  

What I wanted is something so I can "add text" to a kernel (i.e. the
results of my patches).  It would be nice to extract at runtime, but not
necessary.

What I did was just:

cat >>uImage
some comments
<control-D>

and I can easily extract it with this script:

#! /bin/bash

image=$1
args=$(mkimage -l $1 2>/dev/null | grep 'Data Size')

set - $args

size=$3

size=$((size + 64))


dd if=$image skip=$size bs=1 2>/dev/null

This works fine:
%uboot-comments ./uImage 2.6.22.19-vanilla
this is a test
lovely kernel

but mkimage -l complains a little:

%mkimage -l uImage-2.6.22.19-vanilla
*** Warning: "uImage-2.6.22.19-vanilla" has corrupted data!
Image Name:   Linux-2.6.22.19
Created:      Mon Apr 14 13:04:02 2008
Image Type:   PowerPC Linux Kernel Image (gzip compressed)
Data Size:    1578239 Bytes = 1541.25 kB = 1.51 MB
Load Address: 0x00000000
Entry Point:  0x00000000


I suppose a tool could be build with compresses the kernel, puts in a
special elf section with a comment, recompresses the kernel, and builds
a new image -- but this is pretty easy...

This seems to boot with no problems...

marty



More information about the Linuxppc-dev mailing list