Open 3ooabkhxtn opened 2 years ago
Made also a rewrite in pseudo python code of the boot process.
For better reading. sw_commit
seems to be the main variable, which forces the switch.
bootargs_base = "console=ttyS0,115200"
mtdparts0 = "mtdparts=rtk_spi_nor_mtd:256K(boot),8K(env),8K(env2),240K(config),1328K(k0)ro,2512K(r0)ro,1328K(k1),2512K(r1),4K@0ro,4K@0ro,4K@0ro,4K@0ro,1328K@512K(linux),2512K@1840K(rootfs) root=31:5"
mtdparts1 = "mtdparts=rtk_spi_nor_mtd:256K(boot),8K(env),8K(env2),240K(config),1328K(k0),2512K(r0),1328K(k1)ro,2512K(r1)ro,4K@0ro,4K@0ro,4K@0ro,4K@0ro,1328K@4352K(linux),2512K@5680K(rootfs) root=31:7"
rst2dfl_flg = "???"
img0_kernel = "94080000"
img1_kernel = "94440000"
bootargs = ""
sw_active = 1
sw_commit = 1
sw_tryactive = 1
def saveenv():
print("Write to Flash")
def en_wdt():
print("mw b8003268 e7c00000")
def b0():
bootargs = bootargs_base + " " + mtdparts0 + " " + rst2dfl_flg + "; bootm " + img0_kernel
print(bootargs)
def b1():
bootargs = bootargs_base + " " + mtdparts1 + " " + rst2dfl_flg + "; bootm " + img1_kernel
print(bootargs)
def set_act0():
global sw_active
if (sw_active != 0):
sw_active = 0
print("sw_active: X -> 0")
saveenv()
def set_act1():
global sw_active
if (sw_active != 1):
sw_active = 1
print("sw_active: X -> 1")
saveenv()
def boot_by_commit():
global sw_commit
if (sw_commit == 0):
set_act0()
b0()
else:
set_act1()
b1()
def boot_by_tryactive():
global sw_tryactive
global sw_active
if (sw_tryactive == 0):
sw_tryactive = 2
print("sw_tryactive: X -> 2")
sw_active = 0
print("sw_active: X -> 0")
saveenv()
en_wdt()
b0()
else:
sw_tryactive = 2
print("sw_tryactive: X -> 2")
sw_active = 1
print("sw_active: X -> 1")
saveenv()
en_wdt()
b1()
def bootcmd():
if (sw_tryactive == 2):
boot_by_commit()
else:
boot_by_tryactive()
if __name__ == '__main__':
print("Preboot Values:")
print("sw_active: " + str(sw_active))
print("sw_commit: " + str(sw_commit))
print("sw_tryactive: " + str(sw_tryactive))
print()
bootcmd()
print()
print("Afterboot Values:")
print("sw_active: " + str(sw_active))
print("sw_commit: " + str(sw_commit))
print("sw_tryactive: " + str(sw_tryactive))
Set sw_tryactive to 0. After next boot, it booted up firmware 220304 (slot 0)
# nv setenv sw_tryactive 0
# reboot
Rebooting again started firmware 210702 (slot 1)
Setting sw_commit to 0 and rebooting activated firmware firmware 220304 (slot 0). And now at every boot 220304 is booting.
# nv setenv sw_commit 0
# reboot
With firmware 220304 I got an emtpy MAC_KEY entry in my config and omci was not starting. I read out ethaddr
with nv getenv
and set ELAN_MAC_ADDR to the same mac address and then it was starting.
# nv getenv
...
ethaddr=XX:XX:XX:XX:XX:XX
...
# flash set ELAN_MAC_ADDR xxxxxxxxxxxx
Hey guys, I habe another question,
my DFP-34X-2C2 seems to have two firmware versions. It is booting into 210702, but in the bootargs it mentions also 220304.
Haven't read about that anywhere else already, so I thought I share the info.
Haven't yet figured out fully how to switch. Have only a dump from my
nv getenv
. But could not test, as my stick is not running right now.Full dump: