Monday 1:40 p.m.–2:25 p.m.
Networking without an OS
Josh Triplett
- Audience level:
- Novice
- Category:
- Embedded Systems
Description
Many Python modules, such as socket and select, wrap low-level functionality written in C and provided by the OS. But what if you don't have an OS, and don't want any C code? We implemented client and server networking in Python itself, for a bare-metal environment running without an OS.
Our socket and select implementations support Python HTTP server and client modules, which we'll demo live.
Abstract
We ported Python to run directly on hardware and firmware, without an operating system, as part of the BIOS Implementation Test Suite (BITS) project ([biosbits.org](http://biosbits.org)). Despite the low-level environment, we try to write as little C as possible, implementing most of BITS in Python itself. We added network functionality, both client (supporting urllib2) and server (supporting BaseHTTPServer), written in Python itself with only a few lines of C glue. This includes a Python implementation of the _socket and select modules, compatible with CPython's C implementation.
Our network implementation makes use of EFI firmware calls, including asynchronous callbacks. We show how to handle these callbacks safely in Python without breaking Python's concurrency model.
As a demonstration of the networking functionality, we'll show a web client running on bare metal to download new test code and upload test results, and a web server on bare metal serving up firmware information.