Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
broadcom-utils
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
Container registry
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Broadcom
broadcom-utils
Commits
39541e16
Commit
39541e16
authored
5 years ago
by
Ronny Nilsson
Browse files
Options
Downloads
Patches
Plain Diff
Support for creating an UBI volume.
parent
d95633e6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
brcm_fw_tool/image-ubi.c
+33
-3
33 additions, 3 deletions
brcm_fw_tool/image-ubi.c
with
33 additions
and
3 deletions
brcm_fw_tool/image-ubi.c
+
33
−
3
View file @
39541e16
...
...
@@ -76,6 +76,7 @@ struct metaInfo_t {
//-------------------------------------------------------------
const
char
ubiStr3
[]
=
"metadata"
;
char
ubiStr2
[]
=
"cferam.000"
;
char
ubiStr1
[]
=
"committed"
;
...
...
@@ -145,6 +146,32 @@ int ubi_erase_volume(int devId, int volId)
//-------------------------------------------------------------
// Erase an UBI volume (if exists).
int
ubi_create_volume
(
int
volId
)
{
char
nodePath
[
UBI_MAX_VOLUME_NAME
];
struct
ubi_mkvol_request
mkReq
;
memset
(
&
mkReq
,
0
,
sizeof
(
mkReq
));
mkReq
.
vol_id
=
volId
;
mkReq
.
bytes
=
devInfo
.
leb_size
;
mkReq
.
vol_type
=
UBI_STATIC_VOLUME
;
mkReq
.
name
=
ubiStr3
;
snprintf
(
nodePath
,
UBI_MAX_VOLUME_NAME
,
"/dev/ubi%d"
,
devInfo
.
dev_num
);
errno
=
0
;
if
(
ubi_mkvol
(
libubi
,
nodePath
,
&
mkReq
))
{
fprintf
(
stderr
,
"Error creating UBI volume %d: %s
\n
"
,
volId
,
strerror
(
errno
));
return
-
1
;
}
return
0
;
}
//-------------------------------------------------------------
// Init the UBI library and query system for info.
static
int
ubi_probe
(
void
)
...
...
@@ -510,9 +537,12 @@ static int meta_manage_vols(void)
}
tmpMeta
=
meta_by_id
(
newMeta
);
if
(
tmpMeta
)
{
ubi_erase_volume
(
tmpMeta
->
volInfo
.
dev_num
,
tmpMeta
->
volInfo
.
vol_id
);
}
if
(
tmpMeta
)
ubi_erase_volume
(
newMeta
);
if
(
ubi_create_volume
(
newMeta
))
return
-
1
;
tmpMeta
=
meta_by_id
(
delMeta
);
if
(
tmpMeta
)
ubi_erase_volume
(
delMeta
);
//delete_volume(newMeta);
//create_new_ubi(newMeta)
...
...
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