Xous SDK (pinned for betrusted transpilation)
Find a file
bunnie 6745206303 mulling this pile of OpenSK code to see what we should cut, what we should keep
alright. the composite device problem is solved. The bigger issue I'm
mulling is if I should try to port the Google OpenSK FIDO2 stack into
Xous, or if I should just do a limited U2F implementation.

Poking around at the OpenSK stuff...porting looks possible, but, it's
going to be vendoring in all of the source from the OpenSK project. So
it'll be tough to apply patches if they happen; on the other hand, the
OpenSK implementation is FIDO2 certified, and the stable branch hasn't
moved since Nov 2021.

The main downsides of the OpenSK implementation are:

- it uses nightly. I think it can be stripped out, though; I haven't
  seen a "good reason" for it yet, it's mostly because Tock uses
  nightly. There's only one alarming use of it and it's in the crypto
  crates but those will be stripped out because....
- the crypto libraries are in fact not suitable for use. I dug into
  them and they definitely need to be gutted and replaced with the
  community-blessed crypto libraries and APIs. which is one big reason
  why once this goes into Xous land it doesn't go back easily into
  OpenSK land -- they actually have slightly different crypto
  APIs. more modern ones, to be fair, but, they haven't been reviewed.
- the implementation has "too many features"...for example, I don't
  think we'll ever realistically do authenticator attestation as it
  requires signing NDAs and provisioning secret keys that we can't
  share with users. But that code is there, and we'll either have to
  gut or bodge it.

The plusses are:

- it's FIDO2 certified. So, at least the protocol stack is probably
  complete and fully implemented, which means for features we don't
  use today I can just leave hooks or dummy values there for a fast
  migration path.
- Looks like they aren't changing things too fast in the dev
  branch...so this probably is not like riding a greased pig
- Looks like a couple of paid professionals wrote the code...better
  than what we have going on here
- I think I see a path to carve out their "persistent store" and glom
  it into the PDDB; a path to adapt their crypto traits into
  Xous-native traits; and a path to connect their CTAP protocol engine
  to the Xous HID server. So it seems feasible. But they baked in some
  bad API assumptions deeply enough that they are one-way streets I
  think to get these ports done.

I'm going to sleep on this, but I'm leaning toward trying to pull in
the OpenSK code because even tho it is a bit painful it probably gets
a bigger feature scope and so far it looks like I wouldn't be changing
any protocol-level stuff for the port, I would just be monkeying
around with the internal storage, crypto, and USB implementations, so
ideally the end result is we get a certified FIDO2 protocol engine for
the effort.

I think the main concern I have going in this direction is I don't see
a way to do this and simultaneously be able to absorb upstream patches
into this vendored code, because their API assumptions are too
different. Any bug fixes or patches would have to be manually applied
and merged. But maybe that's not such a big deal...?
2022-05-27 03:01:39 +08:00
.cargo add an off-line config reminder option in .config 2022-04-10 15:52:31 +08:00
.github/workflows try to fix the gh automation 2022-03-28 15:49:22 +08:00
.vscode restore format on save for vscode 2022-04-22 12:21:42 +02:00
apps Fix link in repl demo 2022-05-11 13:20:09 +09:00
devkey beginnings of image signing 2021-07-06 17:31:09 +08:00
docs Update flash.md 2022-01-09 18:00:38 +08:00
emulation update renode to latest soc 2022-05-06 13:39:28 +08:00
imports bump com_rs rev (no mangling of opcodes by rustfmt) 2022-05-25 23:54:44 +08:00
kernel kernel: print connection count on per-process output 2022-04-05 15:11:47 +08:00
LICENSES creating LICENSES directory 2021-01-25 14:52:31 +01:00
loader fix more merge problems 2022-04-21 18:01:24 +08:00
locales change en-audio to en-tts 2022-03-10 15:38:55 +08:00
macros clarify the dependency policy 2022-01-10 16:50:10 +08:00
precursors bug fixes for SpinalHDL core (EP0 setups now go to the correct location) 2022-05-16 00:34:42 +08:00
services mulling this pile of OpenSK code to see what we should cut, what we should keep 2022-05-27 03:01:39 +08:00
svd2repl emulation: add initial TLV320AIC3100 2022-04-21 11:42:02 +08:00
svd2utra fix Atomic version of instructions to be non-mut 2022-05-06 13:36:11 +08:00
tools add a script to help extract keyboard mappings for unknown keyboards 2022-05-17 16:39:48 +08:00
utralib Merge branch 'main' of github.com:betrusted-io/xous-core into kernel-monorepo 2022-01-14 15:33:10 +08:00
xous-ipc Pass thru buffer serialize Err 2022-04-23 13:11:52 +10:00
xous-rs add a first-pass at what hardware CI automation strings might look like 2022-05-24 02:22:36 +08:00
xtask start to lay in u2f messaging infrastructure 2022-05-26 17:58:22 +08:00
.gitattributes gitattributes: add txt as lf 2021-03-10 17:36:41 +08:00
.gitignore ignore changes to Renode filesystem template 2022-04-27 01:22:28 +08:00
API.md Merge branch 'bunnie-dev' into main 2022-04-08 01:34:02 +08:00
buildpush.ps1 start to lay in u2f messaging infrastructure 2022-05-26 17:58:22 +08:00
buildpush.sh Switch to using env to find the path to bash. 2022-03-28 16:43:47 -06:00
Cargo.lock mulling this pile of OpenSK code to see what we should cut, what we should keep 2022-05-27 03:01:39 +08:00
Cargo.toml start to lay in u2f messaging infrastructure 2022-05-26 17:58:22 +08:00
CODE_OF_CONDUCT.md
CONTRIBUTING.md CONTRIBUTRING: Update license link 2022-04-24 21:48:43 +08:00
README.md Update README.md 2022-04-03 13:10:56 +08:00
RELEASE-v0.8.md clean up release notes 2021-09-05 20:46:23 +08:00
RELEASE-v0.9.md update release notes 2022-05-24 16:59:49 +08:00
rustfmt.toml finalize formatting run 2021-08-20 00:26:16 +08:00
start-gdb.sh
wb-gdb.sh

