12
12
13
13
set -e
14
14
15
+ is_enabled () {
16
+ grep -q " ^$1 =y" $KCONFIG_CONFIG
17
+ }
18
+
19
+ if_enabled_echo () {
20
+ if is_enabled " $1 " ; then
21
+ echo -n " $2 "
22
+ elif [ $# -ge 3 ]; then
23
+ echo -n " $3 "
24
+ fi
25
+ }
26
+
15
27
create_package () {
16
28
local pname=" $1 " pdir=" $2 "
17
29
@@ -62,7 +74,7 @@ parisc|mips|powerpc)
62
74
installed_image_path=" boot/vmlinuz-$version "
63
75
esac
64
76
65
- BUILD_DEBUG=" $( grep -s ' ^ CONFIG_DEBUG_INFO=y ' $KCONFIG_CONFIG || true ) "
77
+ BUILD_DEBUG=$( if_enabled_echo CONFIG_DEBUG_INFO Yes )
66
78
67
79
# Setup the directory structure
68
80
rm -rf " $tmpdir " " $kernel_headers_dir " " $libc_headers_dir " " $dbg_dir " $objtree /debian/files
83
95
fi
84
96
cp " $( $MAKE -s -f $srctree /Makefile image_name) " " $tmpdir /$installed_image_path "
85
97
86
- if grep -q " ^ CONFIG_OF_EARLY_FLATTREE=y " $KCONFIG_CONFIG ; then
98
+ if is_enabled CONFIG_OF_EARLY_FLATTREE; then
87
99
# Only some architectures with OF support have this target
88
100
if [ -d " ${srctree} /arch/$SRCARCH /boot/dts" ]; then
89
101
$MAKE -f $srctree /Makefile INSTALL_DTBS_PATH=" $tmpdir /usr/lib/$packagename " dtbs_install
90
102
fi
91
103
fi
92
104
93
- if grep -q ' ^ CONFIG_MODULES=y ' $KCONFIG_CONFIG ; then
105
+ if is_enabled CONFIG_MODULES; then
94
106
INSTALL_MOD_PATH=" $tmpdir " $MAKE -f $srctree /Makefile modules_install
95
107
rm -f " $tmpdir /lib/modules/$version /build"
96
108
rm -f " $tmpdir /lib/modules/$version /source"
@@ -111,8 +123,7 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
111
123
done
112
124
113
125
# resign stripped modules
114
- MODULE_SIG_ALL=" $( grep -s ' ^CONFIG_MODULE_SIG_ALL=y' $KCONFIG_CONFIG || true) "
115
- if [ -n " $MODULE_SIG_ALL " ]; then
126
+ if is_enabled CONFIG_MODULE_SIG_ALL; then
116
127
INSTALL_MOD_PATH=" $tmpdir " $MAKE -f $srctree /Makefile modules_sign
117
128
fi
118
129
fi
129
140
# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and
130
141
# so do we; recent versions of dracut and initramfs-tools will obey this.
131
142
debhookdir=${KDEB_HOOKDIR:-/ etc/ kernel}
132
- if grep -q ' ^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG ; then
133
- want_initrd=Yes
134
- else
135
- want_initrd=No
136
- fi
137
143
for script in postinst postrm preinst prerm ; do
138
144
mkdir -p " $tmpdir$debhookdir /$script .d"
139
145
cat << EOF > "$tmpdir /DEBIAN/$script "
@@ -145,7 +151,7 @@ set -e
145
151
export DEB_MAINT_PARAMS="\$ *"
146
152
147
153
# Tell initramfs builder whether it's wanted
148
- export INITRD=$want_initrd
154
+ export INITRD=$( if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No )
149
155
150
156
test -d $debhookdir /$script .d && run-parts --arg="$version " --arg="/$installed_image_path " $debhookdir /$script .d
151
157
exit 0
@@ -158,11 +164,11 @@ done
158
164
(cd $srctree ; find arch/* /include include scripts -type f -o -type l) >> " $objtree /debian/hdrsrcfiles"
159
165
(cd $srctree ; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> " $objtree /debian/hdrsrcfiles"
160
166
(cd $srctree ; find $( find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> " $objtree /debian/hdrsrcfiles"
161
- if grep -q ' ^ CONFIG_STACK_VALIDATION=y ' $KCONFIG_CONFIG ; then
167
+ if is_enabled CONFIG_STACK_VALIDATION; then
162
168
(cd $objtree ; find tools/objtool -type f -executable) >> " $objtree /debian/hdrobjfiles"
163
169
fi
164
170
(cd $objtree ; find arch/$SRCARCH /include Module.symvers include scripts -type f) >> " $objtree /debian/hdrobjfiles"
165
- if grep -q ' ^ CONFIG_GCC_PLUGINS=y ' $KCONFIG_CONFIG ; then
171
+ if is_enabled CONFIG_GCC_PLUGINS; then
166
172
(cd $objtree ; find scripts/gcc-plugins -name \* .so -o -name gcc-common.h) >> " $objtree /debian/hdrobjfiles"
167
173
fi
168
174
destdir=$kernel_headers_dir /usr/src/linux-headers-$version
0 commit comments