Skip to contentSkip to conversation

wic: FAT16 and python module fixes

PATCH New Darren Hart 1 participant 3 messages Oct 15, 2013

lore
Share & tools
lore
#0 lore raw

cover wic: FAT16 and python module fixes

The following changes since commit 2b5bac02196b8bd30d223d508f5f7d4300889fd7:

poky: Update Version post release (2013-10-14 16:59:12 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib wic
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=wic

Darren Hart (2):
wic: Force lba off for FAT16 partitions
wic: Check for external modules

 scripts/lib/mic/utils/partitionedfs.py |   10 ++++++++++
 scripts/wic                            |   12 ++++++++++++
 2 files changed, 22 insertions(+)
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 wic: Check for external modules

Since eight unique files import rpm, perform a check at the top level for the existence of the rpm module print a sensible error message if it is not. This may be able to be removed if some of the core rpm dependencies are removed from the mic libs.

Also check for urlgrabber.

This avoids a bracktrace in the event the modules are not installed which can be very off-putting to would-be users.

---
 scripts/wic |   12 ++++++++++++
 1 file changed, 12 insertions(+)
scripts/wic +12 -0
index 06e72bb..f665823 100755
@@ -31,11 +31,23 @@
 
 __version__ = "0.1.0"
 
+# Python Standard Library modules
 import os
 import sys
 import optparse
 import logging
 
+# External modules
+try:
+    import rpm
+    import urlgrabber
+except ImportError:
+    print("ERROR: failed to import necessary modules.")
+    print("Please ensure the following modules are installed:")
+    print("\trpm");
+    print("\turlgrabber");
+    sys.exit(1)
+
 scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])))
 lib_path = scripts_path + '/lib'
 sys.path = sys.path + [lib_path]
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 wic: Force lba off for FAT16 partitions

In reply to Darren Hart

If fat16 is specified to the mkpart parted command, parted will default to setting the lba flag which causes certain EFI firmware to fail to detect the filesystem. lba shouldn't be necessary for FAT16 filesystems anyway, explicitly disable it.

---
 scripts/lib/mic/utils/partitionedfs.py |   10 ++++++++++
 1 file changed, 10 insertions(+)
scripts/lib/mic/utils/partitionedfs.py +10 -0
index e8cded2..59263ba 100644
@@ -352,6 +352,16 @@ class PartitionedMount(Mount):
                 self.__run_parted(["-s", d['disk'].device, "set",
                                    "%d" % p['num'], flag_name, "on"])
 
+            # Parted defaults to enabling the lba flag for fat16 partitions,
+            # which causes compatibility issues with some firmware (and really
+            # isn't necessary).
+            if parted_fs_type == "fat16":
+                if d['ptable_format'] == 'msdos':
+                    msger.debug("Disable 'lba' flag for partition '%s' on disk '%s'" % \
+                                (p['num'], d['disk'].device))
+                    self.__run_parted(["-s", d['disk'].device, "set",
+                                       "%d" % p['num'], "lba", "off"])
+
         # If the partition table format is "gpt", find out PARTUUIDs for all
         # the partitions. And if users specified custom parition type UUIDs,
         # set them.
Signature · 1 line
1.7.9.5