Hello, here is a patch for flash-kernel to become nand-aware. I also built a package for armhf with this patch that is available from
https://debian.kleine-koenig.org/pool/main/f/flash-kernel/flash-kernel_3.56ukl2_armhf.deb
for testing. On my device (without bad blocks) this works fine.
After talking to some guys in #mtd on OFTC I think this is the right way
to go as upstream won't expand flashcp anytime soon.
Best regards
Uwe
--->8---
[PATCH] Use nand-aware tools to write to nand flashes
This fixes #813995 assuming that mtd-utils won't change
---
debian/changelog | 3 +++
functions | 14 +++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 75c69d0..5bfa975 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,9 @@ flash-kernel (3.57) UNRELEASED; urgency=medium
* Add new marvell kernel flavour as alternative for orion5x and
kirkwood.
+ [ Uwe Kleine-König ]
+ * use nandwrite when writing to nand flash.
+
-- Colin Watson <[email protected]> Fri, 29 Jan 2016 13:35:17 +0000
flash-kernel (3.56) unstable; urgency=medium
diff --git a/functions b/functions
index adfb85a..203edce 100644
--- a/functions
+++ b/functions
@@ -337,7 +337,19 @@ write_mtd() {
# Can't really flashcp to /dev/mtd<N> when testing
if [ -z "${FK_TESTSUITE_RUNNING}" ]; then
- flashcp "$input_file" "$output_mtd"
+ local flashtype=$(cat /sys/class/mtd/$base_mtd/type)
+ case "$flashtype" in
+ nand|mlc-nand)
+ flash_erase "$output_mtd" 0 0
+ nandwrite -p "$output_mtd" "$input_file"
+ ;;
+ nor)
+ flashcp "$input_file" "$output_mtd"
+ ;;
+ *)
+ error "unsupported flash type"
+ ;;
+ esac
else
cp "$input_file" "$output_mtd"
fi
--
2.1.4
signature.asc
Description: PGP signature

