在2022年2月10日二月 上午8:17,Johannes Berg写道: > On Thu, 2022-02-10 at 00:44 +0100, Hauke Mehrtens wrote: >> >> What build problem do you get when you include "#include <linux/bug.h>" >> here on kernel 4.9.299? >> > > I haven't tried, but per the explanation, you get issues if you tried to > include bug.h in the first place, since then you get > > bug.h > -> includes build_bug.h (since the patch) > -> uses build_bug.h from backports > -> includes bug.h (does nothing, double include) > Yep that's the problem. What I'm trying is something like: Though it won't work in kernel intergration mode. My makefile foo does not allow me to come up a idea. diff --git a/backport/Makefile.real b/backport/Makefile.real index 65508028..26482e52 100644 --- a/backport/Makefile.real +++ b/backport/Makefile.real @@ -83,8 +83,19 @@ backport-include/backport/autoconf.h: .config Kconfig.versions Kconfig.kernel ) > backport-include/backport/autoconf.h @echo " done." +.PHONY: backport-include/backport/version.h +backport-include/backport/version.h: + @echo -n "Building backport-include/backport/version.h ..." + @echo "#ifndef COMPAT_VERSION_INCLUDED" > $@ + @echo "#define COMPAT_VERSION_INCLUDED" >> $@ + @echo '#define COMPAT_LINUX_VERSION $(VERSION)' >> $@ + @echo '#define COMPAT_LINUX_PATCHLEVEL $(PATCHLEVEL)' >> $@ + @echo '#define COMPAT_LINUX_SUBLEVEL $(SUBLEVEL)' >> $@ + @echo "#endif" >> $@ + @echo " done." + .PHONY: modules -modules: backport-include/backport/autoconf.h +modules: backport-include/backport/autoconf.h backport-include/backport/version.h @$(MAKE) -f Makefile.build modules .PHONY: install diff --git a/backport/backport-include/linux/version.h b/backport/backport-include/linux/version.h index 2cb601ad..06684ffa 100644 --- a/backport/backport-include/linux/version.h +++ b/backport/backport-include/linux/version.h @@ -1,5 +1,7 @@ #ifndef _BP_LINUX_VERSION_H #define _BP_LINUX_VERSION_H + +#include <backport/version.h> #include_next <linux/version.h> #ifndef RHEL_RELEASE_VERSION @@ -10,8 +12,17 @@ #define RHEL_RELEASE_CODE 0 #endif -#define LINUX_VERSION_IS_LESS(x1,x2,x3) (LINUX_VERSION_CODE < KERNEL_VERSION(x1,x2,x3)) -#define LINUX_VERSION_IS_GEQ(x1,x2,x3) (LINUX_VERSION_CODE >= KERNEL_VERSION(x1,x2,x3)) +#define COMPACT_KERNEL_VERSION(a,b,c) (((a) << 24) + ((b) << 16) + (c)) + +#define COMPACT_LINUX_VERSION_CODE \ + COMPACT_KERNEL_VERSION(COMPAT_LINUX_VERSION, \ + COMPAT_LINUX_PATCHLEVEL, \ + COMPAT_LINUX_SUBLEVEL) + +#define LINUX_VERSION_IS_LESS(x1,x2,x3) \ + (COMPACT_LINUX_VERSION_CODE < COMPACT_KERNEL_VERSION(x1,x2,x3)) +#define LINUX_VERSION_IS_GEQ(x1,x2,x3) \ + (COMPACT_LINUX_VERSION_CODE >= COMPACT_KERNEL_VERSION(x1,x2,x3)) #define LINUX_VERSION_IN_RANGE(x1,x2,x3, y1,y2,y3) \ (LINUX_VERSION_IS_GEQ(x1,x2,x3) && LINUX_VERSION_IS_LESS(y1,y2,y3)) #endif /* _BP_LINUX_VERSION_H */ [...] -- - Jiaxun -- To unsubscribe from this list: send the line "unsubscribe backports" in