Brian Sune 3ba9b1f7bd Cyclone V Board handsoff script
Since turning from old build flow.
New Altera SoCFPGA requires converting handsoff
conversion via the python script. This is from
official provided, and now sync to U-Boot with
better location at tools/cv_xxxx. Meantime,
requirement.txt is also provided to further
explain the libraries require for these scripts.

Signed-off-by: Brian Sune <briansune@gmail.com>
Reviewed-by: Tien Fong Chee <tien.fong.chee@altera.com>
2025-12-01 14:01:12 +08:00

33 lines
930 B
Python
Executable File

# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
"""
XML node parser
Copyright (C) 2022 Intel Corporation <www.intel.com>
Author: Lee, Kah Jing <kah.jing.lee@intel.com>
"""
import xml.dom
def isElementNode(XMLNode):
""" check if the node is element node """
return XMLNode.nodeType == xml.dom.Node.ELEMENT_NODE
def firstElementChild(XMLNode):
""" Calling firstChild on an Node of type Element often (always?)
returns a Node of Text type. How annoying! Return the first Element
child
"""
child = XMLNode.firstChild
while child != None and not isElementNode(child):
child = nextElementSibling(child)
return child
def nextElementSibling(XMLNode):
""" nextElementSibling will return the next sibling of XMLNode that is
an Element Node Type
"""
sib = XMLNode.nextSibling
while sib != None and not isElementNode(sib):
sib = sib.nextSibling
return sib