true-systems / ubnt-openwrt-flashing

Flashing OpenWrt directly from factory image running AirOS v6.1.7
23 stars 7 forks source link

Versions: New(393220) 6.0.4, Required(393476) 6.1.4 #4

Closed F4HTB closed 7 months ago

F4HTB commented 1 year ago

Hello,

I try your process to factory install openwrt. I was an issue, last message was Versions: New(393220) 6.0.4, Required(393476) 6.1.4

Can you help? Thanks!

Teusner commented 1 year ago

Hi,

Same here, I've got:

[...]
Flash start: 9F000000
Flash end: 9F800000
Header MAGIC 'OPEN'
Current: XW.ar934x.v6.1.7.32555.180523.1754

New ver: XW.ar934x.v6.0.4-42.OpenWrt-r11257-5090152ae3
Versions: New(393220) 6.0.4, Required(393476) 6.1.4
Invalid version 'XW.ar934x.v6.0.4-42.OpenWrt-r11257-5090152ae3'

I don't have any solutions for now. I'm interested in any fix and I will keep you informed if I find any solutions on my side

Teusner commented 1 year ago

If the problem persists, I found a solution: flash using flash-sysupgrade instead of using flash-factory (don't really know what is the difference between these two solutions, but they seems presented as equivalent in the README.md ...)

So you'll need to download the sysuprgade image instead of the factory image, available here: https://downloads.openwrt.org/releases/19.07.5/targets/ath79/generic/openwrt-19.07.5-ath79-generic-ubnt_bullet-m-xw-squashfs-sysupgrade.bin

Then here is a copy of my successful flash if it could help:

> make flash-sysupgrade FW_OWRT=openwrt-19.07.5-ath79-generic-ubnt_bullet-m-xw-squashfs-sysupgrade.bin
wget https://dl.ubnt.com/firmwares/XW-fw/v6.1.7/XW.v6.1.7.32555.180523.1754.bin
--2023-09-11 15:21:46--  https://dl.ubnt.com/firmwares/XW-fw/v6.1.7/XW.v6.1.7.32555.180523.1754.bin
Resolving dl.ubnt.com (dl.ubnt.com)... 3.162.36.64
Connecting to dl.ubnt.com (dl.ubnt.com)|3.162.36.64|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7531809 (7,2M) [application/octet-stream]
Saving to: ‘XW.v6.1.7.32555.180523.1754.bin’

XW.v6.1.7.32555.180523.1754.bin                    100%[================================================================================================================>]   7,18M  1,33MB/s    in 6,6s    

2023-09-11 15:21:53 (1,10 MB/s) - ‘XW.v6.1.7.32555.180523.1754.bin’ saved [7531809/7531809]

ssh-copy-id ubnt@192.168.1.20
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 3 key(s) remain to be installed -- if you are prompted now it is to install the new keys
ubnt@192.168.1.20's password: 

Number of key(s) added: 3

Now try logging into the machine, with:   "ssh 'ubnt@192.168.1.20'"
and check to make sure that only the key(s) you wanted were added.

Creating factory firmware backup
ssh ubnt@192.168.1.20 "cat /dev/mtd2 /dev/mtd3" > firmware-backup.bin
ubnt@192.168.1.20's password: 
ssh ubnt@192.168.1.20 "umount /tmp ;mount -t tmpfs tmpfs /tmp"
ubnt@192.168.1.20's password: 
scp flash-sysupgrade.sh openwrt-19.07.5-ath79-generic-ubnt_bullet-m-xw-squashfs-sysupgrade.bin XW.v6.1.7.32555.180523.1754.bin ubnt@192.168.1.20:/tmp
ubnt@192.168.1.20's password: 
flash-sysupgrade.sh                                                                                                                                                       100%   12KB   1.1MB/s   00:00    
openwrt-19.07.5-ath79-generic-ubnt_bullet-m-xw-squashfs-sysupgrade.bin                                                                                                    100% 4096KB   1.9MB/s   00:02    
XW.v6.1.7.32555.180523.1754.bin                                                                                                                                           100% 7355KB   1.9MB/s   00:03    
ssh ubnt@192.168.1.20 "/bin/sh /tmp/flash-sysupgrade.sh /tmp/openwrt-19.07.5-ath79-generic-ubnt_bullet-m-xw-squashfs-sysupgrade.bin 2>&1" | tee flash-sysupgrade.log
ubnt@192.168.1.20's password: 
Verifying /sbin/ubntbox checksum...
Trying to unlock flash...
Found mtd block: /dev/mtd0(u-boot)
Found mtd block: /dev/mtd1(u-boot-env)
Found mtd block: /dev/mtd2(kernel)
Found mtd block: /dev/mtd3(rootfs)
Found mtd block: /dev/mtd4(cfg)
Found mtd block: /dev/mtd5(EEPROM)
Got U-Boot variable: mtdparts = mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),1024k(kernel),6528k(rootfs),256k(cfg),64k(EEPROM)
Adding U-Boot partition: u-boot 9F000000 00040000
Adding U-Boot partition: u-boot-env 9F040000 00010000
Adding U-Boot partition: kernel 9F050000 00100000
Adding U-Boot partition: rootfs 9F150000 00660000
Adding U-Boot partition: cfg 9F7B0000 00040000
Adding U-Boot partition: EEPROM 9F7F0000 00010000
Calculating flash size:
Adding block: /dev/mtd0("u-boot") - size: 00040000
Adding block: /dev/mtd1("u-boot-env") - size: 00010000
Adding block: /dev/mtd2("kernel") - size: 00100000
Adding block: /dev/mtd3("rootfs") - size: 00660000
Adding block: /dev/mtd4("cfg") - size: 00040000
Adding block: /dev/mtd5("EEPROM") - size: 00010000
Total flash size: 00800000
Flash start: 9F000000
Flash end: 9F800000
Header MAGIC 'UBNT'
Current: XW.ar934x.v6.1.7.32555.180523.1754

