# Porting FreeBSD - First Steps



## ThothK (Aug 28, 2016)

Hi People,

I have agonized for a couple of weeks over how to ask and what to ask. 

I want to learn about porting FreeBSD to new devices. I have read a variety of pages and the docs but I do not feel that I have learned whatever I need to know in order to apply what I have read.
I believe that if I learn how to port FreeBSD and why certain tasks are performed, I can apply the knowledge to the following objectives:
1. Boot FreeBSD on an NVidia Shield K1 Tablet.
2. Boot FreeBSD on ARM based custom hardware the company I work for is putting together.
3. Boot FreeBSD on an Olimex A20 Lime.
4. Be able to convince the decision maker at the company that there is a path to FreeBSD.
5. Fantasy of booting FreeBSD on a Linksys 1900 AC and ACS.

I have used Crochet FreeBSD for two BeagleBone Blacks. I have also used the build available from freebsd.org on a third. 

What are the first steps I should investigate, perform, and / or whatever to port FreeBSD to a new platform? What are the first questions I should ask?


Some of the pages I have read:

Crochet FreeBSD New Board Example
github.com/freebsd/crochet/tree/master/board/NewBoardExample

Crochet FreeBSD Raspberry Pi Boot Readme 
github.com/freebsd/crochet/blob/master/board/RaspberryPi/boot/README

Flattened Device Tree
wiki.freebsd.org/FlattenedDeviceTree

FreeBSD / ARMv6 in QEMU
www.kernelnomicon.org/?p=229

Introduction to NanoBSD
www.freebsd.org/doc/en_US.ISO8859-1/articles/nanobsd/article.html

Loader(8)
www.freebsd.org/cgi/man.cgi?query=loader&sektion=8

Netbooting ARM/MIPS devices: kinds of kernel and u-boot
www.kernelnomicon.org/?p=327

Porting FreeBSD to a new ARM Board
www.bidouilliste.com/blog/2015/11/27/Porting-FreeBSD-to-a-new-ARM-Board-Part-1/
www.bidouilliste.com/blog/2015/11/28/Porting-FreeBSD-to-a-new-ARM-Board-Part-2/
www.bidouilliste.com/blog/2016/02/10/Porting-FreeBSD-to-a-new-ARM-Board-Part-3/

Porting MultiROM
github.com/Tasssadar/multirom/wiki/Porting-MultiROM

Resources For Newbies
https://www.freebsd.org/projects/newbies.html



Thank You,


-thoth-


----------



## a59303 (Aug 28, 2016)

Hi,

I don't know if this is obvious but there is a Porter's Handbook.

https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/

But also I found that this wiki (_elinux.org_) has a lot of in depth information. Links below from the same wiki, different pages.

http://elinux.org/Tegra/SoCs

http://elinux.org/Jetson_TK1

I hope you can get something out of that,


- a5'


----------



## ThothK (Aug 28, 2016)

Hi a5',

I do have a tab opened to the porters-handbook @ freebsd.org in my FreeBSD session. I think that once I get two of the devices booting to FreeBSD from the eMMC (or equivalent), I will be spending a bit of time there.

The Tegra SoC page provided a way for me to verify that the K1 in the Shield is the same as or close enough to what was used on the Jetson that I can use some of the code changes in FreeBSD head. 
Thank you for that.


-thoth-


----------



## a59303 (Aug 28, 2016)

You are welcome, although I now think this is more appropriate;

https://wiki.freebsd.org/EmbeddedHandbook

But also the handbook, porters handbook and developers handbook are linked under the documents tabs on the top of the page.

anyway,
good luck -a5


----------



## jrm@ (Aug 29, 2016)

The Porter's Handbook is not what you're after.  It describes porting third party software.   Think makefiles and packages, not porting the OS to new hardware.


----------



## ThothK (Aug 29, 2016)

Hi People,

After reviewing my notes and thinking about this segmented approach to figuring this all out, I think the first step includes, but is not limited to:

- Identify the processor used on the device.
- Determine if the bootloader is locked or unlocked.
- Identify the memory layout of the device.
- Determine the device's boot sequence up to main OS start.
- Identify how UBoot should be configured.

What else should I list as tasks and / or considerations while planning out the steps to perform prior to the next step? .... Which I have not determined as yet.



-thoth-


----------

