From be0a53342bec78025413dbbd0bf4de5d9c8b454f Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 26 Jun 2013 08:25:38 +0300 Subject: [PATCH] baseimager: add a couple of more installer FW variables Add two more installer framework variables: INSTALLERFW_ROOT_PART_NUM and INSTALLERFW_BOOT_PART_NUM which define the boot and root parition numbers. Change-Id: I6b717d3051faa23edb58b44265b3eae3aab2a63e Signed-off-by: Artem Bityutskiy --- mic/imager/baseimager.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py index 39bb6dd..b8e414c 100644 --- a/mic/imager/baseimager.py +++ b/mic/imager/baseimager.py @@ -434,6 +434,8 @@ class BaseImageCreator(object): env = {} pnum = 0 + root_pnum = "" + boot_pnum = "" for p in kickstart.get_partitions(self.ks): env.update(self._set_part_env(pnum, "SIZE", p.size)) @@ -444,8 +446,24 @@ class BaseImageCreator(object): env.update(self._set_part_env(pnum, "BOOTFLAG", p.active)) env.update(self._set_part_env(pnum, "ALIGN", p.align)) env.update(self._set_part_env(pnum, "TYPE_ID", p.part_type)) + + if p.mountpoint == "/": + assert root_pnum == "" + root_pnum = pnum + elif p.mountpoint == "/boot": + assert boot_pnum == "" + boot_pnum = pnum + pnum += 1 + # Root and boot parition numbers + assert root_pnum != "" + if boot_pnum == "": + # The boot parition is the root partition + boot_pnum = root_pnum + env[self.installerfw_prefix + "ROOT_PART_NUM"] = str(root_pnum) + env[self.installerfw_prefix + "BOOT_PART_NUM"] = str(boot_pnum) + # Count of paritions env[self.installerfw_prefix + "PART_COUNT"] = str(pnum) -- 2.7.4