Xous Core

Core files for the Xous microkernel operating system.

You might find this wiki handy, as well as the Xous Book.

This repository contains everything necessary to build the Xous kernel from source. It consists of the following projects:

  • kernel: core memory manager, irq manager, and syscallhandler
  • loader: initial loader used to start the kernel
  • tools: programs used to construct a final boot image
  • docs: documentation on various aspects of Xous
  • emulation: Renode scripts used to emulate Xous
  • xous-rs: userspace library

Dependencies

  • Xous requires its own Rust target, riscv32imac-unknown-xous-elf. If you run cargo xtask from the command line, you should be prompted to install the target automatically if it does not already exist.
  • You may need to remove the target/ directory before building, if rustc continues to behave like it can't find the xous target even after it is installed.
  • If you plan on doing USB firmware updates, you'll need progressbar2 (updates) and pyusb (updates). Note that pyusb has name space conflicts with similarly named packages, so if updates aren't working you may need to create a venv or uninstall conflicting packages.
  • If you are doing development on the digital signatures with the Python helper scripts, you will need: pycryptodome (signing - PEM read), cryptography (signing - x509 read), pynacl (signing - ed25519 signatures) (most users won't need this).
  • Some system packages are needed, which can be installed with sudo apt install libssl-dev libxkbcommon-dev or similar
  • If you receive an error about feature resolver is required, try installing a newer version of rustc and cargo via rustup

Quickstart using Hosted Mode

You can try out Xous in a "hosted mode" wherein programs are compiled for your native platform and are run locally as processes within your current operating system. System calls are replaced with network calls to a kernel that simply shuffles messages around.

Xous uses the xtask convention, where various complex build commands are stored under cargo xtask. This allows for us to create arbitrarily complex build sequences without resorting to make (which is platform-dependent), sh (which requires a lot of external tooling), or another build system.

To build a set of sample programs and run them all using the kernel for communication, clone this repository and run:

cargo xtask run

This will build several servers and a "shell" program to control them all. Most notably, a graphics-server will appear and kernel messages will begin scrolling in your terminal.

Quickstart using an emulator

Xous uses Renode as the preferred emulator, because it is easy to extend the hardware peripherals without recompiling the entire emulator.

Download Renode and ensure it is in your path. For now, you need to download the nightly build, until DecodedOperation is included in the release.

Then, build Xous:

cargo xtask renode-image

This will compile everything in release mode for RISC-V, compile the tools require to package it all up, then create an image file.

Finally, run Renode and specify the xous-release.resc REnode SCript:

renode emulation/xous-release.resc

Renode will start emulation automatically, and will run the same set of programs as in "Hosted mode".

Generating a hardware image

To build for real hardware, you must specify an .svd file. This file is generated by the SoC build process and describes a single Betrusted core. These addresses will change as hardware is modified, so if you distribute a modified Betrusted core, you should be sure to distribute the .svd file.

We have included a reference version of the gateware and its SVD file in the precursors directory, so you can compile a gateware for the reference image using this command:

cargo xtask hw-image precursors/soc.svd

The resulting images are in your target directory (typically target/riscv32imac-unknown-xous-elf/release/) with the names xous.img (for the kernel) and loader.bin (for its bootloader). The corresponding gateware is in precursors/soc_csr.bin. These can be written to your device by following the update guide.