Skip to content

Instantly share code, notes, and snippets.

@Pavlos1
Created February 14, 2024 15:50
Show Gist options
  • Save Pavlos1/b60e07e184777af60095c04ebdd55c95 to your computer and use it in GitHub Desktop.
Save Pavlos1/b60e07e184777af60095c04ebdd55c95 to your computer and use it in GitHub Desktop.
Ox64 proof of concept: boot NuttX from flash
##############################################################################
# In this document, we outline the steps required to make a standalone flash
# image for the Ox64 that boots NuttX. We will be using the OpenBouffalo
# buildroot overlay to help us with this, but we will not be building the
# Linux kernel or rootfs.
##############################################################################
# We are using a patched OpenBouffalo overlay so that NuttX is loaded at
# 0x50200000 instead of 0x50000000. If you wish, you can build your own
# NuttX image whose memory map starts at 0x50000000, and then continue following
# these instructions using the upstream OpenBouffalo overlay instead.
git clone -b nuttx_poc https://github.com/Pavlos1/buildroot_bouffalo
git clone https://github.com/buildroot/buildroot
export BR_BOUFFALO_OVERLAY_PATH=$(pwd)/buildroot_bouffalo
cd buildroot
make BR2_EXTERNAL=$BR_BOUFFALO_OVERLAY_PATH pine64_ox64_defconfig
# Note: These are the same settings as you would set when building a regular
# OpenBouffalo linux image.
make menuconfig
# * Navigate to Target Options
# * Enable Integer Multiplication and Division (M)
# * Enable Atomic Instructions (A)
# * Enable Single-precision Floating-point (F)
# * Enable Double-precision Floating-point (D)
# * Set Target ABI to lp64d
# * Under Toolchain, enable Fortran support and OpenMP support
# Avoid building the whole system...
make opensbi uboot oblfr
cd output/images
# Download the NuttX image. You may replace it with your own if you wish, but
# make sure it still ends up at output/images/ImageNuttx
wget -O ImageNuttx https://github.com/lupyuen2/wip-pinephone-nuttx/releases/download/bl808d-1/Image
# Compress the NuttX image
lz4 ImageNuttx ImageNuttx.lz4
# Generate our equivalent of `bl808-firmware.bin`.
# Note: I don't think `u-boot.dtb` gets picked up by NuttX at all. It's just
# here so that mergebin.py has something vaguely sensible to process.
$BR_BOUFFALO_OVERLAY_PATH/board/pine64/ox64/mergebin.py \
-o bl808-nuttx.bin -k ImageNuttx.lz4 -d u-boot.dtb -s fw_jump.bin
##############################################################################
# File checklist (in output/images):
# * m0_lowload_bl808_m0.bin
# * d0_lowload_bl808_d0.bin
# * bl808-nuttx.bin
#
# Flash these the same way you would flash normal OpenBouffalo images.
##############################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment