]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
wic: Add argument --hidden to default imager
authorLeon Anavi <leon.anavi@konsulko.com>
Mon, 15 May 2023 12:00:10 +0000 (15:00 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 25 May 2023 09:29:04 +0000 (10:29 +0100)
Add argument --hidden to avoid MS Windows prompting to format
partition after flashing to a USB stick, SD card on another media.
Set Bit 0 (RequiredPartition) to mark that the partition is
required for the platform to function on GUID Partition Table
(GPT).

The new argument simplifies setting RequiredPartition on GPT
through a WKS file and the default imager plugin. Otherwise,
without this feature, to achieve the same result a new imager
plugin has to be implemented and set in WIC_CREATE_EXTRA_ARGS.

Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/ksparser.py
scripts/lib/wic/partition.py
scripts/lib/wic/plugins/imager/direct.py

index d1e546b12d0bc04f9ae2806813d534a4c08d6c2a..667b2ff9c332a648f38e00202bcdc9581278e37c 100644 (file)
@@ -171,6 +171,7 @@ class KickStart():
         part.add_argument('--rootfs-dir')
         part.add_argument('--type', default='primary',
                 choices = ('primary', 'logical'))
+        part.add_argument('--hidden', action='store_true')
 
         # --size and --fixed-size cannot be specified together; options
         # ----extra-space and --overhead-factor should also raise a parser
index 382afa44bce804054e38ff5d657341357d612f29..bda4aef1b4ec1d5b686e9493431bedd6b2c395f1 100644 (file)
@@ -59,6 +59,7 @@ class Partition():
         self.updated_fstab_path = None
         self.has_fstab = False
         self.update_fstab_in_rootfs = False
+        self.hidden = args.hidden
 
         self.lineno = lineno
         self.source_file = ""
index 7315d8f073c0f1a4d478d023908adfc6002eea39..55347f5480ae1675cc5f72a732c2d0a44e6cbef4 100644 (file)
@@ -605,6 +605,13 @@ class PartitionedImage():
                                 (self.path, part.num, part.system_id),
                                 self.native_sysroot)
 
+            if part.hidden and self.ptable_format == "gpt":
+                logger.debug("Set hidden attribute for partition '%s' on disk '%s'",
+                             part.num, self.path)
+                exec_native_cmd("sfdisk --part-attrs %s %s RequiredPartition" % \
+                                (self.path, part.num),
+                                self.native_sysroot)
+
     def cleanup(self):
         pass