How to run FreeBSD on new boards built on Rockchip 35XX..

I'm also trying to get FreeBSD working on a RK35xx board, the Orange Pi 3B. Which uses RK3566, I pretty new to this, so I must confess I'm a little bit lost. I'd like to build an image that wouldn't require users to flash a new bootloader, so I'm trying to get this working with the onboard U-Boot bootloader. I've chose this board because it's a very cheap one and I could by from local resellers, I can in fact easily afford more expensive boards, but I wanted to have more people involved on this without the price barrier.

I'll try to register my progress on this thread. My goal is to have pfSense + WiFi working on this board, so this will probably be very difficult, but it should be very fun as well.
https://forums.freebsd.org/threads/raspberry-pi-5-status.91406/post-645892
renatoalencar, do you use JTAG and GDB to debug your Orange Pi 3B RK3566 board bring up? Flirc Jeff probe is a $16 USD or 15 EU$ 2 serial channel that provides a console port and a JTAG OpenOCD interface. What do you use? What JAG probes are you interested in? Can you share your thoughts?

I really want to see this inexpensive Arm64 Quad Core A55 running desktop FreeBSD or GhostBSD so that others have a chance for a first computer running FreeBSD / GhostBSD, like the old Commodore C64 was 40 years ago. Connected to a family TV for a Display Monitor and Sound , have a keyboard and mouse to allow for creativity and building. ( Tablets and Cellphones are for consuming media , not creating digital assets ie, spread sheets, CAD Computer Aided Design Files, Editing Video, Inkspace creating digital pictures). So, I applaud your efforts and encourage you to continue.

https://ghostbsd-arm64.blogspot.com/2023/12/how-to-install-ghostbsd-arm64-into-usb.html#more How to install GhostBSD-Arm64 into a USB SSD drive.
https://ghostbsd-arm64.blogspot.com/2024/01/january-19-2024-howto-download.html
Download FreeBSD 14.0-RELEASE image to write into a USB Flash drive stick or
Download GhostBSD-Arm64 image to write into a USB Flash drive stick.
 
i used u-boot from https://github.com/Kwiboo/u-boot-rockchip
just add CONFIG_EFI_LOADER=y to configs/orangepi-3b-rk3566_defconfig and it worked
i have a lot of hacks for this board most of the stuff is posted in the
https://forums.freebsd.org/threads/running-freebsd-on-radxa-rock-3c-rk3566-board.89389 thread
I've made this changes to the Orange Pi's U-Boot tree and could get it to work:

Code:
diff --git a/Makefile b/Makefile
index 590fd4c1f..f7f1309d2 100644
--- a/Makefile
+++ b/Makefile
@@ -360,7 +360,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
 KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
            -Wno-format-security \
            -fno-builtin -ffreestanding
-KBUILD_CFLAGS    += -fshort-wchar -Werror
+KBUILD_CFLAGS    += -fshort-wchar
 KBUILD_AFLAGS   := -D__ASSEMBLY__

 # Read UBOOTRELEASE from include/config/uboot.release (if it exists)
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index 7d0a9aa2f..91b2f7060 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -1040,7 +1040,7 @@ void board_quiesce_devices(void *images)

     /* relocate kernel after decompress cleanup */
     kernel_addr = env_get_ulong("kernel_addr_r", 16, 0);
