diff --git a/src/builder/b-conf.c b/src/builder/b-conf.c
index 1839dc9..397ea41 100644
--- a/src/builder/b-conf.c
+++ b/src/builder/b-conf.c
@@ -46,7 +46,8 @@ static const char * const paths_global[] = {
"power-off.url",
"power-monitor.url",
"rebuild_script_user",
- "rebuild_script_root"
+ "rebuild_script_root",
+ "build-timeout-secs"
};
enum enum_paths_global {
@@ -65,7 +66,8 @@ enum enum_paths_global {
LEJPM_POWER_OFF_URL,
LEJPM_POWER_MONITOR_URL,
LEJPM_REBUILD_SCRIPT_USER,
- LEJPM_REBUILD_SCRIPT_ROOT
+ LEJPM_REBUILD_SCRIPT_ROOT,
+ LEJPM_BUILD_TIMEOUT_SECS
};
/* platform-related part */
@@ -258,6 +260,11 @@ saib_conf_global_cb(struct lejp_ctx *ctx, char reason)
if (!(reason & LEJP_FLAG_CB_IS_VALUE) || !ctx->path_match)
return 0;
+ if (ctx->path_match - 1 == LEJPM_BUILD_TIMEOUT_SECS) {
+ a->builder->build_timeout_secs = (unsigned int)atoi(ctx->buf);
+ lwsl_notice("%s: LEJPM_BUILD_TIMEOUT_SECS %u\n", __func__, a->builder->build_timeout_secs);
+ }
+
if (reason != LEJPCB_VAL_STR_END)
return 0;
diff --git a/src/builder/b-nspawn.c b/src/builder/b-nspawn.c
index 350ce6a..1343af6 100644
--- a/src/builder/b-nspawn.c
+++ b/src/builder/b-nspawn.c
@@ -666,7 +666,7 @@ saib_spawn_script(struct sai_nspawn *ns)
info.exec_array = cmd;
info.protocol_name = "sai-stdxxx";
info.max_log_lines = 10000;
- info.timeout_us = 30 * 60 * LWS_US_PER_SEC;
+ info.timeout_us = (uint64_t)builder.build_timeout_secs * LWS_US_PER_SEC;
info.reap_cb = sai_lsp_reap_cb;
#if defined(WIN32)
info.pty_mode = 0;
@@ -864,7 +864,7 @@ saib_shell_spawn(struct sai_plat_server *spm, const char *task_uuid)
info.exec_array = cmd;
info.protocol_name = "sai-saishell";
info.max_log_lines = 10000;
- info.timeout_us = 30 * 60 * LWS_US_PER_SEC;
+ info.timeout_us = (uint64_t)builder.build_timeout_secs * LWS_US_PER_SEC;
info.reap_cb = sai_shell_reap_cb;
info.pty_mode = 1;
info.disable_ctrlc = 0;
diff --git a/src/builder/b-private.h b/src/builder/b-private.h
index 39b9a58..8ee836b 100644
--- a/src/builder/b-private.h
+++ b/src/builder/b-private.h
@@ -185,6 +185,7 @@ struct sai_builder {
uint64_t disk_reserved_kib;
uint16_t wrap14;
+ unsigned int build_timeout_secs;
#if !defined(WIN32)
int pipe_suspender_wr;
diff --git a/src/builder/b-sai.c b/src/builder/b-sai.c
index 78a13a3..a450f32 100644
--- a/src/builder/b-sai.c
+++ b/src/builder/b-sai.c
@@ -654,6 +654,7 @@ saib_app_run(int argc, const char **argv)
*/
lwsl_notice("%s: config dir %s\n", __func__, config_dir);
+ builder.build_timeout_secs = 30 * 60;
if (saib_config_global(&builder, config_dir)) {
lwsl_err("%s: global config failed\n", __func__);