
Ask HN: Why is BSD becoming more popular in embedded devices? - gaspoweredcat
I have noticed a steady rise in embedded systems using BSD based operating systems and i was just wondering why its being chosen over linux for example. Both Sony and Nintendo are using BSD based guts in their consoles and im also seeing it used fairly regularly in EPOS systems and a fair few other things.
======
m45t3r
> Sony and Nintendo

Video game makers generally doesn't make much money with hardware, they make
money selling software (a.k.a. games), thanks to licensing. To allow only
licensed software to run in a modern video console, all software running on it
is signed with a key that only the console maker have. However, if someone
discovers a way to run unlicensed (unsigned) software in their hardware, this
means that the console maker will lose money to piracy.

Generally, using BSD systems in video consoles is desired since you can simply
close the source code (thanks to the BSD license) and not reveal possibly
potencial kernel exploits. Kernel exploits are the key for console security
since once you get a exploit running in kernel, you can leak encryption keys
or simply bypass the signature checking. Kernel exploits is what allowed
piracy in most last generation consoles (Nintendo 3DS, Nintendo Wii U, PS
Vita, PS3). Using Linux, thanks to GPL license, would mean opening the source
code of the kernel, allowing someone to study for exploits.

Actually, even if PS Vita/PS4 uses BSDs as a base, they use a heavily modified
BSD, since using a vanilla kernel would make a public exploit in say, FreeBSD,
easily ported to their device.

Nintendo consoles actually uses an in-house developed kernel by Nintendo, that
debutted on Nintendo 3DS; the Nintendo Switch's BSD part is mostly network,
however BSD network is used even on Windows because it is of high quality and
portable (and BSD licensed).

Disclaimer: I am not a console expert or anything, I mostly follow the console
scene so those information can be wrong.

~~~
Asooka
> since using a vanilla kernel would make a public exploit in say, FreeBSD,
> easily ported to their device

