Skip to content

Commit 5644ecc

Browse files
authored
Merge pull request #1688 from annietllnd/shrinkwrap
Update Void Linux on FVP LP
2 parents c65265f + 2b4788d commit 5644ecc

File tree

7 files changed

+148
-173
lines changed

7 files changed

+148
-173
lines changed

content/learning-paths/servers-and-cloud-computing/glibc-linux-fvp/_index.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Glibc + Linux + FVP
2+
title: Build and test a custom Linux image on an FVP
33

44
draft: true
55
cascade:
@@ -8,32 +8,24 @@ cascade:
88
minutes_to_complete: 60
99

1010
who_is_this_for: >
11-
Developers who wish to run a Linux system (optionally using a custom kernel and
12-
a C library) on an Arm Fixed Virtual Platform (FVP) model. For example, this
13-
guide might be useful if you want to test patches for the Linux kernel or Glibc.
11+
This is an advanced topic for developers who wish to run a Linux system (optionally using a custom kernel and
12+
a C library) on an Arm Fixed Virtual Platform (FVP) model. This learning path might be useful to follow if you want to test patches for the Linux kernel or Glibc prior to having hardware available.
1413
15-
learning_objectives:
14+
learning_objectives:
1615
- Build the Linux kernel.
1716
- Install the Shrinkwrap tool, build firmware for the FVP and run it.
1817
- Configure and boot a Linux system on the FVP.
19-
- Configure guest OS to make running Glibc tests easier.
18+
- Configure guest OS and run Glibc tests.
2019
- Build Glibc and run tests on the system running on the FVP.
2120

2221
prerequisites:
23-
- An AArch64 or x86 host running a Linux system.
24-
- GCC cross toolchain for the `aarch64-none-linux-gnu` target.
25-
- Docker.
26-
- Git to checkout sources.
27-
- Make to build the tools.
28-
- Bash for your shell.
29-
- Python 3.x and `pip` to create a Python virtual environment.
30-
- Common tools like `wget`, `unxz`, `truncate`.
22+
- An AArch64 or x86_64 Linux machine. The instructions in this Learning Path have been tested on AArch64 Linux machine running Ubuntu 24.04.
3123

3224
author: Yury Khrustalev
3325

3426
### Tags
3527
skilllevels: Advanced
36-
subjects: Architecture Enablement
28+
subjects: Performance and Architecture
3729
armips:
3830
- AArch64
3931
tools_software_languages:

content/learning-paths/servers-and-cloud-computing/glibc-linux-fvp/conventions.md

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,49 @@
11
---
2-
title: Conventions
2+
title: Development environment
33
weight: 2
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
For a few things you may need root access on your host system to do minimal setup and
10-
install packages that are described in the following sections.
9+
In this section, you will install packages and review the directory structure used throughout the learning path.
1110

12-
## Naming conventions
11+
## Install dependencies
1312

14-
In the following sections we use host system to checkout sources and build various
15-
tools and we also make configuration changes to the guest system that will run on
16-
the Arm [Fixed Virtual Platform (FVP)][1] model.
13+
Run the following commands to make sure the necessary dependencies are installed on your host machine:
1714

18-
Before we begin, it's important to describe the specifics of our setup making it easier
19-
to write commands and code examples. Wherever possible we use generic commands and code
20-
examples but in certain places we have to use hardcoded values and absolute paths.
15+
```bash
16+
sudo apt update && sudo apt install -y \
17+
git make bash \
18+
flex bison build-essential libssl-dev bc libelf-dev libncurses-dev \
19+
python3 python3-pip python-is-python3 python3-venv wget xz-utils coreutils
20+
```
2121

22-
Table 1. Directory layout
22+
Install GCC to cross compile Linux applications:
23+
```bash
24+
sudo apt install gcc-aarch64-linux-gnu -y
25+
```
26+
27+
{{% notice Note%}}
28+
The GCC cross toolchain installation directory contains everything a cross toolchain would need, for example, the path to the `gcc` tool would be `/usr/bin/aarch64-linux-gnu-gcc`.
29+
{{% /notice %}}
2330

24-
| Path | Description |
25-
|--------------------------------------|--------------------------------------------|
26-
| `/path/to/cross/gcc` | GCC cross toolchain installation directory |
27-
| `/home/user` | Home directory of your host non-root user |
28-
| `/home/user/workspace` | Workspace directory |
29-
| `/home/user/workspace/linux` | Folder with the Linux kernel sources |
30-
| `/home/user/workspace/linux-headers` | Directory for installing kernel headers |
31-
| `/home/user/workspace/linux-build` | Folder for the Linux kernel build output |
32-
| `/home/user/workspace/glibc` | Folder for the Glibc sources |
33-
| `/home/user/workspace/glibc-build` | Directory for the Glibc build output |
31+
Install Docker, refer to the [Docker install guide](/install-guides/docker/).
3432

