I have posted this before, but it keeps getting lost under all the other posts, so I’ll post again.
As this keeps popping up it might be worth adding it into the docs ![]()
Here it is:
Setting bootcount 3 in rc.local does not permanently work as LEDE, presumably kernel, sets it back to bootcount=0 as soon as the init.d process has finished ie as rc.local completes.
A workaround for this is to add the following to /etc/rc.local of the NOR image:
echo sleep 1 > /tmp/bootnor
echo fw_setenv bootcount 3 >> /tmp/bootnor
chmod +x /tmp/bootnor
/tmp/./bootnor &
This created a script file and sets it to run in the background.
Now if you want to boot NAND again all you have to do is manually set bootcount=0
Possibly if power is removed in the short interval between init.d completing and the one second sleep ending then you might still have bootcount=0, defeating this workaround, so just add the extra lines to rc.local in the NAND image as well.
This will effectively swap the default from NAND to NOR