Support for Creality-box wb01

Hi to all

i want to add this device to OpenWRT and made a successful build on 23.05-snapshot

so far, so good

but, when i tried to patch main snapshot & compile, i run into error with newly added Boya by25q128as

--- a/dev/null
+++ b//drivers/mtd/spi-nor/boya.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/mtd/spi-nor.h>
+
+#include "core.h"
+
+static const struct flash_info boya_parts[] = {
+        { "by25q128as", INFO(0x684018, 0, 64 * 1024, 256,
+                        SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
+                        SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+        },
+};
+
+const struct spi_nor_manufacturer spi_nor_boya = {
+       .name = "boya",
+       .parts = boya_parts,
+       .nparts = ARRAY_SIZE(boya_parts),
+};

this worked on 23.05 but on snapshot ...

error is:

make[4]: Entering directory '/mnt/data/openwrt/snapshot/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-6.1.82'
  CALL    scripts/checksyscalls.sh
  CC      drivers/mtd/spi-nor/boya.o
drivers/mtd/spi-nor/boya.c:9:58: error: macro "INFO" passed 5 arguments, but takes just 4
    9 |                         SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
      |                                                          ^
In file included from drivers/mtd/spi-nor/boya.c:4:
drivers/mtd/spi-nor/core.h:537: note: macro "INFO" defined here
  537 | #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors)              \
      | 
drivers/mtd/spi-nor/boya.c:7:25: error: 'INFO' undeclared here (not in a function)
    7 |         { "by25q128as", INFO(0x684018, 0, 64 * 1024, 256,
      |                         ^~~~
make[8]: *** [scripts/Makefile.build:250: drivers/mtd/spi-nor/boya.o] Error 1

ok, the key is

passed 5 arguments, but takes just 4

could somebody help me to "translate" spi-nor definition for main snapshot ?

tnx in advance

Maybe you can find a hint here :wink:

Looks like the patch needs updating for the newer kernel version in snapshot.

  • Which target is it, mt76x8?
  • Where did you get the patch from?

There are already two pending PRs for this device:

and I just read that the Boya patch conflicts with a BoHong patch that is already included. And it should work with the BoHong patch anyway?

Ohhhh ... damn it :smiley:

i was soo happy to finally made my first PR and give something to community :frowning: but, OK

yes, mt7688

yes, after all, i made it :slight_smile: at least, hope it is right way

--- a/dev/null
+++ b//drivers/mtd/spi-nor/boya.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/mtd/spi-nor.h>
+
+#include "core.h"
+
+static const struct flash_info boya_parts[] = {
+        { "by25q128as", INFO(0x684018, 0, 64 * 1024, 256)
+                        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+        },
+};
+
+const struct spi_nor_manufacturer spi_nor_boya = {
+       .name = "boya",
+       .parts = boya_parts,
+       .nparts = ARRAY_SIZE(boya_parts),
+};

and successfully compiled on snapshot and booted
everything is working well
WIFI, switch, usb ports

but, there is already 2 other PR, so there is no point to submit another ?

EDIT: Sorry, wrong copy&paste :smiley:

Good question - sometimes PRs get stuck if there is not much interest, this is an unfortunate situation. But in this case, the author of the more recent PR, did not respond to my comment and all and the PR itself looks somewhat abandoned. The author of the first patch hasn't made any comment for years, so this might also be abandoned.

From personal experience, it is sometimes better to post to the Mailing List instead of creating a PR - but YMMV. It also depends on the target, some targets have very active reviewers, some are less active. I got ipq40xx and mt7621 devices accepted very quickly, but lantiq and realtek took significantly longer!

ok, my main reason for taking care by my self is: switch & very bad WIFI

i found on internet few ready made image
they was outdated, or have problem with vlans on eth0, or WIFI was too weak

so i made a DTS with &esw, and wifi eprom entry, and magic :slight_smile: everything is in place, vlans as expected wiith swconfig/luci and wifi is good (as good it can be from small panel antenna) so i attached 2 USB printer and started to use as p910nd
ok, will wait this month and if there is no movement on other PRs ... will see

1 Like

you are right
bh25q128as = by25q128as
and my device work well with already included BoHong ...

ohh... wasted time for patching spi-nor :slight_smile:

There is never wasted time if you've learned something on this journey :wink:

I tried to add support for the Fritz!Box 3390 a few years back and for this purpose I wrote a custom Eterhernet PHY driver - just to find out that a fixed-link node works equally well and is actually the better solution. Long story short: I learned quite a bit about Ehternet PHY drivers and Linux drivers in general, something I wouldn't have done otherwise.

1 Like

I know that feeling.
Looking into support for the Creality-box WB02, which basically is the same hardware with a BT chip and a different flash layout. The last one has me stumped.

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 01000000 00010000 "ALL"
mtd1: 00030000 00010000 "Bootloader"
mtd2: 00010000 00010000 "Config"
mtd3: 00010000 00010000 "Factory"
mtd4: 000d0000 00010000 "Kernel"
mtd5: 007e0000 00010000 "RootFS"
mtd6: 00700000 00010000 "APP"
mtd7: 008b0000 00010000 "FW_OLD"
mtd8: 00fb0000 00010000 "FW_NEW"

so ... we are in trouble as i see

mine is WB01 and have same layout as your WB02
and no, there is no BT
box is labeled as WB01, fccid same as prev PR attempt
looking on manufacturer site, there is only one FW ...

but, regard to mtd layout, there is no problem since first 3 partition is in place, and rest is overwritten
radio calibration & MAC is in "factory"
so far, so good

Probably a redundant question but the layout of your WB01 is not?

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 01000000 00010000 "ALL"
mtd1: 00030000 00010000 "Bootloader"
mtd2: 00010000 00010000 "Config"
mtd3: 00010000 00010000 "Factory"
mtd4: 000d0000 00010000 "Kernel"
mtd5: 00ee0000 00010000 "RootFS"

If that is the case, it is seriously weird. Why keep selling WB01's if there is a replacement (WB02)?

As i said, same as your (wb02)
and NOT like prev PR

but, since DTS for "my" wb01 and prev wb01 is same, at least for flash layout
and the MAC & eeprom data is in same place, i see no reason for worry
looks like manufacturer switched to new layout with recent FW

would you please look at your WB, does have one or two MAC address?

you could use telnet to connect to original FW
10.10.10.254
root / cxswprin

well, actually, there is 3pcs of MAC stored in factory partition

factory@04 - OEM WIFI
factory@28 - OEM Ethernet
factory@2e - unused

root@wr199.wrt.ele:~# hexdump  /dev/mtd2
0000000 7628 0006 eefc 00e6 4c86 0000 0000 0000
0000010 ffff ffff ffff ffff ffff ffff ffff ffff
0000020 0000 0000 0020 0000 eefc ffe6 4c86 eefc
0000030 40e6 061b 3411 2000 ffff 0100 0000 0000
0000040 0000 0022 0000 0000 0030 0000 0000 0000
0000050 0082 9400 b940 cac0 831e 8383 ca40 8020
0000060 0000 0000 0000 0000 0000 0000 0000 0000

so, @andyboeh , you was right with your question about MAC addresses in PR submitted by chepo92

well ... here it is
if somebody want to try before i send PR

1 Like

The WB02 is at my work so sorry for the late reply.
As far as I can see mine only has one MAC address. See the ouput of ifconfig -a below.

This week I will try to compile a build and flash it to see if it also works on the wb02.

ifconfig -a
apcli0    Link encap:Ethernet  HWaddr FE:EE:62:00:50:FA
          inet addr:192.168.50.53  Bcast:192.168.50.255  Mask:255.255.255.0
          inet6 addr: fe80::fcee:62ff:fe00:50fa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

br0       Link encap:Ethernet  HWaddr FC:EE:62:00:50:FA
          inet addr:10.10.10.254  Bcast:10.10.10.255  Mask:255.255.255.0
          inet6 addr: fe80::feee:62ff:fe00:50fa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1109 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:452837 (442.2 KiB)

eth2      Link encap:Ethernet  HWaddr FC:EE:62:FF:50:FA
          inet6 addr: fe80::feee:62ff:feff:50fa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2266 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:888479 (867.6 KiB)
          Interrupt:3

eth2.1    Link encap:Ethernet  HWaddr FC:EE:62:FF:50:FA
          inet6 addr: fe80::feee:62ff:feff:50fa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:410 (410.0 B)

eth2.2    Link encap:Ethernet  HWaddr FC:EE:62:FF:50:FA
          inet6 addr: fe80::feee:62ff:feff:50fa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:492 (492.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:255 errors:0 dropped:0 overruns:0 frame:0
          TX packets:255 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:21746 (21.2 KiB)  TX bytes:21746 (21.2 KiB)

ra0       Link encap:Ethernet  HWaddr FC:EE:62:00:50:FA
          inet6 addr: fe80::feee:62ff:fe00:50fa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:4

Nope :slight_smile: you are wrong :slight_smile:
same as mine
radio is "00", eth is "FF"

FC:EE:62:00:50:FA
FC:EE:62:FF:50:FA

so, basically, same as WB01

suppose it will work, as i read on internet review / differences between wb01 and wb02 is only BT module
the question is: where they put this BT ?

you could paste here dmesg from your device, maybe we saw something ...

and about flash process
best is to try from telnet, as in commit message, this way, you will have visual track what is happening ...

please try to keep initial build as low as possible
only default package selection
since we have only cca 8.6 MB for initial flash

000d0000 "Kernel" + 007e0000 "RootFS" = 9109504 byte

it is limitation for first time flash, since flashing is done from OEM firmware, and OEM is limited with this two partition
next flashing with sysupgrade.bin could be larger because OWRT will replace partition table and we will have full size flash
good luck