Hello i am wondering if someone could advise me on how to apply a patch to my build?
I have used the precomplied image and used image generator to build for my witi router. However both set the spi flash at 16mb instead of 32mb. I have a patch to fix this issue and have already built an image from source. Now i need to apply this patch in my build but cant seem to find a good guide or explanation on how to do this. The guide 'working with patches' seems to talk of patching packages rather than system source.
Anyway the patch i need to apply is as follows
commit e47c06f846d27aba6eb84b3d9d4af937bd58f82f
Author: build <build@mqmaker.com>
Date: Thu Mar 1 04:39:42 2018 +0000
to support 32MB nor flash
diff --git a/target/linux/ramips/dts/WITI.dts b/target/linux/ramips/dts/WITI.dts
index 91f6693..05c643b 100644
--- a/target/linux/ramips/dts/WITI.dts
+++ b/target/linux/ramips/dts/WITI.dts
@@ -76,7 +76,7 @@
partition@50000 {
label = "firmware";
- reg = <0x50000 0xfb0000>;
+ reg = <0x50000 0x1fb0000>;
};
};
};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 15ea9a1..2df8a76 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -176,7 +176,7 @@ TARGET_DEVICES += wf-2881
define Device/witi
DTS := WITI
- IMAGE_SIZE := $(ralink_default_fw_size_16M)
+ IMAGE_SIZE := $(ralink_default_fw_size_32M)
DEVICE_TITLE := MQmaker WiTi
DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci
endef
diff --git a/target/linux/ramips/patches-4.4/102-32m-nor-reset.patch b/target/linux/ramips/patches-4.4/102-32m-nor-reset.patch
new file mode 100644
index 0000000..668f526
--- /dev/null
+++ b/target/linux/ramips/patches-4.4/102-32m-nor-reset.patch
@@ -0,0 +1,25 @@
+diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
+index 1c9af71..6b44185 100644
+--- a/drivers/mtd/devices/m25p80.c
++++ b/drivers/mtd/devices/m25p80.c
+@@ -261,6 +261,12 @@ static int m25p_remove(struct spi_device *spi)
+ {
+ struct m25p *flash = spi_get_drvdata(spi);
+
++ printk("nor reset\n");
++ flash->command[0] = 0x66;
++ spi_write(flash->spi, flash->command, 1);
++ flash->command[0] = 0x99;
++ spi_write(flash->spi, flash->command, 1);
++
+ /* Clean up MTD stuff. */
+ return mtd_device_unregister(&flash->spi_nor.mtd);
+ }
+@@ -328,6 +334,7 @@ static struct spi_driver m25p80_driver = {
+ .id_table = m25p_ids,
+ .probe = m25p_probe,
+ .remove = m25p_remove,
++ .shutdown = m25p_remove,
+
+ /* REVISIT: many of these chips have deep power-down modes, which
+ * should clearly be entered on suspend() to minimize power use.