RFC: adding post build comments to kernels
From: Leisner, Martin <hidden>
Date: 2008-04-15 22:04:04
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=20 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). =20 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=3D$1 args=3D$(mkimage -l $1 2>/dev/null | grep 'Data Size') set - $args size=3D$3 size=3D$((size + 64)) dd if=3D$image skip=3D$size bs=3D1 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 =3D 1541.25 kB =3D 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