Skip to content

Commit

Permalink
Fix issue when using board software thats missing sec_xloader_ddr_test
Browse files Browse the repository at this point in the history
penn5 committed Jun 17, 2019
1 parent 45b11e9 commit e9fb77d
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion fastbootflasher.py
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ def flash(parts):
except DeviceNotFoundError:
time.sleep(10)
# For faster flashing we take advantage of "ultraflash" which lets you stream the image
for partition, file in parts.items():
for partition, file in parts:
# File must be a filename, not a file()
fdev._SimpleCommand(b'ultraflash', arg=partition, info_cb=info_cb, timeout_ms=0)
fdev.Download(file, info_cb=info_cb, progress_callback=progress_cb)
12 changes: 8 additions & 4 deletions idtconfig.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from lxml import etree
import re
import re, os

def get_images(cfg: bytes):
try:
@@ -19,13 +19,17 @@ def get_images(cfg: bytes):
return get_simple(cfg.decode("utf-8")), {}
ddr_images = tree.xpath("(//configurations/configuration)[1]/bootloaderimage_ddr/image")
std_images = tree.xpath("(//configurations/configuration)[1]/bootloaderimage/image")
idt_images = {int(img.get("address"), 0):img.text for img in ddr_images}
ddr_ids = [img.get("identifier") for img in ddr_images]
idt_images = {}
ddr_ids = []
for img in ddr_images:
if os.path.isfile(img.text):
idt_images[int(img.get("address"), 0)] = img.text
ddr_ids += [img.get("identifier")]
for img in std_images:
if not img.get("identifier") in ddr_ids:
idt_images[int(img.get("address"), 0)] = img.text
print(idt_images)
fastboot_images = {img.get("identifier", 0):img.text for img in tree.xpath("(//configurations/configuration)[1]/fastbootimage/image")}
fastboot_images = [(img.get("identifier", 0),img.text) for img in tree.xpath("(//configurations/configuration)[1]/fastbootimage/image")]
return idt_images, fastboot_images

def get_simple(cfg):
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ def main(config, device, full, chip=""):
# First parse the config
idt_images, fastboot_images = idtconfig.get_images(config.read())
flasher = imageflasher.ImageFlasher(chip)
if device != False: # We have to check not False rather than just True, because None evaluates to False, and None should be passed intact
if not device is False:
flasher.connect_serial(device)
for addr, fil in idt_images.items():
flasher.download_from_disk(os.path.join(os.path.dirname(config.name), fil.replace("/", os.path.sep)), addr)
@@ -40,7 +40,7 @@ def main(config, device, full, chip=""):
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.""")
parser.add_argument("--norun", "-n", action="store_false", dest="run")
parser.add_argument("--device", "-d")
parser.add_argument("--fastboot", "--full", "-f", help="Flashes all fastboot images from the IDT config as well. Not supported with hikey config", action="store_true", default=False, dest="full")
parser.add_argument("--fastboot", "--full", "-f", help="Flashes all fastboot images from the IDT config as well. Will erase IMEI, SN, etc. Not supported with hikey config", action="store_true", default=False, dest="full")
parser.add_argument("config")
args = parser.parse_args()
with open(args.config, "rb") as f:

0 comments on commit e9fb77d

Please sign in to comment.