mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
tools: packv2: added support to flash bootcfg based on RDP
This patch adds support to flash the bootconfig based on the RDPs. 1. To flash bootconfig based on Multi-RDP add entry like below in all flash partition xmls for non-mmc flash partition: <img_name type="string" bootconfig_type="1">file1_name</img_name> <img_name type="string" bootconfig_type="2">file2_name</img_name> <img_name type="string" bootconfig_type="3">file3_name</img_name> for mmc flash partition: bootconfig_type_max="2" filename_img1="file1_name" filename_img2="file2_name" and specify which bootconfig to flash on each RDP by adding entry like below, in config xml under each RDP nodes. <bootconfig_type>1</bootconfig_type> 2. for single bootconfig case, there is no change. just add single entry like below in all flash partition xmls <img_name type="string">file_name</img_name> Change-Id: Id68c4f6f6c4cced493ac5130378897711e8cb9e4 Signed-off-by: Ram Kumar D <quic_ramd@quicinc.com>
This commit is contained in:
parent
4568deeb3c
commit
615200e1e8
1 changed files with 140 additions and 0 deletions
140
tools/pack_v2.py
140
tools/pack_v2.py
|
|
@ -513,6 +513,88 @@ class Pack(object):
|
|||
except KeyError as e:
|
||||
return None
|
||||
|
||||
def __gen_flash_script_bootconfig(self, entries, partition, flinfo, script, part_section):
|
||||
global ARCH_NAME
|
||||
fw_imgs = []
|
||||
skip_size_check = ""
|
||||
|
||||
if flinfo.type != "emmc":
|
||||
fw_objs = part_section.findall('img_name')
|
||||
if (len(fw_objs) <= 1):
|
||||
return 0
|
||||
|
||||
for i in fw_objs:
|
||||
fw_imgs.append(i.text)
|
||||
else:
|
||||
if 'bootconfig_type_max' in part_section.attrib and image_type == "all":
|
||||
max_files = int(part_section.attrib['bootconfig_type_max'])
|
||||
else:
|
||||
return 0;
|
||||
|
||||
for fw_type in range(1, max_files+1):
|
||||
if 'filename_img' + str(fw_type) in part_section.attrib:
|
||||
filename = part_section.attrib['filename_img' + str(fw_type)]
|
||||
if filename == "":
|
||||
continue
|
||||
fw_imgs.append(filename)
|
||||
|
||||
i = 0
|
||||
for filename in fw_imgs:
|
||||
machid_list = []
|
||||
i = i + 1
|
||||
|
||||
for section in entries:
|
||||
file_type = section.find('.//bootconfig_type')
|
||||
if file_type == None:
|
||||
continue
|
||||
|
||||
file_type = str(section.find(".//bootconfig_type").text)
|
||||
if str(file_type) != str(i):
|
||||
continue
|
||||
|
||||
machid = int(section.find(".//machid").text, 0)
|
||||
machid = "%x" % machid
|
||||
machid_list.append(machid)
|
||||
|
||||
img_size = self.__get_img_size(filename)
|
||||
part_info = self.__get_part_info(partition)
|
||||
|
||||
section_label = partition.split(":")
|
||||
if len(section_label) != 1:
|
||||
section_conf = section_label[1]
|
||||
else:
|
||||
section_conf = section_label[0]
|
||||
section_conf = section_conf.lower()
|
||||
|
||||
if self.flinfo.type != "emmc":
|
||||
if part_info == None:
|
||||
if self.flinfo.type == 'norplusnand':
|
||||
if count > 2:
|
||||
error("More than 2 NAND images for NOR+NAND is not allowed")
|
||||
elif img_size > part_info.length:
|
||||
print("img size is larger than part. len in '%s'" % section_conf)
|
||||
return 0
|
||||
else:
|
||||
if part_info != None:
|
||||
if (img_size > 0):
|
||||
if img_size > (part_info.length * self.flinfo.blocksize):
|
||||
print("img size is larger than part. len in '%s'" % section_conf)
|
||||
return 0
|
||||
|
||||
if part_info == None and self.flinfo.type != 'norplusnand':
|
||||
print("Flash type is norplusemmc")
|
||||
return 1
|
||||
|
||||
if len(machid_list) > 0:
|
||||
script.start_if_or("machid", machid_list)
|
||||
|
||||
if img_size > 0:
|
||||
script.imxtract_n_flash(filename[:-4] + "-" + sha1(filename), part_info.name)
|
||||
|
||||
script.end_if()
|
||||
|
||||
return 1
|
||||
|
||||
def __gen_flash_script_cdt(self, entries, partition, flinfo, script):
|
||||
global ARCH_NAME
|
||||
for section in entries:
|
||||
|
|
@ -983,6 +1065,8 @@ class Pack(object):
|
|||
except KeyError as e:
|
||||
if tiny_16m == "true":
|
||||
pass
|
||||
elif 'bootconfig_type_max' in section.attrib and image_type == "all":
|
||||
partition = section.attrib['label']
|
||||
else:
|
||||
try:
|
||||
partition = section.attrib['label']
|
||||
|
|
@ -1006,6 +1090,14 @@ class Pack(object):
|
|||
pass
|
||||
diff_files = "" # Clear for next iteration
|
||||
|
||||
if "0:BOOTCONFIG" in partition:
|
||||
try:
|
||||
ret = self.__gen_flash_script_bootconfig(entries, partition, flinfo, script, section)
|
||||
if ret == 1:
|
||||
continue
|
||||
except KeyError, e:
|
||||
continue
|
||||
|
||||
# Get machID
|
||||
if partition != "0:CDT" and partition != "0:DDRCONFIG":
|
||||
machid = None
|
||||
|
|
@ -1100,6 +1192,43 @@ class Pack(object):
|
|||
|
||||
return 1
|
||||
|
||||
def __gen_script_bootconfig(self, images, flinfo, part_info, section):
|
||||
global ARCH_NAME
|
||||
fw_imgs = []
|
||||
|
||||
if flinfo.type != "emmc":
|
||||
fw_objs = section.findall('img_name')
|
||||
if (len(fw_objs) <= 1):
|
||||
return 0
|
||||
|
||||
for i in fw_objs:
|
||||
fw_imgs.append(i.text)
|
||||
|
||||
else:
|
||||
if 'bootconfig_type_max' in section.attrib:
|
||||
max_files = int(section.attrib['bootconfig_type_max'])
|
||||
else:
|
||||
return 0;
|
||||
|
||||
for fw_type in range(1, max_files+1):
|
||||
if 'filename_img' + str(fw_type) in section.attrib:
|
||||
filename = section.attrib['filename_img' + str(fw_type)]
|
||||
if filename == "":
|
||||
continue
|
||||
fw_imgs.append(filename)
|
||||
|
||||
if part_info == None and self.flinfo.type != 'norplusnand':
|
||||
return 0
|
||||
|
||||
for filename in fw_imgs:
|
||||
image_info = ImageInfo(filename[:-4] + "-" + sha1(filename),
|
||||
filename, "firmware")
|
||||
if filename.lower() != "none":
|
||||
if image_info not in images:
|
||||
images.append(image_info)
|
||||
|
||||
return 1
|
||||
|
||||
def __gen_script_cdt(self, images, flinfo, root, section_conf, partition):
|
||||
global ARCH_NAME
|
||||
|
||||
|
|
@ -1355,6 +1484,8 @@ class Pack(object):
|
|||
except KeyError as e:
|
||||
if tiny_16m == "true":
|
||||
pass
|
||||
elif "bootconfig_type_max" in section.attrib:
|
||||
partition = section.attrib['label']
|
||||
else:
|
||||
try:
|
||||
partition = section.attrib['label']
|
||||
|
|
@ -1391,6 +1522,15 @@ class Pack(object):
|
|||
|
||||
section_conf = section_conf.lower()
|
||||
|
||||
if section_conf == "bootconfig" or section_conf == "bootconfig1":
|
||||
try:
|
||||
if image_type == "all" or section[8].attrib['image_type'] == image_type:
|
||||
ret = self.__gen_script_bootconfig(images, flinfo, part_info, section)
|
||||
if ret == 1:
|
||||
continue
|
||||
except KeyError, e:
|
||||
continue
|
||||
|
||||
if section_conf == "cdt" or section_conf == "ddrconfig":
|
||||
try:
|
||||
if image_type == "all" or section[8].attrib['image_type'] == image_type:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue