aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorMathieu Martin-Borret <mathieu.mb@protonmail.com>2020-07-10 13:40:58 +1000
committerPetr Štetiar <ynezz@true.cz>2020-07-13 22:45:04 +0200
commit96761ecc2f998e0ae082719ed27adbecd12e520f (patch)
treed16485b6f1129cf90fdfe95c8d9020a33d22a738 /target
parenta44eff6ad31a82f32ed8fa22c404787635ad623e (diff)
downloadupstream-96761ecc2f998e0ae082719ed27adbecd12e520f.tar.gz
upstream-96761ecc2f998e0ae082719ed27adbecd12e520f.tar.bz2
upstream-96761ecc2f998e0ae082719ed27adbecd12e520f.zip
kernel: mtdsplit_uimage: add SGE parser
Adding SGE parser for SGE (T&W) Shenzhen Gongjin Electronics to add 96 bytes padding the the firmware image Signed-off-by: Mathieu Martin-Borret <mathieu.mb@protonmail.com>
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
index 525ad8218b..7a9ec8acde 100644
--- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
+++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
@@ -408,6 +408,43 @@ static struct mtd_part_parser uimage_fonfxc_parser = {
};
/**************************************************
+ * SGE (T&W) Shenzhen Gongjin Electronics
+ **************************************************/
+
+#define SGE_PAD_LEN 96
+
+static ssize_t uimage_find_sge(u_char *buf, size_t len, int *extralen)
+{
+ if (uimage_verify_default(buf, len, extralen) < 0)
+ return -EINVAL;
+
+ *extralen = SGE_PAD_LEN;
+
+ return 0;
+}
+
+static int
+mtdsplit_uimage_parse_sge(struct mtd_info *master,
+ const struct mtd_partition **pparts,
+ struct mtd_part_parser_data *data)
+{
+ return __mtdsplit_parse_uimage(master, pparts, data,
+ uimage_find_sge);
+}
+
+static const struct of_device_id mtdsplit_uimage_sge_of_match_table[] = {
+ { .compatible = "sge,uimage" },
+ {},
+};
+
+static struct mtd_part_parser uimage_sge_parser = {
+ .owner = THIS_MODULE,
+ .name = "sge-fw",
+ .of_match_table = mtdsplit_uimage_sge_of_match_table,
+ .parse_fn = mtdsplit_uimage_parse_sge,
+};
+
+/**************************************************
* OKLI (OpenWrt Kernel Loader Image)
**************************************************/
@@ -470,6 +507,7 @@ static int __init mtdsplit_uimage_init(void)
register_mtd_parser(&uimage_netgear_parser);
register_mtd_parser(&uimage_edimax_parser);
register_mtd_parser(&uimage_fonfxc_parser);
+ register_mtd_parser(&uimage_sge_parser);
register_mtd_parser(&uimage_okli_parser);
return 0;