Why Teams call analytics are critical to your entire business
Embedding FreeBSD: for large and small beds
1. Using FreeBSD in an Embedded Environment
A Work in Progress
Philip Paeps
philip@FreeBSD.org
The FreeBSD Project
OpenFest 2011 — Sofia, Bulgaria
6 November 2011
2. Welcome to the Embedded World!
Console Server: What, Why?
Embedding FreeBSD
Future Directions
Questions/Comments
1 Welcome to the Embedded World!
Differences with Other Worlds
Intellectual Property
FreeBSD as an Embedded Platform
2 Console Server: What, Why?
What is a Console Server Anyway?
Why Build This Yourself
3 Embedding FreeBSD
Development Boards
Software Ecosystem
Using NanoBSD
Remember crunchgen?
4 Future Directions
Philip Paeps Using FreeBSD in an Embedded Environment
3. Welcome to the Embedded World!
Console Server: What, Why? Differences with Other Worlds
Embedding FreeBSD Intellectual Property
Future Directions FreeBSD as an Embedded Platform
Questions/Comments
Outline
1 Welcome to the Embedded World!
Differences with Other Worlds
Intellectual Property
FreeBSD as an Embedded Platform
2 Console Server: What, Why?
What is a Console Server Anyway?
Why Build This Yourself
3 Embedding FreeBSD
Development Boards
Software Ecosystem
Using NanoBSD
Remember crunchgen?
4 Future Directions
Philip Paeps Using FreeBSD in an Embedded Environment
4. Welcome to the Embedded World!
Console Server: What, Why? Differences with Other Worlds
Embedding FreeBSD Intellectual Property
Future Directions FreeBSD as an Embedded Platform
Questions/Comments
Differences with Other Worlds
Space is not free
There is never any time
Electricity costs money too
Philip Paeps Using FreeBSD in an Embedded Environment
5. Welcome to the Embedded World!
Console Server: What, Why? Differences with Other Worlds
Embedding FreeBSD Intellectual Property
Future Directions FreeBSD as an Embedded Platform
Questions/Comments
Intellectual Property
Legal uncertainty is not an option
Some things really should not be GNU-“free”
You do not want to hack a payment terminal
. . . or an ATM
. . . or an X-ray detector
Repeat after me: GNU is not (always) “free”
Philip Paeps Using FreeBSD in an Embedded Environment
6. Welcome to the Embedded World!
Console Server: What, Why? Differences with Other Worlds
Embedding FreeBSD Intellectual Property
Future Directions FreeBSD as an Embedded Platform
Questions/Comments
Traditional Embedded Systems
Proprietary
. . . and often expensive
Tiny code-size (10s–100s of Kbytes)
More or less “hard” real-time
Task-switching or multithreaded
Single-application optimized
Philip Paeps Using FreeBSD in an Embedded Environment
7. Welcome to the Embedded World!
Console Server: What, Why? Differences with Other Worlds
Embedding FreeBSD Intellectual Property
Future Directions FreeBSD as an Embedded Platform
Questions/Comments
Features of FreeBSD
Friendly BSD-style licence
Contrast with GNU licence
Integrated build-system
Easy to build complete systems
Easy to modify to requirements
Support for some popular embedded platforms
x86
ARM
PowerPC
MIPS
Philip Paeps Using FreeBSD in an Embedded Environment
8. Welcome to the Embedded World!
Console Server: What, Why? Differences with Other Worlds
Embedding FreeBSD Intellectual Property
Future Directions FreeBSD as an Embedded Platform
Questions/Comments
Problems with FreeBSD
Somewhat larger than perhaps desirable
On the order of 10s–100s of Mbytes
Easy to strip down up to a point
Slightly trickier to strip down further
Chunks of infrastructure still lacking
Support for more embedded architectures
NAND/NOR flash device abstraction
Hard to compete with Linux
Linux has a lot of mindshare
Not as bad as it used to be. . .
Tougher to compete purely on features
Philip Paeps Using FreeBSD in an Embedded Environment
9. Welcome to the Embedded World!
Console Server: What, Why?
What is a Console Server Anyway?
Embedding FreeBSD
Why Build This Yourself
Future Directions
Questions/Comments
Outline
1 Welcome to the Embedded World!
Differences with Other Worlds
Intellectual Property
FreeBSD as an Embedded Platform
2 Console Server: What, Why?
What is a Console Server Anyway?
Why Build This Yourself
3 Embedding FreeBSD
Development Boards
Software Ecosystem
Using NanoBSD
Remember crunchgen?
4 Future Directions
Philip Paeps Using FreeBSD in an Embedded Environment
10. Welcome to the Embedded World!
Console Server: What, Why?
What is a Console Server Anyway?
Embedding FreeBSD
Why Build This Yourself
Future Directions
Questions/Comments
What is a Console Server Anyway?
Central component of any hacker lab
Talk to consoles without keyboards and monitors
Debug kernels using DDB or even GDB from a comfy chair
Similar uses in large datacentres
. . . for many of the same reasons
Philip Paeps Using FreeBSD in an Embedded Environment
11. Welcome to the Embedded World!
Console Server: What, Why?
What is a Console Server Anyway?
Embedding FreeBSD
Why Build This Yourself
Future Directions
Questions/Comments
Why Build This Yourself
Commercial units often very expensive
Blame the datacentres!
Retired ones on eBay loud, clunky and powerhungry
It’s fun, of course!
Philip Paeps Using FreeBSD in an Embedded Environment
12. Welcome to the Embedded World!
Development Boards
Console Server: What, Why?
Software Ecosystem
Embedding FreeBSD
Using NanoBSD
Future Directions
Remember crunchgen?
Questions/Comments
Outline
1 Welcome to the Embedded World!
Differences with Other Worlds
Intellectual Property
FreeBSD as an Embedded Platform
2 Console Server: What, Why?
What is a Console Server Anyway?
Why Build This Yourself
3 Embedding FreeBSD
Development Boards
Software Ecosystem
Using NanoBSD
Remember crunchgen?
4 Future Directions
Philip Paeps Using FreeBSD in an Embedded Environment
13. Welcome to the Embedded World!
Development Boards
Console Server: What, Why?
Software Ecosystem
Embedding FreeBSD
Using NanoBSD
Future Directions
Remember crunchgen?
Questions/Comments
Soekris Net4521
100/133 Mhz AMD ElanSC520
32 Mbyte RAM
Compact flash storage
8 GPIOs
1 UART
No USB on-board
MiniPCI and some other stuff
Max 14W power consumption
Philip Paeps Using FreeBSD in an Embedded Environment
14. Welcome to the Embedded World!
Development Boards
Console Server: What, Why?
Software Ecosystem
Embedding FreeBSD
Using NanoBSD
Future Directions
Remember crunchgen?
Questions/Comments
Artila M-501
180MHz Atmel AT91RM9200
64 Mbyte RAM
16 Mbyte on-board NOR
32 GPIOs
4 UARTs
USB on-board
The usual complement of busses
(I2 C, I2 S, SPI, SD, . . . )
Max 2.5W power consumption
Philip Paeps Using FreeBSD in an Embedded Environment
15. Welcome to the Embedded World!
Development Boards
Console Server: What, Why?
Software Ecosystem
Embedding FreeBSD
Using NanoBSD
Future Directions
Remember crunchgen?
Questions/Comments
Feature Comparisson
Soekris net4521: Artila M-501:
PRO: Standard PC architecture PRO: Lots and lots of UARTs
PRO: Easy to flash CF cards PRO: Tiny power requirements
CON: High power requirement PRO: Cheap(ish) to manufacture
CON: Few UARTs PRO: Very small hardware
CON: Largish hardware CON: Higher porting effort
CON: Fairly expensive CON: Less convenient development
Philip Paeps Using FreeBSD in an Embedded Environment
16. Welcome to the Embedded World!
Development Boards
Console Server: What, Why?
Software Ecosystem
Embedding FreeBSD
Using NanoBSD
Future Directions
Remember crunchgen?
Questions/Comments
Getting Software on the Boards
Development phase: Production system:
Netbooting with BOOTP/TFTP Soekris runs from easy CF cards
Software runs from root on NFS Artila has NOR flash on board
FreeBSD makes this very easy Flashing NOR is a bit tricky
Philip Paeps Using FreeBSD in an Embedded Environment
17. Welcome to the Embedded World!
Development Boards
Console Server: What, Why?
Software Ecosystem
Embedding FreeBSD
Using NanoBSD
Future Directions
Remember crunchgen?
Questions/Comments
FreeBSD as a Development Workstation
Base system contains most required tools
Other bits can easily be installed from ports/packages
Netbooting FreeBSD is fairly trivial(ish)
Once it works, it tends to keep working
Philip Paeps Using FreeBSD in an Embedded Environment
18. Welcome to the Embedded World!
Development Boards
Console Server: What, Why?
Software Ecosystem
Embedding FreeBSD
Using NanoBSD
Future Directions
Remember crunchgen?
Questions/Comments
Documentation
Interfaces are (often) extensively documented
Even the kernel!
Philip Paeps Using FreeBSD in an Embedded Environment
19. Welcome to the Embedded World!
Development Boards
Console Server: What, Why?
Software Ecosystem
Embedding FreeBSD
Using NanoBSD
Future Directions
Remember crunchgen?
Questions/Comments
Integrated Build Environment
Build a cross-toolchain in one command
Build the “world” in one command
Yes! You can do partial builds
No need to reinvent yet another wheel
Philip Paeps Using FreeBSD in an Embedded Environment
20. Welcome to the Embedded World!
Development Boards
Console Server: What, Why?
Software Ecosystem
Embedding FreeBSD
Using NanoBSD
Future Directions
Remember crunchgen?
Questions/Comments
Features of NanoBSD
NanoBSD is a script to drive the “normal” build system
Primarily optimized for producing disk images for CF
Chops the FreeBSD world down to 10s of Mbyte easily
That is still quite large though
Philip Paeps Using FreeBSD in an Embedded Environment
21. Welcome to the Embedded World!
Development Boards
Console Server: What, Why?
Software Ecosystem
Embedding FreeBSD
Using NanoBSD
Future Directions
Remember crunchgen?
Questions/Comments
Remember crunchgen?
A bit like “busybox” from the Linux/GNU world
. . . but not really
Originally from PicoBSD
Now mainly used in /rescue
Can chop FreeBSD down to < 10 Mbyte
Philip Paeps Using FreeBSD in an Embedded Environment
22. Welcome to the Embedded World!
Console Server: What, Why?
Embedding FreeBSD
Future Directions
Questions/Comments
Outline
1 Welcome to the Embedded World!
Differences with Other Worlds
Intellectual Property
FreeBSD as an Embedded Platform
2 Console Server: What, Why?
What is a Console Server Anyway?
Why Build This Yourself
3 Embedding FreeBSD
Development Boards
Software Ecosystem
Using NanoBSD
Remember crunchgen?
4 Future Directions
Philip Paeps Using FreeBSD in an Embedded Environment
23. Welcome to the Embedded World!
Console Server: What, Why?
Embedding FreeBSD
Future Directions
Questions/Comments
Make FreeBSD Better
Bootloader improvements for development
Generic flash layer in the kernel
Cross-platform pkg add
Better integration of crunchgen with the build
Perhaps with NanoBSD
Call it FemtoBSD?
. . . your wishlist here . . .
Philip Paeps Using FreeBSD in an Embedded Environment
24. Welcome to the Embedded World!
Console Server: What, Why?
Embedding FreeBSD
Future Directions
Questions/Comments
Porting FreeBSD to CHERI
My current “big” project
64bit-only MIPS on an FPGA
Security research with
University of Cambridge
FreeBSD target operating
system
Philip Paeps Using FreeBSD in an Embedded Environment
25. Welcome to the Embedded World!
Console Server: What, Why?
Embedding FreeBSD
Future Directions
Questions/Comments
Questions? Comments?
Philip Paeps Using FreeBSD in an Embedded Environment