You mean like at the recent CCC where they demonstrated using a WebKit exploit
to trigger a BSD exploit via which they install a working Linux system on a
PS4 and launch Steam? Link:
[https://www.youtube.com/watch?v=QMiubC6LdTA](https://www.youtube.com/watch?v=QMiubC6LdTA)

It's not as simple as that because the PS4 is a custom board, so even though
the CPU and GPU are standard AMD components, some hacking was required. But
using exploits that have long been patched to gain access to hardware by Sony
and Nintendo is nothing new.

~~~
m45t3r
Note that I didn't say it was impossible to port a BSD exploit to it, I just
said that it was harder. I don't know the specific version of FreeBSD/NetBSD
that PS4 uses, but lets say it is FreeBSD 9. I am sure that not all CVEs in
FreeBSD 9 are portable to PS4, and even when it does work it will need
additional some additional work because of the differences between PS4 kernel
and vanilla *BSD.

Another observation: if PS4 used Linux, Sony would be forced to open the
modified PS4's Linux kernel thanks to GPL License, and would be trivial to
check for security exploits since you have the source code.

------
znpy
Long story short: the BSD license.

BSD systems have always suffered a lack of device drivers.

But if you are a huge enough company, you can do two things:

1\. Choose already-supported hardware to develop on 2\. Customize the OS to
fit your needs

Using a BSD-licensed system feature no. 2 becomes particularly nice, as you
don't have to share your changes back and you can keep your work for yourself
(for both IP and security-through-obscurity).

~~~
dv_dt
And if you're Nintendo, you're likely to end up writing custom device drivers
for your hardware no matter if you starting point is a BSD OS or Linux.

------
trome
What Point of Sale systems have you seen running BSD? In the US, all the major
retailers are either on SLES through IBM/Toshiba, or your Walmart and are on
your own homerolled Linux box as a POS.

Outside of that, its all Windows for the smaller chains, Truno and similar
will not talk to them, so they get to deal with NCR who sells them a meh
system based on whatever the last supported version of Windows is. Even
smaller and you get into PCAmerica (Windows) or Clover (Android/Linux).

On the embedded front ($X to $XX) BSD supports fewer platforms than Windows
for IoT, you can't even boot it on your average ARM board or MIPS router. Only
in high end consoles ($XXX) has Sony & Nintendo chosen to use BSD, which
requires a substantial amount of work, but there is significant perceived
value by making locked down "consoles" that can only run their signed
software.

~~~
ams6110
> BSD supports fewer platforms than Windows

OpenBSD currently supports:

    
    
       alpha
       amd64
       armv7
       hppa
       i386
       landisk
       loongson
       luna88k
       macppc
       octeon
       sgi
       sparc64
    
    

NetBSD has "Tier I" support for...

    
    
       amd64
       evbarm (ARM evaluation boards)
       evbmips (MIPS-based evaluation boards)
       evbppc (PowerPC-based evaluation boards)
       hpcarm (StrongARM based Windows CE PDA machines)
       i386
       sparc64
    

...and "Tier II" support for nearly 50 others.

~~~
pm215
For embedded support, the platform (ie the entire SoC and its devices) is more
important than just the CPU architecture. Every SoC is different and if the OS
doesn't have drivers and support for the devices on it then it won't boot,
even if the OS supports ARM or MIPS in general.

------
eb0la
I guess it's by the License, software available and documentation.

In my case (about 20 years ago) the documentation was what made me use BSD
instead of Linux.

Back in 1996 there was little (reliable) documentation about Linux kernel
internals and boot process. For BSD (OpenBSD) it was the opposite: well
documented and reliable.

------
dnel
I believe the BSD licensing makes it easier to integrate BSD code into
proprietary software without needing to open source the proprietary code.

~~~
okket
And yet Linux derived systems win often because if you are not 100% in control
of the hardware (Apple, Nintendo...), driver availability + flexibility >
license pains.

~~~
eddieroger
Sure, but the original question was specifically around embedded systems,
which is usually the definition of "in control of the hardware." So for folks
like Apple, Nintendo, Sony for the PS4, etc, the answer makes sense.

------
tete
Even though people are right about the license being a reason one has to keep
in mind that there actually is quite a few other BSD licensed (often real
time) operating systems targeting embedded devices, like Contiki, Minix,
TinyOS and others.

I think the community and quality of documentation as well as not being
controlled by single entities are a big part.

It's not just the license. There are quite a few ways to get around using
Linux in many use cases without caring about its license. And there is Toybox.

------
krylon
I am not sure about the other ones, but I vaguely remember that NetBSD makes
driver development relatively easy, or at least one does not need to re-write
or copy-past driver code when moving from, say, PCI to a USB-attached device.

I can imagine that makes it a sensible choice for companies that build their
own hardware (custom peripherals and so forth).

Also, as others have pointed out, the BSD License. Some companies won't touch
GPL code with a ten-foot stick.

------
roblabla
BSD kernel is not used in Nintendo, only the network stack (despite all the
media craze saying so).

Nintendo has a habit of doing their own custom OS designed specifically for
the needs of their consoles (3ds, switch and wiiu all have its own OS), but
using a battle-tested and proven network stack means less problems in the long
run.

~~~
eb0la
The IPv6 BSD network stack was developed in Japan. There was some people from
keio university working on in. (Un)surprisingly key developers from Nintendo
also studied there.

Coincidence?

------
AsyncAwait
Because Sony, Nintendo, Apple or even IoT companies that make $9 connected
switches do not want to deal with licensing, simple as that.

~~~
trome
If you look at that space, the OrangePi Zero and others all run Linux, not
*BSD. Nintendo & Sony have both chosen to go and build on BSD for their high
end consoles so they can have tight control and give nothing back, but the NES
Classic runs Linux as porting BSD doesn't make sense.

~~~
AsyncAwait
> the OrangePi Zero and others all run Linux

I am not talking about dev boards, I am talking about Chinese OEMs that do not
give a crap about open-source.

> give nothing back

Exactly, that's the allure of BSD/MIT for these sorts of companies.

~~~
trome
> I am not talking about dev boards, I am talking about Chinese OEMs that do
> not give a crap about open-source.

As far as I can discern, they literally do not give a crap and do the bare
minimum to get a half working Linux BSP so they can run an ancient version of
Android. Then it gets used for your security camera, and that is why you have
20 shitty IP cams running kernel 2.6 calling home to Hunan Province.

That BSP will rarely be released to the public, much less mainlined, and it is
sure to be mixing proprietary code with GPL'ed code. *BSD doesn't even factor
into the equation, since GPL compliance doesn't matter to Allwinner or
Rockchip.

------
nudpiedo
BSD had always several advantages over other open source systems which are
widely available... I think the number of advantages and shortcomings didn't
really change over the time but if you want to discuss WHY it is becoming NOW
a more popular choice, my personal guess is:

\- The state of the art of Ops and information in internet makes that today
anyone with some curiosity can understand and start modifying/administrating
tools and systems which decades ago was only possible for specialists in the
area. \- Truly cross compatible source code and runtimes are widely available
(not just C code that has to be compiled in the target architecture like in
the old times.) \- With the raise of open information now technical choices
can be made contrasting the experience from other teams or companies which
made similar choices in the past.

~~~
rleigh
Could another contributing factor be that Linux is becoming less appropriate
for embedded use?

In the mid 2000s, I developed an embedded system for my employer based on
Debian, cut right down and with our software started directly from inittab,
set to respawn (we could have replaced init entirely with a bit more work).
With stuff like systemd in the mainstream, Linux userspace is increasingly
opinionated and desktop-centric. It takes time and effort to strip out stuff
you don't want, particularly when it's increasingly enforced and you have to
do custom builds. In comparison the BSDs are easy to build with
customisations, including the ports I might need. While I no longer do
embedded stuff, I do wonder what it's like with the current state of Linux.

------
CyberFonic
Apple OS X and iOS are both BSD based as well.

There 4 main families of BSD, each with a different focus. All are highly
secure and some are portable across most CPUs. The Wikipedia articles provide
a lot of good information.

I would choose BSD over Linux because it is more compact, far more secure and
easier to implement drivers. The tools and utilities for both Linux and BSD
are GNU - so only the kernel is different.

~~~
gaspoweredcat
well you learn something every day (and it also shows my complete lack of
apple knowledge) i always thought apples operating systems were unix based.

~~~
geff82
BSD can be called a direct descendant of the original Unix, in contrast to
Linux. So macOS is Unix.

~~~
mfukar
I don't see why - all the design decisions of the original unix are alive and
kicking in linux. User and kernel space. Nothing fundamentally separates the
two.

~~~
X86BSD
Actually they are not. POSIX? Sure. But Linux is notorious for NIH and is
incredibly off in the weeds in incompatible and broken ways from the UNIX
world. Have you tried porting software written for Linux to another platform??

~~~
mfukar
I don't see what point you're trying to make. UNIX does not guarantee
portability, so of course software for Linux doesn't work out-of-the-box, or
even build for that matter, in other UNIXoids.

Linux's NIH syndrome, however unfortunate it is, has not expanded into its
unix roots. (yet?)

------
merlyn
> a steady rise in embedded systems using BSD

Perhaps it is more visible now, but BSD embedded systems have been very widely
deployed for quite some time.

------
LoSboccacc
[https://duckduckgo.com/?q=lawsuit+GPL+embedded+linux&t=hd&ia...](https://duckduckgo.com/?q=lawsuit+GPL+embedded+linux&t=hd&ia=web)

even when the devices are not in violation, it costs money to litigate.

------
h1d
It sounds like BSD stays relevant because of the license which is attractive
to corporations ( but not so for developers) which leads to corporate class
funding and a bit of zfs/pf kind of technical advantage.

------
asgharali7072
here is full study of computer input devices

[http://www.apnapedia.com/computer-input-
devices/](http://www.apnapedia.com/computer-input-devices/)

------
geggam
Linux is getting bloated to do a minimal install.

~~~
fs111
Define bloated

~~~
kazinator
You could once have a usable Linux system running in 4 to 8 megs of RAM, with
X.

I posit a definition of "bloated" as needing more than that.

