resources: Update riscv-ubuntu README
This change updates the README to more accurately reflect the
directory structure of src/riscv-ubuntu.
Instructions on inserting the provided exit.sh into the image have
been added.
Made clarification on the U-boot version that must be used in qemu.
A more update to date download link for U-boot is provided.
Added instructions on how to boot the locally built image in gem5.
Change-Id: I1027712924b19edaf2d0eee39cbbb966e3272e17
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5-resources/+/65391
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
diff --git a/src/riscv-ubuntu/README.md b/src/riscv-ubuntu/README.md
index e4f2778..90ba5b3 100644
--- a/src/riscv-ubuntu/README.md
+++ b/src/riscv-ubuntu/README.md
@@ -1,5 +1,5 @@
---
-title: Linux x86-ubuntu image
+title: Linux riscv-ubuntu image
tags:
- riscv
- fullsystem
@@ -31,8 +31,10 @@
|
|___ disk-image/
| |___ shared/ # Auxiliary files needed for disk creation
+ | | |___ serial-getty@.service # Auto-login script
| |___ riscv-ubuntu/
- | |___ exit.sh # Exits the simulated guest upon booting
+ | |___ gem5_init.sh # The script to be appended to .bashrc on the disk image
+ | |___ exit.sh # A script that calls m5 exit
|
|___ ubuntu.img # The disk image
|
@@ -80,7 +82,7 @@
# unpacking/decompressing the disk image
xz -dk ubuntu-20.04.4-preinstalled-server-riscv64+unmatched.img.xz
# renaming the disk image
-mv ubuntu-20.04.4-preinstalled-server-riscv64+unmatched.img.xz ubuntu.img
+mv ubuntu-20.04.4-preinstalled-server-riscv64+unmatched.img ubuntu.img
# adding 4GB to the disk
qemu-img resize -f raw ubuntu.img +4G
```
@@ -93,18 +95,23 @@
>
> apt install qemu-system-misc opensbi u-boot-qemu qemu-utils
>
-> Hirsute's version of u-boot-qemu is required at the moment to boot hirsute images.
+> u-boot-qemu version 2022.01 (or newer) is required to boot in qemu.
-To use Hirsute's version of u-boot-qemu, we will download the package from here,
-(https://packages.ubuntu.com/hirsute/u-boot-qemu). The following command will
+To use this version of u-boot-qemu, we will download the package from here,
+(https://mirrors.edge.kernel.org/ubuntu/pool/main/u/u-boot/). The following command will
download and install the package.
```sh
-wget http://mirrors.kernel.org/ubuntu/pool/main/u/u-boot/u-boot-qemu_2021.01+dfsg-3ubuntu9_all.deb
-dpkg -i u-boot-qemu_2021.01+dfsg-3ubuntu9_all.deb
+wget https://mirrors.edge.kernel.org/ubuntu/pool/main/u/u-boot/u-boot-qemu_2022.01%2Bdfsg-2ubuntu2_all.deb
+dpkg -i u-boot-qemu_2022.01+dfsg-2ubuntu2_all.deb
apt-get install -f
```
+The correct version of u-boot-qemu is also available in the Ubuntu 22.04 or later.
+```sh
+apt install u-boot-qemu
+```
+
The following command will install the rest of the dependencies,
```sh
apt install qemu-system-misc opensbi qemu-utils
@@ -174,6 +181,7 @@
scp -P 5555 gem5/util/m5/build/riscv/out/m5 ubuntu@localhost:/home/ubuntu/
scp -P 5555 disk-image/shared/serial-getty@.service ubuntu@localhost:/home/ubuntu/
scp -P 5555 disk-image/riscv-ubuntu/gem5_init.sh ubuntu@localhost:/home/ubuntu/
+scp -P 5555 disk-image/riscv-ubuntu/exit.sh ubuntu@localhost:/home/ubuntu/
```
Connecting to the guest,
@@ -194,6 +202,9 @@
mv /home/ubuntu/gem5_init.sh /root/
chmod +x /root/gem5_init.sh
echo "/root/gem5_init.sh" >> /root/.bashrc
+
+mv /home/ubuntu/exit.sh /root/
+chmod +x /root/exit.sh
```
# Pre-built disk image
@@ -204,3 +215,15 @@
This disk image is used in the following gem5 example RISCV config files, found within the gem5 repository:
* `gem5/configs/example/gem5_library/riscv-fs.py`, which simulates a full system running with RISCV ISA.
* `gem5/configs/example/gem5_library/riscv-ubuntu-run.py`, which simulates a full system with RISCV based Ubuntu 20.04 disk-image. Upon successful start-up, a `m5_exit instruction encountered` is encountered. The simulation ends then.
+
+Note: To use the locally built Ubuntu image in gem5, make sure to pass the `root_partition`
+parameter to `CustomResource` or `CustomDiskImageResource`. For example,
+```py
+board.set_kernel_disk_workload(
+ kernel=Resource("riscv-bootloader-vmlinux-5.10"),
+ disk_image=CustomDiskImageResource(
+ local_path="<RESOURCES_PARENT_PATH>/gem5-resources/src/riscv-ubuntu/ubuntu.img",
+ disk_root_partition="1",
+ )
+)
+```
\ No newline at end of file
diff --git a/src/riscv-ubuntu/disk-image/riscv-ubuntu/exit.sh b/src/riscv-ubuntu/disk-image/riscv-ubuntu/exit.sh
new file mode 100644
index 0000000..4b147e0
--- /dev/null
+++ b/src/riscv-ubuntu/disk-image/riscv-ubuntu/exit.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Copyright (c) 2020 The Regents of the University of California.
+# SPDX-License-Identifier: BSD 3-Clause
+
+m5 exit