@@ -100,6 +100,7 @@ def flash( # noqa: C901
100100 retries : int = 3 ,
101101 method : str = "fls" ,
102102 fls_version : str = "" ,
103+ fls_binary_url : str | None = None ,
103104 ):
104105 if bearer_token :
105106 bearer_token = self ._validate_bearer_token (bearer_token )
@@ -173,7 +174,7 @@ def flash( # noqa: C901
173174 self ._perform_flash_operation (
174175 partition , path , image_url , should_download_to_httpd ,
175176 storage_thread , error_queue , cacert_file , insecure_tls ,
176- headers , bearer_token , method , fls_version
177+ headers , bearer_token , method , fls_version , fls_binary_url
177178 )
178179 self .logger .info (f"Flash operation succeeded on attempt { attempt + 1 } " )
179180 break
@@ -299,6 +300,7 @@ def _perform_flash_operation(
299300 bearer_token : str | None ,
300301 method : str ,
301302 fls_version : str ,
303+ fls_binary_url : str | None ,
302304 ):
303305 """Perform the actual flash operation with console setup.
304306
@@ -363,6 +365,7 @@ def _perform_flash_operation(
363365 stored_cacert ,
364366 header_args ,
365367 fls_version ,
368+ fls_binary_url ,
366369 )
367370 elif method == "shell" :
368371 self ._flash_with_progress (
@@ -464,6 +467,7 @@ def _flash_with_fls(
464467 stored_cacert ,
465468 header_args : str ,
466469 fls_version : str ,
470+ fls_binary_url : str | None ,
467471 ):
468472 """Flash image to target device with progress monitoring.
469473
@@ -477,13 +481,27 @@ def _flash_with_fls(
477481 stored_cacert: Path to the stored CA certificate in the DUT flasher
478482 header_args: Header arguments for curl command
479483 fls_version: Version of FLS to use
484+ fls_binary_url: Custom URL to download FLS binary from (overrides fls_version)
480485 """
481486
482487 # Calculate decompress and tls arguments for curl
483488 prompt = manifest .spec .login .prompt
484489 tls_args = self ._cmdline_tls_args (insecure_tls , stored_cacert )
485490
486- if fls_version != "" :
491+ if fls_binary_url :
492+ self .logger .info (f"Downloading FLS binary from custom URL: { fls_binary_url } " )
493+ console .sendline (f"curl -L { fls_binary_url } -o /sbin/fls" )
494+ console .expect (prompt , timeout = EXPECT_TIMEOUT_DEFAULT )
495+ console .sendline ("echo $?" )
496+ console .expect (prompt , timeout = EXPECT_TIMEOUT_DEFAULT )
497+
498+ exit_code = int (console .before .decode (errors = "ignore" ).strip ().splitlines ()[- 1 ])
499+
500+ if exit_code != 0 :
501+ raise FlashRetryableError (f"Failed to download FLS from { fls_binary_url } , exit code: { exit_code } " )
502+ console .sendline ("chmod +x /sbin/fls" )
503+ console .expect (prompt , timeout = EXPECT_TIMEOUT_DEFAULT )
504+ elif fls_version != "" :
487505 self .logger .info (f"Downloading FLS version { fls_version } from GitHub releases" )
488506 # Download fls binary to the target device (until it is available on the target device)
489507 fls_url = (
@@ -1166,6 +1184,11 @@ def base():
11661184 default = "0.1.9" , # TODO(majopela): set default to "" once fls is included in our images
11671185 help = "Download an specific fls version from the github releases" ,
11681186 )
1187+ @click .option (
1188+ "--fls-binary-url" ,
1189+ type = str ,
1190+ help = "Custom URL to download FLS binary from (overrides --fls-version)" ,
1191+ )
11691192 @debug_console_option
11701193 def flash (
11711194 file ,
@@ -1182,6 +1205,7 @@ def flash(
11821205 retries ,
11831206 method ,
11841207 fls_version ,
1208+ fls_binary_url ,
11851209 ):
11861210 """Flash image to DUT from file"""
11871211 if os_image_checksum_file and os .path .exists (os_image_checksum_file ):
@@ -1205,6 +1229,7 @@ def flash(
12051229 retries = retries ,
12061230 method = method ,
12071231 fls_version = fls_version ,
1232+ fls_binary_url = fls_binary_url ,
12081233 )
12091234
12101235 @base .command ()
0 commit comments