I will document how to build your own custom port for Nano-Pi R2S. This does not guarantee that everything will work but it is a start.
I am going to leave the method you install ports tree up to you. There are many.
So the first step for me is to find if U-Boot supports this platform.
I am looking at previous build source code on my computer for a "defconfig" file. This is the support file needed for a platform to build.
All U-Boot defconfig's are found in U-Boot source tree in a directory name
/configs.
So I move to a recent build on my computer and search.
I like to manually look instead of grepping. The file can be named strangely. I see what I need.
nanopi-r2s-plus-rk3328_defconfig
OK so U-Boot supports this platform. We can build a custom port on FreeBSD.
Create a new directory for your custom port. Since there is already a R2S (Non-Plus model) we will annotate our directory name.
mkdir /usr/ports/sysutils/u-boot-nanopi-r2s-plus
So we build a new port by adding a directory under /usr/ports/sysutils directory.
Doing so will allow our custom port to adopt the settings of u-boot-master. This is the parent port and your custom port is a child.
Now in this directory we need to add two new files. One is the build director file. Aptly named Makefile. The other is a description of this port along with instructions.
Both are raw text files and can be created with an editor that we will use to create our two files. I like to use ee but some users may prefer vi or nano.
Lets move the the new directory you have created.
cd /usr/ports/sysutils/u-boot-nanopi-r2s-plus
Now that I am under my custom ports directory I will create the two needed files. Their names:
Makefile and
pkg-descr
ee Makefile
Code:
MASTERDIR= ${.CURDIR}/../u-boot-master
MODEL= nanopi-r2s-plus
BOARD_CONFIG= nanopi-r2s-plus-rk3328_defconfig
FAMILY= rk3328
UBOOT_EXTRA_TARGETS= u-boot.itb
.include "${MASTERDIR}/Makefile"
After you insert this properly to your new file hit <ESC> key to save and exit.
Notice the directive here. EXTRA_TARGETS. It probably means something about how it boots.
I simply took the R2S Makefile and added the defconfig for R2S-plus.
There is a good chance the board works similar to R2S.
OK now for the second file. The ports package description file and package notes.
pkg-descr
ee pkg-descr
Code:
U-Boot loader and related files for the Nanopi R2S-plus.
To install this bootloader on an sdcard just do:
dd if=/usr/local/share/u-boot/u-boot-nanopi-r2s-plus/idbloader.img of=/path/to/sdcarddevice seek=64 bs=512 conv=sync
dd if=/usr/local/share/u-boot/u-boot-nanopi-r2s-plus/u-boot.itb of=/path/to/sdcarddevice seek=16384 bs=512 conv=sync
Once again I have copied this file from R2S and changed name and paths.
Notice how the port instructions work? There is no partition to add. These instructions come right from R2S build.
OK so now you have a port structure you can build your port.
make install
Follow the instructions for the port to flash to MicroSD card.