[Click] Minimizing patch size

Philip Prindeville philipp_subx at redfish-solutions.com
Tue Jan 4 02:54:41 EST 2011


I was looking at the click kernel patches and noticed two things.

(1) none of the kernels seem to be particularly recent.
(2) a lot of the patches seem to be something other than added functionality.

Looking, for instance, at:

diff --git a/arch/arm/mach-iop13xx/irq.c b/arch/arm/mach-iop13xx/irq.c
index 69f07b2..e217167 100644
--- a/arch/arm/mach-iop13xx/irq.c
+++ b/arch/arm/mach-iop13xx/irq.c
@@ -38,7 +38,7 @@ static u32 read_intctl_0(void)
  }
  static void write_intctl_0(u32 val)
  {
-       asm volatile("mcr p6, 0, %0, c0, c4, 0"::"r" (val));
+       asm volatile("mcr p6, 0, %0, c0, c4, 0": :"r" (val));
  }

...


I'm wondering why this is required? First, why would the C++ compiler try to compile a .c file, and second, why would it not be able to parse an asm() directive correctly?

Looking over the patches, the "essential" ones are less than a thousand lines.

(3) I work a bit with the compat-wireless group, and they've managed to come up with a loadable module that provides "shim" functionality that allows the most recent wireless (wifi) drivers to load and run against older kernels.  I can use a 2.6.37 driver with a 2.6.27 kernel (even with the skb changes that occurred in the interim).

It should be possible to do something similar for click.

The only substantive change is adding new member fields to netdevice.h.

What about using a Makefile adaptation like:

%.o: %.c:
	(echo '#ifdef __cplusplus' ; \
	 echo 'extern "C" {' ; \
	 echo '#endif' ; \
	 echo '# 0 "$<"' ; \
	 cat $<  ; \
	 echo '#ifdef __cplusplus' ; \
	 echo '}' ; \
	 echo '#endif' ) | $(CC) $(CFLAGS) -c - -o $@


to bracket the contents of C files with:

#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif

and compile them that way?

I'm not sure if the debugging symbols would still be valid, or if they'd point to the wrong source files, but there are ways to patch that up with objcopy.

Comments?

Thanks,

-Philip



More information about the click mailing list