Skip to content

Commit

Permalink
Merge pull request #100 from GaloisInc/94-upgrade-qemu-9.0
Browse files Browse the repository at this point in the history
Upgrade QEMU package to 9.0.2

This updates our QEMU package to version 9.0.2, which includes a fix for the issue described [here](rust-vmm/vhost#247 (comment)).

QEMU is now managed as a submodule ([verse-debian-qemu](https://github.com/GaloisInc/verse-debian-qemu), a fork of the [Debian QEMU packaging repo](https://salsa.debian.org/qemu-team/qemu)).  This lets us control the precise version of QEMU we use and makes it easier to track any VERSE-specific changes.  The previous approach used `apt source` to download the source for the Debian 12 QEMU package and then applied some custom patches; this limited us to the version of QEMU that's packaged in Debian 12, which is too old.
  • Loading branch information
spernsteiner authored Aug 1, 2024
2 parents 291d51c + 217d08a commit a122d23
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 1,158 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
- uses: actions/checkout@v4
- name: Checkout submodules
run: |
git config --global url."https://podhrmic:${{ secrets.VERSE_VHOST_DEVICE_ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git config --global url."https://galoisactions:${{ secrets.VERSE_VHOST_DEVICE_ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git submodule update --init src/pkvm_setup/libgpiod
git submodule update --init src/pkvm_setup/vhost-device
- name: Hash inputs
Expand Down Expand Up @@ -187,6 +187,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: |
git config --global url."https://galoisactions:${{ secrets.VERSE_VHOST_DEVICE_ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git submodule update --init src/pkvm_setup/qemu
- name: Hash inputs
id: hash
run: |
Expand Down Expand Up @@ -245,10 +249,11 @@ jobs:
- uses: actions/checkout@v4
- name: Checkout submodules
run: |
git config --global url."https://podhrmic:${{ secrets.VERSE_VHOST_DEVICE_ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git config --global url."https://galoisactions:${{ secrets.VERSE_VHOST_DEVICE_ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git submodule update --init src/pkvm_setup/libgpiod
git submodule update --init src/pkvm_setup/vhost-device
git submodule update --init src/pkvm_setup/linux-pkvm
git submodule update --init src/pkvm_setup/qemu
- name: Hash inputs
id: hash
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@
[submodule "src/cerberus"]
path = src/cerberus
url = https://github.com/rems-project/cerberus.git
[submodule "src/pkvm_setup/qemu"]
path = src/pkvm_setup/qemu
url = [email protected]:GaloisInc/verse-debian-qemu.git
29 changes: 12 additions & 17 deletions src/pkvm_setup/build_qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ dist=bookworm
echo "target=$target"
echo "dist=$dist"

sudo apt install -y pbuilder ubuntu-dev-tools dpkg-dev
sudo apt install -y pbuilder ubuntu-dev-tools dpkg-dev pristine-tar
PBUILDFOLDER="$(pwd)/qemu_build"
export PBUILDFOLDER

echo "Creating pbuilder base.tgz for $dist $target" 1>&2
pbuilder-dist "$dist" "$target" create
if [[ -f "$PBUILDFOLDER/${dist}-base.tgz" ]]; then
echo "Using existing pbuilder base.tgz for $dist $target" 1>&2
else
echo "Creating pbuilder base.tgz for $dist $target" 1>&2
pbuilder-dist "$dist" "$target" create
fi

sole() {
if [[ "$#" -ne 1 ]]; then
Expand All @@ -40,22 +44,13 @@ sole() {
fi
}

patch_dir="$(pwd)/qemu_patches"
(
# TODO: clean old src dir first (avoid reapplying patches)
mkdir -p "$PBUILDFOLDER/src"
cd "$PBUILDFOLDER/src"
cd qemu
echo "Preparing QEMU sources" 1>&2
apt source qemu
(
cd "$(sole qemu*/)"
for patch in "$patch_dir"/debian-*.patch; do
echo "Applying $patch" 1>&2
patch -p1 <"$patch"
done
dpkg-buildpackage --build=source -uc -us
)
pristine-tar checkout ../qemu_9.0.2+ds.orig.tar.xz
debian/rules debian/control
dpkg-buildpackage --build=source -uc -us
)

dsc_file="$(sole "$PBUILDFOLDER/src/"qemu_*-9999+verse*.dsc)"
dsc_file="$(sole qemu_*-9999+verse*.dsc)"
pbuilder-dist "$dist" "$target" build "$dsc_file"
4 changes: 2 additions & 2 deletions src/pkvm_setup/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ pkvm_list_outputs() {
# qemu

qemu_get_input_hashes() {
( cd src/pkvm_setup/qemu_patches && git rev-parse HEAD:./ )
( cd src/pkvm_setup/qemu && git rev-parse HEAD:./ )
sha1sum src/pkvm_setup/build_qemu.sh
}

qemu_build() {
(
cd src/pkvm_setup
bash build_qemu.sh
bash build_qemu.sh aarch64
)
}

Expand Down
1 change: 1 addition & 0 deletions src/pkvm_setup/qemu
Submodule qemu added at c06e9e
Loading

0 comments on commit a122d23

Please sign in to comment.