bkernel is an experimental kernel for embedded devices written in Rust. I'm mostly trying out Rust now to see how it applies to kernel development.
Note for Nix users
shell.nix for you. Just drop in with
nix-shell and all dependencies are there (including nightly rust).
Note: it won't work for platforms other than x86-64_linux. You should change rust-nightly hash in
You need an gcc-arm-none-eabi toolchain before you can build the kernel.
If you don't know where to get one, you can get it there:
- Download one for your platform
This project needs lots of nightly features:
- core intrinsics
- const fn
- lang items
- conservative impl trait
- integer atomics
- fixed size array
Nightly builds are not backward-compatible, so only the latest version is supported (it changes every 6 weeks). That's why you need a reasonably up-to-date nightly rust.
bkernel needs Rust sources to build libcore for the target. If you don't have one, don't worry: it will be automatically downloaded to
If you have Rust git repo on you computer, you can point to it with:
Note: building bkernel will checkout rust to a commit your rustc was compiled with.
makebuild all binaries, documentation and run tests;
make buildonly build kernel;
make testrun tests;
make docbuild documentation;
make flashflash kernel;
make resetreset the device;
make device_testrun device tests.
$DEVICEcan be set to point to the device tty (defaults to
After booting the kernel you should see all LEDs are turned on and a terminal is running on PB6/PB7 pins.
The following commands are supported:
hi- says hello
-6- turn on/off LD3/4/5/6
temp- read temperature and humidity from HTU21D sensor
panic- throw a panic
help- for more commands
There are device tests that are executed with expect. It must be installed on your system.
You must flash the device before testing.
To run device tests, execute:
make device_test DEVICE=/dev/ttyUSB0
Note: device path can be different on your platform.
The bkernel source code is licensed by a modified GNU General Public License - the modification taking a form of an exception. The exception permits the source code of applications that use bkernel and are distributed as executables to remain closed source, thus permitting the use of bkernel in commercial applications without necessitating that the whole application be open sourced. The exception can only be used if you wish to combine bkernel with a proprietary product, and you comply with the terms stated in the exception itself.
The full text of the bkernel license is available here.