This error is observed when writing to flash is locked:
[shell title=”device is locked error”]
donal@horizonemb-build1:/data_fast/android/iMX8x/android_build$ sudo `which fastboot` flash vbmeta_b out/target/product/som_mx8q/vbmeta-imx8qx-var-som-wifi.img
target reported max download size of 419430400 bytes
Sending ‘vbmeta_b’ (4 KB)…
OKAY [ 0.003s]
Writing ‘vbmeta_b’…
FAILED (remote: device is locked.)
Finished. Total time: 0.014s
[/shell]
To disable the oem lock, follow these steps:
From Android:
- Settings => System => About Tablet => Build number
- keep on tapping until you see a prompt that says “You are now a developer!”
- Settings => System => Advanced => Developer options => OEM unlocking
From the serial terminal:
- reboot to bootloader
- type “fastboot q” in the U-Boot command line
- run “sudo `which fastboot` oem unlock” from the Host PC
- wait until the unlock process is complete
- proceed for flashing
If an error such as “FAILED (remote: unknown command)” is reported, then oem unlock will need to be enabled in the bootloader. For iMX8 (and possibly other iMX families), this can be done by editing the following file:
uboot-imx/drivers/usb/gadget/fastboot_lock_unlock.h
Inserting “#define CONFIG_ENABLE_LOCKSTATUS_SUPPORT” and rebuilding and flashing uBoot.