summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-01-28 21:19:29 +0000
committerLeah Rowe <leah@libreboot.org>2023-01-28 21:26:36 +0000
commitadc76e38140e29526131d35f2c102009bfafeff8 (patch)
tree4bb66c60fd064e16968ca8e0c3e3405f58670654 /util
parent3e150bf3032074ba4270131fd3e1fb5f0b1cc43e (diff)
util/nvmutil: do not write non-changes to disk
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index abbf243..6dbe518 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -129,6 +129,8 @@ main(int argc, char *argv[])
if (gbeFileModified)
writeGbeFile(&fd, FILENAME);
+ else if ((cmd != &cmd_dump))
+ printf("File `%s` not modified.\n", FILENAME);
nvmutil_exit:
if ((errno != 0) && (cmd != &cmd_dump))
@@ -406,6 +408,9 @@ word(int pos16, int partnum)
void
setWord(int pos16, int partnum, uint16_t val16)
{
+ if (word(pos16, partnum) == val16)
+ return;
+
uint8_t *nbuf = (uint8_t *) gbe[partnum];
uint8_t val8[2] = {(uint8_t) (val16 & 0xff), (uint8_t) (val16 >> 8)};
uint16_t pos8 = pos16 << 1;