3533

34+
## Directory Structure
3635

37-
We presume that the GCC cross toolchain installation directory contains everything a
38-
cross toolchain would need, for example, the path to the `gcc` tool would be
39-
`/path/to/cross/gcc/bin/aarch64-none-linux-gnu-gcc`.
36+
In the following sections you will checkout sources and build various tools on your Linux host machine. Before you begin, lets look at the directory structure of where you will build the different parts of software stack needed to run this learning path.
37+
38+
Table 1. Directory layout
4039

41-
In the next steps we create a Python virtual environment. It doesn't matter where
42-
it is located, but to avoid ambiguity let's presume it is in `~/workspace/venv`.
40+
| Path | Description |
41+
|--------------------------------------|---------------------------------------|
42+
| `$HOME` | Home directory of your host non-root user |
43+
| `$HOME/workspace` | Workspace directory |
44+
| `$HOME/workspace/linux` | Folder with the Linux kernel sources |
45+
| `$HOME/workspace/linux-headers` | Directory for installing kernel headers |
46+
| `$HOME/workspace/linux-build` | Folder for the Linux kernel build output |
47+
| `$HOME/workspace/glibc` | Folder for the Glibc sources |
48+
| `$HOME/workspace/glibc-build` | Directory for the Glibc build output |
4349

44-
[1]: https://developer.arm.com/downloads/-/arm-ecosystem-fvps

content/learning-paths/servers-and-cloud-computing/glibc-linux-fvp/fvp.md

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Boot Linux on FVP
2+
title: Boot Linux on the FVP
33
weight: 5
44

55
### FIXED, DO NOT MODIFY
@@ -8,30 +8,29 @@ layout: learningpathall
88

99
## Introduction
1010

11-
During this step, we set up everything for the FVP to run and then boot the Linux system
12-
using the kernel and the root file system that we prepared earlier.
11+
During this step, you will set up everything for the FVP to run and then boot the Linux system
12+
using the kernel and the root file system that you prepared earlier in the earlier sections.
1313

