diff options
Diffstat (limited to 'scripts/package')
| -rw-r--r-- | scripts/package/Makefile | 24 | ||||
| -rw-r--r-- | scripts/package/builddeb | 56 | ||||
| -rw-r--r-- | scripts/package/buildtar | 111 | ||||
| -rwxr-xr-x | scripts/package/mkspec | 9 |
4 files changed, 189 insertions, 11 deletions
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 3b1f2eff2584..f3e7e8e4a500 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
| @@ -59,7 +59,7 @@ $(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile | |||
| 59 | $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@ | 59 | $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@ |
| 60 | 60 | ||
| 61 | binrpm-pkg: $(objtree)/binkernel.spec | 61 | binrpm-pkg: $(objtree)/binkernel.spec |
| 62 | $(MAKE) | 62 | $(MAKE) KBUILD_SRC= |
| 63 | set -e; \ | 63 | set -e; \ |
| 64 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version | 64 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version |
| 65 | set -e; \ | 65 | set -e; \ |
| @@ -74,16 +74,30 @@ clean-files += $(objtree)/binkernel.spec | |||
| 74 | # | 74 | # |
| 75 | .PHONY: deb-pkg | 75 | .PHONY: deb-pkg |
| 76 | deb-pkg: | 76 | deb-pkg: |
| 77 | $(MAKE) | 77 | $(MAKE) KBUILD_SRC= |
| 78 | $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb | 78 | $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb |
| 79 | 79 | ||
| 80 | clean-dirs += $(objtree)/debian/ | 80 | clean-dirs += $(objtree)/debian/ |
| 81 | 81 | ||
| 82 | 82 | ||
| 83 | # tarball targets | ||
| 84 | # --------------------------------------------------------------------------- | ||
| 85 | .PHONY: tar%pkg | ||
| 86 | tar%pkg: | ||
| 87 | $(MAKE) | ||
| 88 | $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ | ||
| 89 | |||
| 90 | clean-dirs += $(objtree)/tar-install/ | ||
| 91 | |||
| 92 | |||
| 83 | # Help text displayed when executing 'make help' | 93 | # Help text displayed when executing 'make help' |
| 84 | # --------------------------------------------------------------------------- | 94 | # --------------------------------------------------------------------------- |
| 85 | help: | 95 | help: |
| 86 | @echo ' rpm-pkg - Build the kernel as an RPM package' | 96 | @echo ' rpm-pkg - Build the kernel as an RPM package' |
| 87 | @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel & modules' | 97 | @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel' |
| 88 | @echo ' deb-pkg - Build the kernel as an deb package' | 98 | @echo ' and modules' |
| 99 | @echo ' deb-pkg - Build the kernel as an deb package' | ||
| 100 | @echo ' tar-pkg - Build the kernel as an uncompressed tarball' | ||
| 101 | @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' | ||
| 102 | @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' | ||
| 89 | 103 | ||
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index c279b6310f02..6edb29f2b4a6 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
| @@ -14,18 +14,38 @@ set -e | |||
| 14 | # Some variables and settings used throughout the script | 14 | # Some variables and settings used throughout the script |
| 15 | version=$KERNELRELEASE | 15 | version=$KERNELRELEASE |
| 16 | tmpdir="$objtree/debian/tmp" | 16 | tmpdir="$objtree/debian/tmp" |
| 17 | packagename=linux-$version | ||
| 18 | |||
| 19 | if [ "$ARCH" == "um" ] ; then | ||
| 20 | packagename=user-mode-linux-$version | ||
| 21 | fi | ||
| 17 | 22 | ||
| 18 | # Setup the directory structure | 23 | # Setup the directory structure |
| 19 | rm -rf "$tmpdir" | 24 | rm -rf "$tmpdir" |
| 20 | mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" | 25 | mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" |
| 26 | if [ "$ARCH" == "um" ] ; then | ||
| 27 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin" | ||
| 28 | fi | ||
| 21 | 29 | ||
| 22 | # Build and install the kernel | 30 | # Build and install the kernel |
| 23 | cp System.map "$tmpdir/boot/System.map-$version" | 31 | if [ "$ARCH" == "um" ] ; then |
| 24 | cp .config "$tmpdir/boot/config-$version" | 32 | $MAKE linux |
| 25 | cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" | 33 | cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" |
| 34 | cp .config "$tmpdir/usr/share/doc/$packagename/config" | ||
| 35 | gzip "$tmpdir/usr/share/doc/$packagename/config" | ||
| 36 | cp $KBUILD_IMAGE "$tmpdir/usr/bin/linux-$version" | ||
| 37 | else | ||
| 38 | cp System.map "$tmpdir/boot/System.map-$version" | ||
| 39 | cp .config "$tmpdir/boot/config-$version" | ||
| 40 | cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" | ||
| 41 | fi | ||
| 26 | 42 | ||
| 27 | if grep -q '^CONFIG_MODULES=y' .config ; then | 43 | if grep -q '^CONFIG_MODULES=y' .config ; then |
| 28 | INSTALL_MOD_PATH="$tmpdir" make modules_install | 44 | INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install |
| 45 | if [ "$ARCH" == "um" ] ; then | ||
| 46 | mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" | ||
| 47 | rmdir "$tmpdir/lib/modules/$version" | ||
| 48 | fi | ||
| 29 | fi | 49 | fi |
| 30 | 50 | ||
| 31 | # Install the maintainer scripts | 51 | # Install the maintainer scripts |
| @@ -53,6 +73,8 @@ linux ($version) unstable; urgency=low | |||
| 53 | EOF | 73 | EOF |
| 54 | 74 | ||
| 55 | # Generate a control file | 75 | # Generate a control file |
| 76 | if [ "$ARCH" == "um" ]; then | ||
| 77 | |||
| 56 | cat <<EOF > debian/control | 78 | cat <<EOF > debian/control |
| 57 | Source: linux | 79 | Source: linux |
| 58 | Section: base | 80 | Section: base |
| @@ -60,12 +82,34 @@ Priority: optional | |||
| 60 | Maintainer: $name | 82 | Maintainer: $name |
| 61 | Standards-Version: 3.6.1 | 83 | Standards-Version: 3.6.1 |
| 62 | 84 | ||
| 63 | Package: linux-$version | 85 | Package: $packagename |
| 86 | Architecture: any | ||
| 87 | Description: User Mode Linux kernel, version $version | ||
| 88 | User-mode Linux is a port of the Linux kernel to its own system call | ||
| 89 | interface. It provides a kind of virtual machine, which runs Linux | ||
| 90 | as a user process under another Linux kernel. This is useful for | ||
| 91 | kernel development, sandboxes, jails, experimentation, and | ||
| 92 | many other things. | ||
| 93 | . | ||
| 94 | This package contains the Linux kernel, modules and corresponding other | ||
| 95 | files version $version | ||
| 96 | EOF | ||
| 97 | |||
| 98 | else | ||
| 99 | cat <<EOF > debian/control | ||
| 100 | Source: linux | ||
| 101 | Section: base | ||
| 102 | Priority: optional | ||
| 103 | Maintainer: $name | ||
| 104 | Standards-Version: 3.6.1 | ||
| 105 | |||
| 106 | Package: $packagename | ||
| 64 | Architecture: any | 107 | Architecture: any |
| 65 | Description: Linux kernel, version $version | 108 | Description: Linux kernel, version $version |
| 66 | This package contains the Linux kernel, modules and corresponding other | 109 | This package contains the Linux kernel, modules and corresponding other |
| 67 | files version $version. | 110 | files version $version |
| 68 | EOF | 111 | EOF |
| 112 | fi | ||
| 69 | 113 | ||
| 70 | # Fix some ownership and permissions | 114 | # Fix some ownership and permissions |
| 71 | chown -R root:root "$tmpdir" | 115 | chown -R root:root "$tmpdir" |
diff --git a/scripts/package/buildtar b/scripts/package/buildtar new file mode 100644 index 000000000000..d8fffe6f8906 --- /dev/null +++ b/scripts/package/buildtar | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # | ||
| 4 | # buildtar 0.0.3 | ||
| 5 | # | ||
| 6 | # (C) 2004-2005 by Jan-Benedict Glaw <jbglaw@lug-owl.de> | ||
| 7 | # | ||
| 8 | # This script is used to compile a tarball from the currently | ||
| 9 | # prepared kernel. Based upon the builddeb script from | ||
| 10 | # Wichert Akkerman <wichert@wiggy.net>. | ||
| 11 | # | ||
| 12 | |||
| 13 | set -e | ||
| 14 | |||
| 15 | # | ||
| 16 | # Some variables and settings used throughout the script | ||
| 17 | # | ||
| 18 | version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}${EXTRANAME}" | ||
| 19 | tmpdir="${objtree}/tar-install" | ||
| 20 | tarball="${objtree}/linux-${version}.tar" | ||
| 21 | |||
| 22 | |||
| 23 | # | ||
| 24 | # Figure out how to compress, if requested at all | ||
| 25 | # | ||
| 26 | case "${1}" in | ||
| 27 | tar-pkg) | ||
| 28 | compress="cat" | ||
| 29 | file_ext="" | ||
| 30 | ;; | ||
| 31 | targz-pkg) | ||
| 32 | compress="gzip -c9" | ||
| 33 | file_ext=".gz" | ||
| 34 | ;; | ||
| 35 | tarbz2-pkg) | ||
| 36 | compress="bzip2 -c9" | ||
| 37 | file_ext=".bz2" | ||
| 38 | ;; | ||
| 39 | *) | ||
| 40 | echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2 | ||
| 41 | exit 1 | ||
| 42 | ;; | ||
| 43 | esac | ||
| 44 | |||
| 45 | |||
| 46 | # | ||
| 47 | # Clean-up and re-create the temporary directory | ||
| 48 | # | ||
| 49 | rm -rf -- "${tmpdir}" | ||
| 50 | mkdir -p -- "${tmpdir}/boot" | ||
| 51 | |||
| 52 | |||
| 53 | # | ||
| 54 | # Try to install modules | ||
| 55 | # | ||
| 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 | ||
| 62 | fi | ||
| 63 | |||
| 64 | |||
| 65 | # | ||
| 66 | # Install basic kernel files | ||
| 67 | # | ||
| 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}" | ||
| 71 | |||
| 72 | |||
| 73 | # | ||
| 74 | # Install arch-specific kernel image(s) | ||
| 75 | # | ||
| 76 | case "${ARCH}" in | ||
| 77 | i386) | ||
| 78 | [ -f arch/i386/boot/bzImage ] && cp -v -- arch/i386/boot/bzImage "${tmpdir}/boot/vmlinuz-${version}" | ||
| 79 | ;; | ||
| 80 | alpha) | ||
| 81 | [ -f arch/alpha/boot/vmlinux.gz ] && cp -v -- arch/alpha/boot/vmlinux.gz "${tmpdir}/boot/vmlinuz-${version}" | ||
| 82 | ;; | ||
| 83 | 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" | ||
| 86 | ;; | ||
| 87 | *) | ||
| 88 | [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${version}" | ||
| 89 | echo "" >&2 | ||
| 90 | echo '** ** ** WARNING ** ** **' >&2 | ||
| 91 | echo "" >&2 | ||
| 92 | echo "Your architecture did not define any architecture-dependant files" >&2 | ||
| 93 | echo "to be placed into the tarball. Please add those to ${0} ..." >&2 | ||
| 94 | echo "" >&2 | ||
| 95 | sleep 5 | ||
| 96 | ;; | ||
| 97 | esac | ||
| 98 | |||
| 99 | |||
| 100 | # | ||
| 101 | # Create the tarball | ||
| 102 | # | ||
| 103 | ( | ||
| 104 | cd "${tmpdir}" | ||
| 105 | tar cf - . | ${compress} > "${tarball}${file_ext}" | ||
| 106 | ) | ||
| 107 | |||
| 108 | echo "Tarball successfully created in ${tarball}${file_ext}" | ||
| 109 | |||
| 110 | exit 0 | ||
| 111 | |||
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 6e7a58f145ad..0b1038737548 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
| @@ -62,10 +62,19 @@ echo "" | |||
| 62 | fi | 62 | fi |
| 63 | 63 | ||
| 64 | echo "%install" | 64 | echo "%install" |
| 65 | echo "%ifarch ia64" | ||
| 66 | echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' | ||
| 67 | echo "%else" | ||
| 65 | echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' | 68 | echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' |
| 69 | echo "%endif" | ||
| 66 | 70 | ||
| 67 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' | 71 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' |
| 72 | echo "%ifarch ia64" | ||
| 73 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" | ||
| 74 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" | ||
| 75 | echo "%else" | ||
| 68 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" | 76 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" |
| 77 | echo "%endif" | ||
| 69 | 78 | ||
| 70 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" | 79 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" |
| 71 | 80 | ||
