#!/bin/bash # This script is based on the work performed by Aristeu Rozanski # I got a copy from his work by e-mail, due that no CVS tree is # being referenced if [ -f include/generated/utsrelease.h ]; then FILE=include/generated/utsrelease.h; else FILE=include/linux/utsrelease.h; fi version=$(grep UTS_RELEASE $FILE | cut -f 2 -d '"'); if [ -z "$version" ]; then echo "couldn't get version" >&2; exit 1; fi echo "version is $version" >&2 dir=$(mktemp -d); #make $(cat vars) modules_install INSTALL_MOD_PATH=$dir/ >/dev/null; make $(cat vars) modules_install INSTALL_MOD_PATH=$dir/ >/dev/null; mkdir $dir/boot cp .config $dir/boot/config-$version; cp System.map $dir/boot/System.map-$version; cp arch/x86/boot/bzImage $dir/boot/vmlinuz-$version; cp vmlinux $dir/boot; last=$PWD; cd $dir debug_enabled=0; # stripping debug info and packing in a different tarball if [ -n "$(grep ^CONFIG_DEBUG_KERNEL=y $last/.config)" ]; then debug_enabled=1; debug=$(mktemp -d); find . -name \*.ko -exec objcopy --only-keep-debug {} {}.debug \; find . -name \*.ko -exec strip -g {} \; tar cfj $last/debug-$version.tar.bz2 boot/vmlinux $(find lib -name \*.debug) rm boot/vmlinux $(find lib -name \*.debug); rm -Rf $debug; fi tar cfj $last/$version.tar.bz2 * cd $last; echo $version.tar.bz2; if [ $debug_enabled = 1 ]; then echo "debug info saved on debug-$version.tar.bz2" fi rm -Rf $dir;