File: 0002-fix-add-missing-decrypted-size-entry.patch

package info (click to toggle)
swugenerator 0.5-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 388 kB
  • sloc: python: 1,194; sh: 107; makefile: 14
file content (33 lines) | stat: -rw-r--r-- 1,190 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Pratik Manvar <pratik.manvar@ifm.com>
Date: Wed, 30 Jul 2025 19:21:49 +0530
Subject: fix: add missing `decrypted-size` entry

The decrypted-size field is required when flashing encrypted images
to the MTD partition on NOR flash.

This attribute is also required to handle the UBI Volumes. Due to a
limit in the Linux kernel API for UBI volumes, the size reserved to
be written on disk should be declared before actually writing anything.

Signed-off-by: Pratik Manvar <pratik.manvar@ifm.com>
Tested-by: Stefano Babic <stefano.babic@swupdate.org>
Forwarded: not-needed
Origin: upstream
---
 swugenerator/generator.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/swugenerator/generator.py b/swugenerator/generator.py
index 628dffe..1721aef 100644
--- a/swugenerator/generator.py
+++ b/swugenerator/generator.py
@@ -201,6 +201,9 @@ class SWUGenerator:
                 entry["ivt"] = iv
                 new.ivt = iv
 
+                entry.setdefault("properties", {}) \
+                    .update({ "decrypted-size": str(new.getsize()) })
+
             self.artifacts.append(new)
         else:
             logging.debug("Artifact %s already stored", entry["filename"])