|
1 | 1 | # Rust Hello on Unikraft |
2 | 2 |
|
3 | | -Build and run a Rust Hello program on Unikraft. |
| 3 | +Build and run a `std` independent Rust Hello program on Unikraft. |
4 | 4 | Follow the instructions below to set up, configure, build and run Rust Hello. |
5 | 5 | Make sure you installed the [requirements](../README.md#requirements) and the [Rust toolchain channel through Rustup](https://www.rust-lang.org/tools/install). |
6 | 6 |
|
@@ -160,3 +160,36 @@ In order to remove the generated files by Cargo in the `target` directory, use: |
160 | 160 | ```console |
161 | 161 | cargo clean |
162 | 162 | ``` |
| 163 | +## Customize |
| 164 | + |
| 165 | +Rust Hello is the simplest application to be run with Unikraft. |
| 166 | +This makes it ideal as a minimal testing ground for new features: it builds fast, it doesn't have dependencies. |
| 167 | + |
| 168 | +### Update the Unikraft Core Code |
| 169 | + |
| 170 | +If updating the Unikraft core code in the `./workdir/unikraft/` directory, you then go through the [configure](#configure), [build](#build) and [run](#run) steps. |
| 171 | + |
| 172 | +### Add Other Object Files |
| 173 | + |
| 174 | +The current configuration use a object file. |
| 175 | +If looking to add another file to the build, update the [`Makefile.uk`](Makefile.uk) file. |
| 176 | + |
| 177 | +For example, to add a new object file `support.o` to the build, update the [`Makefile.uk`](Makefile.uk) file to: |
| 178 | + |
| 179 | +```make |
| 180 | +$(eval $(call addlib,apprshello)) |
| 181 | + |
| 182 | +APPRSHELLO_OBJS-y += $(APPRSHELLO_BASE)/target/x86_64-unknown-none/debug/deps/rs_hello-*.o |
| 183 | +APPRSHELLO_OBJS-y += $(APPRSHELLO_BASE)/support.o |
| 184 | +``` |
| 185 | + |
| 186 | +To include a Rust library, such as `librs_hello.rlib`, update the [`Makefile.uk`](Makefile.uk) file to: |
| 187 | + |
| 188 | +```make |
| 189 | +$(eval $(call addlib,apprshello)) |
| 190 | + |
| 191 | +APPRSHELLO_OBJS-y += $(APPRSHELLO_BASE)/target/x86_64-unknown-none/debug/deps/rs_hello-*.o |
| 192 | +APPRSHELLO_ALIBS-y += $(APPRSHELLO_BASE)/librs_hello.rlib |
| 193 | +``` |
| 194 | + |
| 195 | +Then go through the [configure](#configure), [build](#build) and [run](#run) steps. |
0 commit comments