diff --git a/config/boards/odroidm1.wip b/config/boards/odroidm1.wip index 7d0f38231..e96368914 100644 --- a/config/boards/odroidm1.wip +++ b/config/boards/odroidm1.wip @@ -39,9 +39,18 @@ function post_family_config__uboot_config() { # We don't use u-boot-rockchip-spi.bin here; instead, write SPL and u-boot individually # If we're deinfesting from Petitboot, clear the environment too; PREBOOT will save a new one for mainline function write_uboot_platform_mtd() { - flashcp -v -p "${1}/idbloader-spi.img" /dev/mtd0 # write SPL - flashcp -v -p "${1}/u-boot.itb" /dev/mtd2 # write u-boot - if fw_printenv | grep -q -i petitboot; then # Petitboot leaves a horrible env behind, clear it off if so + declare extra_opts_flashcp="-p" # -p is: "read the flash and only write blocks that are actually different" + # if on bullseye, flashcp/mtd-utils is old, and doesn't have --partition/-p + if flashcp -h | grep -q -e '--partition'; then + echo "Confirmed flashcp supports --partition/-p -- read and write only changed blocks." >&2 + else + extra_opts_flashcp="" + echo "flashcp does not support --partition/-p, will write full SPI flash blocks." >&2 + fi + + flashcp -v "${extra_opts_flashcp}" "${1}/idbloader-spi.img" /dev/mtd0 # write SPL + flashcp -v "${extra_opts_flashcp}" "${1}/u-boot.itb" /dev/mtd2 # write u-boot + if fw_printenv | grep -q -i petitboot; then # Petitboot leaves a horrible env behind, clear it off if so echo "Found traces of Petitboot in SPI u-boot environment, clearing SPI environment..." >&2 flash_erase /dev/mtd1 0 0 # clear u-boot env fi