On 29/08/2019 10.12, Petr Mladek wrote: > On Wed 2019-08-28 21:18:37, Uwe Kleine-König wrote: > BTW: I though more about generating or cut&pasting the arrary. > I can't find any reasonable way how to generate it. Something like this seems to work, though it probably needs some massage to be accepted by kbuild folks: define filechk_errcode.h echo '#include <linux/errno.h>' | \ $(CPP) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) -dM - | \ grep 'define E' | sort -k3,3n | \ awk '{print "errcode("$$2")\t/* "$$3" */"}' endef include/generated/errcode.h: FORCE $(call filechk,errcode.h) Then one can just #define errcode(foo) ... right before #include <generated/errcode.h>. It cannot be used to generate cases in a switch() because some expand to the same number, but that's ok, because I can't imagine the switch actually generating good or small code. I haven't checked how or whether it works in a cross-compile situation. Rasmus