Skip to content

Instantly share code, notes, and snippets.

@evadot
Created October 17, 2017 12:08
Show Gist options
  • Save evadot/40f92fb5320121fd8ee3b6d0d9c256c1 to your computer and use it in GitHub Desktop.
Save evadot/40f92fb5320121fd8ee3b6d0d9c256c1 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -x
set -e
XEN_VERSION=4.8
XEN_PATCHLEVEL=2
# Install the needed packages
apt install -y -q gcc quilt bin86 git make build-essential
# Checkout the xen sources
rm -rf xen-${XEN_VERSION}.${XEN_PATCHLEVEL}
mkdir -p xen-${XEN_VERSION}.${XEN_PATCHLEVEL}
git clone --single-branch -b RELEASE-${XEN_VERSION}.${XEN_PATCHLEVEL} https://xenbits.xen.org/git-http/xen.git xen-${XEN_VERSION}.${XEN_PATCHLEVEL}
XSA="https://xenbits.xen.org/xsa/xsa231-4.9.patch \
https://xenbits.xen.org/xsa/xsa232.patch \
https://xenbits.xen.org/xsa/xsa233.patch \
https://xenbits.xen.org/xsa/xsa234-4.8.patch \
https://xenbits.xen.org/xsa/xsa237-4.8/0001-x86-dont-allow-MSI-pIRQ-mapping-on-unowned-device.patch \
https://xenbits.xen.org/xsa/xsa237-4.8/0002-x86-enforce-proper-privilege-when-mapping-pIRQ-s.patch \
https://xenbits.xen.org/xsa/xsa237-4.8/0003-x86-MSI-disallow-redundant-enabling.patch \
https://xenbits.xen.org/xsa/xsa237-4.8/0004-x86-IRQ-conditionally-preserve-irq-pirq-mapping-on-error.patch \
https://xenbits.xen.org/xsa/xsa237-4.8/0005-x86-FLASK-fix-unmap-domain-IRQ-XSM-hook.patch \
https://xenbits.xen.org/xsa/xsa238.patch \
https://xenbits.xen.org/xsa/xsa239.patch \
https://xenbits.xen.org/xsa/xsa240-4.8/0001-x86-limit-linear-page-table-use-to-a-single-level.patch \
https://xenbits.xen.org/xsa/xsa240-4.8/0002-x86-mm-Disable-PV-linear-pagetables-by-default.patch \
https://xenbits.xen.org/xsa/xsa241-4.8.patch \
https://xenbits.xen.org/xsa/xsa242.patch \
https://xenbits.xen.org/xsa/xsa243-4.8.patch \
https://xenbits.xen.org/xsa/xsa244.patch \
https://xenbits.xen.org/xsa/xsa245/0001-xen-page_alloc-Cover-memory-unreserved-after-boot-in.patch \
https://xenbits.xen.org/xsa/xsa245/0002-xen-arm-Correctly-report-the-memory-region-in-the-du.patch"
cd xen-${XEN_VERSION}.${XEN_PATCHLEVEL}
mkdir patches
cd patches
for xsa in ${XSA}; do
wget ${xsa}
echo ${xsa} | awk -F'/' '{print $NF}' >> series
done
cd ..
quilt push -a
make -C xen defconfig
make -C xen XEN_WHOAMI=root XEN_DOMAIN=xen XEN_BUILD_HOST=xen XEN_BUILD_DATE="Sun Jan 01 01:01:00 CEST 2017" XEN_BUILD_TIME=01:01:00 SMBIOS_REL_DATE=01/01/2017 VGABIOS_REL_DATE="01 Mon 2017" build -j1
cd ../
buildid=`readelf -Wn xen-${XEN_VERSION}.${XEN_PATCHLEVEL}/xen/xen-syms | tail -1 | sed 's/.*Build ID: //'`
mv xen-${XEN_VERSION}.${XEN_PATCHLEVEL} xen-${XEN_VERSION}.${XEN_PATCHLEVEL}-${buildid}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment