Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
587a99f8
Commit
587a99f8
authored
Mar 22, 2019
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
values for flash_erase are read from sysfs for all partitions
parent
d3a262f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
update_nand.php
src/update/update_nand.php
+19
-10
No files found.
src/update/update_nand.php
View file @
587a99f8
...
...
@@ -141,6 +141,21 @@ function backup_note(){
print
(
"<b>NOTE</b>: If flashing rootfs, please download a backup copy of <a href='
$base
?cmd=backup'>/etc/elphel393</a><br/>"
);
}
// $defaults are not used yet. No need
function
get_flash_erase_args
(
$dev
,
$defaults
){
$mtd_device
=
explode
(
"/"
,
$dev
)[
2
];
$mtd_sysfs_path
=
"/sys/class/mtd/
$mtd_device
"
;
$mtd_size
=
intval
(
file_get_contents
(
"
$mtd_sysfs_path
/size"
));
$mtd_erasesize
=
intval
(
file_get_contents
(
"
$mtd_sysfs_path
/erasesize"
));
$mtd_size_blocks
=
intval
(
$mtd_size
/
$mtd_erasesize
);
$mtd_erase_start
=
0
;
$res
=
"
$mtd_erase_start
$mtd_size_blocks
"
;
return
$res
;
}
function
nandflash
(
$list
){
global
$UPDATE_DIR
;
global
$FLASH_LOG
;
...
...
@@ -153,20 +168,14 @@ function nandflash($list){
if
(
$e
[
0
]
==
0
){
if
(
$e
[
1
]
!=
"rootfs.ubi"
){
exec
(
"flash_unlock ${e[2]} >>
$FLASH_LOG
"
);
exec
(
"flash_erase ${e[2]} ${e[3]} >>
$FLASH_LOG
"
);
$flash_erase_args
=
get_flash_erase_args
(
$e
[
2
],
$e
[
3
]);
exec
(
"flash_erase ${e[2]}
$flash_erase_args
>>
$FLASH_LOG
"
);
exec
(
"nandwrite -n ${e[2]} -p
$UPDATE_DIR
/${e[1]} >>
$FLASH_LOG
"
);
}
else
{
if
(
!
is_dir
(
$NAND_PATH
))
{
exec
(
"flash_unlock ${e[2]} >>
$FLASH_LOG
"
);
// make more universal
$mtd_device
=
explode
(
"/"
,
$e
[
2
])[
2
];
$mtd_sysfs_path
=
"/sys/class/mtd/
$mtd_device
"
;
$mtd_size
=
intval
(
file_get_contents
(
"
$mtd_sysfs_path
/size"
));
$mtd_erasesize
=
intval
(
file_get_contents
(
"
$mtd_sysfs_path
/erasesize"
));
$mtd_size_blocks
=
intval
(
$mtd_size
/
$mtd_erasesize
);
$mtd_erase_start
=
0
;
//exec("flash_erase ${e[2]} ${e[3]} >> $FLASH_LOG");
exec
(
"flash_erase ${e[2]}
$mtd_erase_start
$mtd_size_blocks
>>
$FLASH_LOG
"
);
$flash_erase_args
=
get_flash_erase_args
(
$e
[
2
],
$e
[
3
]);
exec
(
"flash_erase ${e[2]}
$flash_erase_args
>>
$FLASH_LOG
"
);
exec
(
"ubiformat ${e[2]} -f
$UPDATE_DIR
/${e[1]} ${e[4]} >>
$FLASH_LOG
"
);
}
else
{
rootfs_warning_note
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment