Installing OpenWRT from U-boot - how to know offset?

Hello!

I have TP-Link WR1043N HW ver 5.0 connected throught UART.
On load, entered to u-boot console:
And already did
ath>
setenv serverip 192.168.0.66
tftpboot 0x80060000 openwrt.bin
printenv

bootargs=console=ttyS0,115200 board=AP152 rootfstype=squashfs init=/etc/preinit mtdparts=spi0.0:128k(factory-uboot),128k(u-boot),1152k(uImage),14912k(rootfs),64k@0xff0000(ART) mem=64M
bootcmd=bootm 0x9f040000
bootdelay=1
baudrate=115200
ethaddr=0x00:0xaa:0xbb:0xcc:0xdd:0xee
dir=
lu=tftp 0x80060000 ${dir}tuboot.bin&&erase 0x9f000000 +$filesize&&cp.b $fileaddr 0x9f000000 $filesize
lf=tftp 0x80060000 ${dir}ap152${bc}-jffs2&&erase 0x9f010000 +$filesize&&cp.b $fileaddr 0x9f010000 $filesize
lk=tftp 0x80060000 ${dir}vmlinux${bc}.lzma.uImage&&erase 0x9f300000 +$filesize&&cp.b $fileaddr 0x9f300000 $filesize
stdin=serial
stdout=serial
stderr=serial
ethact=eth0
filesize=9ca9ad
fileaddr=80060000
ipaddr=192.168.0.2
serverip=192.168.0.66

And now I need to write it to flash.
I very afraid to mistake here

erase $myoffset +$filesize
cp.b $fileaddr $myoffset $filesize

I came up with a variable $myoffset.
How to know $myoffset value?

Thank you.

You can see from the bootcmd that the firmware is stored at offset of 0x9f040000. 0x9F000000 is the first location in the flash, and the first 4* 64k blocks (0x040000) hold the bootloader.

It is highly advisable to backup copy your bootloader and ART partitions to a safe place on your PC before poking around in the flash.

1 Like

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