# BSD versus Linux on Raspberry?



## Spartrekus (Jan 26, 2018)

Hello, 

A nice competition : *BSD versus Linux for PI. 

BSD running many systems, Linux as well, Android is good example.

Would you try to convince me to use FreeBSD /w George?





What about your PI: *BSD versus Linux ?


----------



## ralphbsz (Jan 26, 2018)

On a RPi3, tried FreeBSD.  While in theory it would probably have been possible to get most things to work (with recompiling, learning poudriere, and so on), it was just easier to install Raspbian, where everything works flawlessly and easily.  Wireless is the exception, that's just not supported yet on FreeBSD.

For me, the driving factor towards trying FreeBSD was: I'm unfamiliar with administering Linux in the sense of modern distributions.  Which files does the networking setup get saved in, how are daemons started and stopped, how is `su` versus `sudo` configured, and all that stuff.  So for me using Raspbian, I had to waste time to relearn things.  But then when things like 1-wire temperature sensors, GPIO, I2C required a lot of extra work on FreeBSD, I went the path of lesser resistance.


----------



## balanga (Jan 27, 2018)

I got an RPi a few years ago hoping to use it for learning something about electronics. Unfortunately nearly all the programming examples I look at for dealing with GPIO depend on the Python module RPi.GPIO which is not available on FreeBSD, and I just don't like using Linux so my electronics education is on hold at the moment...

Here's hoping someone can come up with RPi.GPIO module and include it in ports.


----------



## Deleted member 9563 (Jan 27, 2018)

Learning about electronics? It's a much better idea to get a digital multimeter.


----------



## Sensucht94 (Jan 27, 2018)

If on 64-bit ARM Cortex-53(Rpi3/Pine64)  BSD still lags behind Linux a little bit: FreeBSD CURRENT supports arm64 quite well, but still has some minor issues compared to Linux distros that provide good arm64 ports (Rasbpian or Arch/ARM, don't even waste time trying Fedora or Ubuntu ARM64 ports). OpenBSD 6.2 introduced official arm64 support but is still largely experimental and I wouldn't recommend it. 

However, in my experience, unless probably you buy an AMD Opteron ARM workstation, you're not going to see the difference between 32-bit and 64-bit on the 2Gb RAM and the limited A-53 CPU the Rpi3 come with. Personally I've made my tests, and came to the conclusion that on Rpi3, the OS choice is more inportant than a arm64 port. So, my recommendations;

- Void Linux-musl and Alpine only provide 32-bit armv7/armhf ports but eith their feather hardware requirements are the only Linux distros which is worth running as minimal desktop-workstation on rpi3

- NetBSD-CURRENT earmv6hf runs extremely well too on Rpi3, thanks to ebijun image

- Looking at Forum's threads about Rpi3, FreeBSD (either STABLE-armv7 or CURRENT-aarch64)  is another good choice, and there are many here using it, though personally don't,so it wpuld be better to hear their respinse.

Finally, bear in mind that, as far as I know,the only distros fully supporting Rpi3's wireless chip are Raspbian and Arch, while Fedora added it in 27, but after having tested it, I'd say it's still to unreliable. Only sone OSs provide support for Rpi3 bluetooth (NetBSD does for example, and I think FreeBSD too). Anyway, outside the diatro I mentioned above,you'll either need a Ethernet connection or a USB dongle


----------



## balanga (Jan 27, 2018)

OJ said:


> Learning about electronics? It's a much better idea to get a digital multimeter.



I meant learning electronics in the sense of being able to program electronic devices, sensors, switches, relays etc...


----------



## Spartrekus (Jan 27, 2018)

https://www.netbsd.org/about/

netbsd is buggy on the RPI3. The keyboard is not working.


----------



## CraigHB (Jan 27, 2018)

balanga said:


> I meant learning electronics in the sense of being able to program electronic devices, sensors, switches, relays etc...



If you want learn electronics do some single purpose stuff with 8 or 16 bit micro-controllers.  The programming is right down at the same level as the hardware.  If done a few projects like that as a hobbyist and it's interesting.  You use a proprietary IDE usually coding in C but you can do things in assembly if you want.  The thing about general purpose stuff is it's more about the software since the hardware is pretty generic.  You might learn some electronics in interfacing I2C or SPI stuff, but not to the extent of designing your own boards and coding the controllers like you do with single purpose devices.


----------



## balanga (Jan 27, 2018)

When I said I wanted to learn electronics, I didn't mean in any great depth just to know how to switch devices on and off or program sensors and such like. The what I'm hoping to do with the GPIO on my RPi, but using FreeBSD rather than Linux.


----------



## CraigHB (Jan 27, 2018)

Fair enough, just thought I'd mention that if you wanted to really get into it.


----------



## Spartrekus (Jan 28, 2018)

balanga said:


> When I said I wanted to learn electronics, I didn't mean in any great depth just to know how to switch devices on and off or program sensors and such like. The what I'm hoping to do with the GPIO on my RPi, but using FreeBSD rather than Linux.



Arduino is actually better suited for electronics. Arduino is more popular than Raspberry even, at least in France.

https://www.arduino.cc


----------



## balanga (Jan 28, 2018)

Spartrekus said:


> Arduino is actually better suited for electronics. Arduino is more popular than Raspberry even, at least in France.
> 
> https://www.arduino.cc



I may end up getting a  udoo x86 .


----------



## CraigHB (Jan 28, 2018)

Yeah Arduino is the way to go if you're purely into learning electronics, less time coding more time building circuits. And it's mostly open source so it's more akin to what FreeBSD is about.


----------



## Phishfry (Jan 29, 2018)

balanga said:


> I meant learning electronics in the sense of being able to program electronic devices, sensors, switches, relays etc...


How hard are any of these tasks?

Here you have it:
relay on-relay off
gpioctl 23 1
gpioctl 23 0

switch on-switch off
gpioctl 23 1
gpioctl 23 0

https://vzaigrin.wordpress.com/2014/04/18/working-with-gpio-on-raspberry-pi-with-freebsd/

I think what you meant to say is you need to learn how to write programs to use these controls.


----------



## Phishfry (Jan 29, 2018)

balanga said:


> I may end up getting a  udoo x86 .



Just for reference PC Engines APU2/3 Line and MinnowboardMax from Netgate are the only two x86 platforms with GPIO drivers for FreeBSD.


----------



## balanga (Jan 29, 2018)

Phishfry said:


> I think what you meant to say is you need to learn how to write programs to use these controls.



I think what I need to do is to learn how to build an RPi.GPIO python module for FreeBSD.... Trouble is, knowing me, it will probably take me a year to build it, so I'd better get started.... Here goes...

https://pypi.python.org/pypi/RPi.GPIO


----------



## Phishfry (Jan 29, 2018)

balanga said:


> I think what I need to do is to learn how to build an RPi.GPIO python module for FreeBSD


GPIO's are interfaced in Linux as sysfs. Anything related to GPIO on Linux can be thrown out the door for FreeBSD use.

There is already a python GPIO library for FreeBSD.
https://github.com/evadot/fbsd_gpio_py


----------



## balanga (Jan 29, 2018)

Phishfry said:


> GPIO's are interfaced in Linux as sysfs. Anything related to GPIO on Linux can be thrown out the door for FreeBSD use.
> 
> There is already a python GPIO library for FreeBSD.
> https://github.com/evadot/fbsd_gpio_py



Would I be able to use this library with this code with minor name substitutions:-

```
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
print "LED on"
GPIO.output(18,GPIO.HIGH)
time.sleep(1)
print "LED off"
GPIO.output(18,GPIO.LOW)
```


----------