-    if (kernel_addr != bootm_images->ep) {
+    if (bootm_images != NULL && kernel_addr != bootm_images->ep) {
         memmove((char *)bootm_images->ep, (const char *)kernel_addr,
             bootm_images->os.image_len);
         printf("== DO RELOCATE == Kernel from 0x%08lx to 0x%08lx\n",
diff --git a/common/main.c b/common/main.c
index 6a1159879..b14cc903e 100644
--- a/common/main.c
+++ b/common/main.c
@@ -63,6 +63,7 @@ void main_loop(void)
     if (cli_process_fdt(&s))
         cli_secure_boot_cmd(s);

+    run_command("fdt chosen; fdt set /aliases mmc0 \"/sdhci@fe310000\";", 0);
     autoboot_command(s);

     cli_loop();
diff --git a/configs/orangepi-3b-rk3566_defconfig b/configs/orangepi-3b-rk3566_defconfig
index 4b5eed949..9eece0bbd 100644
--- a/configs/orangepi-3b-rk3566_defconfig
+++ b/configs/orangepi-3b-rk3566_defconfig
@@ -211,7 +211,7 @@ CONFIG_LZ4=y
 CONFIG_LZMA=y
 CONFIG_SPL_GZIP=y
 CONFIG_ERRNO_STR=y
-# CONFIG_EFI_LOADER is not set
+CONFIG_EFI_LOADER=y
 CONFIG_AVB_LIBAVB=y
 CONFIG_AVB_LIBAVB_AB=y
 CONFIG_AVB_LIBAVB_ATX=y
diff --git a/make.sh b/make.sh
index 233bc9aa3..9978a2d7a 100755
--- a/make.sh
+++ b/make.sh
@@ -13,7 +13,8 @@ CMD_ARGS=$1
 ########################################### User can modify #############################################
 RKBIN_TOOLS=../rkbin/tools
 CROSS_COMPILE_ARM32=../prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
-CROSS_COMPILE_ARM64=../prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
+#CROSS_COMPILE_ARM64=../prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
+CROSS_COMPILE_ARM64=/sbin/aarch64-linux-gnu-
 ########################################### User not touch #############################################
 # Declare global INI file searching index name for every chip, update in select_chip_info()
 RKCHIP=

Only setting CONFIG_EFI_LOADER and making a small tweak for it to work.

I've also used the Quartz64 Model A device tree and changed the clocks and reset settings for the GMAC interface and got Ethernet working. I've been trying to fix some issues with the eqos driver (proper initialization and auto negotiation issues), got some progress, although at a slow pace.

I'm using the -CURRENT image, and I just need to load the
/boot/dtb/rockchip/rk3566-quartz64-a.dtb
device tree at first boot to get serial working. It's actually being easier than I thought initially, besides the networking stuff.

GMAC Device Tree:

Code:
&gmac1 {
        assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>;
        assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>;
        assigned-clock-rates = <0>, <125000000>;
        clock_in_out = "input";
        phy-supply = <&vcc_3v3>;
        phy-mode = "rgmii";
        pinctrl-names = "default";
        pinctrl-0 = <&gmac1m0_miim
                     &gmac1m0_tx_bus2
                     &gmac1m0_rx_bus2
                     &gmac1m0_rgmii_clk
                     &gmac1m0_clkinout
                     &gmac1m0_rgmii_bus>;
        snps,reset-gpio = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
        snps,reset-active-low;
        /* Reset time is 20ms, 100ms for rtl8211f */
        snps,reset-delays-us = <0 50000 200000>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
        phy-handle = <&rgmii_phy1>;
        status = "okay";
};
 
https://forums.freebsd.org/threads/raspberry-pi-5-status.91406/post-645892
renatoalencar, do you use JTAG and GDB to debug your Orange Pi 3B RK3566 board bring up? Flirc Jeff probe is a $16 USD or 15 EU$ 2 serial channel that provides a console port and a JTAG OpenOCD interface. What do you use? What JAG probes are you interested in? Can you share your thoughts?

I really want to see this inexpensive Arm64 Quad Core A55 running desktop FreeBSD or GhostBSD so that others have a chance for a first computer running FreeBSD / GhostBSD, like the old Commodore C64 was 40 years ago. Connected to a family TV for a Display Monitor and Sound , have a keyboard and mouse to allow for creativity and building. ( Tablets and Cellphones are for consuming media , not creating digital assets ie, spread sheets, CAD Computer Aided Design Files, Editing Video, Inkspace creating digital pictures). So, I applaud your efforts and encourage you to continue.

https://ghostbsd-arm64.blogspot.com/2023/12/how-to-install-ghostbsd-arm64-into-usb.html#more How to install GhostBSD-Arm64 into a USB SSD drive.
https://ghostbsd-arm64.blogspot.com/2024/01/january-19-2024-howto-download.html
Download FreeBSD 14.0-RELEASE image to write into a USB Flash drive stick or
Download GhostBSD-Arm64 image to write into a USB Flash drive stick.
I didn't try to use JTAG on this one, I need to find one and see it works with this board, looks like the SD card connection shares some pin with the JTAG interface, which may interfere with each other.

Looks like I need USB and HDMI working for this, so I'll try to do that later. I believe things should be partially in place for this.
 
Back
Top