[LEDE-DEV] [PATCH] bcm53xx: calculate TRX CRC32 using whole kernel partition

Rafał Miłecki zajec5 at gmail.com
Mon May 9 11:35:20 PDT 2016


This provides better protection of flash data.

Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
---
 target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc
index abbb04a..e8a7e4d 100644
--- a/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc
+++ b/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc
@@ -1,7 +1,12 @@
 #!/bin/sh
 #
-# Copyright (C) 2007 OpenWrt.org
+# Copyright (C) 2016 LEDE project
 #
 #
 
-mtd fixtrx firmware || mtd fixseama firmware
+kernel_size=$(cat /proc/mtd | egrep -m 1 "kernel|linux" | cut -d ' ' -f 2)
+[ -n "$kernel_size" ] && kernel_size=$((0x$kernel_size))
+
+mtd ${kernel_size:+-c $kernel_size} fixtrx firmware && exit 0
+mtd fixseama firmware && exit 0
+exit 1
-- 
1.8.4.5




More information about the Lede-dev mailing list