blob: 287b27de28483b91f71be62f944c0902eb1c86d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#
# Makefile for the output source package
#
ifeq ($(KERNELRELEASE),)
MAKEFLAGS += --no-print-directory
SHELL := /bin/bash
BACKPORT_PWD := $(shell pwd)
KMODDIR ?= updates
ifneq ($(origin KLIB), undefined)
KMODPATH_ARG := "INSTALL_MOD_PATH=$(KLIB)"
else
KLIB := /lib/modules/$(shell uname -r)/
KMODPATH_ARG :=
endif
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.*//')
export KLIB KLIB_BUILD BACKPORT_PWD KMODDIR KMODPATH_ARG
# disable built-in rules for this file
.SUFFIXES:
.PHONY: default
default:
@$(MAKE) modules
.PHONY: mrproper
mrproper:
@test -f .config && $(MAKE) clean || true
@rm -f .config
@rm -f .kernel_config_md5 Kconfig.versions Kconfig.kernel
@rm -f backport-include/backport/autoconf.h
.DEFAULT:
@set -e ; test -f $(KERNEL_CONFIG) || ( \
echo "/--------------" ;\
echo "| Your kernel headers are incomplete/not installed." ;\
echo "| Please install kernel headers, including a .config" ;\
echo "| file or use the KLIB/KLIB_BUILD make variables to" ;\
echo "| set the kernel to build against, e.g." ;\
echo "| make KLIB=/lib/modules/3.1.7/" ;\
echo "| to compile/install for the installed kernel 3.1.7" ;\
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 ..." ;\
grep -v -f .local-symbols $(KERNEL_CONFIG) | grep = | ( \
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 ;\
kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
test "$$kver" != "" || echo "Kernel version parse failed!" ;\
test "$$kver" != "" ;\
kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
print=0 ;\
for v in $$kvers ; do \
if [ "$$print" = "1" ] ; then \
echo config BACKPORT_KERNEL_$$(echo $$v | tr . _) ;\
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
@$(MAKE) -f Makefile.real "$@"
else
include $(BACKPORT_PWD)/Makefile.kernel
endif
|