My Enterprise Card Runs Linux • &> /dev/null
I’m an embedded programs engineer.
I spend a number of my free time on the lookout for issues I might use in future designs, or issues that tickle one among my fancies.
A type of issues is affordable Linux-capable computer systems, the cheaper the higher.
So I began diving into the very deep rabbit gap of obscure processors.
I believed to myself, “These processors are practically low-cost sufficient to present away.”
After some time I come across the thought of creating a barebones Linux board in a enterprise card kind issue.
As quickly as I had the thought I believed it will be fairly cool to do.
I’ve seen digital business playing cards before, with numerous enjoyable options together with emulating USB flash drives, blinkenlights, and even wi-fi transceivers.
I’ve by no means seen one working Linux, nonetheless.
So I constructed one.
That is the completed product.
It’s a full, minimal ARM laptop working my custom-made Linux firmware constructed with Buildroot.
It has a USB port within the nook.
In case you plug it into a pc, it boots in about 6 seconds and exhibits up over USB as a flash drive and a digital serial port that you should utilize to log into the cardboard’s shell.
The flash drive has a README file, a duplicate of my résumé, and a few of my images.
The shell has a number of video games and Unix classics corresponding to fortune and rogue, a small 2048, and a small MicroPython interpreter.
All that is completed on a really small 8MB flash chip.
The bootloader matches in 256KB, the kernel is 1.6MB, and the entire root filesystem is 2.4MB.
So, there’s loads of house for the digital flash drive.
It additionally features a writable house listing, on the off probability that anybody creates one thing they wish to preserve.
That is additionally saved on the flash chip, which is correctly put on leveled with UBI.
The entire thing prices underneath $3.
It’s low-cost sufficient to present away.
In case you get one from me, I’m most likely making an attempt to impress you.
Design and meeting
I designed and constructed all the pieces myself.
That is actually my job, and I get pleasure from it, a lot of the problem was discovering components that had been low-cost sufficient for a hobbyist.
The selection of processor was probably the most essential determination to maintain the price low and make the mission possible.
After a lot analysis, I chosen the F1C100s, a reasonably obscure cost-optimized (learn: rattling low-cost) half made by Allwinner; it consists of each RAM and CPU in a single bundle.
I purchased these on Taobao.
All the opposite miscellaneous elements had been sourced from LCSC.
I fabricated the PCBs with JLC.
For $8 I bought 10 copies.
I’ve been very impressed with boards I’ve gotten from JLC; they’re not fairly as good as those from OSHPark, however they appear nice, particularly for the value.
The primary spin of the boards had been matte black, which regarded advantageous however had been fairly the fingerprint magnets.
There have been a pair issues with the primary spin: first, the USB port wasn’t lengthy sufficient to reliably make contact in lots of USB ports.
Much less critically, the flash footprint was improper, which I labored round by bending the leads underneath the half by hand.
(My spouse stated I used to be “dead-spidering” the half!)
As soon as I had validated all the pieces else, I re-spun the boards to get the model you see on the high of this text.
As a result of dimension of all these small components, instantly I made a decision to reflow solder all the pieces utilizing a cheap reflow oven.
I’ve entry to a laser cutter, so I laser-cut my very own solder paste stencil utilizing laminator pages.
The stencil turned out moderately properly.
The 0.2mm apertures for the processor pins wanted particular consideration to get them to come back out clear: laser energy and focus had been essential.
I utilized solder paste and positioned elements by hand.
I made positive to have a lead-free course of—the boards, components, and solder paste are all RoHS—in order that I wouldn’t really feel unhealthy about giving them to individuals.
Every element takes round 10 seconds to hand-place, so I attempted to maintain element rely as little as doable.
For extra dialogue in regards to the design and software program, you could be taken with studying my detailed write-up.
Invoice of Supplies & Price
I stored prices low.
It’s low-cost sufficient that I don’t really feel unhealthy giving it away, as designed!
I’m not going to present one to utterly everybody as a result of it does take time to assemble every card, and meeting value isn’t factored in right here (my time is “free”).
Part | Worth |
---|---|
F1C100s | $1.42 |
PCB | $0.80 |
8MB flash | $0.17 |
All different elements | $0.49 |
Whole | $2.88 |
In fact, there are different prices which might be tough to quantify like transport (because it’s unfold throughout a number of initiatives).
However that is positively fairly low-cost for a Linux board.
It additionally provides a fairly first rate place to begin for quantifying how a lot it prices corporations to fabricate bottom-end units: you guess they’re getting all the pieces even cheaper than I’m!
Capabilities
What can I say?
It boots a brilliant stripped-down Linux in about 6 seconds.
As a consequence of kind issue and price, the cardboard lacks I/O, networking, and any quantity of storage to run heavyweight packages.
Nonetheless, I managed to cram a bunch of fascinating stuff into the firmware picture.
USB
I might do any variety of issues with the USB, however I selected to maintain it pretty easy so that folks might have a good probability of getting all the pieces engaged on their laptop once they tried it out.
Linux enables you to behave as a “machine” with the Gadget Framework.
Since I forward-ported some drivers from others’ earlier work on this processor, I’ve all of the performance of your entire USB gadget framework at my disposal.
I made a decision to emulate a pre-generated flash drive and provide a shell over a digital serial port.
Shell
You’ll be able to run all these from the emulated serial console after you log in (as root
, the one consumer):
rogue
: the basic Unix dungeon crawler.2048
: a easy console mode 2048 recreation.fortune
: numerous pithy sayings. I made a decision to not embody your entire database of quotes right here to save lots of house for different performance.micropython
: a really small Python interpreter.
Emulated Flash Drive
Throughout the compilation course of, the construct instruments generate a small FAT32 picture and add it as one of many UBI partitions.
As I described above, the Linux gadget subsystem presents this as a mass storage machine to the PC.
In case you’d wish to see what seems on the flash drive, the simplest factor to do can be to go look at the source code.
There’s a few of my images and my resume.
Assets
Supply Code
-
In case you’d wish to see my Buildroot tree, it’s open-sourced on GitHub at
thirtythreeforty/businesscard-linux
.
It incorporates the code to generate the NOR flash picture, which is then put in through the processor’s USB obtain mode.
It additionally has bundle definitions for the video games and different goodies like fortune that I packaged for Buildroot as soon as I bought all the pieces working.
In case you’re wanting to make use of the F1C100s in a mission, it’s an excellent place to begin (and be happy to get in contact when you have questions). -
I rebased Icenowy’s excellent F1C100s work on Linux v4.9.
My enterprise card runs near-mainline v5.2 with this handful of patches rebased and debugged.
It’s hosted on GitHub atthirtythreeforty/linux
. -
I consider I presently have the world’s finest port of U-Boot to the F1C100s, based mostly once more partly on some work by Icenowy.
(Surprisingly, getting U-Boot totally working was fairly annoying.)
I’m engaged on upstreaming this.
Within the meantime, it is usually on GitHub atthirtythreeforty/u-boot
.
F1C100s Documentation
I discovered some (sparse) documentation for the F1C100s, which I’m mirroring right here:
And at last, I’ve uploaded my schematic for the curious.
You’ll be able to obtain it by clicking on it beneath.
The F1C100s is considerably scarce right here within the US, so right here’s an open provide for individuals who wish to design with this half: for those who design a board with this chip on it, get in contact and I’ll get you some samples to construct your board.
Conclusion
I taught myself lots on this mission: it’s my first mission utilizing a reflow oven to solder the components.
I additionally needed to learn to discover assets for poorly-documented components.
There was much more to it than what I touched on on this fast presentation; once more, if you wish to see how the sausage will get made, see additionally my companion detailed write-up.
I drew from my present expertise with embedded Linux and designing PCBs.
It isn’t flawless, however it’s a fairly good illustration of my skills.
In case you’d wish to learn to do this sort of factor, you may also be taken with my ongoing Mastering Embedded Linux sequence!
I’m strolling via methods to construct {hardware} and software program from scratch for tiny, low-cost Linux programs very like my enterprise card.
You can even subscribe to all future updates from the flamboyant new Subscribe page.