====================
Detailed revision history can be found in the Git repository; for code, look at lbmk.git
and for documentation, look at lbwww.git
.
With no additional changes to nvmutil, the project became part of lbmk, which is the Libreboot build system. Please refer to Libreboot’s imported version of the nvmutil documentation: nvmutil.html
This code and documentation import was performed on November 17th, 2022.
Future changes to nvmutil (in lbmk.git
) shall be included in regular Libreboot release announcements, under news/
, so please be sure to check that from now on.
For historical and reference purposes, the original nvmutil repository shall be preserved on notabug. See:
https://notabug.org/osboot/nvmutil
Very minor bugfix release:
stdio rpath
(instead of stdio wpath
), only when the dump
command is used. (pledge is only used on OpenBSD systems; an ifdef rule prevents its use on other systems)Not much has changed, as this just fixes minor bugs and behavioural quirks seen in the previous release:
No new features have been added. This is a code cleanup and bugfix release.
dump
command no longer warns about multicast MAC addresses (such a warning is unnecessary, and up to the user to prevent)setmac
command still prevents multicast MAC addresses being set, but no longer specifically warns about them (the documentation says not to use them already. No need to re-implement documentation in code)No new features have been added. This is a code cleanup and bugfix release.
tcc
in an x86_64 machine. On my tests, tcc
produces a 10540 byte binary in the previous release; in this release I got 9796 bytes.nvmmac
from the older nvmutils is 9892 bytes compiled with tcc
on my test system; that’s with the help/version output text removed from nvmmac. This nvmutil release contains so many more features and safety checks than just that lone nvmmac
utility, yet the nvmutil
binary is 1% smaller in size! That’s how efficient the nvmutil
code is, and there is probably room for further improvement of code efficiency.status
variable is no longer used; instead, errno
is used exclusively and extensively. Error handling is much simpler, and much more unixy as a result.dump
command no longer states whether the MAC address is local or global; this can be easily done by yourself, and this change slightly reduces code bloat in nvmutil. The code still warns you if the MAC address is multicastdump
command now warns when the address is multicast, if set by another tool or older nvmutil that way (it will also return non-zero status upon exit). In addition, it will say whether the address is locally or globally assigned.setmac
command can now be used without specifying a MAC address, which will cause the same behaviour as setmac ??:??:??:??:??:??
Released on 8 August 2022. Changes:
pledge(2)
now used, if available at build time (ifdef rule used, so it still compiles on Linux/FreeBSD)setmac
is now able to set random MAC addresses. This is done by reading from /dev/urandom
. It is done conditionally, per-nibble, as specified by the user. For example, you can specify ??:??:??:??:??:??
and every nibble will be random, or you could set some of them statically. For example: 00:1f:16:??:4?:?2
read()
and pwrite()
functions are now used for reading and writing files; older nvmutil versions used fopen/fseek/ftell and so on. The read/write functions are POSIX, and enable more robust file handling.showmac
and dump
, O_RDONLY
is now set when executing read()
. This means that these commands can now be used on read-only files.-Os
flag used, instead of -O2
dump
command will always cause an EXIT_FAILURE
status when at least one part in the NVM image has a bad checksum. When writing a new MAC address, it will work only on valid parts like before, but now nvmutil will return with EXIT_FAILURE
if one OR both parts are bad; older nvmutil versions always returned EXIT_SUCCESS
after modifying the file.help
and version
commands have been removed; it is best to simply read the documentation. Programs should not include documentation inside themselves, but documentation should always be supplied separately, alongside that program. This change alone accounts for roughly 1/3 (33%) of the code size reduction; the other 2/3 of that reduction is due to increased code efficiency in general.My test setup is an x86_64 machine with tcc
used as the compiler; the libc doesn’t really matter, if you use dynamic linking. Command:
make CC=tcc
Observations (dynamic linking with libc files):
SLOC (source lines of code):
These numbers were obtained, using the sloccount
program by David A. Wheeler, which you can find here:
This means that the actual reduction in compiled logic is about 1.89KB, or a 15% reduction, in nvmutil 20220808. By logic, I mean all code excluding the help function; this distinction is important, because the help/version commands are unavailable in nvmutil 20220808, but they were available in nvmutil 20220802.
Extra note: I also tested compressed sizes. With tar
piped to xz -9e
, I saw: about 3KB if compiled with tcc, and 5KB using gcc. Clang produces binaries of similar size, when compared with GCC.
Since the performance of nvmutil is largely disk-bound, I really recommend compiling it with tcc
, not GCC or Clang because the binary sizes are much larger with those compilers, even with optimization flags; despite this, the Makefile in nvmutil assumes GCC/Clang and sets CFLAGS
to -Os
.
Released on 2 August 2022. Changes:
Released on 31 July 2022. Changes:
malloc
function is no longer usedThat’s it. Bug fixes and safety features added. Enjoy!
Initial release. It is functionally equivalent to the older nvmutils
, developed for the osboot project. This newer version is reduced to a single source file instead of many, and builds as a single binary instead of many.
Markdown file for this page: https://libreboot.org/docs/install/nvmutilimport.md
Subscribe to RSS for this site
This HTML page was generated by the Untitled Static Site Generator.