releasetools.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright (C) 2009 The Android Open Source Project
  2. # Copyright (c) 2011, The Linux Foundation. All rights reserved.
  3. # Copyright (C) 2017-2018 The LineageOS Project
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. import common
  17. import re
  18. def FullOTA_InstallEnd(info):
  19. OTA_InstallEnd(info)
  20. return
  21. def IncrementalOTA_InstallEnd(info):
  22. OTA_InstallEnd(info)
  23. return
  24. def AddImage(info, basename, dest):
  25. path = "IMAGES/" + basename
  26. if path not in info.input_zip.namelist():
  27. return
  28. data = info.input_zip.read(path)
  29. common.ZipWriteStr(info.output_zip, basename, data)
  30. info.script.AppendExtra('package_extract_file("%s", "%s");' % (basename, dest))
  31. def OTA_InstallEnd(info):
  32. info.script.Print("Patching firmware images...")
  33. AddImage(info, "dtbo.img", "/dev/block/bootdevice/by-name/dtbo")
  34. AddImage(info, "init_boot.img", "/dev/block/bootdevice/by-name/init_boot")
  35. AddImage(info, "vbmeta.img", "/dev/block/bootdevice/by-name/vbmeta")
  36. AddImage(info, "vbmeta_system.img", "/dev/block/bootdevice/by-name/vbmeta_system")
  37. AddImage(info, "vendor_boot.img", "/dev/block/bootdevice/by-name/vendor_boot")
  38. return