AR300M, force NOR boot

Hi at all.

I need to boot every time into nor, i use boot_dev=on and it work.

But because i want prevent to boot into nand , this solution is not good (change switch and it boot on nand)

I tried with bootcount=3 but it is reset to zero every boot, even this solution is not good

If i change “bootcmd” param:

bootcmd=if nand bad; then nboot 0x81000000 0 || run blf; else run blf; fi

with:

bootcmd=run blf

it work??

 

 

 

@diapolon

I have posted this before, but it keeps getting lost under all the other posts, so I’ll post again.

@alzhao

As this keeps popping up it might be worth adding it into the docs :slight_smile:

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

@bluewavenet

thankyou, i know you solution but it’s a workaround and i wold like prevent this:

“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.”

You could even add a reboot command to the end of the bootnor script in the NAND image then the only way to get back into NAND image would be to reflash.

yes, but refllashing NAND image the tricks is bypassed… i would like a definitive solutions :slight_smile:

@diapolon

Yes that is true and I did start down that path only to abandon it as:

  1. NAND not supported on this device by LEDE

  2. The NAND version is discontinued in favour of NOR only version.

  3. The extra space given by the NAND is very rarely used. In my application I have lighttpd, php7, uhttpd with luci, and a whole suite of my own software and still have over 8MB free flash so it was not worth the effort.

  4. The 16MB version is cheaper :slight_smile:

@bluewavenet

i agree with you :slight_smile: