FreeBSD 14.0 Compiling kernel for Raspberry Pi 4B

 FreeBSD 14.0 Compiling kernel for Raspberry Pi 4B

in 4 easy steps, updated December 13, 2022

  1. Start with a downloaded RPI image .img FreeBSD snapshot file you can write into a USB Flash drive.
  2. Boot  the from USB Flash drive image built from a  Snapshot image  
  3. Use the running Snapshot image FreeBSD use "bsdinstall" to download and install FreeBSD, over the ethernet cable connected to your router, to the external usb Hard drive or SSD drive.
  4. Shutdown reboot,  remove the USB Flash drive stick from the RasPi4B, reboot from the external usb Hard drive or SSD drive.

Here is the September 9, 2022 FreeBSD 14.0 Snapshot image for RPI 3 or 4, right click on to "save as" a file on your local hard drive.  or use either of the commands: 

curl -O https://url_link   

wget -c https://url_link 

FreeBSD-14.0-CURRENT-arm64-aarch64-RPI-20221209-b1ef176eb528-259626.img.xz This is a December 9 2022 image

Write the uncompressed .img file into a USB flash drive.  

  1. Download file first , 
  2. then second uncompress the .xz file to an .img file,  
  3. third write into a USB Flash drive using a tool appropriate to your operating system.

xz -dv  FreeBSD-14.0-CURRENT-arm64-aarch64-RPI-20220902-e1963173708-257718.img.xz   A great tutorial on the Data Duplicator (better known a Disk Destroyer) command.


Balena Etcher


Linux:   Use what Linux image you prefer.  Checkout if you need a small linux

Where X is a,b,c, or d   sba  or sbb or sbc or sbd  Notice Capitol M in the "bs=1M" block size option

 dd if=FreeBSD-14.0-CURRENT-arm64-aarch64-RPI-20220902-e1963173708-257718.img of=/dev/sdX  bs=1M conv=sync status=progress 

*BSD:  Check out these two live images that run from a USB flash drive.  Use these running live images as a tool to download the FreeBSD image file, uncompress the .img.xz file, and write the file to the USB flash drive stick 

Where X is 0, 1, 2, 3 da0 or da1 or da2 or da3 
dd if=/path/to/GhostBSD-YY.MM.DD.iso of=/dev/daX bs=1m conv=sync status=progress  or for Raspberry Pi OS tools for Raspberry Pi 4B hardware.
you can find the rpi-imager tool here, and the Raspberry Pi OS, and many other helpful items.  Github for rpi-imager software

Download and install Raspberry Pi Imager to a computer with an SD card reader.
Put the SD card you'll use with your Raspberry Pi into the reader and run Raspberry Pi Imager. in a Terminal window.

Setup the Raspberry Pi to boot from a USB flash drive. Insert the made USB flash drive to boot the raspberry pi 4B hardware.  Run the raspi-conf program to update the hardware configuration to boot from USB Flash drive before Micro SD card.

Attach a USB SSD and run "bsdinstall"

Attach an external USB hard drive (or SSD) via a USB 3.0 cable (or USB 2.0 cable)

Run command line "bsdinstall"  and install FreeBSD 14.0 from over the ethernet internet to your blank SSD drive.  Afterwards, "shutdown -r now", remove the USB flash drive after shutdown and before reboot.  The system should boot from external USB hard drive (or SSD).  Congratulations you have a booting functioning  FreeBSD operating system installed to your hard disk or SSD.  Enjoy the fruits of your labor.

Booting from external USB SSD

After booting up a Fresh FreeBSD kernel from the external USB SSD with a Ethernet cable connected from Gigabit RJ-45 Ethernet port to your router.  Check that you are connected to the internet.  First check that you can ping the router:   ping -c 3  or  ping -c 3

ping -c 3  IP number for Google DNS 

ping -c 3  IP Name for Hurricane Electric IP network provider.  Also Supports IP6 networking

Verify the local time and that the nntp time daemon has updated the local time clock for FreeBSD.

The command:
           date 202206131627
     sets the date to “June 13, 2022, 4:27 PM”.


su root


 Installing FreeBSD Source Code 14.0-CURRENT to /usr/src

