Skip to content

Commit

Permalink
resources: Move to gem5 bridge devices in x86 disk files
Browse files Browse the repository at this point in the history
  • Loading branch information
nkrim committed Sep 6, 2024
1 parent d59ce64 commit b46b152
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/x86-ubuntu/files/after_boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# gem5-bridge exit signifying that after_boot.sh is running
printf "In after_boot.sh...\n"
gem5-bridge exit # TODO: Make this a specialized event.
echo 0 > /dev/gem5/exit # TODO: Make this a specialized event.

# Read /proc/cmdline and parse options

Expand All @@ -28,19 +28,19 @@ fi
printf "Interactive mode: $interactive\n"

if [[ $interactive == true ]]; then
printf "Interactive mode enabled, dropping to shell."
printf "Interactive mode enabled, dropping to shell.\n"
/bin/bash
else
# Try to read the file from the host when running with gem5
if ! [ -z $IGNORE_M5 ]; then
printf "Starting gem5 init... trying to read run script file via readfile.\n"
if ! gem5-bridge readfile > /tmp/script; then
if ! cat /dev/gem5/readfile > /tmp/script; then
printf "Failed to run gem5-bridge readfile, exiting!\n"
rm -f /tmp/script
# If we can't read the script exit the simulation. If we cannot exit the
# simulation, this probably means that we are running in QEMU. So, ignore
# future calls to gem5-bridge.
if ! gem5-bridge exit; then
if ! echo 0 > /dev/gem5/exit; then
# Useful for booting the disk image in (e.g.,) qemu for debugging
printf "gem5-bridge exit failed, dropping to shell.\n"
IGNORE_M5=1 /bin/bash
Expand All @@ -51,7 +51,7 @@ else
/tmp/script
printf "Done running script from gem5-bridge, exiting.\n"
rm -f /tmp/script
gem5-bridge exit
echo 0 > /dev/gem5/exit
fi
fi
fi
2 changes: 1 addition & 1 deletion src/x86-ubuntu/files/exit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Copyright (c) 2020 The Regents of the University of California.
# SPDX-License-Identifier: BSD 3-Clause

m5 exit
echo 0 > /dev/gem5/exit
2 changes: 1 addition & 1 deletion src/x86-ubuntu/files/gem5_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ modprobe gem5_bridge || insmod /lib/modules/$(uname -r)/gem5/gem5_bridge.ko
# This will cause the simulation to exit. Note that this will
# cause qemu to fail.
printf "Kernel booted, In gem5 init...\n"
gem5-bridge exit # TODO: Make this a specialized event.
echo 0 > /dev/gem5/exit # TODO: Make this a specialized event.

if [[ $cmdline == *"no_systemd"* ]]; then
no_systemd=true
Expand Down

0 comments on commit b46b152

Please sign in to comment.