2013-06-15 20:14:06 +00:00
|
|
|
--- a/Makefile
|
|
|
|
+++ b/Makefile
|
2015-02-05 23:18:47 +00:00
|
|
|
@@ -5,7 +5,7 @@
|
|
|
|
ifeq ($(KERNELRELEASE),)
|
|
|
|
|
|
|
|
MAKEFLAGS += --no-print-directory
|
|
|
|
-SHELL := /bin/bash
|
|
|
|
+SHELL := /usr/bin/env bash
|
2015-03-11 15:02:47 +00:00
|
|
|
BACKPORT_DIR := $(shell pwd)
|
2015-02-05 23:18:47 +00:00
|
|
|
|
|
|
|
KMODDIR ?= updates
|
2013-06-15 20:14:06 +00:00
|
|
|
@@ -19,6 +19,7 @@ KLIB_BUILD ?= $(KLIB)/build/
|
|
|
|
KERNEL_CONFIG := $(KLIB_BUILD)/.config
|
|
|
|
KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile
|
|
|
|
CONFIG_MD5 := $(shell md5sum $(KERNEL_CONFIG) 2>/dev/null | sed 's/\s.*//')
|
|
|
|
+STAMP_KERNEL_CONFIG := .kernel_config_md5_$(CONFIG_MD5)
|
|
|
|
|
2015-03-11 15:02:47 +00:00
|
|
|
export KLIB KLIB_BUILD BACKPORT_DIR KMODDIR KMODPATH_ARG
|
2013-06-15 20:14:06 +00:00
|
|
|
|
|
|
|
@@ -36,7 +37,8 @@ mrproper:
|
|
|
|
@rm -f .kernel_config_md5 Kconfig.versions Kconfig.kernel
|
|
|
|
@rm -f backport-include/backport/autoconf.h
|
|
|
|
|
|
|
|
-.DEFAULT:
|
|
|
|
+.SILENT: $(STAMP_KERNEL_CONFIG)
|
|
|
|
+$(STAMP_KERNEL_CONFIG):
|
2017-08-22 21:59:48 +00:00
|
|
|
@set -e ; test -f local-symbols || ( \
|
2013-06-15 20:14:06 +00:00
|
|
|
echo "/--------------" ;\
|
|
|
|
echo "| You shouldn't run make in the backports tree, but only in" ;\
|
2019-03-28 15:00:43 +00:00
|
|
|
@@ -60,58 +62,62 @@ mrproper:
|
2013-06-15 20:14:06 +00:00
|
|
|
echo "| (that isn't currently running.)" ;\
|
|
|
|
echo "\\--" ;\
|
|
|
|
false)
|
|
|
|
- @set -e ; if [ "$$(cat .kernel_config_md5 2>/dev/null)" != "$(CONFIG_MD5)" ] ;\
|
|
|
|
- then \
|
|
|
|
- echo -n "Generating local configuration database from kernel ..." ;\
|
2017-08-22 21:59:48 +00:00
|
|
|
- grep -v -f local-symbols $(KERNEL_CONFIG) | grep = | ( \
|
2013-06-15 20:14:06 +00:00
|
|
|
- while read l ; do \
|
|
|
|
- if [ "$${l:0:7}" != "CONFIG_" ] ; then \
|
|
|
|
- continue ;\
|
|
|
|
- fi ;\
|
|
|
|
- l=$${l:7} ;\
|
|
|
|
- n=$${l%%=*} ;\
|
|
|
|
- v=$${l#*=} ;\
|
|
|
|
- if [ "$$v" = "m" ] ; then \
|
|
|
|
- echo config $$n ;\
|
|
|
|
- echo ' tristate' ;\
|
|
|
|
- elif [ "$$v" = "y" ] ; then \
|
|
|
|
- echo config $$n ;\
|
|
|
|
- echo ' bool' ;\
|
|
|
|
- else \
|
|
|
|
- continue ;\
|
|
|
|
- fi ;\
|
|
|
|
- echo " default $$v" ;\
|
|
|
|
- echo "" ;\
|
|
|
|
- done \
|
|
|
|
- ) > Kconfig.kernel ;\
|
2021-06-05 16:21:57 +00:00
|
|
|
- kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) M=$(BACKPORT_DIR) \
|
|
|
|
- kernelversion | sed 's/^\(\([3-5]\|2\.6\)\.[0-9]\+\).*/\1/;t;d');\
|
2013-06-15 20:14:06 +00:00
|
|
|
- test "$$kver" != "" || echo "Kernel version parse failed!" ;\
|
|
|
|
- test "$$kver" != "" ;\
|
|
|
|
- kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
|
2015-07-06 16:26:34 +00:00
|
|
|
- kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
|
2019-03-28 15:00:43 +00:00
|
|
|
- kvers="$$kvers $$(seq 0 20 | sed 's/^/4./')" ;\
|
|
|
|
- kvers="$$kvers $$(seq 0 99 | sed 's/^/5./')" ;\
|
2013-06-15 20:14:06 +00:00
|
|
|
- print=0 ;\
|
|
|
|
- for v in $$kvers ; do \
|
|
|
|
- if [ "$$print" = "1" ] ; then \
|
2015-03-11 15:02:47 +00:00
|
|
|
- echo config KERNEL_$$(echo $$v | tr . _) ;\
|
2013-06-15 20:14:06 +00:00
|
|
|
- echo " def_bool y" ;\
|
|
|
|
- fi ;\
|
|
|
|
- if [ "$$v" = "$$kver" ] ; then print=1 ; fi ;\
|
|
|
|
- done > Kconfig.versions ;\
|
|
|
|
- # RHEL as well, sadly we need to grep for it ;\
|
|
|
|
- RHEL_MAJOR=$$(grep '^RHEL_MAJOR' $(KERNEL_MAKEFILE) | \
|
|
|
|
- sed 's/.*=\s*\([0-9]*\)/\1/;t;d') ;\
|
|
|
|
- RHEL_MINOR=$$(grep '^RHEL_MINOR' $(KERNEL_MAKEFILE) | \
|
|
|
|
- sed 's/.*=\s*\([0-9]*\)/\1/;t;d') ;\
|
|
|
|
- for v in $$(seq 0 $$RHEL_MINOR) ; do \
|
|
|
|
- echo config BACKPORT_RHEL_KERNEL_$${RHEL_MAJOR}_$$v ;\
|
|
|
|
- echo " def_bool y" ;\
|
|
|
|
- done >> Kconfig.versions ;\
|
|
|
|
- echo " done." ;\
|
|
|
|
- fi ;\
|
|
|
|
- echo "$(CONFIG_MD5)" > .kernel_config_md5
|
|
|
|
+ @rm -f .kernel_config_md5_*
|
|
|
|
+ @touch $@
|
|
|
|
+
|
2017-08-22 21:59:48 +00:00
|
|
|
+Kconfig.kernel: $(STAMP_KERNEL_CONFIG) local-symbols
|
2013-06-15 20:14:06 +00:00
|
|
|
+ @printf "Generating local configuration database from kernel ..."
|
2017-08-22 21:59:48 +00:00
|
|
|
+ @grep -v -f local-symbols $(KERNEL_CONFIG) | grep = | ( \
|
2013-06-15 20:14:06 +00:00
|
|
|
+ while read l ; do \
|
|
|
|
+ if [ "$${l:0:7}" != "CONFIG_" ] ; then \
|
|
|
|
+ continue ;\
|
|
|
|
+ fi ;\
|
|
|
|
+ l=$${l:7} ;\
|
|
|
|
+ n=$${l%%=*} ;\
|
|
|
|
+ v=$${l#*=} ;\
|
|
|
|
+ if [ "$$v" = "m" ] ; then \
|
|
|
|
+ echo config $$n ;\
|
|
|
|
+ echo ' tristate' ;\
|
|
|
|
+ elif [ "$$v" = "y" ] ; then \
|
|
|
|
+ echo config $$n ;\
|
|
|
|
+ echo ' bool' ;\
|
|
|
|
+ else \
|
|
|
|
+ continue ;\
|
|
|
|
+ fi ;\
|
|
|
|
+ echo " default $$v" ;\
|
|
|
|
+ echo "" ;\
|
|
|
|
+ done \
|
|
|
|
+ ) > $@
|
|
|
|
+ @echo " done."
|
|
|
|
+
|
|
|
|
+Kconfig.versions: Kconfig.kernel
|
2021-06-05 16:21:57 +00:00
|
|
|
+ @kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) M=$(BACKPORT_DIR) \
|
|
|
|
+ kernelversion | sed 's/^\(\([3-5]\|2\.6\)\.[0-9]\+\).*/\1/;t;d');\
|
2013-06-15 20:14:06 +00:00
|
|
|
+ test "$$kver" != "" || echo "Kernel version parse failed!" ;\
|
|
|
|
+ test "$$kver" != "" ;\
|
|
|
|
+ kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
|
2015-07-06 16:26:34 +00:00
|
|
|
+ kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
|
2019-03-28 15:00:43 +00:00
|
|
|
+ kvers="$$kvers $$(seq 0 20 | sed 's/^/4./')" ;\
|
|
|
|
+ kvers="$$kvers $$(seq 0 99 | sed 's/^/5./')" ;\
|
2013-06-15 20:14:06 +00:00
|
|
|
+ print=0 ;\
|
|
|
|
+ for v in $$kvers ; do \
|
|
|
|
+ if [ "$$print" = "1" ] ; then \
|
2015-03-11 15:02:47 +00:00
|
|
|
+ echo config KERNEL_$$(echo $$v | tr . _) ;\
|
2013-06-15 20:14:06 +00:00
|
|
|
+ echo " def_bool y" ;\
|
|
|
|
+ fi ;\
|
|
|
|
+ if [ "$$v" = "$$kver" ] ; then print=1 ; fi ;\
|
|
|
|
+ done > $@
|
|
|
|
+ @RHEL_MAJOR=$$(grep '^RHEL_MAJOR' $(KERNEL_MAKEFILE) | \
|
|
|
|
+ sed 's/.*=\s*\([0-9]*\)/\1/;t;d') ;\
|
|
|
|
+ RHEL_MINOR=$$(grep '^RHEL_MINOR' $(KERNEL_MAKEFILE) | \
|
|
|
|
+ sed 's/.*=\s*\([0-9]*\)/\1/;t;d') ;\
|
|
|
|
+ for v in $$(seq 0 $$RHEL_MINOR) ; do \
|
|
|
|
+ echo config BACKPORT_RHEL_KERNEL_$${RHEL_MAJOR}_$$v ;\
|
|
|
|
+ echo " def_bool y" ;\
|
|
|
|
+ done >> $@
|
|
|
|
+
|
|
|
|
+.DEFAULT:
|
|
|
|
+ @$(MAKE) Kconfig.versions
|
|
|
|
@$(MAKE) -f Makefile.real "$@"
|
|
|
|
|
2013-11-12 22:11:33 +00:00
|
|
|
.PHONY: defconfig-help
|
2013-06-15 20:14:06 +00:00
|
|
|
--- a/Makefile.real
|
|
|
|
+++ b/Makefile.real
|
2014-05-20 09:35:17 +00:00
|
|
|
@@ -59,7 +59,7 @@ defconfig-%::
|
2013-06-15 20:14:06 +00:00
|
|
|
|
|
|
|
backport-include/backport/autoconf.h: .config Kconfig.versions Kconfig.kernel
|
|
|
|
@$(MAKE) oldconfig
|
|
|
|
- @echo -n "Building backport-include/backport/autoconf.h ..."
|
|
|
|
+ @printf "Building backport-include/backport/autoconf.h ..."
|
2017-08-22 21:59:48 +00:00
|
|
|
@grep -f local-symbols .config | ( \
|
2013-06-15 20:14:06 +00:00
|
|
|
echo "#ifndef COMPAT_AUTOCONF_INCLUDED" ;\
|
|
|
|
echo "#define COMPAT_AUTOCONF_INCLUDED" ;\
|
2014-05-20 09:35:17 +00:00
|
|
|
@@ -80,7 +80,12 @@ backport-include/backport/autoconf.h: .c
|
2013-06-15 20:14:06 +00:00
|
|
|
esac ;\
|
|
|
|
done ;\
|
|
|
|
echo "#endif /* COMPAT_AUTOCONF_INCLUDED */" ;\
|
|
|
|
- ) > backport-include/backport/autoconf.h
|
|
|
|
+ ) > $@.new
|
|
|
|
+ @if cmp -s $@ $@.new; then \
|
|
|
|
+ rm -f $@.new; \
|
|
|
|
+ else \
|
|
|
|
+ mv $@.new $@; \
|
|
|
|
+ fi
|
|
|
|
@echo " done."
|
|
|
|
|
|
|
|
.PHONY: modules
|