Debian vs. Yocto for Embedded Systems
bytesnap.com
bytesnap.com
Debian is great, and it's somewhat famous for the wide varieties of architectures it runs on. But fundamentally, it's an OS meant for use on systems that look a lot more like a computer than an embedded device. It's true, there's a good amount of overlap these days -- the most common OS for Raspberry Pi's is a Debian derivative, Raspbian -- but if you were building an IP camera, it's hardly the first thing I'd recommend.
Yocto, on the other hand, isn't really a distribution of Linux as much as it is a pile of code that lets you craft your own distribution. In a way, it shares some attributes with Gentoo here, though much more narrowly focused. Yocto is meant to produce images that get "flashed", even if not literally to EEPROM; it has integrations with tools like mender, that allow A/B/x style failover on updates. You'd expect things made with Yocto to be upgraded in a single block -- OS, code, all of it -- because it's all meant to run together. Updating a single package isn't really how Yocto is meant to work.
All in all, I mean... yes, I agree with the fundamental point: in most circumstances, when working on low-resource embedded devices, you're probably going to want something more like Yocto than like Debian, but, also, it's a very strange comparison to make.
Most SoC vendors provide a Debian image precisely for this market segment. The thing is, a lot of the guys who need a Linux embedded system are not embedded engineers, so they greatly benefit from having something like Debian, which has infinite resources to build upon.
Source: paid to work on bringing up and maintaining Yocto systems every day.
Source: same as you.
When building Debian/Ubuntu based firmware, you don't really know what package versions you'll get unless you are mirroring the package tree yourself.
If you don't, then any build-flow that involves apt-upgrading or apt-installing packages (yes, even Docker builds) has no guarantee that you'll get an equivalent result if you rerun it 3 months later.
If you remember later, shoot me an email at nicholas-replace-with-dot-clark at gmaildotcom
In general, once you have a build environment that is actively maintain (to fix important bugs and security vulnerabilities), it will approach Debian stable to some degree, in the sense that developers get updates they did not request (so that they stop baking in known and fixed vulnerabilities into their applications).
You can ask `apt` to install specific versions of packages. You do have to provide a repository that contains old versions though, e.g. Debian's snapshot archive: https://snapshot.debian.org/
Also I would be interested to hear how debian has advantages in cross-building; I thought they native-compile all of their packages. Is that really the case that in debian that you can modify some existing deb source package (eg. change configure flags or apply some patch) and cross compile that into a .deb, like you can in Yocto?
And yes. I can install a cross-compiler (from the stock repo!) and custom-build whatever (not 100% of the archive is cross-buildable yet, but most of it is). And most of the time you don't care about the details, and you don't need to cross-build anything: the full Debian archive is pre-built and available on all the supported architectures (whatever you care about is probably on that list).
And there's another big advantage. Developers might be using a different-architecture machine for their testing, and it's really nice to have an identical set of installed packages and version across dev and deployment boxes, even if they have different architectures. This is actually a very common case: people develop on their amd64 laptops, but the deployment might happen on an arm, or something.
At Toradex we provide an operating system and OTA platform called Torizon which is Yocto-based but uses Debian containers with custom packages for hardware acceleration, so our customers have the customisation of Yocto (if they so desire) while getting a very familiar programming environment (Debian). "The best of both worlds", so to say.
Customers are very happy to not deal with the usual Yocto mess.
[1] https://developer.toradex.com/torizon/provided-containers/de...
Disclosure: I'm a software engineer at Toradex.
Most vendors are on yocto nowadays anyway. If you stick with buildroot you'll be doing all the work yourself.
And if your device has limited storage...
I know some projects picked it up and adapted it to their purposes, it's relatively simple and written in Python.
So: if you're making a consumer-facing product that has secured firmware updates, then Debian (or any derivative like Ubuntu) is probably not what you want. Assuming you care about license compliance.
That clause was the reason why the Linux kernel stayed on GPLv2, and so did a lot of core embedded software like BusyBox.
Second of all, even for consumer products, you can still make it so that you no longer trust machines that have been tampered with -- as long as you still let the person execute their own code. For example, Chromebooks getting put into developer mode by removing a screw could be cut off from cloud resources, or a phone screaming at you on boot that it's no longer trustworthy.
For consumer products, we are both right. A consumer product developer must provide owners with any secrets/keys/code necessary to replace any of the GPLv3 software. So: rights to modify the rootfs.
It's OK for the product to complain at you for doing it, but the vendor has to tell you how, if you ask. And give you any signing keys. That's not ideal on products that might have software-unlockable features, or on public-facing things like routers.
It's control through the threat of ending a relationship, which Redhat is also trying now. You can't really say that it's allowed for in the GPL (there's no text in the GPL that says that it is allowed), it's just something that the GPL does not cover.