Skip to content

Commit 5016a0e

Browse files
authored
resources: Update disk image source to add hypercall and gem5bridge-driver (#69)
This PR updates the disk image build source for the X86 and Arm base Ubuntu and NPB disk images. The built disk images will now use hypercalls instead of classic exits, and will now also use the gem5 bridge driver, which allows for `gem5-bridge` commands to be run without the use of `sudo`. Both hypercalls and the gem5 bridge driver were introduced in gem5 v25.0. The build process for the base Ubuntu disk images supports Ubuntu 24.04 and 22.04, and the build process for the NPB disk images supports Ubuntu 24.04 only.
1 parent c2803fe commit 5016a0e

32 files changed

+669
-301
lines changed

src/npb-24.04-imgs/arm-npb.pkr.hcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ source "qemu" "initialize" {
3535
format = "raw"
3636
headless = "true"
3737
disk_image = "true"
38-
iso_checksum = "sha256:eb94422a3908c6c5183c03666b278b6e8bcfbde04da3d7c3bb5374bc82e0ef48"
39-
iso_urls = ["./arm-ubuntu-24.04-20240823"]
38+
iso_checksum = "sha256:71698e2b3e424402b49f92f667a73eb372ed24cf0e1751099ee1c6c4f1944483"
39+
iso_urls = ["./arm-ubuntu-24.04-20250515"]
4040
memory = "8192"
4141
output_directory = "disk-image-arm-npb"
4242
qemu_binary = "/usr/bin/qemu-system-aarch64"

src/npb-24.04-imgs/build-arm.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ dd if=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd of=flash0.img conv=notrunc
1414
cd ..
1515

1616
# get the base image from gem5 resource
17-
if [! -f ./arm-ubuntu-24.04-20240823 ]; then
18-
wget https://storage.googleapis.com/dist.gem5.org/dist/develop/images/arm/ubuntu-24-04/arm-ubuntu-24.04-20240823.gz
19-
gunzip arm-ubuntu-24.04-20240823.gz
17+
if [! -f ./arm-ubuntu-24.04-20250515 ]; then
18+
wget https://gem5resources.blob.core.windows.net/dist-gem5-org/dist/develop/images/arm/ubuntu-24-04/arm-ubuntu-24.04-20250515.gz
19+
gunzip arm-ubuntu-24.04-20250515.gz
2020
fi
21+
2122
# Install the needed plugins
2223
./packer init arm-npb.pkr.hcl
2324

src/npb-24.04-imgs/build-x86.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ if [ ! -f ./packer ]; then
1111
rm packer_${PACKER_VERSION}_linux_amd64.zip;
1212
fi
1313

14-
if [! -f ./x86-ubuntu-24-04-v2 ]; then
15-
wget https://storage.googleapis.com/dist.gem5.org/dist/develop/images/x86/ubuntu-24-04/x86-ubuntu-24-04-v2.gz
16-
gunzip x86-ubuntu-24-04-v2.gz
14+
if [! -f ./x86-ubuntu-24.04-20250515 ]; then
15+
wget https://gem5resources.blob.core.windows.net/dist-gem5-org/dist/develop/images/x86/ubuntu-24-04/x86-ubuntu-24.04-20250515.gz
16+
gunzip x86-ubuntu-24.04-20250515.gz
1717
fi
18+
1819
# Install the needed plugins
1920
./packer init x86-npb.pkr.hcl
2021

src/npb-24.04-imgs/npb-with-roi/NPB/NPB3.4-OMP/common/hooks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ void m5_work_begin_interface_()
5151
{
5252

5353
printf(" -------------------- ROI BEGIN -------------------- \n");
54-
m5_work_begin_addr(0,0);
54+
m5_hypercall_addr(4);
5555
}
5656

5757
void m5_work_end_interface_()
5858
{
59-
m5_work_end_addr(0,0);
59+
m5_hypercall_addr(5);
6060
printf(" -------------------- ROI END -------------------- \n");
6161
}

src/npb-24.04-imgs/scripts/post-installation.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ make clean
1616
make suite M5_ANNOTATION=1
1717
echo "Disabling network by default"
1818
echo "See README.md for instructions on how to enable network"
19-
mv /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.bak
19+
20+
if [ -f /etc/netplan/50-cloud-init.yaml ]; then
21+
mv /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.bak
22+
elif [ -f /etc/netplan/00-installer-config.yaml ]; then
23+
mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak
24+
netplan apply
25+
fi
26+
2027
# Disable systemd service that waits for network to be online
2128
systemctl disable systemd-networkd-wait-online.service
2229
systemctl mask systemd-networkd-wait-online.service
23-
24-
netplan apply

src/npb-24.04-imgs/x86-npb.pkr.hcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ source "qemu" "initialize" {
3636
format = "raw"
3737
headless = "true"
3838
disk_image = "true"
39-
iso_checksum = "sha256:6cedf26ebf281b823b24722341d3a2ab1f1ba26b10b536916d3f23cf92a8f4b5"
40-
iso_urls = ["./x86-ubuntu-24-04-v2"]
39+
iso_checksum = "sha256:58dfdabfd2510657776ad946c8c4e9cceacbd0806414690598a4f4808c2349b6"
40+
iso_urls = ["./x86-ubuntu-24.04-20250515"]
4141
memory = "8192"
4242
output_directory = "disk-image-x86-npb"
4343
qemu_binary = "/usr/bin/qemu-system-x86_64"

src/ubuntu-generic-diskimages/BUILDING.md

Lines changed: 126 additions & 102 deletions
Large diffs are not rendered by default.

src/ubuntu-generic-diskimages/files/arm/after_boot.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# gem5-bridge exit signifying that after_boot.sh is running
1616
printf "In after_boot.sh...\n"
17-
gem5-bridge --addr=0x10010000 exit # TODO: Make this a specialized event.
17+
gem5-bridge --addr=0x10010000 hypercall 2
1818

1919
# Read /proc/cmdline and parse options
2020

@@ -51,7 +51,7 @@ else
5151
/tmp/script
5252
printf "Done running script from gem5-bridge, exiting.\n"
5353
rm -f /tmp/script
54-
gem5-bridge --addr=0x10010000 exit
54+
gem5-bridge --addr=0x10010000 hypercall 3
5555
fi
5656
fi
5757
fi

src/ubuntu-generic-diskimages/files/arm/gem5_init.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,27 @@ mount -t sysfs /sys /sys
1515
cmdline=$(cat /proc/cmdline)
1616
no_systemd=false
1717

18+
# Load gem5_bridge driver
19+
## Default parameters (ARM64)
20+
gem5_bridge_baseaddr=0x10010000
21+
gem5_bridge_rangesize=0x10000
22+
## Try to read overloads from kernel arguments
23+
if [[ $cmdline =~ gem5_bridge_baseaddr=([[:alnum:]]+) ]]; then
24+
gem5_bridge_baseaddr=${BASH_REMATCH[1]}
25+
fi
26+
if [[ $cmdline =~ gem5_bridge_rangesize=([[:alnum:]]+) ]]; then
27+
gem5_bridge_rangesize=${BASH_REMATCH[1]}
28+
fi
29+
## Insert driver
30+
modprobe gem5_bridge \
31+
gem5_bridge_baseaddr=$gem5_bridge_baseaddr \
32+
gem5_bridge_rangesize=$gem5_bridge_rangesize
33+
1834
# gem5-bridge exit signifying that kernel is booted
1935
# This will cause the simulation to exit. Note that this will
2036
# cause qemu to fail.
2137
printf "Kernel booted, In gem5 init...\n"
22-
gem5-bridge --addr=0x10010000 exit # TODO: Make this a specialized event.
38+
gem5-bridge --addr=0x10010000 hypercall 1
2339

2440
if [[ $cmdline == *"no_systemd"* ]]; then
2541
no_systemd=true

src/ubuntu-generic-diskimages/files/serial-getty@.service

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)