[U-Boot] [PATCH] fw_env: Make env flash lock optional

dirk.eibach at gdsys.cc dirk.eibach at gdsys.cc
Thu Jun 2 09:09:14 CEST 2016


From: Dirk Eibach <dirk.eibach at gdsys.cc>

Since locking flash is horribly broken on some platforms,
offer an option to build fw_env tools without locking.

Signed-off-by: Dirk Eibach <dirk.eibach at gdsys.cc>

---

 tools/env/fw_env.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 06cf63d..e47232a 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -908,8 +908,10 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count,
 			return -1;
 		}
 
+#ifndef NO_MEMLOCK
 		if (mtd_type != MTD_ABSENT)
 			ioctl(fd, MEMLOCK, &erase);
+#endif
 
 		processed  += erasesize;
 		block_seek = 0;
@@ -941,7 +943,9 @@ static int flash_flag_obsolete (int dev, int fd, off_t offset)
 	}
 	ioctl (fd, MEMUNLOCK, &erase);
 	rc = write (fd, &obsolete_flag, sizeof (obsolete_flag));
+#ifndef NO_MEMLOCK
 	ioctl (fd, MEMLOCK, &erase);
+#endif
 	if (rc < 0)
 		perror ("Could not set obsolete flag");
 
-- 
2.1.3



More information about the U-Boot mailing list