New ver: XW.ar934x.v6.1.7.32555.180523.1754
Versions: New(393479) 6.1.7, Required(393476) 6.1.4
FW Part: "u-boot"(1), MAGIC: 'PART', Base: 0x9F000000, DLen: 0x0003A408, PLen: 0x00040000
FW Part: "kernel"(2), MAGIC: 'PART', Base: 0x9F050000, DLen: 0x000E9BB2, PLen: 0x00100000
FW Part: "rootfs"(3), MAGIC: 'PART', Base: 0x9F150000, DLen: 0x00600000, PLen: 0x00660000
FW Part: "script"(4), MAGIC: 'EXEC', Base: 0x00000000, DLen: 0x0000A9EE, PLen: 0x0000A9EE
FW Part: "signtr"(5), MAGIC: 'EXEC', Base: 0x00000000, DLen: 0x00000121, PLen: 0x00000121
Signature partition found
Signature verified
Signature MAGIC 'END.'
FW Part: "u-boot"(1), MAGIC: 'PART', Base: 0x9F000000, DLen: 0x0003A408, PLen: 0x00040000
Skipping 'u-boot' FW part.
FW Part: "kernel"(2), MAGIC: 'PART', Base: 0x9F050000, DLen: 0x000E9BB2, PLen: 0x00100000
FW Part: "rootfs"(3), MAGIC: 'PART', Base: 0x9F150000, DLen: 0x00600000, PLen: 0x00660000
FW Part: "script"(4), MAGIC: 'EXEC', Base: 0x00000000, DLen: 0x0000A9EE, PLen: 0x0000A9EE
Extract Script: 'tar -xz -C /tmp'
Pre-Check Script '/tmp/bin/precheck' success.
FW Part: "signtr"(5), MAGIC: 'EXEC', Base: 0x00000000, DLen: 0x00000121, PLen: 0x00000121
Signature partition found
Adding adjusted FW partition:
name:   'kernel'
flash_base: 0x9F050000
mem_base:   0x80002000
size:       0x00100000
entry_point:    0x80002000
data_len:   0x000E9BB2
desc_cksum: 0x00000000
file_cksum: 0x00000000
===========================
Adding adjusted FW partition:
name:   'rootfs'
flash_base: 0x9F150000
mem_base:   0xBDBDBDBD
size:       0x00660000
entry_point:    0xBDBDBDBD
data_len:   0x00600000
desc_cksum: 0x00000000
file_cksum: 0x00000000
===========================
Signature MAGIC 'END.'
Working(1) with block: /dev/mtd0
Skipping: artificial: 0, unallocated: 0,writeable: 1024(WRITEABLE: 400, flags: C00), fw.flash_base: 9F050000 < blk->base: 9F000000 + blk->size: 40000
Copying FIS partition: 0 =>
name:   'u-boot'
flash_base: 0x9F000000
mem_base:   0xBDBDBDBD
size:       0x00040000
entry_point:    0xBDBDBDBD
data_len:   0x00040000
desc_cksum: 0xBDBDBDBD
file_cksum: 0xBDBDBDBD
===========================
Working(1) with block: /dev/mtd1
Skipping: artificial: 0, unallocated: 0,writeable: 1024(WRITEABLE: 400, flags: C00), fw.flash_base: 9F050000 < blk->base: 9F040000 + blk->size: 10000
Copying FIS partition: 1 =>
name:   'u-boot-env'
flash_base: 0x9F040000
mem_base:   0xBDBDBDBD
size:       0x00010000
entry_point:    0xBDBDBDBD
data_len:   0x00010000
desc_cksum: 0xBDBDBDBD
file_cksum: 0xBDBDBDBD
===========================
Working(1) with block: /dev/mtd2
Working(2) with block: /dev/mtd2
End check: 9F050000 + 00100000 <= 9F150000
Creating FIS partition: 2 =>
name:   'kernel'
flash_base: 0x9F050000
mem_base:   0x80002000
size:       0x00100000
entry_point:    0x80002000
data_len:   0x000E9BB2
desc_cksum: 0x00000000
file_cksum: 0x00000000
===========================
Working(1) with block: /dev/mtd2
Skipping: artificial: 0, unallocated: 0,writeable: 1024(WRITEABLE: 400, flags: C00), fw.flash_base: 9F150000 < blk->base: 9F050000 + blk->size: 100000
Working(1) with block: /dev/mtd3
Working(2) with block: /dev/mtd3
End check: 9F150000 + 00660000 <= 9F7B0000
Creating FIS partition: 3 =>
name:   'rootfs'
flash_base: 0x9F150000
mem_base:   0xBDBDBDBD
size:       0x00660000
entry_point:    0xBDBDBDBD
data_len:   0x00600000
desc_cksum: 0x00000000
file_cksum: 0x00000000
===========================
Working(3) with block: /dev/mtd4
Copying FIS partition: 4 <=
name:   'cfg'
flash_base: 0x9F7B0000
mem_base:   0xBDBDBDBD
size:       0x00040000
entry_point:    0xBDBDBDBD
data_len:   0x00040000
desc_cksum: 0xBDBDBDBD
file_cksum: 0xBDBDBDBD
===========================
Working(3) with block: /dev/mtd5
Copying FIS partition: 5 <=
name:   'EEPROM'
flash_base: 0x9F7F0000
mem_base:   0xBDBDBDBD
size:       0x00010000
entry_point:    0xBDBDBDBD
data_len:   0x00010000
desc_cksum: 0xBDBDBDBD
file_cksum: 0xBDBDBDBD
===========================
New FIS entries count 6
Executing: '/bin/updatefix.sh 393479 393479'
Current ver: 393479
New version: 393479
No need to fix.
'/bin/updatefix.sh 393479 393479' result: 0
Exec Script: '/tmp/bin/preflash'
Working(1) with block: /dev/mtd0
Skipping: artificial: 0, unallocated: 0,writeable: 1024(WRITEABLE: 400, flags: C00), fw.flash_base: 9F050000 < blk->base: 9F000000 + blk->size: 40000
Copying FIS partition: 0 =>
name:   'u-boot'
flash_base: 0x9F000000
mem_base:   0xBDBDBDBD
size:       0x00040000
entry_point:    0xBDBDBDBD
data_len:   0x00040000
desc_cksum: 0xBDBDBDBD
file_cksum: 0xBDBDBDBD
===========================
Working(1) with block: /dev/mtd1
Skipping: artificial: 0, unallocated: 0,writeable: 1024(WRITEABLE: 400, flags: C00), fw.flash_base: 9F050000 < blk->base: 9F040000 + blk->size: 10000
Copying FIS partition: 1 =>
name:   'u-boot-env'
flash_base: 0x9F040000
mem_base:   0xBDBDBDBD
size:       0x00010000
entry_point:    0xBDBDBDBD
data_len:   0x00010000
desc_cksum: 0xBDBDBDBD
file_cksum: 0xBDBDBDBD
===========================
Working(1) with block: /dev/mtd2
Working(2) with block: /dev/mtd2
Unlocking /dev/mtd2(kernel) ...
Unlocking device failed: ioctl(MEMUNLOCK): Operation not supported
Writing 'kernel         ' to /dev/mtd2(kernel         ) ...  
Writing: 0x000E9BB2 bytes with offset 0x00000000
[%0  ]
Block on '/dev/mtd2' at 00000000(len: 00010000) has no changes.
[%6  ]
Block on '/dev/mtd2' at 00010000(len: 00010000) has no changes.
[%13 ]
Block on '/dev/mtd2' at 00020000(len: 00010000) has no changes.
[%20 ]
Block on '/dev/mtd2' at 00030000(len: 00010000) has no changes.
[%27 ]
Block on '/dev/mtd2' at 00040000(len: 00010000) has no changes.
[%34 ]
Block on '/dev/mtd2' at 00050000(len: 00010000) has no changes.
[%41 ]
Block on '/dev/mtd2' at 00060000(len: 00010000) has no changes.
[%47 ]
Block on '/dev/mtd2' at 00070000(len: 00010000) has no changes.
[%54 ]
Block on '/dev/mtd2' at 00080000(len: 00010000) has no changes.
[%61 ]
Block on '/dev/mtd2' at 00090000(len: 00010000) has no changes.
[%68 ]
Block on '/dev/mtd2' at 000A0000(len: 00010000) has no changes.
[%75 ]
Block on '/dev/mtd2' at 000B0000(len: 00010000) has no changes.
[%82 ]
Block on '/dev/mtd2' at 000C0000(len: 00010000) has no changes.
[%88 ]
Block on '/dev/mtd2' at 000D0000(len: 00010000) has no changes.
[%95 ]
Block on '/dev/mtd2' at 000E0000(len: 00009BB2) has no changes.
[%100]

