Mkporayfw.c no longer avail in 22.03.0

I used to generate code for WT3020 modified to 16Mb flash with no problem since 19.07 i did the flash upgrade. Everything went well until 21.02.1 (last time I did the job)
Willing to upgrade to 22.03.0 I discover that the header generator previously located:
has disappeared. Therfore I was not abble to modify it so that to introduce teh 16M varaint.
however it is still used during the code generation (probably in a precompiled bin version as generating 8M code works and only 16M generation code fails). See error log hereafter

/home/francis/openwrt/staging_dir/host/bin/mkporayfw -B WT3020 -F 16M -f /home/francis/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-22.03.0-ramips-mt7620-nexx_wt3020-16m-squashfs-factory.bin -o /home/francis/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/
[mkporayfw] *** error: unknown flash layout "16M"

How can I restore the previous way of doing (access to mkporayfw.c, modifiy it , have it compiled automatically during code generation)
THX for you help

firmware-utils was separated to the external repository.;a=summary

You can generate a patch for your modification of mkporayfw.c and put the patch to tools/firmware-utils/patches/ in OpenWrt tree.


THX for the quick answer which unfortunately is above my competence level in code generation. I 'm a basic user.
Can you please give more detailed guidance:
1)generate a patch
2)put the patch in " tools/firmware-utils/patches/" (which donnot exist and is most probably not scanned by default by the make)

  1. clone firmware-utils repository, make changes, and generate a patch by git command.

    cd /your/working/directory/
    git clone
    cd firmware-utils/
    (edit mkporayfw.c)
    git diff HEAD > mkporayfw_16m.patch   # or any filename
  2. "patches" is a special directory on OpenWrt. The patches in the directory will be applied automatically when building the tool by build system of OpenWrt. If not exist, you can create.

1 Like

maybe I did wrong as it still fails
my working dir is /home/francis
I clone the firmware-utils at this location
cd firmware-utils/src
made the changes to mkporayfw.c
git diff HEAD > 900_mkporayfw_16m.patch # see the file content hereafter

diff --git a/src/mkporayfw.c b/src/mkporayfw.c
index 43c8885..9543efe 100644
--- a/src/mkporayfw.c
+++ b/src/mkporayfw.c
@@ -132,6 +132,9 @@ static struct flash_layout layouts[] = {
 	}, {
 		.id		= "8M",
 		.fw_max_len	= 0x7c0000,
+	}, {
+		.id		= "16M",
+		.fw_max_len	= 0xfc0000,
 	}, {
 		/* terminating entry */
@@ -229,6 +232,11 @@ static struct board_info boards[] = {
                 .layout_id      = "8M",
                 .key            = KEY_NEXX_2,
         }, {
+                .id             = "WT3020",
+                .hw_id          = HWID_NEXX_WT3020,
+                .layout_id      = "16M",
+                .key            = KEY_NEXX_2,
+        }, {

Then I found the following directory in the /home/francis/openwrt/target/linux/ramips/patches5.10
I copy the 900_mkporayfw_16m.patch file into that directory
but it sill doesn't' work with following error message

Applying /home/francis/openwrt/target/linux/ramips/patches-5.10/900_mkporayfw_16m.patch using plaintext: 
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|diff --git a/src/mkporayfw.c b/src/mkporayfw.c
|index 43c8885..9543efe 100644
|--- a/src/mkporayfw.c
|+++ b/src/mkporayfw.c
No file to patch.  Skipping patch.

look like I made a bad directory setting but I don't see how to fix it properly

target/linux/ramips/patches-5.10 is wrong place for the patch of mkporayfw.c. Please create a directory tools/firmware-utils/patches and put the patch to it. Of course, please delete the generated patch of mkporayfw.c from target/linux/ramips/patches-5.10.

OK, I had to rebuild from a fresh checkout so that to have the patch taken into consideration (seen from error log) . Look like the mkporayfw is not rebuild when you introduce the patch after being compiled once (object file not rebuild?).
Nevertheless the patch is well processed when using a fresh build.
Thank you very much for your help, I will update accordingly the "WT3020 increase flash size" documentation

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.