aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/checkkconfigsymbols.sh4
-rw-r--r--scripts/coccinelle/misc/boolreturn.cocci58
-rw-r--r--scripts/package/builddeb94
-rwxr-xr-xscripts/package/mkspec46
4 files changed, 178 insertions, 24 deletions
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh
index 2ca49bb31efc..ccb3391882d1 100755
--- a/scripts/checkkconfigsymbols.sh
+++ b/scripts/checkkconfigsymbols.sh
@@ -9,7 +9,7 @@ paths="$@"
9# Doing this once at the beginning saves a lot of time, on a cache-hot tree. 9# Doing this once at the beginning saves a lot of time, on a cache-hot tree.
10Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" 10Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`"
11 11
12/bin/echo -e "File list \tundefined symbol used" 12printf "File list \tundefined symbol used\n"
13find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i 13find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i
14do 14do
15 # Output the bare Kconfig variable and the filename; the _MODULE part at 15 # Output the bare Kconfig variable and the filename; the _MODULE part at
@@ -54,6 +54,6 @@ while read symb files; do
54 # beyond the purpose of this script. 54 # beyond the purpose of this script.
55 symb_bare=`echo $symb | sed -e 's/_MODULE//'` 55 symb_bare=`echo $symb | sed -e 's/_MODULE//'`
56 if ! grep -q "\<$symb_bare\>" $Kconfigs; then 56 if ! grep -q "\<$symb_bare\>" $Kconfigs; then
57 /bin/echo -e "$files: \t$symb" 57 printf "$files: \t$symb\n"
58 fi 58 fi
59done|sort 59done|sort
diff --git a/scripts/coccinelle/misc/boolreturn.cocci b/scripts/coccinelle/misc/boolreturn.cocci
new file mode 100644
index 000000000000..a43c7b0c36ef
--- /dev/null
+++ b/scripts/coccinelle/misc/boolreturn.cocci
@@ -0,0 +1,58 @@
1/// Return statements in functions returning bool should use
2/// true/false instead of 1/0.
3//
4// Confidence: High
5// Options: --no-includes --include-headers
6
7virtual patch
8virtual report
9virtual context
10
11@r1 depends on patch@
12identifier fn;
13typedef bool;
14symbol false;
15symbol true;
16@@
17
18bool fn ( ... )
19{
20<...
21return
22(
23- 0
24+ false
25|
26- 1
27+ true
28)
29 ;
30...>
31}
32
33@r2 depends on report || context@
34identifier fn;
35position p;
36@@
37
38bool fn ( ... )
39{
40<...
41return
42(
43* 0@p
44|
45* 1@p
46)
47 ;
48...>
49}
50
51
52@script:python depends on report@
53p << r2.p;
54fn << r2.fn;
55@@
56
57msg = "WARNING: return of 0/1 in function '%s' with return type bool" % fn
58coccilib.report.print_report(p[0], msg)
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index acb86507828a..90e521fde35f 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -41,9 +41,9 @@ create_package() {
41 parisc*) 41 parisc*)
42 debarch=hppa ;; 42 debarch=hppa ;;
43 mips*) 43 mips*)
44 debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;; 44 debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el) ;;
45 arm*) 45 arm*)
46 debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;; 46 debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el) ;;
47 *) 47 *)
48 echo "" >&2 48 echo "" >&2
49 echo "** ** ** WARNING ** ** **" >&2 49 echo "** ** ** WARNING ** ** **" >&2
@@ -78,17 +78,35 @@ tmpdir="$objtree/debian/tmp"
78fwdir="$objtree/debian/fwtmp" 78fwdir="$objtree/debian/fwtmp"
79kernel_headers_dir="$objtree/debian/hdrtmp" 79kernel_headers_dir="$objtree/debian/hdrtmp"
80libc_headers_dir="$objtree/debian/headertmp" 80libc_headers_dir="$objtree/debian/headertmp"
81dbg_dir="$objtree/debian/dbgtmp"
81packagename=linux-image-$version 82packagename=linux-image-$version
82fwpackagename=linux-firmware-image 83fwpackagename=linux-firmware-image-$version
83kernel_headers_packagename=linux-headers-$version 84kernel_headers_packagename=linux-headers-$version
84libc_headers_packagename=linux-libc-dev 85libc_headers_packagename=linux-libc-dev
86dbg_packagename=$packagename-dbg
85 87
86if [ "$ARCH" = "um" ] ; then 88if [ "$ARCH" = "um" ] ; then
87 packagename=user-mode-linux-$version 89 packagename=user-mode-linux-$version
88fi 90fi
89 91
92# Not all arches have the same installed path in debian
93# XXX: have each arch Makefile export a variable of the canonical image install
94# path instead
95case $ARCH in
96um)
97 installed_image_path="usr/bin/linux-$version"
98 ;;
99parisc|mips|powerpc)
100 installed_image_path="boot/vmlinux-$version"
101 ;;
102*)
103 installed_image_path="boot/vmlinuz-$version"
104esac
105
106BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
107
90# Setup the directory structure 108# Setup the directory structure
91rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" 109rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir"
92mkdir -m 755 -p "$tmpdir/DEBIAN" 110mkdir -m 755 -p "$tmpdir/DEBIAN"
93mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" 111mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
94mkdir -m 755 -p "$fwdir/DEBIAN" 112mkdir -m 755 -p "$fwdir/DEBIAN"
@@ -101,26 +119,29 @@ mkdir -p "$kernel_headers_dir/lib/modules/$version/"
101if [ "$ARCH" = "um" ] ; then 119if [ "$ARCH" = "um" ] ; then
102 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" 120 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin"
103fi 121fi
122if [ -n "$BUILD_DEBUG" ] ; then
123 mkdir -p "$dbg_dir/usr/share/doc/$dbg_packagename"
124 mkdir -m 755 -p "$dbg_dir/DEBIAN"
125fi
104 126
105# Build and install the kernel 127# Build and install the kernel
106if [ "$ARCH" = "um" ] ; then 128if [ "$ARCH" = "um" ] ; then
107 $MAKE linux 129 $MAKE linux
108 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" 130 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
109 cp .config "$tmpdir/usr/share/doc/$packagename/config" 131 cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
110 gzip "$tmpdir/usr/share/doc/$packagename/config" 132 gzip "$tmpdir/usr/share/doc/$packagename/config"
111 cp $KBUILD_IMAGE "$tmpdir/usr/bin/linux-$version"
112else 133else
113 cp System.map "$tmpdir/boot/System.map-$version" 134 cp System.map "$tmpdir/boot/System.map-$version"
114 cp .config "$tmpdir/boot/config-$version" 135 cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
115 # Not all arches include the boot path in KBUILD_IMAGE 136fi
116 if [ -e $KBUILD_IMAGE ]; then 137# Not all arches include the boot path in KBUILD_IMAGE
117 cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" 138if [ -e $KBUILD_IMAGE ]; then
118 else 139 cp $KBUILD_IMAGE "$tmpdir/$installed_image_path"
119 cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" 140else
120 fi 141 cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path"
121fi 142fi
122 143
123if grep -q '^CONFIG_MODULES=y' .config ; then 144if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
124 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install 145 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install
125 rm -f "$tmpdir/lib/modules/$version/build" 146 rm -f "$tmpdir/lib/modules/$version/build"
126 rm -f "$tmpdir/lib/modules/$version/source" 147 rm -f "$tmpdir/lib/modules/$version/source"
@@ -128,6 +149,20 @@ if grep -q '^CONFIG_MODULES=y' .config ; then
128 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" 149 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
129 rmdir "$tmpdir/lib/modules/$version" 150 rmdir "$tmpdir/lib/modules/$version"
130 fi 151 fi
152 if [ -n "$BUILD_DEBUG" ] ; then
153 (
154 cd $tmpdir
155 for module in $(find lib/modules/ -name *.ko); do
156 mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
157 # only keep debug symbols in the debug file
158 objcopy --only-keep-debug $module $dbg_dir/usr/lib/debug/$module
159 # strip original module from debug symbols
160 objcopy --strip-debug $module
161 # then add a link to those
162 objcopy --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module
163 done
164 )
165 fi
131fi 166fi
132 167
133if [ "$ARCH" != "um" ]; then 168if [ "$ARCH" != "um" ]; then
@@ -149,7 +184,7 @@ set -e
149# Pass maintainer script parameters to hook scripts 184# Pass maintainer script parameters to hook scripts
150export DEB_MAINT_PARAMS="\$*" 185export DEB_MAINT_PARAMS="\$*"
151 186
152test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d 187test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
153exit 0 188exit 0
154EOF 189EOF
155 chmod 755 "$tmpdir/DEBIAN/$script" 190 chmod 755 "$tmpdir/DEBIAN/$script"
@@ -245,11 +280,12 @@ fi
245# Build header package 280# Build header package
246(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles") 281(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles")
247(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles") 282(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles")
248(cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles") 283(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles")
249destdir=$kernel_headers_dir/usr/src/linux-headers-$version 284destdir=$kernel_headers_dir/usr/src/linux-headers-$version
250mkdir -p "$destdir" 285mkdir -p "$destdir"
251(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) 286(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -)
252(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) 287(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
288(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
253ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" 289ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
254rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" 290rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
255arch=$(dpkg --print-architecture) 291arch=$(dpkg --print-architecture)
@@ -299,4 +335,30 @@ fi
299 335
300create_package "$packagename" "$tmpdir" 336create_package "$packagename" "$tmpdir"
301 337
338if [ -n "$BUILD_DEBUG" ] ; then
339 # Build debug package
340 # Different tools want the image in different locations
341 # perf
342 mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/
343 cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/
344 # systemtap
345 mkdir -p $dbg_dir/usr/lib/debug/boot/
346 ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version
347 # kdump-tools
348 ln -s lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/vmlinux-$version
349
350 cat <<EOF >> debian/control
351
352Package: $dbg_packagename
353Section: debug
354Provides: linux-debug, linux-debug-$version
355Architecture: any
356Description: Linux kernel debugging symbols for $version
357 This package will come in handy if you need to debug the kernel. It provides
358 all the necessary debug symbols for the kernel and its modules.
359EOF
360
361 create_package "$dbg_packagename" "$dbg_dir"
362fi
363
302exit 0 364exit 0
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index fdd3fbf4d4a4..13957602f7ca 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# Output a simple RPM spec file that uses no fancy features requiring 3# Output a simple RPM spec file.
4# RPM v4. This is intended to work with any RPM distro. 4# This version assumes a minimum of RPM 4.0.3.
5# 5#
6# The only gothic bit here is redefining install_post to avoid 6# The only gothic bit here is redefining install_post to avoid
7# stripping the symbols from files in the kernel which we want 7# stripping the symbols from files in the kernel which we want
@@ -59,6 +59,14 @@ echo "header files define structures and constants that are needed for"
59echo "building most standard programs and are also needed for rebuilding the" 59echo "building most standard programs and are also needed for rebuilding the"
60echo "glibc package." 60echo "glibc package."
61echo "" 61echo ""
62echo "%package devel"
63echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel"
64echo "Group: System Environment/Kernel"
65echo "AutoReqProv: no"
66echo "%description -n kernel-devel"
67echo "This package provides kernel headers and makefiles sufficient to build modules"
68echo "against the $__KERNELRELEASE kernel package."
69echo ""
62 70
63if ! $PREBUILT; then 71if ! $PREBUILT; then
64echo "%prep" 72echo "%prep"
@@ -77,13 +85,14 @@ echo "%install"
77echo 'KBUILD_IMAGE=$(make image_name)' 85echo 'KBUILD_IMAGE=$(make image_name)'
78echo "%ifarch ia64" 86echo "%ifarch ia64"
79echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' 87echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
80echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
81echo "%else" 88echo "%else"
82echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' 89echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
83echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
84echo "%endif" 90echo "%endif"
91echo 'mkdir -p $RPM_BUILD_ROOT'"/lib/firmware/$KERNELRELEASE"
85 92
86echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install' 93echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= mod-fw= modules_install'
94echo 'INSTALL_FW_PATH=$RPM_BUILD_ROOT'"/lib/firmware/$KERNELRELEASE"
95echo 'make INSTALL_FW_PATH=$INSTALL_FW_PATH' firmware_install
87echo "%ifarch ia64" 96echo "%ifarch ia64"
88echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" 97echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
89echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" 98echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
@@ -108,18 +117,43 @@ echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
108echo 'mv vmlinux.orig vmlinux' 117echo 'mv vmlinux.orig vmlinux'
109echo "%endif" 118echo "%endif"
110 119
120echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/{build,source}"
121echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE"
122echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude=firmware --exclude .config.old --exclude .missing-syscalls.d\""
123echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)"
124echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE"
125echo "ln -sf /usr/src/kernels/$KERNELRELEASE build"
126echo "ln -sf /usr/src/kernels/$KERNELRELEASE source"
127
111echo "" 128echo ""
112echo "%clean" 129echo "%clean"
113echo 'rm -rf $RPM_BUILD_ROOT' 130echo 'rm -rf $RPM_BUILD_ROOT'
114echo "" 131echo ""
132echo "%post"
133echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then"
134echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm"
135echo "cp /boot/System.map-$KERNELRELEASE /boot/System.map-$KERNELRELEASE-rpm"
136echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE"
137echo "/sbin/installkernel $KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm"
138echo "rm -f /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm"
139echo "fi"
140echo ""
115echo "%files" 141echo "%files"
116echo '%defattr (-, root, root)' 142echo '%defattr (-, root, root)'
117echo "%dir /lib/modules" 143echo "%dir /lib/modules"
118echo "/lib/modules/$KERNELRELEASE" 144echo "/lib/modules/$KERNELRELEASE"
119echo "/lib/firmware" 145echo "%exclude /lib/modules/$KERNELRELEASE/build"
146echo "%exclude /lib/modules/$KERNELRELEASE/source"
147echo "/lib/firmware/$KERNELRELEASE"
120echo "/boot/*" 148echo "/boot/*"
121echo "" 149echo ""
122echo "%files headers" 150echo "%files headers"
123echo '%defattr (-, root, root)' 151echo '%defattr (-, root, root)'
124echo "/usr/include" 152echo "/usr/include"
125echo "" 153echo ""
154echo "%files devel"
155echo '%defattr (-, root, root)'
156echo "/usr/src/kernels/$KERNELRELEASE"
157echo "/lib/modules/$KERNELRELEASE/build"
158echo "/lib/modules/$KERNELRELEASE/source"
159echo ""