Commit 6073aa643f52fd12b02f0532dc96287f4c3293b5

Authored by Jan-Benedict Glaw
Committed by
1 parent 752625cff3

kbuild: tar-pkg with out-out-tree building

Fix out-of-tree builds for the tar-pkg targets

When I wrote the buildtar script, I didn't even think about
out-of-tree builds because I didn't use these back then. This patch
throughoutly uses ${objtree} instead of `pwd`.

Also, the kernel version is no longer manually built. Instead, it will
properly use $KERNELRELEASE .  Installing modules is only done if
CONFIG_MODULES is set.

Signed-off-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

Showing 2 changed files with 14 additions and 19 deletions Side-by-side Diff

scripts/package/Makefile
... ... @@ -84,7 +84,7 @@
84 84 # ---------------------------------------------------------------------------
85 85 .PHONY: tar%pkg
86 86 tar%pkg:
87   - $(MAKE)
  87 + $(MAKE) KBUILD_SRC=
88 88 $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
89 89  
90 90 clean-dirs += $(objtree)/tar-install/
scripts/package/buildtar
1 1 #!/bin/sh
2 2  
3 3 #
4   -# buildtar 0.0.3
  4 +# buildtar 0.0.4
5 5 #
6   -# (C) 2004-2005 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
  6 +# (C) 2004-2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
7 7 #
8 8 # This script is used to compile a tarball from the currently
9 9 # prepared kernel. Based upon the builddeb script from
10 10  
... ... @@ -15,9 +15,8 @@
15 15 #
16 16 # Some variables and settings used throughout the script
17 17 #
18   -version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}${EXTRANAME}"
19 18 tmpdir="${objtree}/tar-install"
20   -tarball="${objtree}/linux-${version}.tar"
  19 +tarball="${objtree}/linux-${KERNELRELEASE}.tar"
21 20  
22 21  
23 22 #
24 23  
... ... @@ -53,21 +52,17 @@
53 52 #
54 53 # Try to install modules
55 54 #
56   -if ! make INSTALL_MOD_PATH="${tmpdir}" modules_install; then
57   - echo "" >&2
58   - echo "Ignoring error at module_install time, since that could be" >&2
59   - echo "a result of missing local modutils/module-init-tools," >&2
60   - echo "or you just didn't compile in module support at all..." >&2
61   - echo "" >&2
  55 +if grep -q '^CONFIG_MODULES=y' "${objtree}/.config"; then
  56 + make ARCH="${ARCH}" O="${objtree}" KBUILD_SRC= INSTALL_MOD_PATH="${tmpdir}" modules_install
62 57 fi
63 58  
64 59  
65 60 #
66 61 # Install basic kernel files
67 62 #
68   -cp -v -- System.map "${tmpdir}/boot/System.map-${version}"
69   -cp -v -- .config "${tmpdir}/boot/config-${version}"
70   -cp -v -- vmlinux "${tmpdir}/boot/vmlinux-${version}"
  63 +cp -v -- "${objtree}/System.map" "${tmpdir}/boot/System.map-${KERNELRELEASE}"
  64 +cp -v -- "${objtree}/.config" "${tmpdir}/boot/config-${KERNELRELEASE}"
  65 +cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
71 66  
72 67  
73 68 #
74 69  
75 70  
76 71  
... ... @@ -75,17 +70,17 @@
75 70 #
76 71 case "${ARCH}" in
77 72 i386)
78   - [ -f arch/i386/boot/bzImage ] && cp -v -- arch/i386/boot/bzImage "${tmpdir}/boot/vmlinuz-${version}"
  73 + [ -f "${objtree}/arch/i386/boot/bzImage" ] && cp -v -- "${objtree}/arch/i386/boot/bzImage" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
79 74 ;;
80 75 alpha)
81   - [ -f arch/alpha/boot/vmlinux.gz ] && cp -v -- arch/alpha/boot/vmlinux.gz "${tmpdir}/boot/vmlinuz-${version}"
  76 + [ -f "${objtree}/arch/alpha/boot/vmlinux.gz" ] && cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
82 77 ;;
83 78 vax)
84   - [ -f vmlinux.SYS ] && cp -v -- vmlinux.SYS "${tmpdir}/boot/vmlinux-${version}.SYS"
85   - [ -f vmlinux.dsk ] && cp -v -- vmlinux.dsk "${tmpdir}/boot/vmlinux-${version}.dsk"
  79 + [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS"
  80 + [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk"
86 81 ;;
87 82 *)
88   - [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${version}"
  83 + [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}"
89 84 echo "" >&2
90 85 echo '** ** ** WARNING ** ** **' >&2
91 86 echo "" >&2