Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wangrunji0408/FuchsiaRustSDK
A minimal out-of-the-box Fuchsia SDK for Rust.
https://github.com/wangrunji0408/FuchsiaRustSDK
fuchsia rust
Last synced: 2 months ago
JSON representation
A minimal out-of-the-box Fuchsia SDK for Rust.
- Host: GitHub
- URL: https://github.com/wangrunji0408/FuchsiaRustSDK
- Owner: wangrunji0408
- License: mit
- Created: 2019-10-30T06:20:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-25T17:04:23.000Z (about 5 years ago)
- Last Synced: 2024-11-07T14:02:45.050Z (2 months ago)
- Topics: fuchsia, rust
- Language: Makefile
- Size: 20.2 MB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fuchsia Rust SDK
A minimal out-of-the-box Fuchsia SDK for Rust (without complex GN!).
Build and test your Rust programs on Fuchsia OS (Zircon Kernel) right now!!
## Quick start
Dependencies:
* Linux or macOS
* QEMU
* Rust toolchainBefore you start:
```sh
rustup target add x86_64-fuchsia aarch64-fuchsia
```Build and run:
```sh
# for x86_64
make build # build Rust project
make run # run Zircon on QEMU# for aarch64
make buildarm
make runarm
```Test your programs:
```sh
...
[00005.462] 01919:01974> vc: Successfully attached to display 1
[00005.474] 01919:01974> vc: new input device /dev/class/input/002
# you need to press Enter here
$ hello
Hello, Zircon!!!
$
```## What's inside the box
We use prebuilt objects from [Fuchsia-VM-20190715](https://fuchsia-china.com/fuchsia-virtual-machine-download/).
### UEFI Bootloader
| Description | Path | Source Path |
| ---------------------- | ---------------------------------------------------- | -------------------------------------------- |
| UEFI firmware for QEMU | [prebuilt/OVMF.fd](prebuilt/OVMF.fd) | https://www.kraxel.org/repos/jenkins/edk2/ |
| Zircon UEFI Bootloader | [esp/efi/boot/bootx64.efi](esp/efi/boot/bootx64.efi) | out/default.zircon/efi-x64-clang/bootx64.efi |The bootloader will look for a ZBI-format image (`esp/zircon.bin`) containing kernel and bootfs.
### BootFS and ZBI image
| Description | Path | Source Path |
| ----------------------- | ------------------------------------------------------------ | --------------------------------------- |
| Zircon and BootFS image | [prebuilt/legacy-image-x64.zbi](prebuilt/legacy-image-x64.zbi) | out/default.zircon/legacy-image-x64.zbi |
| ZBI CLI tool | [tools/Linux/zbi](tools/Linux/zbi) | out/default.zircon/tools/zbi |We use `zbi` CLI tool to append all files in `bootfs` dir, to the BOOTFS section of the prebuilt image `legacy-image-x64.zbi`, then put the result to `esp/zircon.bin`.
### User libs
Rust programs for Fuchsia need to link the following libraries:
| Path | Source Path |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [prebuilt/ulib](prebuilt/ulib)/{Scrt1.o, libc.so, libzircon.so} | out/default/sdk/exported/zircon_sysroot/arch/x64/sysroot/lib/* |
| [prebuilt/ulib/libfdio.so](prebuilt/ulib/libfdio.so) | out/default.zircon/user-x64-clang.shlib/obj/system/ulib/fdio/libfdio.so |
| [prebuilt/ulib/libunwind.so](prebuilt/ulib/libunwind.so) | prebuilt/third_party/clang/linux-x64/lib/x86_64-unknown-fuchsia/c++/libunwind.so |## Acknowledgement
Thanks to [@PanQL](https://github.com/PanQL) for the help and deep analysis of Fuchsia project.