mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-19 08:54:48 -04:00
tools/env/fw_printenv: Make redundant env work on locked flashes also
The invalidation of the old environment instance did not work for flashes supporting hardware locking. Now we unlock/lock around this update also. Signed-off-by: Detlev Zundel <dzu@denx.de>
This commit is contained in:
parent
a4e8d9f5f9
commit
0aef7bc719
7
tools/env/fw_env.c
vendored
7
tools/env/fw_env.c
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* (C) Copyright 2000-2008
|
* (C) Copyright 2000-2010
|
||||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||||
*
|
*
|
||||||
* (C) Copyright 2008
|
* (C) Copyright 2008
|
||||||
@ -899,7 +899,10 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count,
|
|||||||
static int flash_flag_obsolete (int dev, int fd, off_t offset)
|
static int flash_flag_obsolete (int dev, int fd, off_t offset)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
struct erase_info_user erase;
|
||||||
|
|
||||||
|
erase.start = DEVOFFSET (dev);
|
||||||
|
erase.length = DEVESIZE (dev);
|
||||||
/* This relies on the fact, that obsolete_flag == 0 */
|
/* This relies on the fact, that obsolete_flag == 0 */
|
||||||
rc = lseek (fd, offset, SEEK_SET);
|
rc = lseek (fd, offset, SEEK_SET);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@ -907,7 +910,9 @@ static int flash_flag_obsolete (int dev, int fd, off_t offset)
|
|||||||
DEVNAME (dev));
|
DEVNAME (dev));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
ioctl (fd, MEMUNLOCK, &erase);
|
||||||
rc = write (fd, &obsolete_flag, sizeof (obsolete_flag));
|
rc = write (fd, &obsolete_flag, sizeof (obsolete_flag));
|
||||||
|
ioctl (fd, MEMLOCK, &erase);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
perror ("Could not set obsolete flag");
|
perror ("Could not set obsolete flag");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user