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
Automate
Agent sessions
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
Broadcom
broadcom-utils
Commits
d95633e6
Commit
d95633e6
authored
Sep 24, 2019
by
Ronny Nilsson
Browse files
Options
Downloads
Patches
Plain Diff
Support for erasing UBI volumes.
parent
aefb770c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
brcm_fw_tool/image-ubi.c
+37
-0
37 additions, 0 deletions
brcm_fw_tool/image-ubi.c
with
37 additions
and
0 deletions
brcm_fw_tool/image-ubi.c
+
37
−
0
View file @
d95633e6
...
@@ -114,6 +114,37 @@ static unsigned int ubi_read_blk(unsigned char *start, unsigned int blk, unsigne
...
@@ -114,6 +114,37 @@ static unsigned int ubi_read_blk(unsigned char *start, unsigned int blk, unsigne
//-------------------------------------------------------------
// Erase an UBI volume (if exists).
int
ubi_erase_volume
(
int
devId
,
int
volId
)
{
char
nodePath
[
UBI_MAX_VOLUME_NAME
];
struct
ubi_vol_info
volInfo
;
memset
(
&
volInfo
,
0
,
sizeof
(
volInfo
));
if
(
!
ubi_dev_present
(
libubi
,
devId
))
return
-
1
;
if
(
ubi_get_vol_info1
(
libubi
,
devId
,
volId
,
&
volInfo
)
&&
errno
==
ENODEV
)
{
fprintf
(
stderr
,
"Error deleting volume %d: %s
\n
"
,
volId
,
strerror
(
errno
));
return
-
1
;
}
else
if
(
volInfo
.
dev_num
!=
devId
||
volInfo
.
vol_id
!=
volId
)
{
fprintf
(
stderr
,
"Error deleting volume %d
\n
"
,
volId
);
return
-
1
;
}
snprintf
(
nodePath
,
UBI_MAX_VOLUME_NAME
,
"/dev/ubi%d"
,
devId
);
if
(
ubi_rmvol
(
libubi
,
nodePath
,
volId
))
{
fprintf
(
stderr
,
"Error deleting volume %d: %s
\n
"
,
volId
,
strerror
(
errno
));
return
-
1
;
}
return
0
;
}
//-------------------------------------------------------------
//-------------------------------------------------------------
// Init the UBI library and query system for info.
// Init the UBI library and query system for info.
static
int
ubi_probe
(
void
)
static
int
ubi_probe
(
void
)
...
@@ -424,6 +455,7 @@ static int meta_generate_blob(int seqNo)
...
@@ -424,6 +455,7 @@ static int meta_generate_blob(int seqNo)
static
int
meta_manage_vols
(
void
)
static
int
meta_manage_vols
(
void
)
{
{
int
highSeqNo
,
highMeta
,
i
,
newMeta
,
delMeta
;
int
highSeqNo
,
highMeta
,
i
,
newMeta
,
delMeta
;
struct
metaInfo_t
*
tmpMeta
;
highSeqNo
=
0
;
highSeqNo
=
0
;
highMeta
=
0
;
highMeta
=
0
;
...
@@ -477,6 +509,11 @@ static int meta_manage_vols(void)
...
@@ -477,6 +509,11 @@ static int meta_manage_vols(void)
printf
(
".
\n
"
);
printf
(
".
\n
"
);
}
}
tmpMeta
=
meta_by_id
(
newMeta
);
if
(
tmpMeta
)
{
ubi_erase_volume
(
tmpMeta
->
volInfo
.
dev_num
,
tmpMeta
->
volInfo
.
vol_id
);
}
//delete_volume(newMeta);
//delete_volume(newMeta);
//create_new_ubi(newMeta)
//create_new_ubi(newMeta)
//write_metadata(newMeta)
//write_metadata(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
sign in
to comment