You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ubuntu-generic-diskimages/BUILDING.md
+32-13
Original file line number
Diff line number
Diff line change
@@ -15,15 +15,15 @@ This document provides instructions for creating the **x86-ubuntu** and **arm-ub
15
15
16
16
After building the Dockerfile, you can retrieve the kernel and modules on your host using the `copy_modules_to_host.sh` script.
17
17
-**`scripts/`**: Contains scripts that run on the disk image after installation.
18
-
-**`disable-network.sh`**: Disables networking by renaming the Netplan configuration file (`.yaml` → `.yaml.bak`) and disabling network services in systemd.
18
+
-**`disable-network.sh`**: Disables networking by renaming the Netplan configuration file (`.yaml` → `.yaml.bak`) and disabling network services in systemd. Disabling network decreases boot time by removing the 2 minute wait for network service to get online in systemd.
19
19
-**`disable-systemd-services-x86.sh`**: Disables non-essential systemd services for x86 disk images to reduce boot time in gem5 simulations.
20
20
-**`extract-x86-kernel.sh`**: Extracts the kernel from the x86 disk image and moves it to `/home/gem5`. Packer then copies the extracted kernel from the disk image to the host.
21
21
-**`increase-system-entropy-for-arm-disk.sh`**: Uses `haveged` to increase system entropy for ARM disk images, reducing boot delays caused by low entropy.
22
22
-**`install-common-packages.sh`**: Installs necessary packages common to all disk images.
23
-
-**`install-gem5-bridge.sh`**: Clones and builds `gem5-bridge`, allowing the disk image to use `m5ops` commands.
23
+
-**`install-gem5-bridge.sh`**: Clones and builds `gem5-bridge`, allowing the disk image to use `m5ops` commands. For more information about using `m5ops` you can take a look at <https://bootcamp.gem5.org/#02-Using-gem5/03-running-in-gem5>.
24
24
-**`install-user-benchmarks.sh`**: User-editable script for installing custom benchmarks.
25
25
-**`install-user-packages.sh`**: User-editable script for installing additional packages beyond those in `install-common-packages.sh`.
26
-
-**`update-gem5-init.sh`**: Updates the `init` file with `gem5_init.sh` from the `files` directory.
26
+
-**`update-gem5-init.sh`**: Updates the `init` file with `gem5_init.sh` from the `files` directory. The `gem5_init.sh` script updates the `init` script that is run when ubuntu boots to include the `no_systemd` kernel arg, initialize the `gem5-bridge` driver and call an exit event indicating that the kernel has booted.
27
27
-**`update-modules-arm-22.04.sh`**: Installs kernel modules built via the Dockerfile in `kernel-and-modules/arm-ubuntu-22.04` for the ARM 22.04 disk image.
28
28
-**`update-modules-arm-24.04.sh`**: Installs kernel modules built via the Dockerfile in `kernel-and-modules/arm-ubuntu-24.04` for the ARM 24.04 disk image.
29
29
@@ -66,22 +66,20 @@ Since the ARM disk image requires the `gem5-bridge` module to enable running `ge
66
66
3.**Verify the Output Directory**
67
67
After running the script, a directory named **`my-arm-<kernel_version>-kernel`** will be created in the `kernel-and-modules` directory. This directory contains:
68
68
69
-
-`vmlinux`: The built kernel (**used in gem5 simulations but not copied to the disk**).
69
+
-`vmlinux`: The built kernel (**used in gem5 simulations but not copied onto the built disk image**).
70
70
- A subdirectory containing all kernel modules, including `gem5-bridge`.
71
71
72
72
### **Generating the EFI Boot File**
73
73
74
-
The ARM disk image requires an **EFI file** to boot in qemu. This is provided as `flash0.img` in the Packer configuration.
74
+
The ARM disk image requires an **EFI file** to boot in qemu. Running `build-arm.sh` automatically generates this file.This is provided as `flash0.img` in the Packer configuration.
75
75
76
-
To generate `flash0.img`, run the following commands in the `files/` directory:
76
+
To generate `flash0.img` manually, run the following commands in the `files/` directory:
Run `build-arm.sh` with `22.04` or `24.04` to build the respective ARM disk image in `ubuntu-generic-diskimages`.
92
90
93
91
**ARM Build Assumption**:
94
-
The build assumes execution on an **ARM machine**, as it uses KVM for virtualization. If running on a non-ARM host, update `build-arm.sh` by setting `"use_kvm=false"` in the `./packer build` command.
92
+
The build assumes execution on an **ARM machine**, as it uses KVM for virtualization. If running on a non-ARM host, update `build-arm.sh` by setting `"use_kvm=false"` in the `./packer build` command:
You would also need to update the isa of the packer binary being downloaded in the `build-arm.sh` file. To download the `amd64` packer binary you can update the section that downloads the packer binary in `build-arm.sh` file to the following:
95
99
96
-
This script downloads the Packer binary, initializes Packer, and builds the disk image.
The `build-arm.sh` script downloads the Packer binary, initializes Packer, and builds the disk image.
97
109
98
110
## Kernel Extraction (x86 Only)
99
111
@@ -125,6 +137,7 @@ This kernel can be used as a resource for **gem5 simulations** and is not restri
125
137
- **gem5-Bridge (`m5`)**:
126
138
- Installed at `/usr/local/bin/gem5-bridge` with a symlink to `m5`for compatibility.
127
139
- `libm5` is installed in`/usr/local/lib/`, and headers are placed in`/usr/local/include/m5`.
140
+
- Add more packages by modifying `scripts/install-user-packages.sh`. Install benchmarks onto the base disk image by modifying `scripts/install-user-benchmarks.sh`.
128
141
129
142
## Extending the Disk Image
130
143
@@ -138,15 +151,15 @@ This kernel can be used as a resource for **gem5 simulations** and is not restri
138
151
}
139
152
```
140
153
141
-
If you need to increase the size of the image when adding more libraries and files to the image update the size of the partition in the respective `http/*/user-data` file. Also, update the `disk_size` parameter in`post-installation.sh` to be at least one mega byte more than the size you defined in the `user-data` file.
154
+
If you need to increase the size of the image when adding more libraries and files to the image update the size of the partition in the respective `http/*/user-data` file. Also, update the `disk_size` parameter inthe packer file to be at least one mega byte more than the size you defined in the `user-data` file.
142
155
143
-
**NOTE:** You can extend this disk image by modifying the `post-installation.sh` script, but it requires building the image from scratch.
156
+
**NOTE:** You can extend this disk image by modifying the `install-user-benchmarks` and `install-user-packages.sh` script, but it requires building the image from scratch.
144
157
145
158
To take a pre-built image and add new files or packages, take a look at the following [documentation](https://www.gem5.org/documentation/gem5-stdlib/extending-disk-images).
146
159
147
160
## Troubleshooting
148
161
149
-
- **Enable Packer Logs**:
162
+
- **Enable Packer Logs**: This causes Packer to print additional debug messages.
150
163
151
164
```sh
152
165
PACKER_LOG=INFO ./build.sh
@@ -158,6 +171,12 @@ To take a pre-built image and add new files or packages, take a look at the foll
158
171
159
172
- **Monitor Installation**:
160
173
- Use a **VNC viewer** to watch installation. The port is displayed in the terminal.
174
+
The output may appear as follows:
175
+
176
+
```bash
177
+
==> qemu.initialize: Waiting 10s for boot...
178
+
==> qemu.initialize: Connecting to VM via VNC (127.0.0.1:5995)
0 commit comments