|
@@ -141,23 +141,28 @@ python do_swuimage () {
|
|
|
swupdate_write_sha256(s, file, hash)
|
|
swupdate_write_sha256(s, file, hash)
|
|
|
|
|
|
|
|
if d.getVar('SWUPDATE_SIGNING', True) == '1':
|
|
if d.getVar('SWUPDATE_SIGNING', True) == '1':
|
|
|
- privkey = d.getVar('SWUPDATE_PRIVATE_KEY', True)
|
|
|
|
|
- if not privkey:
|
|
|
|
|
- bb.fatal("SWUPDATE_PRIVATE_KEY isn't set")
|
|
|
|
|
- if not os.path.exists(privkey):
|
|
|
|
|
- bb.fatal("SWUPDATE_PRIVATE_KEY %s doesn't exist" % (privkey))
|
|
|
|
|
- passout = d.getVar('SWUPDATE_PASSWORD_FILE', True)
|
|
|
|
|
- if passout:
|
|
|
|
|
- passout = "-passin file:'%s' " % (passout)
|
|
|
|
|
|
|
+ sign_tool = d.getVar('SWUPDATE_SIGN_TOOL', True)
|
|
|
|
|
+ if sign_tool:
|
|
|
|
|
+ if os.system(sign_tool) != 0:
|
|
|
|
|
+ bb.fatal("Failed to sign with %s" % (sign_tool))
|
|
|
else:
|
|
else:
|
|
|
- passout = ""
|
|
|
|
|
- signcmd = "openssl dgst -sha256 -sign '%s' %s -out '%s' '%s'" % (
|
|
|
|
|
- privkey,
|
|
|
|
|
- passout,
|
|
|
|
|
- os.path.join(s, 'sw-description.sig'),
|
|
|
|
|
- os.path.join(s, 'sw-description'))
|
|
|
|
|
- if os.system(signcmd) != 0:
|
|
|
|
|
- bb.fatal("Failed to sign sw-description with %s" % (privkey))
|
|
|
|
|
|
|
+ privkey = d.getVar('SWUPDATE_PRIVATE_KEY', True)
|
|
|
|
|
+ if not privkey:
|
|
|
|
|
+ bb.fatal("SWUPDATE_PRIVATE_KEY isn't set")
|
|
|
|
|
+ if not os.path.exists(privkey):
|
|
|
|
|
+ bb.fatal("SWUPDATE_PRIVATE_KEY %s doesn't exist" % (privkey))
|
|
|
|
|
+ passout = d.getVar('SWUPDATE_PASSWORD_FILE', True)
|
|
|
|
|
+ if passout:
|
|
|
|
|
+ passout = "-passin file:'%s' " % (passout)
|
|
|
|
|
+ else:
|
|
|
|
|
+ passout = ""
|
|
|
|
|
+ signcmd = "openssl dgst -sha256 -sign '%s' %s -out '%s' '%s'" % (
|
|
|
|
|
+ privkey,
|
|
|
|
|
+ passout,
|
|
|
|
|
+ os.path.join(s, 'sw-description.sig'),
|
|
|
|
|
+ os.path.join(s, 'sw-description'))
|
|
|
|
|
+ if os.system(signcmd) != 0:
|
|
|
|
|
+ bb.fatal("Failed to sign sw-description with %s" % (privkey))
|
|
|
|
|
|
|
|
line = 'for i in ' + ' '.join(list_for_cpio) + '; do echo $i;done | cpio -ov -H crc >' + os.path.join(deploydir,d.getVar('IMAGE_NAME', True) + '.swu')
|
|
line = 'for i in ' + ' '.join(list_for_cpio) + '; do echo $i;done | cpio -ov -H crc >' + os.path.join(deploydir,d.getVar('IMAGE_NAME', True) + '.swu')
|
|
|
os.system("cd " + s + ";" + line)
|
|
os.system("cd " + s + ";" + line)
|