[OpenWrt-Devel] mtd: sysupgrade: Is `mtd write` Correct for NAND-Based Devices?
Jeff Kletsky
lede at allycomm.com
Tue Apr 9 14:44:40 EDT 2019
In going through code used by a port of an IPQ4019 device, I see that
target/linux/ipq40xx/base-files/lib/upgrade/linksys.sh
in platform_do_upgrade_linksys()
writes the image using
get_image "$1" | mtd write - $part_label
This surprises me as I had thought that NAND-based flash should use
NAND utilities because of the possibility of bad blocks and metadata.
The OEM firmware follows more of what I had expected to see:
ubifs_v1.1.4/usr/sbin/update_defs (Linksys OEM)
in erase_and_program()
if [ ${FLASH_TYPE} = "MTD_NANDFLASH" ]; then
echo -ne "\tErasing... /dev/$2\n" >> /dev/console
if [ "$VERBOSE" = "yes" ]; then
# flash_eraseall -j /dev/$2
flash_erase /dev/$2 0 0
else
# flash_eraseall -q -j /dev/$2
flash_erase -q /dev/$2 0 0
fi
check_error
echo -ne "\tProgramming... /dev/$2\n" >> /dev/console
if [ "$VERBOSE" = "yes" ]; then
#nandwrite -m -a -p /dev/$2 $3
nandwrite -p /dev/$2 $3
else
#nandwrite -q -m -a -p /dev/$2 $3
nandwrite -q -p /dev/$2 $3
fi
check_error
fi
While I don't have any bad blocks in my NAND (yet), should this be changed
to use the NAND-based utilities in a separate patch?
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20190409/d3c3fd19/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list