# How hard is it to learn to work on the kernel?



## EMBAUD (Apr 7, 2016)

Hi Everyone,

I am contemplating the use of FreeBSD for my upcoming embedded project.

I suspect that I am going to have to do a fair amount of work on the kernel to get things working properly, or fix issues.  I'm definitely going to have to write a couple of drivers.

I am an experienced C programmer but have no real experience with operating systems.   

What is it like working on the kernel?  Is it pretty clean?  Does it make sense?  Is it like the Linux kernel where it is competely opaque to an outsider?

This is a professional project, so I need the OS to be rock solid when we release.

My architecture is Xilinx Zynq, which is an ARM Cortex-A9 (armv7-A). 

Please let me know if this is a fools errand... 

Also, what is the best place to go ask development questions?

Thanks!


----------



## xavi (Apr 7, 2016)

EMBAUD said:


> Also, what is the best place to go ask development questions?



You could try the hackers mailing list.


----------



## SirDice (Apr 7, 2016)

This should help: https://wiki.freebsd.org/EmbeddedHandbook


----------



## ondra_knezour (Apr 7, 2016)

Also this https://wiki.freebsd.org/Graphics/Getting started with kernel projects may help

And there are books too
The Design and Implementation of the FreeBSD Operating System
FreeBSD Device Drivers

Regarding readability, cleanness etc. - it of course depends, but you can browse sources to get first impression


----------



## Pegasus711 (Apr 7, 2016)

If you are actually serious, besides the other books mentioned above, do try the embedded FreeBSD cookbook

http://www.amazon.in/Embedded-FreeBSD-Cookbook-Technology/dp/1589950046


----------



## EMBAUD (Apr 8, 2016)

Thanks everyone for the useful pointers.


----------



## Crivens (Apr 8, 2016)

Pegasus711 said:


> If you are actually serious, besides the other books mentioned above, do try the embedded FreeBSD cookbook
> 
> http://www.amazon.in/Embedded-FreeBSD-Cookbook-Technology/dp/1589950046


WARNING: This link is to the indian version (at least when I tried that right now), featuring prices in rupies. Being asked to pay close to 9k for a paperback book is "a bit of a surprise", when one is used to euros or dollars. 

Apart from that, I'll also check it out when I got some spare time


----------



## Pegasus711 (Apr 11, 2016)

hahaha.. well there is no Indian version of this book hence the large figure (due to the dollar conversion happening).

Nevertheless, what I meant to show was the title and more info on the book


----------



## Maelstorm (May 4, 2016)

It's not too bad to work on the kernel.  It does make logical sense.  Depending on the type of device that you are writing drivers for, there may be a device driver in the source tree that you can modify to fit your needs.  I believe that ARM currently has Tier 2 support, so some things may work and other things may not work.  To get a good compile for the CPU that you are using, it may be worthwhile to set certain variables to indicate the exact platform that you are compiling to.  Currently, looking at the release information, it looks like that AArch64 (Arm6) support will be added in FreeBSD 11.0.  That support looks like it is getting back ported to FreeBSD 10.3 Stable, so 10.4 should have some ARM support.  However, all of this is highly dependent on the compiler used, which is currently llvm-clang.


----------



## SirDice (May 4, 2016)

Maelstorm said:


> Currently, looking at the release information, it looks like that AArch64 (Arm6) support will be added in FreeBSD 11.0.


I'm sure it's just a typo but AArch64 is ARMv8. ARM6 is actually an ARMv3 core. As far as I know FreeBSD 10 already has support for ARMv6 and ARMv7 (I had a 10-STABLE working on my Pi) and work is being done in -CURRENT for ARMv8. 

https://en.wikipedia.org/wiki/List_of_ARM_microarchitectures
https://wiki.freebsd.org/FreeBSD/arm
https://wiki.freebsd.org/arm64

As a sidenote, there's also work being done on getting ARM to Tier 1: https://wiki.freebsd.org/ARMTier1


----------



## Maelstorm (May 4, 2016)

Then why not just call it ARMv8 and be done with it?  With all the different nomenclatures floating around, would it not be less confusing to use a more descriptive label to indicate which version of a platform is being talked about?


----------



## fnoyanisi (May 8, 2016)

This link has a handy cross-reference for FreeBSD source tree.


----------

