Blame make-release

Mark McLoughlin 6694af
#!/bin/bash -e
Mark McLoughlin 6694af
Mark McLoughlin 6694af
# Based on avi's scripts/make-release from kvm-userspace.git
Mark McLoughlin 6694af
Mark McLoughlin 6694af
usage()
Mark McLoughlin 6694af
{
Mark McLoughlin 6694af
    echo "usage: make-release name kernel-dir kernel-commit user-dir user-commit"
Mark McLoughlin 6694af
    exit 1
Mark McLoughlin 6694af
}
Mark McLoughlin 6694af
Mark McLoughlin 6694af
[ $# -eq 5 ] || usage
Mark McLoughlin 6694af
Mark McLoughlin 6694af
name="$1"
Mark McLoughlin 6694af
kdir="$2"
Mark McLoughlin 6694af
kcommit="$3"
Mark McLoughlin 6694af
udir="$4"
Mark McLoughlin 6694af
ucommit="$5"
Mark McLoughlin 6694af
archs=(x86 ia64)
Mark McLoughlin 6694af
Mark McLoughlin 6694af
release_dir=$(mktemp -d)
Mark McLoughlin 6694af
Mark McLoughlin 6694af
tarball="$(pwd)/$name.tar.gz"
Mark McLoughlin 6694af
Mark McLoughlin 6694af
cd "${release_dir}"
Mark McLoughlin 6694af
(cd "$udir";  git archive --format=tar --prefix="$name"/ "$ucommit") | tar x
Mark McLoughlin 6694af
cd "$name"
Mark McLoughlin 6694af
cat <<EOF > SOURCES
Mark McLoughlin 6694af
kernel:    $(cd "$kdir"; git rev-parse "$kcommit")
Mark McLoughlin 6694af
userspace: $(cd "$udir"; git rev-parse "$ucommit")
Mark McLoughlin 6694af
EOF
Mark McLoughlin 6694af
Mark McLoughlin 6694af
paths=(drivers/kvm virt/kvm)
Mark McLoughlin 6694af
files=(kvm.h kvm_host.h kvm_para.h kvm_types.h kvm_x86_emulate.h virtext.h svm.h vmx.h)
Mark McLoughlin 6694af
for file in "${files[@]}"; do
Mark McLoughlin 6694af
    for arch in "${archs[@]}"; do
Mark McLoughlin 6694af
	for variant in include/asm-"$arch" arch/"$arch"/include/asm; do
Mark McLoughlin 6694af
	    paths+=("$variant"/"$file")
Mark McLoughlin 6694af
	done
Mark McLoughlin 6694af
    done
Mark McLoughlin 6694af
    paths+=(include/linux/"$file")
Mark McLoughlin 6694af
done
Mark McLoughlin 6694af
for arch in "${archs[@]}"; do
Mark McLoughlin 6694af
    paths+=(arch/"$arch"/kvm)
Mark McLoughlin 6694af
done
Mark McLoughlin 6694af
Mark McLoughlin 6694af
(cd "$kdir"; git archive --format=tar --prefix=linux/ "$kcommit" "${paths[@]}") | tar x
Mark McLoughlin 6694af
Mark McLoughlin 6694af
touch kernel/config.kbuild
Mark McLoughlin 6694af
echo ARCH=ia64 > config.mak
Mark McLoughlin 6694af
make -C kernel sync LINUX=../linux version="$name" >/dev/null
Mark McLoughlin 6694af
echo ARCH=x86_64 > config.mak
Mark McLoughlin 6694af
make -C kernel sync LINUX=../linux version="$name" >/dev/null
Mark McLoughlin 6694af
rm -rf config.mak linux kernel/config.kbuild
Mark McLoughlin 6694af
#rm -rf kernel/include/asm kernel/include-compat/asm
Mark McLoughlin 6694af
sed -i "s/kvm-devel/$name/" qemu/configure
Mark McLoughlin 6694af
Mark McLoughlin 6694af
cd ..
Mark McLoughlin 6694af
Mark McLoughlin 6694af
tar czf "$tarball" "$name"
Mark McLoughlin 6694af
Mark McLoughlin 6694af
cd $(dirname "$tarball")
Mark McLoughlin 6694af
md5sum $(basename "$tarball")
Mark McLoughlin 6694af
Mark McLoughlin 6694af
rm -rf "${release_dir}"