Skip to content

Commit

Permalink
Attempt to make u-boot compile on btt cb2
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTheCoolingFan committed Jul 2, 2024
1 parent 886b4eb commit 4dc9c8e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions config/boards/bigtreetech-cb2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,38 @@ OVERLAY_PREFIX='rk3566'
BOOT_SOC="rk3566"
BOOTBRANCH="tag:v2024.04"
BOOTPATCHDIR="v2024.04"

DDR_BLOB="rk35/rk3566_ddr_1056MHz_v1.18.bin"
BL31_BLOB="rk35/rk3568_bl31_v1.43.elf" # NOT a typo, bl31 is shared across 68 and 66

function post_family_config__bigtreetech-cb2_use_mainline_uboot() {
display_alert "$BOARD" "mainline (Kwiboo's tree) u-boot overrides" "info"

BOOTSOURCE="https://github.com/Kwiboo/u-boot-rockchip.git"
BOOTBRANCH="branch:rk3xxx-2024.04" # specific commit tested is commit:ccef7dfc453bc03c5b5c61fa67d2745b96fa7da6
BOOTPATCHDIR="v2024.04" # empty, patches are already in Kwiboo's branch:rk3xxx-2024.04

BOOTDIR="u-boot-${BOARD}" # do not share u-boot directory

BOOTDELAY=1 # Wait for UART interrupt to enter UMS/RockUSB mode etc
UBOOT_TARGET_MAP="BL31=${RKBIN_DIR}/${BL31_BLOB} ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB};;u-boot-rockchip.bin u-boot-rockchip-spi.bin u-boot.itb idbloader.img idbloader-spi.img"
unset uboot_custom_postprocess write_uboot_platform write_uboot_platform_mtd # disable stuff from rockchip64_common; we're using binman here which does all the work already

# Just use the binman-provided u-boot-rockchip.bin, which is ready-to-go
function write_uboot_platform() {
dd if=${1}/u-boot-rockchip.bin of=${2} bs=32k seek=1 conv=fsync
}

# Smarter/faster/better to-spi writer using flashcp (hopefully with --partition), using the binman-provided 'u-boot-rockchip-spi.bin'
function write_uboot_platform_mtd() {
declare -a extra_opts_flashcp=("--verbose")
if flashcp -h | grep -q -e '--partition'; then
echo "Confirmed flashcp supports --partition -- read and write only changed blocks." >&2
extra_opts_flashcp+=("--partition")
else
echo "flashcp does not support --partition, will write full SPI flash blocks." >&2
fi
flashcp "${extra_opts_flashcp[@]}" "${1}/u-boot-rockchip-spi.bin" /dev/mtd0
}

}

0 comments on commit 4dc9c8e

Please sign in to comment.