Skip to content

Commit

Permalink
Merge pull request #42 from AristoChen/main
Browse files Browse the repository at this point in the history
Support provision tool(genio-flash) for MediaTek devices
  • Loading branch information
kiya956 authored Sep 19, 2024
2 parents 9994a7b + e39c52f commit 6ae8330
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Program your own tplan yaml
password: target device user password
serial_console:
port: /dev/ttyUSBxxx
baud_rate: baud rate, support[115200, 9600]
baud_rate: baud rate, support[115200, 9600, 921600]
network: target device interface
extra-recepients: ["[email protected]"]

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies = [
"pyserial",
"schedule",
"wrapt_timeout_decorator",
"whl",
]

dynamic = ["version"]
Expand Down
1 change: 1 addition & 0 deletions sanity/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def start(plan, con, sched=None):
con,
stage["deploy"].get("utility"),
stage["deploy"].get("method"),
stage["deploy"].get("extra_provision_tool_args"),
stage["deploy"].get("update_boot_assets", False),
stage["deploy"].get("timeout", 600),
)
Expand Down
48 changes: 46 additions & 2 deletions sanity/agent/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,55 @@ def boot_assets_update(addr):
syscmd(cmd)


# pylint: disable=R0911,R0912,R0914,R0915
def deploy(con, method, user_init, update_boot_assets, timeout=600):
# pylint: disable=R0911,R0912,R0913,R0914,R0915
def deploy(
con,
method,
user_init,
extra_provision_tool_args,
update_boot_assets,
timeout=600,
):
"""handle different provision method and run provision"""
files = "seed"
match method:
case "genio_flash":
# Assuming the host is >= 22.04
gitlab_url = (
"git+https://gitlab.com/mediatek/aiot/bsp/"
+ "genio-tools.git#egg=genio-tools"
)
syscmd(f"set -x; pip3 install -U -e {gitlab_url}")
syscmd("set -x; export PATH=$PATH:/home/$USER/.local/bin/")
syscmd("set -x; genio-config")
image_tarball = [
f
for f in os.listdir("./")
if re.search(
r"genio-(core|classic-(server|desktop)).*\.(tar\.xz)$",
f,
)
][0]
image_dir = image_tarball.split(".")[0]
boot_assets_tarball = [
f
for f in os.listdir("./")
if re.search(
r"genio.*boot-assets.*\.(tar\.xz)$",
f,
)
][0]
syscmd(f"set -x; rm -rf {image_dir}")
syscmd(f"set -x; tar xf {image_tarball}")
syscmd(
"set -x; tar --strip-components=1 -xf "
f"{boot_assets_tarball} -C {image_dir}"
)
syscmd(
f"set -x; cd {image_dir};"
f"genio-flash '{extra_provision_tool_args}'"
)

case "utp_com":
# This method is currently used for i.MX6 devices that does not
# use uuu to flash image
Expand Down
6 changes: 5 additions & 1 deletion sanity/launcher/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"port": {"type": "string"},
"baud_rate": {
"type": "integer",
"enum": [115200, 9600],
"enum": [115200, 9600, 921600],
"default": 115200,
},
},
Expand Down Expand Up @@ -60,6 +60,7 @@
"utility": {
"type": "string",
"enum": [
"genio_flash",
"utp_com",
"uuu",
"uuu_bootloader",
Expand All @@ -69,6 +70,9 @@
],
},
"method": {"$ref": "#/$defs/method"},
"extra_provision_tool_args": {
"type": "string"
},
"timeout": {
"type": "integer",
"default": 600,
Expand Down

0 comments on commit 6ae8330

Please sign in to comment.