From c3148c6199756439d1802555b45249066eb7e6cf Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Fri, 5 Jun 2015 10:17:11 +0300 Subject: wic: Refactored getting root device name Replaced DirectImageCreator._get_boot_config private method with a 'rootdev' property. Simplified the code and API. Used 'uuid' property instead of incorrectly used 'part_type'. (From OE-Core rev: 4a303007149ea1205bbd454e70810e7dfa343d4c) Signed-off-by: Ed Bartosh Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- scripts/lib/wic/imager/direct.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'scripts/lib/wic/imager/direct.py') diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 83f9688878..36150c9ad3 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -346,27 +346,23 @@ class DirectImageCreator(BaseImageCreator): msger.info(msg) - def _get_boot_config(self): + @property + def rootdev(self): """ - Return the rootdev/root_part_uuid (if specified by - --part-type) + Get root device name to use as a 'root' parameter + in kernel command line. Assume partition order same as in wks """ - rootdev = None - root_part_uuid = None parts = self._get_parts() - for num, p in enumerate(parts, 1): - if p.mountpoint == "/": - part = '' - if p.disk.startswith('mmcblk'): - part = 'p' - - pnum = self.__get_part_num(num, parts) - rootdev = "/dev/%s%s%-d" % (p.disk, part, pnum) - root_part_uuid = p.part_type - - return (rootdev, root_part_uuid) + for num, part in enumerate(parts, 1): + if part.mountpoint == "/": + if part.uuid: + return "PARTUUID=%s" % part.uuid + else: + suffix = 'p' if part.disk.startswith('mmcblk') else '' + pnum = self.__get_part_num(num, parts) + return "/dev/%s%s%-d" % (part.disk, suffix, pnum) def _cleanup(self): if not self.__image is None: -- cgit v1.2.3-54-g00ecf