#!/bin/sh
echo ""
cd /
KP="/usr/src/linux-$(uname -r)"
echo "Kernel: $KP"
find .${KP} -name "*.o" > /tmp/~excl
find .${KP} -name "*.o.cmd" >> /tmp/~excl
find .${KP} -name "*.ko" >> /tmp/~excl
find .${KP} -name "*.ko.cmd" >> /tmp/~excl
find .${KP} -name ".*.o" >> /tmp/~excl
find .${KP} -name ".*.o.cmd" >> /tmp/~excl
find .${KP} -name ".*.ko" >> /tmp/~excl
find .${KP} -name ".*.ko.cmd" >> /tmp/~excl
find .${KP}/.tmp_versions/ -name "*" >> /tmp/~excl
find .${KP} -name ".*tmp*" >> /tmp/~excl
find .${KP}/arch/i386/boot -name "vmlinux" >> /tmp/~excl
find .${KP}/arch/i386/boot -name "vmlinux.bin*" >> /tmp/~excl
find .${KP}/arch/i386/boot -name "bzImage" >> /tmp/~excl

tar -cvjf /mnt/hda5/g2v_add_krnl.tar.bz2 --exclude=*.o --exclude=*.o.cmd \
     --exclude=.*.o --exclude=.*.o.cmd --exclude=.*.ko --exclude=.*.ko.cmd \
     --exclude=*.ko --exclude=*.ko.cmd --exclude=.${KP}/.tmp_versions \
     --exclude=vmlinux --exclude=vmlinux.bin* --exclude=bzImage \
     ./usr/src

tar -cvjf /mnt/hda5/g2v_opt_krnl_obj.tar.bz2  -T /tmp/~excl 

echo "$0 end"
echo ""
