From 909e621519439b61284cc0b08b6c7637adad21a3 Mon Sep 17 00:00:00 2001 From: Jacek Kryszyn Date: Thu, 23 May 2024 12:25:47 +0200 Subject: [PATCH] Dynamic partitions: fuse tarballs containing super.img Allow to fuse tarballs prepared in such a way that they already contain super.img and do not contain rootfs.img and hal.img. Change-Id: Iac09011bd92f51354e16e70d3bb5f9ab12f299b2 Signed-off-by: Jacek Kryszyn --- scripts/tizen/sd_fusing.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/tizen/sd_fusing.py b/scripts/tizen/sd_fusing.py index 7624f69..e5fbbc7 100755 --- a/scripts/tizen/sd_fusing.py +++ b/scripts/tizen/sd_fusing.py @@ -21,6 +21,7 @@ Format = False Device = "" File = "" Yes = False +SuperDelivered = False LOGGING_NOTICE = int((logging.INFO + logging.WARNING) / 2) @@ -869,6 +870,7 @@ def mkpart(args, target): def check_args(args): global Format global Yes + global SuperDelivered logging.info(f"Device: {args.device}") @@ -893,6 +895,9 @@ def check_args(args): else: Format = False + if args.super_delivered: + SuperDelivered = True + def check_device(args): global Format global Device @@ -1076,7 +1081,7 @@ def do_fuse_image_super(tmpd, target): def do_fuse_image_tarball(tarball, tmpd, target): with tarfile.open(tarball) as tf: for entry in tf: - if target.with_super: + if target.with_super and not SuperDelivered: if entry.name in('hal.img', 'rootfs.img'): tf.extract(entry, path=tmpd) continue @@ -1108,12 +1113,12 @@ def fuse_image(args, target): do_fuse_image_tarball(b, tmpd, target) else: fn = os.path.split(b)[-1] - if target.with_super and fn in ('rootfs.img', 'hal.img'): + if target.with_super and fn in ('rootfs.img', 'hal.img') and not SuperDelivered: shutil.copy(b, os.path.join(tmpd, fn)) else: do_fuse_image(b, target) - if target.with_super: + if target.with_super and not SuperDelivered: do_fuse_image_super(tmpd, target) def logger_notice(self, msg, *args, **kws): @@ -1163,6 +1168,8 @@ if __name__ == '__main__': version=f"%(prog)s {__version__}") parser.add_argument("--YES", action="store_true", help="agree to destroy data on the DEVICE") + parser.add_argument("--super_delivered", action="store_true", + help="indicate that super.img is already in tarball and doesn't have to be created during fusing") args = parser.parse_args() if args.target == 'list': -- 2.7.4