Edgerouter X 19.07 error reading factory partition

Hi,

I have been using OpenWRT 18.06 with Ubiquiti ER-X hardware and am now testing out OpenWRT 19.07. With one of my devices, I noticed a problem when booting 19.07.3 that the Ethernet MAC was being randomly generated instead of using the factory assigned address. I tracked this down to a problem with reading the factory partition.

What is unique about this hardware device is that there is a bad erase block in the factory partition. When booting either 18.06.8 or 19.07.3, this message is displayed:

[    3.131349] Bad eraseblock 7 at 0x0000000e0000                               
[    3.606280] Bad eraseblock 1901 at 0x00000eda0000                            

The Bad eraseblock 7 is the first block of the factory partition:

[    3.675606] 0x000000000000-0x000000080000 : "u-boot"                         
[    3.686570] 0x000000080000-0x0000000e0000 : "u-boot-env"                     
[    3.698195] 0x0000000e0000-0x000000140000 : "factory"                        
[    3.709341] 0x000000140000-0x000000440000 : "kernel1"                        
[    3.720426] 0x000000440000-0x000000740000 : "kernel2"                        
[    3.731523] 0x000000740000-0x00000ff00000 : "ubi"                            

Using dd to read the factory partition and then hexdump to convert it to text, I notice that the bad erase block is returned as valid data. The correct data starts at offset 0x20000.

root@OpenWrt:/tmp# dd if=/dev/mtd2 of=factory                                   
768+0 records in                                                                
768+0 records out                                                               
root@OpenWrt:/tmp# hexdump factory > factory.txt                                
root@OpenWrt:/tmp# head factory.txt                                             
0000000 0000 0000 0000 0000 0000 0000 0000 0000                                 
*                                                                               
0020000 8374 0bc2 0c8a 8376 0bc2 0c8a 41ee 7707                                 
0020010 0800 161f 0000 0000 0000 0000 0000 0000                                 
0020020 3fa5 8374 0bc2 0c8a 0016 3437 3338 3243                                 
0020030 4230 4138 4330 0000 0000 0000 0000 0000                                 
0020040 0000 0000 0000 0000 0000 3565 0030 0000                                 
0020050 0000 0000 0000 0000 0000 0000 0000 0000                                 

Performing this same sequence of steps using Openwrt 18.06.8 the bad erase block data is not returned as valid data. The correct data starts at offset 0.

root@OpenWrt:/tmp# dd if=/dev/mtd2 of=factory                                   
768+0 records in                                                                
768+0 records out                                                               
root@OpenWrt:/tmp# hexdump factory > factory.txt                                
root@OpenWrt:/tmp# head factory.txt                                             
0000000 8374 0bc2 0c8a 8376 0bc2 0c8a 41ee 7707
0000010 0800 161f 0000 0000 0000 0000 0000 0000
0000020 3fa5 8374 0bc2 0c8a 0016 3437 3338 3243
0000030 4230 4138 4330 0000 0000 0000 0000 0000
0000040 0000 0000 0000 0000 0000 3565 0030 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
*

Is there a possible problem with bad block handling in OpenWRT 19.07?

Any insight would be appreciated.
Thank you.