Originally download original /usr/src code head

git -C /usr clone -o freebsd -b main --depth 1 src

One-off, 2021-03-02,  Use this line to update  freebsd code to current state

git -C /usr/src pull --ff-only --unshallow

Standard update to /usr/src  code to the latest

git -C /usr/src pull --ff-only



git -C /usr clone -o freebsd -b main src

After Git Clone Pull source Code; Update Patch Audio code; Compile kernel

"time" the process.  Take about 17,500 seconds ( or about 5 hours on Raspberry Pi 4B with 8 gigs ram and running at 1500Mhz CPU clock. with out a "-j4"; equivalent to "-j1" or use one CPU for jobs.  6600 seconds with "-j4")   The make installkernel  takes about 3 or 4 minutes.
Two Lines to make and install the patched version of the Kernel from a standard user account use "sudo".   See the Patching FreeBSD paragraph below.

cd /usr/src
su root
time make -j4 buildkernel KERNCONF=GENERIC-VCHIQ
time make -j4 installkernel KERNCONF=GENERIC-VCHIQ

Robonuggie Youtube Channel Videos about Installing FreeBSD 13

Here are some related videos about Installing and using Desktop Environments for FreeBSD 13.0 on Raspberry Pi 4 and 400 hardware. has some great videos about installing FreeBSD 13.0 on Raspberry Pi 4 and 400 hardware: Installing FreeBSD 13.0, A Viable alternative, Not Rasberry Pi O/S A week using FreeBSD 13.0 on Raspberry Pi 400 ,  

Patching FreeBSD source code tree with HDMI Audio vchiq patch

[PATCH] Experimental vchiq and bcm2835_audio support for arm64 and arm32  Marcos improved Patchfile source Marcos Patchfile source
Select the whole patch source code from above URL link,  copy, paste into a filename like "HDMI_VCHIQ_sound_patch.txt".  Then follow steps below to patch kernel source code as ROOT user in source code directory base  /usr/src <>

Does this match your usage work flow? I am asking you to verify the steps,
so that I or others can duplicate those steps and have a working kernel to install.
please modify, add, or update the steps below:

su root
cd /usr/src
patch -v <HDMI_VCHIQ_sound_patch.txt
time make -j4 buildkernel KERNCONF=GENERIC-VCHIQ
time make -j4 installkernel KERNCONF=GENERIC-VCHIQ
reboot FreeBSD operating system and use the newly compiled kernel
uname -aK    What is the presently running kernel version.
ls -l /boot/kernel      Look at the file sizes and file dates FYI

Now I expect that HDMI port #0 sound will work and output to my Television connected via HDMI cable to TV's HDMI input #2. So when my tv is displaying the Raspberry Pi 4B desktop screen. Opening FireFox version 104 browser to will play some Video and AUDIO too.

Your thoughts are welcome in the comments below?

ps. I tested the above steps for rebuilding my FreeBSD 14.0-CURRENT kernel and installing FreeBSD 14.0-CURRENT GENERIC-VCHIQ kernel. It worked and I opened Firefox Browser and played Youtube videos.  This made the audio sound come out the mini-HDMI port and play on the Television speakers.  WOW!  Great advance.  Made the FreeBSD distro installation come alive on my Raspiberry Pi 4B.


 FreeBSD ARM Mailing list  archives

Marco's Reply with simple test outputs 

    stock config.txt and dtb-s. 
    dmesg should then show
    vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b87b irq 72 on simplebus0
    vchiq: local ver 8 (min 3), remote ver 8.
    pcm0: <VCHIQ audio> on vchiq0
      cat /dev/random > /dev/dsp
    should play static
    If nothing’s playing, flipping the sysctl dev.pcm.0.dest through
     - 0: both hdmi and headphones
     - 1: headphones
     - 2: hdmi
    usually brings the audio back to life.

     Freds Thanks to Marco

    Ports Manual Information for Handbook and wiki 


    Popular posts from this blog module error, symbol versionsort@FBSD_1.7 not found, ARM64 Raspberry Pi 4B hardware, FreeBSD 14.0-CURRENT

    Download a FreeBSD 14.0 Current version for Raspberry Pi