Through the Looking Glass
While I was on vacation, I spent a while thinking about the custom laptop idea I had, and got some initial research done. I’ve also managed to recruit some friends to help out with this, and came up with a better name for the project: blackbook.
To recap, I want to build a custom laptop with the following goals:
- It should include a solar panel to provide some power independence.
- It should use a non-x86 architecture.
- It should have an eInk display.
- It should end up with a custom operating system.
- It should be easily upgradable and repairable.
- It should incorporate some form of mesh networking.
- I’m not looking to create a general purpose system compatible with every app under the sun. This is a purpose-built machine meant to solve problems that I have; I already have a (okay, several) general purpose machine.
- I’m not looking to write Unix-compatible OS.
- It doesn’t need to be on 24/7. Ideally I’d get 8-12 hours of battery life, but some downtime is both to be expected and preferred.
I don’t really know what I’m doing for most of these parts, so this is an opportunity to work on a bunch of different topics as I see fit.
As part of stage 1, I’ve ordered a pi-top3, a Raspberry Pi model 3 B+ (more on architecure options later), a Raspberry Pi Zero WH, and a 6W panel. This will at least get me to a point where I can start getting my hands dirty with the solar power parts and working on the operating system.
I’ve got a lot of documentation in Dropbox Paper, but I’ve been debating what other mechanisms would be good to share progress and research. Ideally, I’d have some combination of a wiki and blog, but I think this blog suffices for now for updates, and maybe I’ll look into a wiki. I’d rather avoid a full mediawiki setup; I’ve looked into moinmoin, ikiwiki, and dokuwiki. I’m not sold on any of them, but I’m open to options. I’ve also considered setting up a forum (maybe a Discourse server) for discussion, but that’s later down the road. Whatever option I go with, I’d like to find something that allows anonymous viewing.
I’m also open to discussion via email; if you’re interested, drop me a line at kyle at imap cc.
The rest of this post covers what I’ve come up with so far for each of the options.
Architecture and system board
I wanted to use a non-x86 architecture. This is mostly due to the lower power usages of a lot of other architectures, as well as compatible board sizes. To summarize my research, I’ve decided that my requirements are
- minimum of 32M of code storage for a boot loader
- support for an SD card, though having SATA support later would be nice
- minimum of 64M of memory (this is debatable, more is better)
- onboard serial UART
I’ve considered a bunch of candidate system boards:
- RISC-V: there’s really two options for system boards, both by SiFive. The HiFive1 just doesn’t have enough RAM (at 16K), but the HiFive Unleashed is prohibitively expensive. There’s also not much information on the power usage of this board, but the open nature of the architecture is compelling.
- MIPS: the Onion2 is interesting, but it needs a dock or carrier board of some kind that increases the bulk. I’m not sure about the power usage, though.
- ARM: the Raspberry Pi is compelling, and there’s lot of power usage information for these boards. Really, this comes down to the model 3 B+, with ARMv8, and the Zero WH, with ARMv6. The 3 B+ is nice for its builtin peripherals, but it has a high power usage with 2.5A recommended current draw. The Zero WH is smaller but its peripherals aren’t great; it does have a recommended power supply rating of 1.2A, which is a lot better. I’m not sold on this given the Mali GPU.
Right now, the Pi is the most tenable option for early explorations, so I’m proceeding with that. I’d love for a suitable RISC-V board, though.
Solar power and batteries
I’ve been looking at a lot of power options. The 9W panels I’m looking at are about 10x9 inches (or 255x225 mm) and provide roughly 1.5A at peak sunlight. The 6W panel I got to start with is about 9x7 inches (220x175 mm) with about 930 mA at peak sunlight.
One thing that has to be considered is the thermal characteristics of the various components. The Pi seems to be the limiting factor here, with a max temperature of about 70C - I think this should be okay. If I 3D print the chassis, ABS plastic has a glass transition temperature of about 105C, which is kind of the limit when the system is powered off.
I bought a book on building lithium battery packs, and I think the best option might be to build a custom 18650-based battery pack and charger. Otherwise, I have to start stacking battery packs, and neither of the charging options I’ve been looking at (the Adafruit solar charger and the Sparkfun Sunny Buddy) seems to support this kind of configuration. All of the system boards I’ve looked at accept 5V power; stacking batteries means I’ll probably get 7.4V out of the power pack.
From a hardware perspective, this is going to be the most difficult part. I’m eyeing the ED133UT2, but it looks like I’ll have to source it from some random vendor on the internet, as the doesn’t sell these individually. I could get a dev kit, but that’s prohibitively expensive. The bare display module is something like $450, making it possibly the most expensive part of the system - and I don’t know how well it’ll interface with a given system board.
I chose the ED133UT2 based on a cursory investigation into tablet eInk displays - it seems to be what’s in the Sony Paper tablets.
I’ll probably have to settle for a TFT display scavenged off eBay for the first few iterations of the hardware.
I think by 3D printing the chassis and coming up with a list of discrete modules, this should be doable. It looks like it’s highly dependent on how I lay out the case. On the other hand, making it easy to upgrade makes developing the hardware a lot easier.
What custom laptop would be complete without a custom operating system? I’m doing the initial groundwork to build out an operating system, though it’s highly dependent on what system board I end up going with. I’d like to write it in Rust, so I’m working through a few OS walkthroughs with Rust. Some initial design notes:
- I’m not really aiming for any sort of POSIX compliance.
- It should be a single user system, which has a number of consequences.
- The init system just needs to bring up a shell. The first pass at the OS won’t have multiple virtual consoles, which will simplify things.
- I’d like to explore process security mechanisms besides users and groups.
- What does a single user login look like? How does authentication work?
- I’d like to explore object capabilities as a security mechanism. I’ve done some explorations with object capability file stores in the past, but it’s still a topic I’m woefully undereducated in.
- The filesystem is still an open question.
- The filesystem should be encrypted as a basic security measure. This requires some crypto support in the kernel, which adds more complexity.
- Which filesystem to use is another question. FAT doesn’t provide much extra metadata for files but is easy to implement; ext2 and family aren’t too much more complicated, relatively speaking, but I think they’re based on users and groups (e.g. the Unix permissions model).
- How do processes work in this system? How about scheduling?
There’s more questions than this, but it’s definitely going to be a lot of work. I think I’ve convinced some smart people to help, so that’ll be good. I’ll end up doing a lot of reading up on other efforts, like Fuchsia, Redox, KeyKOS, CapROS, etc.
After the kernel comes the question of the userspace. I think the roadmap for this is going to end up with multiple stages. The essential software that’ll need to be written are an editor (I’d like an mg-like editor at first, but we’ll see), some interpreted language (maybe a scheme or forth, but maybe porting Python over), a text-only web browser (or resurrect gopher ;)), a busybox analogue (e.g. all the necessary system tools), and git (or some other SCM). After that comes a PDF viewer, a tmux analogue, an assembler, and a mesh network controller. Finally, a C compiler and/or porting Rust over, maybe adding a GUI/windowing system, and adding things like CSS support to the browser.
I had this crazy backburner idea of something like a system that’s part wiki, part activitypub sort of thing that could be used without needing public infrastructure. That’s the think-big, think-far, sort of project. This presumes, of course, that this goes anywhere.
I’m not a huge fan of the current activitypub twooter alternative for a number of reasons that aren’t really important, but one idea I do like is not needing to rely on the public infrastructure. I’ve been thinking about things I could do with this:
- 802.11 but in adhoc mode, but the drivers and support for this is complicated and 802.11 radios eat power like crazy
- BLE but no one who’s ever written BLE code was happy about it
- LoRa but that’s very low-bandwidth
Not a lot of good options, but there’s plenty of time to think and tinker.
This is admittedly a crazy idea that’s going to take a lot of work. It may never happen. So far, however, thinking about it and working on a few small related parts has been a lot of fun and it involves the kind of tech work that I enjoy. I’ll probably keep plugging away at it until I don’t anymore, and we’ll see how far it goes.