14-
Arm [Fixed Virtual Platform (FVP)][1] is a model that allows you to access functionality
15-
of Armv8.x or v9.x hardware. We use the Armv-A Base Rev C Architecture Envelope Model (AEM).
14+
Arm [Fixed Virtual Platform (FVP)](https://developer.arm.com/downloads/-/arm-ecosystem-fvps) is a model that allows you to access functionality
15+
of Armv8.x or v9.x hardware. You will use the Armv-A Base Rev C Architecture Envelope Model (AEM).
1616

1717
In addition to the model itself, you also need the device tree and the firmware. To simplify
18-
building these components, we use a tool called [Shrinkwrap][2].
18+
building these components, you will use a tool called [Shrinkwrap](https://gitlab.arm.com/tooling/shrinkwrap).
1919

20-
This tool comes with a detailed [user guide][3] that covers all of its features and
21-
configuration options. Here, we provide a short quick-start guide.
20+
This tool comes with a detailed [user guide](https://shrinkwrap.docs.arm.com/en/latest/) that covers all of its features and
21+
configuration options. You will also leverage this tool to run and boot the images you prepared on the FVP.
2222

23-
We also rely on a Docker container to facilitate the building of the firmware and
23+
Shrinkwrap can be used in a few different ways. One of the ways is to use a Docker container to facilitate the building of the firmware and
2424
running the FVP. This helps avoid installing all the dependencies on your host system.
25-
Shrinkwrap can be used without Docker but it requires extra steps to ensure that all
26-
dependencies are of the right version and are installed correctly.
2725

2826
## Install Shrinkwrap
2927

30-
First, we install prerequisites in a Python virtual environment using Python 3.x:
28+
First, install prerequisites in a Python virtual environment using Python 3.x:
3129

3230
```bash
33-
python -m venv ~/workspace/venv
34-
source ~/workspace/venv/bin/activate
31+
cd $HOME
32+
python -m venv $HOME/workspace/venv
33+
source $HOME/workspace/venv/bin/activate
3534
pip install -U pip setuptools wheel
3635
pip install pyyaml termcolor tuxmake
3736
```
@@ -41,7 +40,7 @@ repository. Run this command in the workspace directory:
4140

4241
```bash
4342
git clone https://git.gitlab.arm.com/tooling/shrinkwrap.git
44-
export PATH=${PATH}:$(pwd)/shrinkwrap/shrinkwrap
43+
export PATH=${PATH}:${HOME}/workspace/shrinkwrap/shrinkwrap
4544
```
4645

4746
Putting Shrinkwrap's main executable on your `PATH` is all you need to install the tool.
@@ -52,12 +51,15 @@ is activated, then run this command:
5251
shrinkwrap --version
5352
```
5453

55-
## Build firmware for FVP
54+
You should see a version printed.
5655

57-
Before proceeding, ensure that Docker is installed and usable. Follow the installation
58-
instructions for your distro [here][4].
56+
```output
57+
shrinkwrap v1.0.0
58+
```
59+
60+
## Build firmware for the FVP
5961

60-
Now, we use the Shrinkwrap tool to build the firmware, the third essential ingredient in our
62+
Now, you can use the Shrinkwrap tool to build the firmware, the third essential ingredient in our
6163
setup. The following step needs to be done once although you will need to repeat it if you
6264
want to rebuild the firmware:
6365

@@ -78,17 +80,17 @@ the components including the device tree for the FVP.
7880
At this point, we have everything required to boot our system. Shrinkwrap uses so called overlay
7981
configuration files. The following file instructs Shrinkwrap to connect all the pieces together
8082
and locate the kernel image, and rootfs. It can also be used to tweak any of the FVP
81-
parameters. Save this file as `~/workspace/aarch64.yaml`:
83+
parameters. Create a file in $HOME/workspace directory called `aarch64.yaml` using a text editor of your choice. Copy the contents shown below into the file:
8284

8385
```yaml
8486
run:
8587
rtvars:
8688
ROOTFS:
87-
value: /home/user/workspace/rootfs.img
89+
value: ~/workspace/rootfs.img
8890
CMDLINE:
8991
value: ip=dhcp kpti=off root=/dev/vda2 console=ttyAMA0
9092
KERNEL:
91-
value: /home/user/workspace/linux-build/arch/arm64/boot/Image
93+
value: ~/workspace/linux-build/arch/arm64/boot/Image
9294
params:
9395
-C bp.hostbridge.userNetworking: 1
9496
-C bp.hostbridge.userNetPorts: 8022=22,8123=8123
@@ -108,15 +110,15 @@ The most important parts in this configuration file are:
108110
You can add more ports as needed.
109111

110112
The FVP has many parameters that can be tweaked in this config by adding a `-C param: value`
111-
line to the `params` section. Refer to the [Fast Models Fixed Virtual Platforms Reference Guide][5]
113+
line to the `params` section. Refer to the [Fast Models Fixed Virtual Platforms Reference Guide](https://developer.arm.com/documentation/100966/latest/Getting-Started-with-Fixed-Virtual-Platforms/Configuring-the-model).
112114
for more details.
113115

114116
## Run FVP with Shrinkwrap
115117

116118
To run the FVP using Docker, execute the following command:
117119

118120
```bash
119-
shrinkwrap run ns-edk2.yaml --overlay ~/workspace/aarch64.yaml
121+
shrinkwrap run ns-edk2.yaml --overlay $HOME/workspace/aarch64.yaml
120122
```
121123

122124
At first, Shrinkwrap starts a Docker container and runs the FVP in it. At the beginning
@@ -156,9 +158,6 @@ uname -a
156158
cat /proc/cpuinfo
157159
```
158160

159-
We will do more setup during the next step. This additional setup is optional but it
160-
helps prepare our guest system for running Glibc tests and doing other complex tasks.
161-
162161
## Powering down
163162

164163
You can always press `Ctrl+]` to stop Shrinkwrap in the terminal where Shrinkwrap is
@@ -171,8 +170,6 @@ from the root console of your guest system, for example:
171170
ssh [email protected] -p 8022 poweroff
172171
```
173172

174-
[1]: https://developer.arm.com/downloads/-/arm-ecosystem-fvps
175-
[2]: https://gitlab.arm.com/tooling/shrinkwrap
176-
[3]: https://shrinkwrap.docs.arm.com/en/latest/
177-
[4]: https://docs.docker.com/engine/install/
178-
[5]: https://developer.arm.com/documentation/100966/latest/Getting-Started-with-Fixed-Virtual-Platforms/Configuring-the-model
173+
Continue to the next section for additional setup. The remaining steps are optional but it
174+
helps prepare our guest system for running Glibc tests and doing other complex tasks.
175+

0 commit comments

Comments
 (0)