upgrade: add validation and error handling for u-boot env update
Fail if input is incompatible with "fw_setenv --script". Prefix every line of the fw_setenv script with a space character so they will never be treated as comments (leading space is removed). Add error handling.