Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
System Manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
system
System Manager
Commits
fa7fda77
Commit
fa7fda77
authored
6 months ago
by
Suvendhu Hansa
Browse files
Options
Downloads
Patches
Plain Diff
Draft: test fw_bank
parent
93dfeb49
No related branches found
No related tags found
No related merge requests found
Pipeline
#189365
passed
6 months ago
Stage: static_code_analysis
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fw_images.c
+21
-5
21 additions, 5 deletions
src/fw_images.c
with
21 additions
and
5 deletions
src/fw_images.c
+
21
−
5
View file @
fa7fda77
...
...
@@ -184,17 +184,22 @@ static void dmubus_receive_sysupgrade(struct ubus_context *ctx, struct ubus_even
}
static
int
bbf_fw_image_download
(
const
char
*
url
,
const
char
*
auto_activate
,
const
char
*
username
,
const
char
*
password
,
const
char
*
file_size
,
const
char
*
checksum_algorithm
,
const
char
*
checksum
,
const
char
*
bank_id
,
const
char
*
command
,
const
char
*
obj_path
,
const
char
*
commandKey
,
const
char
*
keep
)
const
char
*
file_size
,
const
char
*
checksum_algorithm
,
const
char
*
checksum
,
const
char
*
bank_id
,
const
char
*
status
,
const
char
*
command
,
const
char
*
obj_path
,
const
char
*
commandKey
,
const
char
*
keep
)
{
char
fw_image_path
[
256
]
=
{
0
};
json_object
*
json_obj
=
NULL
;
bool
activate
=
false
,
valid
=
false
;
bool
activate
=
false
;
int
res
=
0
;
char
fault_msg
[
128
]
=
{
0
};
time_t
complete_time
=
0
;
time_t
start_time
=
time
(
NULL
);
if
(
DM_STRCMP
(
status
,
"Active"
)
==
0
)
{
res
=
-
1
;
snprintf
(
fault_msg
,
sizeof
(
fault_msg
),
"Firmware upgrade not allowed on active partition"
);
goto
end
;
}
DM_STRNCPY
(
fw_image_path
,
"/tmp/firmware-XXXXXX"
,
sizeof
(
fw_image_path
));
// Check the file system size if there is sufficient space for downloading the firmware image
...
...
@@ -231,6 +236,10 @@ static int bbf_fw_image_download(const char *url, const char *auto_activate, con
goto
end
;
}
#if 0
bool valid = false;
json_object *json_obj = NULL;
dmubus_call_blocking("system", "validate_firmware_image", UBUS_ARGS{{"path", fw_image_path, String}}, 1, &json_obj);
if (json_obj == NULL) {
res = -1;
...
...
@@ -250,6 +259,7 @@ static int bbf_fw_image_download(const char *url, const char *auto_activate, con
res = -1;
goto end;
}
#endif
string_to_bool
(
auto_activate
,
&
activate
);
...
...
@@ -558,8 +568,14 @@ static int operate_DeviceInfoFirmwareImage_Download(char *refparam, struct dmctx
char
*
keep_config
=
dmjson_get_value
((
json_object
*
)
value
,
1
,
BBF_VENDOR_PREFIX
"KeepConfig"
);
char
*
bank_id
=
get_fwbank_option_value
(
data
,
"id"
);
if
(
DM_STRLEN
(
bank_id
)
==
0
)
return
USP_FAULT_COMMAND_FAILURE
;
char
*
status
=
get_fwbank_option_value
(
data
,
"status"
);
if
(
DM_STRLEN
(
status
)
==
0
)
return
USP_FAULT_COMMAND_FAILURE
;
int
res
=
bbf_fw_image_download
(
url
,
auto_activate
,
username
,
password
,
file_size
,
checksum_algorithm
,
checksum
,
bank_id
,
command
,
obj_path
,
commandKey
,
keep_config
);
int
res
=
bbf_fw_image_download
(
url
,
auto_activate
,
username
,
password
,
file_size
,
checksum_algorithm
,
checksum
,
bank_id
,
status
,
command
,
obj_path
,
commandKey
,
keep_config
);
if
(
res
==
1
)
{
bbfdm_set_fault_message
(
ctx
,
"Firmware validation failed"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment