Skip to content

Commit 2c7439b

Browse files
authored
Merge branch 'unikraft:scripts' into scripts
2 parents ab9fb38 + dac4e3c commit 2c7439b

File tree

274 files changed

+7306
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+7306
-147
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ out/
3838
*.zip
3939
*.Z
4040
*.7z
41+
42+
# Test output files
43+
log.build.*
44+
log.run.*

README.md

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# Catalog Core
22

3-
This is a catalog of applications that are set up, configured, built and run using first principles tools: Make, GCC, Clang, Kconfig, QEMU, Firecracker, Xen.
3+
This is a catalog of Unikraft applications that are set up, configured, built and run using first principles tools: Make, GCC, Clang, Kconfig, QEMU, Firecracker, Xen.
44
Each directory belongs to a given application and it typically consists of source code, `Makefile`, `Makefile.uk`, filesystem and a `README.md` file with instructions.
55

6-
This catalog is targeted towards core developers (i.e. developers of [`unikraft` core repository](https://github.com/unikraft/unikraft) or [library repositories](https://github.com/search?q=topic%3Alibrary+org%3Aunikraft&type=Repositories)), maintainers, testers and those who want to learn about the [internals of Unikraft](https://unikraft.org/docs/internals).
6+
This catalog is targeted towards Unikraft core developers (i.e. developers of [`unikraft` core repository](https://github.com/unikraft/unikraft) or [library repositories](https://github.com/search?q=topic%3Alibrary+org%3Aunikraft&type=Repositories)), maintainers, testers and those who want to learn about the [internals of Unikraft](https://unikraft.org/docs/internals).
77
Application and tooling developers and general users should use the [official `catalog` repository](https://github.com/unikraft/catalog).
88

9-
In order to use this catalog, clone this repository and enter the preferred application directory:
9+
In order to use this catalog, clone this repository, run the `setup.sh` script and enter the preferred application directory:
1010

1111
```console
1212
git clone https://github.com/unikraft/catalog-core
13-
cd catalog-core/<application-directory>
13+
cd catalog-core/
14+
./setup.sh
15+
cd <application-directory>
1416
```
1517

1618
Inside the directory, follow the instructions in the application `README.md`.
@@ -22,40 +24,75 @@ Before and while you are using this catalog, read about the [internals of Unikra
2224
In order to set up, configure, build and run applications on Unikraft using first principles, the following packages are required:
2325

2426
* `build-essential` / `base-devel` / `@development-tools` (the meta-package that includes `make`, `gcc` and other development-related packages)
27+
* `g++`
2528
* `sudo`
2629
* `flex`
2730
* `bison`
2831
* `git`
2932
* `wget`
33+
* `curl`
3034
* `uuid-runtime`
3135
* `qemu-system-x86`
3236
* `qemu-system-arm`
3337
* `qemu-kvm`
3438
* `sgabios`
3539
* `gcc-aarch64-linux-gnu`
40+
* `g++-aarch64-linux-gnu`
41+
* `bsdcpio`
3642

3743
GCC >= 8 is required to build Unikraft.
3844

3945
On Ubuntu/Debian or other `apt`-based distributions, use the following command to install the requirements:
4046

4147
```console
48+
sudo apt -y update
4249
sudo apt install -y --no-install-recommends \
4350
build-essential \
4451
sudo \
4552
gcc-aarch64-linux-gnu \
53+
g++-aarch64-linux-gnu \
4654
libncurses-dev \
4755
libyaml-dev \
4856
flex \
4957
bison \
5058
git \
5159
wget \
60+
curl \
5261
uuid-runtime \
5362
qemu-kvm \
5463
qemu-system-x86 \
5564
qemu-system-arm \
56-
sgabios
65+
sgabios \
66+
libarchive-tools
5767
```
5868

69+
### QEMU
70+
71+
For running applications with QEMU bridged networking, use the command below:
72+
73+
```console
74+
test -d /etc/qemu || sudo mkdir /etc/qemu
75+
echo "allow all" | sudo tee /etc/qemu/bridge.conf
76+
```
77+
78+
It enables QEMU bridged networking.
79+
80+
### Docker
81+
82+
Certain applications require [Docker](https://www.docker.com/) to build the application and / or the application filesystem.
83+
84+
To install Docker, follow the [official instructions](https://docs.docker.com/engine/install/).
85+
Also follow the [post-install instructions](https://docs.docker.com/engine/install/linux-postinstall/).
86+
The post-install instructions are required to run Docker as a non-root user.
87+
88+
Validate you have a correct Docker installation by running, as an ordinary user (i.e. not `root`):
89+
90+
```console
91+
docker run hello-world
92+
```
93+
94+
In case of a correct Docker installation, the above command will print out a longer "Hello, World!"-like message.
95+
5996
### Clang
6097

6198
Unikraft supports Clang.
@@ -77,7 +114,7 @@ To install Firecracker, use the commands below in a downloads or packages direct
77114
```console
78115
release_url="https://github.com/firecracker-microvm/firecracker/releases"
79116
latest=v1.7.0
80-
curl -L ${release_url}/download/${latest}/firecracker-${latest}-${arch}.tgz | tar -xz
117+
curl -L ${release_url}/download/${latest}/firecracker-${latest}-$(uname -m).tgz | tar -xz
81118
sudo cp release-${latest}-$(uname -m)/firecracker-${latest}-$(uname -m) /usr/local/bin/firecracker-${latest}-$(uname -m)
82119
sudo ln -sfn /usr/local/bin/firecracker-${latest}-$(uname -m) /usr/local/bin/firecracker-$(uname -m)
83120
```
@@ -104,3 +141,42 @@ On Ubuntu/Debian or other `apt`-based distributions, use the following command t
104141
```console
105142
sudo apt install -y xen-utils
106143
```
144+
145+
## Scripted Runs and Testing
146+
147+
To make it easy to quickly build, run and test Unikraft applications, you may use pre-created scripts.
148+
149+
### Scripted Runs
150+
151+
For scripted runs, switch to the `scripts` branch of the repository:
152+
153+
```console
154+
git checkout -b scripts origin/scripts
155+
```
156+
157+
Then use the scripts in the `scripts/` directory of each application.
158+
The build scripts are in the `scripts/build/` directory and the run scripts are in the `scripts/run/` directory.
159+
160+
See instructions in the `scripts/README.md` file about running scripts.
161+
As noted in `scripts/README.md` file, scripts are run from the application directory.
162+
163+
### Testing
164+
165+
To test applications, switch to the `test` branch of the repository:
166+
167+
```console
168+
git checkout -b test origin/test
169+
```
170+
171+
Test all applications by running:
172+
173+
```console
174+
./test.overall.sh
175+
```
176+
177+
To test individual applications, navigate to each application directory and run the scripts in the `scripts/test/` directory.
178+
179+
Build and run logs from running tests are stored in the `scripts/test/log/` directory.
180+
181+
See instructions in the `scripts/test/README.md` file about running scripts.
182+
As noted in the `scripts/test/README.md` file, scripts are run from the application directory.

c-fs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/workdir/

c-fs/Config.uk

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Configure C application that prints file contents.
2+
# This is useful to understand and test filesystem support in Unikraft.
3+
# Enable initrd / CPIO-related core components and configurations.
4+
5+
config APPCFS
6+
bool "Configure C filesystem application with initrd as rootfs"
7+
default y
8+
9+
# Select filesystem core components: vfscore, cpio, ramfs.
10+
select LIBVFSCORE
11+
select LIBVFSCORE_AUTOMOUNT_UP
12+
select LIBRAMFS
13+
select LIBUKCPIO

c-fs/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
UK_ROOT ?= $(PWD)/workdir/unikraft
2+
UK_BUILD ?= $(PWD)/workdir/build
3+
UK_APP ?= $(PWD)
4+
LIBS_BASE = $(PWD)/workdir/libs
5+
UK_LIBS ?=
6+
7+
.PHONY: all
8+
9+
all:
10+
@$(MAKE) -C $(UK_ROOT) L=$(UK_LIBS) A=$(UK_APP) O=$(UK_BUILD)
11+
12+
$(MAKECMDGOALS):
13+
@$(MAKE) -C $(UK_ROOT) L=$(UK_LIBS) A=$(UK_APP) O=$(UK_BUILD) $(MAKECMDGOALS)

c-fs/Makefile.uk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
$(eval $(call addlib,appcfs))
2+
3+
APPCFS_SRCS-y += $(APPCFS_BASE)/cat.c

0 commit comments

Comments
 (0)