xref: /openbmc/linux/scripts/package/builddeb (revision 9de70176)
11da177e4SLinus Torvalds#!/bin/sh
21da177e4SLinus Torvalds#
34964451aSFrans Pop# builddeb 1.3
41da177e4SLinus Torvalds# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
51da177e4SLinus Torvalds#
61da177e4SLinus Torvalds# Simple script to generate a deb package for a Linux kernel. All the
74f66199bSFrans Pop# complexity of what to do with a kernel after it is installed or removed
81da177e4SLinus Torvalds# is left to other scripts and packages: they can install scripts in the
9fe233cb6SFrans Pop# /etc/kernel/{pre,post}{inst,rm}.d/ directories (or an alternative location
10fe233cb6SFrans Pop# specified in KDEB_HOOKDIR) that will be called on package install and
11fe233cb6SFrans Pop# removal.
121da177e4SLinus Torvalds
131da177e4SLinus Torvaldsset -e
141da177e4SLinus Torvalds
153e2ab256SFrans Popcreate_package() {
163e2ab256SFrans Pop	local pname="$1" pdir="$2"
173e2ab256SFrans Pop
189461f666SFrans Pop	cp debian/copyright "$pdir/usr/share/doc/$pname/"
191ab18486Smaximilian attems	cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
201ab18486Smaximilian attems	gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
21b59a1225SFEJES Jozsef	sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \
22b59a1225SFEJES Jozsef		| xargs -r0 md5sum > DEBIAN/md5sums"
239461f666SFrans Pop
243e2ab256SFrans Pop	# Fix ownership and permissions
253e2ab256SFrans Pop	chown -R root:root "$pdir"
263e2ab256SFrans Pop	chmod -R go-w "$pdir"
273e2ab256SFrans Pop
2810f26fa6SAsbjoern Sloth Toennesen	# Attempt to find the correct Debian architecture
2910f26fa6SAsbjoern Sloth Toennesen	local forcearch="" debarch=""
3010f26fa6SAsbjoern Sloth Toennesen	case "$UTS_MACHINE" in
3110f26fa6SAsbjoern Sloth Toennesen	i386|ia64|alpha)
3210f26fa6SAsbjoern Sloth Toennesen		debarch="$UTS_MACHINE" ;;
3310f26fa6SAsbjoern Sloth Toennesen	x86_64)
3410f26fa6SAsbjoern Sloth Toennesen		debarch=amd64 ;;
3510f26fa6SAsbjoern Sloth Toennesen	sparc*)
3610f26fa6SAsbjoern Sloth Toennesen		debarch=sparc ;;
3710f26fa6SAsbjoern Sloth Toennesen	s390*)
3810f26fa6SAsbjoern Sloth Toennesen		debarch=s390 ;;
3910f26fa6SAsbjoern Sloth Toennesen	ppc*)
4010f26fa6SAsbjoern Sloth Toennesen		debarch=powerpc ;;
4110f26fa6SAsbjoern Sloth Toennesen	parisc*)
4210f26fa6SAsbjoern Sloth Toennesen		debarch=hppa ;;
4310f26fa6SAsbjoern Sloth Toennesen	mips*)
44d2091767SAnisse Astier		debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el) ;;
4510f26fa6SAsbjoern Sloth Toennesen	arm*)
46d2091767SAnisse Astier		debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el) ;;
4710f26fa6SAsbjoern Sloth Toennesen	*)
4810f26fa6SAsbjoern Sloth Toennesen		echo "" >&2
4910f26fa6SAsbjoern Sloth Toennesen		echo "** ** **  WARNING  ** ** **" >&2
5010f26fa6SAsbjoern Sloth Toennesen		echo "" >&2
5110f26fa6SAsbjoern Sloth Toennesen		echo "Your architecture doesn't have it's equivalent" >&2
5210f26fa6SAsbjoern Sloth Toennesen		echo "Debian userspace architecture defined!" >&2
5310f26fa6SAsbjoern Sloth Toennesen		echo "Falling back to using your current userspace instead!" >&2
5410f26fa6SAsbjoern Sloth Toennesen		echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
5510f26fa6SAsbjoern Sloth Toennesen		echo "" >&2
5610f26fa6SAsbjoern Sloth Toennesen	esac
5755f88eccSAsbjoern Sloth Toennesen	if [ -n "$KBUILD_DEBARCH" ] ; then
5855f88eccSAsbjoern Sloth Toennesen		debarch="$KBUILD_DEBARCH"
5955f88eccSAsbjoern Sloth Toennesen	fi
6010f26fa6SAsbjoern Sloth Toennesen	if [ -n "$debarch" ] ; then
6110f26fa6SAsbjoern Sloth Toennesen		forcearch="-DArchitecture=$debarch"
6210f26fa6SAsbjoern Sloth Toennesen	fi
6310f26fa6SAsbjoern Sloth Toennesen
643e2ab256SFrans Pop	# Create the package
6510f26fa6SAsbjoern Sloth Toennesen	dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir"
663e2ab256SFrans Pop	dpkg --build "$pdir" ..
673e2ab256SFrans Pop}
683e2ab256SFrans Pop
691da177e4SLinus Torvalds# Some variables and settings used throughout the script
701da177e4SLinus Torvaldsversion=$KERNELRELEASE
714f66199bSFrans Poprevision=$(cat .version)
72c72c75dbSFrans Popif [ -n "$KDEB_PKGVERSION" ]; then
73c72c75dbSFrans Pop	packageversion=$KDEB_PKGVERSION
74c72c75dbSFrans Popelse
75c72c75dbSFrans Pop	packageversion=$version-$revision
76c72c75dbSFrans Popfi
771da177e4SLinus Torvaldstmpdir="$objtree/debian/tmp"
78bf1b3644SJonathan McDowellfwdir="$objtree/debian/fwtmp"
79ee81b786Smaximilian attemskernel_headers_dir="$objtree/debian/hdrtmp"
80ee81b786Smaximilian attemslibc_headers_dir="$objtree/debian/headertmp"
81810e8437SAnisse Astierdbg_dir="$objtree/debian/dbgtmp"
82f7a2c31fSmaximilian attemspackagename=linux-image-$version
83bf1b3644SJonathan McDowellfwpackagename=linux-firmware-image
84ee81b786Smaximilian attemskernel_headers_packagename=linux-headers-$version
85ee81b786Smaximilian attemslibc_headers_packagename=linux-libc-dev
86810e8437SAnisse Astierdbg_packagename=$packagename-dbg
87687c3dacSSam Ravnborg
884f66199bSFrans Popif [ "$ARCH" = "um" ] ; then
89687c3dacSSam Ravnborg	packagename=user-mode-linux-$version
90687c3dacSSam Ravnborgfi
911da177e4SLinus Torvalds
929de70176SAnisse Astier# Not all arches have the same installed path in debian
939de70176SAnisse Astier# XXX: have each arch Makefile export a variable of the canonical image install
949de70176SAnisse Astier# path instead
959de70176SAnisse Astiercase $ARCH in
969de70176SAnisse Astierum)
979de70176SAnisse Astier	installed_image_path="usr/bin/linux-$version"
989de70176SAnisse Astier	;;
999de70176SAnisse Astierparisc|mips|powerpc)
1009de70176SAnisse Astier	installed_image_path="boot/vmlinux-$version"
1019de70176SAnisse Astier	;;
1029de70176SAnisse Astier*)
1039de70176SAnisse Astier	installed_image_path="boot/vmlinuz-$version"
1049de70176SAnisse Astieresac
1059de70176SAnisse Astier
106810e8437SAnisse AstierBUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
107810e8437SAnisse Astier
1081da177e4SLinus Torvalds# Setup the directory structure
109810e8437SAnisse Astierrm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir"
110e86c2412Smaximilian attemsmkdir -m 755 -p "$tmpdir/DEBIAN"
111e86c2412Smaximilian attemsmkdir -p  "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
112e86c2412Smaximilian attemsmkdir -m 755 -p "$fwdir/DEBIAN"
1136607ddadSmaximilian attemsmkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename"
114ee81b786Smaximilian attemsmkdir -m 755 -p "$libc_headers_dir/DEBIAN"
115ee81b786Smaximilian attemsmkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename"
116ee81b786Smaximilian attemsmkdir -m 755 -p "$kernel_headers_dir/DEBIAN"
117ee81b786Smaximilian attemsmkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename"
118a47b6c61SJoerg Roedelmkdir -p "$kernel_headers_dir/lib/modules/$version/"
1194f66199bSFrans Popif [ "$ARCH" = "um" ] ; then
1209461f666SFrans Pop	mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin"
121687c3dacSSam Ravnborgfi
122810e8437SAnisse Astierif [ -n "$BUILD_DEBUG" ] ; then
123810e8437SAnisse Astier	mkdir -p "$dbg_dir/usr/share/doc/$dbg_packagename"
124810e8437SAnisse Astier	mkdir -m 755 -p "$dbg_dir/DEBIAN"
125810e8437SAnisse Astierfi
1261da177e4SLinus Torvalds
1271da177e4SLinus Torvalds# Build and install the kernel
1284f66199bSFrans Popif [ "$ARCH" = "um" ] ; then
129687c3dacSSam Ravnborg	$MAKE linux
130687c3dacSSam Ravnborg	cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
131d2091767SAnisse Astier	cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
132687c3dacSSam Ravnborg	gzip "$tmpdir/usr/share/doc/$packagename/config"
133687c3dacSSam Ravnborgelse
1341da177e4SLinus Torvalds	cp System.map "$tmpdir/boot/System.map-$version"
135d2091767SAnisse Astier	cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
1369de70176SAnisse Astierfi
137a89b433bSFrans Pop# Not all arches include the boot path in KBUILD_IMAGE
138242c5ab0SGuillem Joverif [ -e $KBUILD_IMAGE ]; then
1399de70176SAnisse Astier	cp $KBUILD_IMAGE "$tmpdir/$installed_image_path"
140242c5ab0SGuillem Joverelse
1419de70176SAnisse Astier	cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path"
142687c3dacSSam Ravnborgfi
1431da177e4SLinus Torvalds
144d2091767SAnisse Astierif grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
145dddcbb7cSJoerg Roedel	INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install
146a47b6c61SJoerg Roedel	rm -f "$tmpdir/lib/modules/$version/build"
147a47b6c61SJoerg Roedel	rm -f "$tmpdir/lib/modules/$version/source"
1484f66199bSFrans Pop	if [ "$ARCH" = "um" ] ; then
149687c3dacSSam Ravnborg		mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
150687c3dacSSam Ravnborg		rmdir "$tmpdir/lib/modules/$version"
151687c3dacSSam Ravnborg	fi
152810e8437SAnisse Astier	if [ -n "$BUILD_DEBUG" ] ; then
153810e8437SAnisse Astier		(
154810e8437SAnisse Astier			cd $tmpdir
155810e8437SAnisse Astier			for module in $(find lib/modules/ -name *.ko); do
156810e8437SAnisse Astier				mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
157810e8437SAnisse Astier				# only keep debug symbols in the debug file
158810e8437SAnisse Astier				objcopy --only-keep-debug $module $dbg_dir/usr/lib/debug/$module
159810e8437SAnisse Astier				# strip original module from debug symbols
160810e8437SAnisse Astier				objcopy --strip-debug $module
161810e8437SAnisse Astier				# then add a link to those
162810e8437SAnisse Astier				objcopy --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module
163810e8437SAnisse Astier			done
164810e8437SAnisse Astier		)
165810e8437SAnisse Astier	fi
1661da177e4SLinus Torvaldsfi
1671da177e4SLinus Torvalds
168d7d357bcSJoerg Roedelif [ "$ARCH" != "um" ]; then
169dddcbb7cSJoerg Roedel	$MAKE headers_check KBUILD_SRC=
170dddcbb7cSJoerg Roedel	$MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
171d7d357bcSJoerg Roedelfi
172e6807785Smaximilian attems
1731da177e4SLinus Torvalds# Install the maintainer scripts
174fe233cb6SFrans Pop# Note: hook scripts under /etc/kernel are also executed by official Debian
175fe233cb6SFrans Pop# kernel packages, as well as kernel packages built using make-kpkg
176fe233cb6SFrans Popdebhookdir=${KDEB_HOOKDIR:-/etc/kernel}
1771da177e4SLinus Torvaldsfor script in postinst postrm preinst prerm ; do
178fe233cb6SFrans Pop	mkdir -p "$tmpdir$debhookdir/$script.d"
1791da177e4SLinus Torvalds	cat <<EOF > "$tmpdir/DEBIAN/$script"
1801da177e4SLinus Torvalds#!/bin/sh
1811da177e4SLinus Torvalds
1821da177e4SLinus Torvaldsset -e
1831da177e4SLinus Torvalds
1844964451aSFrans Pop# Pass maintainer script parameters to hook scripts
185241ad11fSmaximilian attemsexport DEB_MAINT_PARAMS="\$*"
1864964451aSFrans Pop
187fe233cb6SFrans Poptest -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d
1881da177e4SLinus Torvaldsexit 0
1891da177e4SLinus TorvaldsEOF
1901da177e4SLinus Torvalds	chmod 755 "$tmpdir/DEBIAN/$script"
1911da177e4SLinus Torvaldsdone
1921da177e4SLinus Torvalds
193edec611dSmaximilian attems# Try to determine maintainer and email values
194edec611dSmaximilian attemsif [ -n "$DEBEMAIL" ]; then
195edec611dSmaximilian attems       email=$DEBEMAIL
196edec611dSmaximilian attemselif [ -n "$EMAIL" ]; then
197edec611dSmaximilian attems       email=$EMAIL
198edec611dSmaximilian attemselse
199edec611dSmaximilian attems       email=$(id -nu)@$(hostname -f)
200edec611dSmaximilian attemsfi
201edec611dSmaximilian attemsif [ -n "$DEBFULLNAME" ]; then
202edec611dSmaximilian attems       name=$DEBFULLNAME
203edec611dSmaximilian attemselif [ -n "$NAME" ]; then
204edec611dSmaximilian attems       name=$NAME
205edec611dSmaximilian attemselse
206edec611dSmaximilian attems       name="Anonymous"
207edec611dSmaximilian attemsfi
208edec611dSmaximilian attemsmaintainer="$name <$email>"
209edec611dSmaximilian attems
2101da177e4SLinus Torvalds# Generate a simple changelog template
2111da177e4SLinus Torvaldscat <<EOF > debian/changelog
2124bf4cd49SFrans Poplinux-upstream ($packageversion) unstable; urgency=low
2131da177e4SLinus Torvalds
214a83ca277SFrans Pop  * Custom built Linux kernel.
2151da177e4SLinus Torvalds
216edec611dSmaximilian attems -- $maintainer  $(date -R)
2171da177e4SLinus TorvaldsEOF
2181da177e4SLinus Torvalds
2199461f666SFrans Pop# Generate copyright file
2209461f666SFrans Popcat <<EOF > debian/copyright
2219461f666SFrans PopThis is a packacked upstream version of the Linux kernel.
2229461f666SFrans Pop
2239461f666SFrans PopThe sources may be found at most Linux ftp sites, including:
2249461f666SFrans Popftp://ftp.kernel.org/pub/linux/kernel
2259461f666SFrans Pop
2269461f666SFrans PopCopyright: 1991 - 2009 Linus Torvalds and others.
2279461f666SFrans Pop
2289461f666SFrans PopThe git repository for mainline kernel development is at:
2299461f666SFrans Popgit://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
2309461f666SFrans Pop
2319461f666SFrans Pop    This program is free software; you can redistribute it and/or modify
2329461f666SFrans Pop    it under the terms of the GNU General Public License as published by
2339461f666SFrans Pop    the Free Software Foundation; version 2 dated June, 1991.
2349461f666SFrans Pop
2359461f666SFrans PopOn Debian GNU/Linux systems, the complete text of the GNU General Public
2369461f666SFrans PopLicense version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
2379461f666SFrans PopEOF
2389461f666SFrans Pop
2391da177e4SLinus Torvalds# Generate a control file
2401da177e4SLinus Torvaldscat <<EOF > debian/control
2414bf4cd49SFrans PopSource: linux-upstream
242aa42abedSRogério BritoSection: kernel
2431da177e4SLinus TorvaldsPriority: optional
244edec611dSmaximilian attemsMaintainer: $maintainer
2452d7204acSRogério BritoStandards-Version: 3.8.4
246ee6eed80SRogério BritoHomepage: http://www.kernel.org/
2473e2ab256SFrans PopEOF
2483e2ab256SFrans Pop
2493e2ab256SFrans Popif [ "$ARCH" = "um" ]; then
2503e2ab256SFrans Pop	cat <<EOF >> debian/control
2511da177e4SLinus Torvalds
252687c3dacSSam RavnborgPackage: $packagename
2538ebc2fe9Smaximilian attemsProvides: linux-image, linux-image-2.6, linux-modules-$version
2541da177e4SLinus TorvaldsArchitecture: any
255dc5962fdSSam RavnborgDescription: User Mode Linux kernel, version $version
256dc5962fdSSam Ravnborg User-mode Linux is a port of the Linux kernel to its own system call
257dc5962fdSSam Ravnborg interface.  It provides a kind of virtual machine, which runs Linux
258dc5962fdSSam Ravnborg as a user process under another Linux kernel.  This is useful for
259dc5962fdSSam Ravnborg kernel development, sandboxes, jails, experimentation, and
260dc5962fdSSam Ravnborg many other things.
261dc5962fdSSam Ravnborg .
2621da177e4SLinus Torvalds This package contains the Linux kernel, modules and corresponding other
263a83ca277SFrans Pop files, version: $version.
2641da177e4SLinus TorvaldsEOF
2651da177e4SLinus Torvalds
266dc5962fdSSam Ravnborgelse
2673e2ab256SFrans Pop	cat <<EOF >> debian/control
268dc5962fdSSam Ravnborg
269dc5962fdSSam RavnborgPackage: $packagename
2708ebc2fe9Smaximilian attemsProvides: linux-image, linux-image-2.6, linux-modules-$version
271bf1b3644SJonathan McDowellSuggests: $fwpackagename
272dc5962fdSSam RavnborgArchitecture: any
273dc5962fdSSam RavnborgDescription: Linux kernel, version $version
274dc5962fdSSam Ravnborg This package contains the Linux kernel, modules and corresponding other
275a83ca277SFrans Pop files, version: $version.
276dc5962fdSSam RavnborgEOF
2774f66199bSFrans Pop
278dc5962fdSSam Ravnborgfi
279dc5962fdSSam Ravnborg
280cd8d60a2STheodore Ts'o# Build header package
2815f011d71Smaximilian attems(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles")
2826c635224SBen Hutchings(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles")
283d2091767SAnisse Astier(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles")
284ee81b786Smaximilian attemsdestdir=$kernel_headers_dir/usr/src/linux-headers-$version
285ee81b786Smaximilian attemsmkdir -p "$destdir"
2866c635224SBen Hutchings(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -)
2876c635224SBen Hutchings(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
288d2091767SAnisse Astier(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
289a47b6c61SJoerg Roedelln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
2906c635224SBen Hutchingsrm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
291cd8d60a2STheodore Ts'oarch=$(dpkg --print-architecture)
292cd8d60a2STheodore Ts'o
293cd8d60a2STheodore Ts'ocat <<EOF >> debian/control
294cd8d60a2STheodore Ts'o
295ee81b786Smaximilian attemsPackage: $kernel_headers_packagename
296cd8d60a2STheodore Ts'oProvides: linux-headers, linux-headers-2.6
297cd8d60a2STheodore Ts'oArchitecture: $arch
298cd8d60a2STheodore Ts'oDescription: Linux kernel headers for $KERNELRELEASE on $arch
299cd8d60a2STheodore Ts'o This package provides kernel header files for $KERNELRELEASE on $arch
300cd8d60a2STheodore Ts'o .
301cd8d60a2STheodore Ts'o This is useful for people who need to build external modules
302cd8d60a2STheodore Ts'oEOF
303cd8d60a2STheodore Ts'o
304bf1b3644SJonathan McDowell# Do we have firmware? Move it out of the way and build it into a package.
305bf1b3644SJonathan McDowellif [ -e "$tmpdir/lib/firmware" ]; then
3066607ddadSmaximilian attems	mv "$tmpdir/lib/firmware"/* "$fwdir/lib/firmware/$version/"
3076607ddadSmaximilian attems	rmdir "$tmpdir/lib/firmware"
308bf1b3644SJonathan McDowell
309bf1b3644SJonathan McDowell	cat <<EOF >> debian/control
310bf1b3644SJonathan McDowell
311bf1b3644SJonathan McDowellPackage: $fwpackagename
312bf1b3644SJonathan McDowellArchitecture: all
313bf1b3644SJonathan McDowellDescription: Linux kernel firmware, version $version
314a83ca277SFrans Pop This package contains firmware from the Linux kernel, version $version.
315bf1b3644SJonathan McDowellEOF
316bf1b3644SJonathan McDowell
3173e2ab256SFrans Pop	create_package "$fwpackagename" "$fwdir"
318bf1b3644SJonathan McDowellfi
319bf1b3644SJonathan McDowell
320e6807785Smaximilian attemscat <<EOF >> debian/control
321e6807785Smaximilian attems
322ee81b786Smaximilian attemsPackage: $libc_headers_packagename
323e6807785Smaximilian attemsSection: devel
324e6807785Smaximilian attemsProvides: linux-kernel-headers
325e6807785Smaximilian attemsArchitecture: any
326e6807785Smaximilian attemsDescription: Linux support headers for userspace development
327e6807785Smaximilian attems This package provides userspaces headers from the Linux kernel.  These headers
328e6807785Smaximilian attems are used by the installed headers for GNU glibc and other system libraries.
329e6807785Smaximilian attemsEOF
330e6807785Smaximilian attems
331d7d357bcSJoerg Roedelif [ "$ARCH" != "um" ]; then
332d7d357bcSJoerg Roedel	create_package "$kernel_headers_packagename" "$kernel_headers_dir"
333ee81b786Smaximilian attems	create_package "$libc_headers_packagename" "$libc_headers_dir"
334d7d357bcSJoerg Roedelfi
335d7d357bcSJoerg Roedel
3363e2ab256SFrans Popcreate_package "$packagename" "$tmpdir"
3371da177e4SLinus Torvalds
338810e8437SAnisse Astierif [ -n "$BUILD_DEBUG" ] ; then
339810e8437SAnisse Astier	# Build debug package
340810e8437SAnisse Astier	# Different tools want the image in different locations
341810e8437SAnisse Astier	# perf
342810e8437SAnisse Astier	mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/
343810e8437SAnisse Astier	cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/
344810e8437SAnisse Astier	# systemtap
345810e8437SAnisse Astier	mkdir -p $dbg_dir/usr/lib/debug/boot/
346810e8437SAnisse Astier	ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version
347810e8437SAnisse Astier	# kdump-tools
348810e8437SAnisse Astier	ln -s lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/vmlinux-$version
349810e8437SAnisse Astier
350810e8437SAnisse Astier	cat <<EOF >> debian/control
351810e8437SAnisse Astier
352810e8437SAnisse AstierPackage: $dbg_packagename
353810e8437SAnisse AstierSection: debug
354810e8437SAnisse AstierProvides: linux-debug, linux-debug-$version
355810e8437SAnisse AstierArchitecture: any
356810e8437SAnisse AstierDescription: Linux kernel debugging symbols for $version
357810e8437SAnisse Astier This package will come in handy if you need to debug the kernel. It provides
358810e8437SAnisse Astier all the necessary debug symbols for the kernel and its modules.
359810e8437SAnisse AstierEOF
360810e8437SAnisse Astier
361810e8437SAnisse Astier	create_package "$dbg_packagename" "$dbg_dir"
362810e8437SAnisse Astierfi
363810e8437SAnisse Astier
3641da177e4SLinus Torvaldsexit 0
365