Reboot after flash img fail

Hi,I got a problem in flash the boot my flow is as follow

press the vol- and power on the board
sudo fastboot erase system -w
sudo fastboot flash aboot emmc_appsboot.mbn
sudo fastboot flash boot boot.img
sudo fastboot flash system system.img
sudo fastboot flash cache cache.img
sudo fastboot flash persist persist.img
sudo fastboot flash userdata userdata.img
sudo fastboot flash recovery recovery.img
sudo fastboot reboot

When I reboot my board go to fastboot mode directly , I don’t need to press vol -,
in this situation if I want to flash again the error message FAILED (remote: device is locked. Cannot flash images)
I have to switch the board to SD-boot mode and re-install again.

The source code is repo in codeaurora , did i miss anything? or do something wrong?

I had encountered same problems.
This is because SD card pre-built was an “unlock” version boot-loader.
Those codes that we repo from codeaurora were set boot-loader to “lock” one.

My temporary solution is to keep “emmc_appsboot.mbn” as SD card version.
DON’T flash it when your other partitions of code are ready for.

Looking forward to someone who could advise us how to switch it OFF in boot-loaders.
Or, shares source code relative information.

Thanks, Dennis

There is no need to flash all that.
boot and system will suffice.