Skip to content

Commit

Permalink
odroidm1: fix flashcp --partition non-usage for old mtd-utils (bu…
Browse files Browse the repository at this point in the history
…llseye etc)
  • Loading branch information
rpardini committed Aug 22, 2023
1 parent c35adb3 commit 67f916c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions config/boards/odroidm1.wip
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 67f916c

Please sign in to comment.