End check: 9F050000 + 00100000 <= 9F150000
Creating FIS partition: 2 =>
name:   'kernel'
flash_base: 0x9F050000
mem_base:   0x80002000
size:       0x00100000
entry_point:    0x80002000
data_len:   0x000E9BB2
desc_cksum: 0x00000000
file_cksum: 0x00000000
===========================
Working(1) with block: /dev/mtd2
Skipping: artificial: 0, unallocated: 0,writeable: 1024(WRITEABLE: 400, flags: C00), fw.flash_base: 9F150000 < blk->base: 9F050000 + blk->size: 100000
Working(1) with block: /dev/mtd3
Working(2) with block: /dev/mtd3
Unlocking /dev/mtd3(rootfs) ...
Unlocking device failed: ioctl(MEMUNLOCK): Operation not supported
Writing 'rootfs         ' to /dev/mtd3(rootfs         ) ...  
Writing: 0x00600000 bytes with offset 0x00000000
[%0  ]
Block on '/dev/mtd3' at 00000000(len: 00010000) has no changes.
[%1  ]
Block on '/dev/mtd3' at 00010000(len: 00010000) has no changes.
[%2  ]
Block on '/dev/mtd3' at 00020000(len: 00010000) has no changes.
[%3  ]
Block on '/dev/mtd3' at 00030000(len: 00010000) has no changes.
[%4  ]
Block on '/dev/mtd3' at 00040000(len: 00010000) has no changes.
[%5  ]
Block on '/dev/mtd3' at 00050000(len: 00010000) has no changes.
[%6  ]
Block on '/dev/mtd3' at 00060000(len: 00010000) has no changes.
[%7  ]
Block on '/dev/mtd3' at 00070000(len: 00010000) has no changes.
[%8  ]
Block on '/dev/mtd3' at 00080000(len: 00010000) has no changes.
[%9  ]
Block on '/dev/mtd3' at 00090000(len: 00010000) has no changes.
[%10 ]
Block on '/dev/mtd3' at 000A0000(len: 00010000) has no changes.
[%11 ]
Block on '/dev/mtd3' at 000B0000(len: 00010000) has no changes.
[%12 ]
Block on '/dev/mtd3' at 000C0000(len: 00010000) has no changes.
[%13 ]
Block on '/dev/mtd3' at 000D0000(len: 00010000) has no changes.
[%14 ]
Block on '/dev/mtd3' at 000E0000(len: 00010000) has no changes.
[%15 ]
Block on '/dev/mtd3' at 000F0000(len: 00010000) has no changes.
[%16 ]
Block on '/dev/mtd3' at 00100000(len: 00010000) has no changes.
[%17 ]
Block on '/dev/mtd3' at 00110000(len: 00010000) has no changes.
[%18 ]
Block on '/dev/mtd3' at 00120000(len: 00010000) has no changes.
[%19 ]
Block on '/dev/mtd3' at 00130000(len: 00010000) has no changes.
[%20 ]
Block on '/dev/mtd3' at 00140000(len: 00010000) has no changes.
[%21 ]
Block on '/dev/mtd3' at 00150000(len: 00010000) has no changes.
[%22 ]
Block on '/dev/mtd3' at 00160000(len: 00010000) has no changes.
[%23 ]
Block on '/dev/mtd3' at 00170000(len: 00010000) has no changes.
[%25 ]
Block on '/dev/mtd3' at 00180000(len: 00010000) has no changes.
[%26 ]
Block on '/dev/mtd3' at 00190000(len: 00010000) has no changes.
[%27 ]
Block on '/dev/mtd3' at 001A0000(len: 00010000) has no changes.
[%28 ]
Block on '/dev/mtd3' at 001B0000(len: 00010000) has no changes.
[%29 ]
Block on '/dev/mtd3' at 001C0000(len: 00010000) has no changes.
[%30 ]
Block on '/dev/mtd3' at 001D0000(len: 00010000) has no changes.
[%31 ]
Block on '/dev/mtd3' at 001E0000(len: 00010000) has no changes.
[%32 ]
Block on '/dev/mtd3' at 001F0000(len: 00010000) has no changes.
[%33 ]
Block on '/dev/mtd3' at 00200000(len: 00010000) has no changes.
[%34 ]
Block on '/dev/mtd3' at 00210000(len: 00010000) has no changes.
[%35 ]
Block on '/dev/mtd3' at 00220000(len: 00010000) has no changes.
[%36 ]
Block on '/dev/mtd3' at 00230000(len: 00010000) has no changes.
[%37 ]
Block on '/dev/mtd3' at 00240000(len: 00010000) has no changes.
[%38 ]
Block on '/dev/mtd3' at 00250000(len: 00010000) has no changes.
[%39 ]
Block on '/dev/mtd3' at 00260000(len: 00010000) has no changes.
[%40 ]
Block on '/dev/mtd3' at 00270000(len: 00010000) has no changes.
[%41 ]
Block on '/dev/mtd3' at 00280000(len: 00010000) has no changes.
[%42 ]
Block on '/dev/mtd3' at 00290000(len: 00010000) has no changes.
[%43 ]
Block on '/dev/mtd3' at 002A0000(len: 00010000) has no changes.
[%44 ]
Block on '/dev/mtd3' at 002B0000(len: 00010000) has no changes.
[%45 ]
Block on '/dev/mtd3' at 002C0000(len: 00010000) has no changes.
[%46 ]
Block on '/dev/mtd3' at 002D0000(len: 00010000) has no changes.
[%47 ]
Block on '/dev/mtd3' at 002E0000(len: 00010000) has no changes.
[%48 ]
Block on '/dev/mtd3' at 002F0000(len: 00010000) has no changes.
[%50 ]
Block on '/dev/mtd3' at 00300000(len: 00010000) has no changes.
[%51 ]
Block on '/dev/mtd3' at 00310000(len: 00010000) has no changes.
[%52 ]
Block on '/dev/mtd3' at 00320000(len: 00010000) has no changes.
[%53 ]
Block on '/dev/mtd3' at 00330000(len: 00010000) has no changes.
[%54 ]
Block on '/dev/mtd3' at 00340000(len: 00010000) has no changes.
[%55 ]
Block on '/dev/mtd3' at 00350000(len: 00010000) has no changes.
[%56 ]
Block on '/dev/mtd3' at 00360000(len: 00010000) has no changes.
[%57 ]
Block on '/dev/mtd3' at 00370000(len: 00010000) has no changes.
[%58 ]
Block on '/dev/mtd3' at 00380000(len: 00010000) has no changes.
[%59 ]
Block on '/dev/mtd3' at 00390000(len: 00010000) has no changes.
[%60 ]
Block on '/dev/mtd3' at 003A0000(len: 00010000) has no changes.
[%61 ]
Block on '/dev/mtd3' at 003B0000(len: 00010000) has no changes.
[%62 ]
Block on '/dev/mtd3' at 003C0000(len: 00010000) has no changes.
[%63 ]
Block on '/dev/mtd3' at 003D0000(len: 00010000) has no changes.
[%64 ]
Block on '/dev/mtd3' at 003E0000(len: 00010000) has no changes.
[%65 ]
Block on '/dev/mtd3' at 003F0000(len: 00010000) has no changes.
[%66 ]
Block on '/dev/mtd3' at 00400000(len: 00010000) has no changes.
[%67 ]
Block on '/dev/mtd3' at 00410000(len: 00010000) has no changes.
[%68 ]
Block on '/dev/mtd3' at 00420000(len: 00010000) has no changes.
[%69 ]
Block on '/dev/mtd3' at 00430000(len: 00010000) has no changes.
[%70 ]
Block on '/dev/mtd3' at 00440000(len: 00010000) has no changes.
[%71 ]
Block on '/dev/mtd3' at 00450000(len: 00010000) has no changes.
[%72 ]
Block on '/dev/mtd3' at 00460000(len: 00010000) has no changes.
[%73 ]
Block on '/dev/mtd3' at 00470000(len: 00010000) has no changes.
[%75 ]
Block on '/dev/mtd3' at 00480000(len: 00010000) has no changes.
[%76 ]
Block on '/dev/mtd3' at 00490000(len: 00010000) has no changes.
[%77 ]
Block on '/dev/mtd3' at 004A0000(len: 00010000) has no changes.
[%78 ]
Block on '/dev/mtd3' at 004B0000(len: 00010000) has no changes.
[%79 ]
Block on '/dev/mtd3' at 004C0000(len: 00010000) has no changes.
[%80 ]
Flash unlocked!
Unlocking kernel ...
Erasing kernel ...
Writing from <stdin> to kernel ...     
Unlocking rootfs ...
Erasing rootfs ...
Writing from <stdin> to rootfs ...     
Rebooting ...
Connection to 192.168.1.20 closed by remote host.

It solve the problem you had in my case, can't give more explanations between the two methods ;)

Teusner

anoniobeta700 commented 1 year ago

The solution works like a charm, Thanks Buddy, was able to flash a Litebeam M5 without lan due to ESD burning out the Lan port. Now i have a semi functional Litebeam that i can use as a repeater.

ynezz commented 7 months ago

flash using flash-sysupgrade instead of using flash-factory (don't really know what is the difference between these two solutions, but they seems presented as equivalent in the README.md ...)

If you look at the Tested device list

image

You can see, that on most of devices you should use sysupgrade image as factory image is not going to work, likely due to following change?

ynezz commented 7 months ago

That being said, those instructions might be a bit hairy, pull requests with improvements are welcome! :)