summaryrefslogtreecommitdiff
path: root/util
AgeCommit message (Collapse)Author
2025-01-24util/nvmutil: more minor cleanupLeah Rowe
just some line breaks Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-24util/nvmutil: more granular MAC parsing errorsLeah Rowe
tell the user exactly what they got wrong, instead of simply printing "bad mac address", which is not very helpful to the user Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-24util/nvmutil: more cleanupLeah Rowe
spread out a few lines, so that they are more readable, and more thoroughly comment some parts. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-24remove errant comment in nvmutilLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-24util/nvmutil: support 16kb and 128kb gbe filesLeah Rowe
See: https://edc.intel.com/content/www/us/en/design/ipla/software-development-platforms/client/platforms/alder-lake-mobile-p/intel-600-series-chipset-family-on-package-platform-controller-hub-pch-datash/spi0-for-flash/ The rules described there are universal, and replicated elsewhere for many other platforms. The rules are simply: * Flash descriptor is one block size, e.g. 4KB * GbE is two block sizes, so if IfD is 4KB, GbE is 8KB Intel defines 16KB and 128KB GbE files in specs, pertaining to 8KB and 64KB block sizes respectively. The minimum size is 4KB blocksize, for 8KB GbE files which we already supported. On larger block sizes, the same 4KB parts are observed: a single 4KB IfD area at the start of the block, and: 4KB GbE part at the start of the GbE region, and: 4KB GbE part at the start of GbE region plus block size The empty space inbetween is padding, and we ignore it, except when running swap/copy commands. The nvmutil code has been modified, to create a 128KB buffer in memory instead of 8KB, for loading GbE files. Partsize is set to GbE file size divided by 2, and only the area of memory we need to use is mapped; for example, if we're loading a 8KB GbE file into memory, we only touch the first 8KB part of the buffer, or first 16KB for 128KB files. In practise, we almost never see GbE files with sizes higher than 8KB, but *we have seen it*, *AND NOW IT'S SUPPORTED!" Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-24util/nvmutil: Prevent unveil allowing dir accessLeah Rowe
We were checking directories *after* calling unveil, which means that the sandboxing was incomplete; we only want files to be accessed, not directories. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-24typo: nvme should say nvm in nvmutil.cLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-24util/nvmutil: General code cleanupLeah Rowe
A lot of size-coding was performed in prior audits, to make the sloccount lower on nvmutil, but this resulted in code that wasn't very human readable. I've reversed some of it and added comments, for clarity. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Update AUTHORS and COPYING filesLeah Rowe
Mention Riku's copyright in the COPYING file, and update my years in that file. Add Riku to the AUTHORS file. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Describe nvmutil in help outputLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Remove the correct binary on uninstallLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/spkmodem-recv: More correct MakefileLeah Rowe
Set up the DESTDIR variable properly. Otherwise, this is just style changes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Honour the INSTALL variableLeah Rowe
Don't assume "install" is the correct command. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Don't clean when doing uninstallLeah Rowe
The user might wish to uninstall, but not remove the build that they just did. The user can still do make clean if they wish. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Proper DESTDIR/PREFIX handlingLeah Rowe
DESTDIR is the root directory where it goes, which is normally an empty string; PREFIX is where the bin directory is located, relative to DESTDIR Default to /usr/local for PREFIX, not /usr, because /usr/bin is for system utilities. nvmutil is a local utility. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Set CC and CFLAGS only if unsetLeah Rowe
We don't want to clobber anything that the user set themselves. Instead, we should respect the user's choice. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Capitalise BABALeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Add uninstall to MakefileLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Add distclean to MakefileLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: Make the GbE checksum a defineLeah Rowe
This makes the code easier to understand. All 2-byte words, stored in little endian order within the 128-byte GbE NVM area, must add up to 0xBABA. If it doesn't, then software is supposed to reject that GbE config. The nvmutil software works on that basis. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: nicer hexdump displayLeah Rowe
make it look like hexdump -C, where individual bytes are spaced, and there is an additional space after 8 bytes, per row. i won't bother with a character display, since that is meaningless on gbe nvm words. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-03util/nvmutil: show the correct hexdump orderLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-01util/nvmutil: Obey the 79-character per line limitLeah Rowe
Must not exceed 79 lines. Some variables and functions have been renamed, and there has been some minor re-factoring. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-01util/nvmutil: Tidy up copyright headerLeah Rowe
I don't like using SPDX for actual copyright declarations. I only want it to be used for the license identifier. Also: I made a *single* change to nvmutil.c in 2024, which means that I have copyright in all years since and including 2022; the file said 2022, 2023, 2025, but it's actually 2022-2025. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-01-01util/nvmutil: Fix another stragglerLeah Rowe
I don't like using strings this way, it looks unclean. Once again, use good old fashioned if/else. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-12-31util/nvmutil: Tidy up pledge callsLeah Rowe
I wasn't too happy using shorthand for strings like that. Tidy it up and use good old fashioned if/else. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-16remove util/autoportLeah Rowe
upstream has merged all of the changes that it contained, so we don't need this anymore. we'll have the newer upstream changes on the next general revision updates for coreboot, within config/coreboot/ Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-01dell-flash-unlock: Remove dependency on GNU MakeNicholas Chin
Use shell scripting in the recipe instead of GNU make's conditional syntax. This allows the Makefile to work with the default implementations of make on the BSDs. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-05-01dell-flash-unlock: Update README for BSDNicholas Chin
Add FreeBSD to the README as it is now supported. Make a note about using gmake instead of make as the makefile currently uses GNU extensions to determine build flags based on the OS. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-05-01dell_flash_unlock: Add support for FreeBSDNicholas Chin
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-05-01dell_flash_unlock: Set iopl level back to 0 when doneNicholas Chin
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-05-01dell_flash_unlock: Fix ec_set_fdo() signatureNicholas Chin
Set argument list as void. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-04-28dell-flash-unlock: Remove unnecessary includes for NetBSDNicholas Chin
The pio.h header, although present on NetBSD, is not necessary, as it only declares x86 port IO inx()/outx() functions which are not actually implemented. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-04-28dell-flash-unlock: Remove memory clobber from inline assemblyNicholas Chin
The x86 port IO instructions do not access memory so it is not needed in the clobber list. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-04-26Merge pull request 'dell-flash-unlock: add NetBSD support' (#194) from ↵Leah Rowe
linear/lbmk:master into master Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/194
2024-03-18util: Import autoport with Haswell patchesNicholas Chin
This is a copy of coreboot's autoport utility, with a patch applied to support Haswell/Lynx Point platforms. That patch is currently in review on coreboot's Gerrit. https://review.coreboot.org/c/coreboot/+/30890 Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-03-16dell-flash-unlock: add NetBSD supportlinear cannon
2024-01-27remove remaining flashrom remnants (use flashprog)Leah Rowe
we use flashprog now! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-05README.md: Add Latitude E7270 as supportedNicholas Chin
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-01-05README.md: Add notes about iopl and AC adapter requirementNicholas Chin
In order for the EC to maintain the state of whether or not to set the flash descriptor override across a power cycle, the AC adapter must be connected, as the system leaves the voltage rail that the EC uses powered under this condition. Without this, the utility may fail, continually asking the user to power off and on. On Linux, CONFIG_X86_IOPL_IOPERM must be set for the kernel, or else the iopl call will error with "Function not implemented". Make a note of this in case a user runs into this issue. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2024-01-05README.md: List E6520, E5530, and M4800 as supportedNicholas Chin
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
2023-12-17README.md: Add possibly not working systemsNicholas Chin
These systems have a report that the unlock utility does not work. Until there are multiple reports of failed unlocks and a technical determination of why it doesn't work, they will not be listed as explicitly unsupported.
2023-12-17README.md: Add E6500, E6420, and E6530 as supportedNicholas Chin
2023-12-17README.md: Add instructions for relaxing memory permissionsNicholas Chin
As this utility requires access to /dev/mem, the default protections of Linux and OpenBSD must be relaxed to allow this. Make a note of this in the instructions.
2023-12-17README.md: Add references to Open Security TrainingNicholas Chin
The old Open Security Training site had a course called Advanced x86: BIOS and SMM Internals, which had a set of slides outlining the method to supress SMIs by changing the GBL_SMI_EN bit. Add a reference to it as this is where I originally learned of this method.
2023-11-06nvmutil: print usageRiku Viitanen
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-11-06nvmutil: fix makefileRiku Viitanen
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-11-06nvmutil: make installRiku Viitanen
make install is nice to have. now respects$(PREFIX) as well. Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-10-17util/spkmodem-recv: detailed copyright historyLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-12util/e6400-flash-unlock: Rename to dell-flash-unlockNicholas Chin
This more accurately describes the scope of the utility. Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>