Building OpenWRT for u-boot upgrade

Normally /dev/mtdblock0 and /dev/mtdblock1 devices are set to be read only as they contain sensitive u-boot boot loader and u-boot environment. In case you want to replace u-boot boot loader and/or u-boot environment from OpenWRT /dev/mtdblock0 and /dev/mtdblock1 devices must be accessible for writing.

To remove write protection you will need to build a new OpenWRT image you'll need to modify file:

target/linux/ar71xx/image/Makefile

Open it with the editor and find the line:

 carambola2_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2048k(kernel),13952k(rootfs),64k(art)ro,16000k@0x50000(firmware) 

and replace it with the line:

 carambola2_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),2048k(kernel),13952k(rootfs),64k(art)ro,16000k@0x50000(firmware) 

Now run make (or make -j 4 to speedup things ) in your OpenWRT directory.