flash: $(RO_FILE) $(ECTOOL)
	# Disable periodic led control commands to reduce i2c activity to the controller.
	ledctrl led0 none
	$(ECTOOL) --interface=dev reboot_ec RW
	$(ECTOOL) --interface=dev flashread 0x0 $(RO_SIZE) $(RO_FILE).old
	# This call may throw some i2c errors due to long erase times
	$(ECTOOL) --interface=dev flasheraseasync 0x0 $(RO_SIZE)
	# Sleep and try erase again, this should succeed.
	sleep 3
	$(ECTOOL) --interface=dev flasheraseasync 0x0 $(RO_SIZE)
	$(ECTOOL) --interface=dev flashwrite 0x0 $(RO_FILE)

