Commit Graph

3109 Commits

Author SHA1 Message Date
Leah Rowe 51e4e43c94 util/nvmutil: tidy up the xopen macro
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 17:41:10 +00:00
Leah Rowe a34e79f501 util/nvmutil: add boundary checks on word/setWord
this was the other complication with doing it as a macro.

for something this fundamental, we really want to ensure
that every access is safe.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 17:35:00 +00:00
Leah Rowe 4e7d48b5c5 util/nvmutil: make word/setWord a function
having this as a macro makes the code quite brittle.

better to have it as a function.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 17:34:37 +00:00
Leah Rowe 8707695184 util/nvmutil: rename openGbeFile to openFiles
merge the urandom handling back into this function.

it's called immediately after in main anyway, so we
may as well. this reduces the size of main.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 17:06:57 +00:00
Leah Rowe c4138752c3 util/nvmutil: remove redundant unveil call
in the given call, we then do an equivalent call
immediately after that is the same, but without
unveil, so we'll just defer to that.

this changes no behaviour.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 17:03:00 +00:00
Leah Rowe a4fe1bfa4d util/nvmutil: call block_unveil earlier
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 17:01:41 +00:00
Leah Rowe ea1a9bc786 util/nvmutil: bring pledge in set_io_flag to main
in general, we should ensure that the pledge calls only happen
inside main. this means we can more easily see them, in future
re-factoring.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 16:57:50 +00:00
Leah Rowe 46b6b1feb3 util/nvmutil: call set_cmd much earlier
this will enable hardening of the pledge syscalls.

it also means that the program will error out much
earlier, when an invalid command is given, rather
than opening a bunch of files first, and it will
do so under reduced privilege already, notwithstanding
the further pledge/unveil hardening that is planned.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 16:46:20 +00:00
Leah Rowe 0106c38217 util/nvmutil: unveil /dev/urandom much earlier
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 16:41:06 +00:00
Leah Rowe 58cf5a1579 util/nvmutil: split xopen handling
same as the previous change. i'm going to harden the unveil
and pledge calls next.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 16:38:09 +00:00
Leah Rowe e5d7c3e3a2 util/nvmutil: split unveil handling
urandom in main. this is because i'm going to further
harden the use of pledge and unveil in a future patch,
and this is a prerequisite.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 16:34:59 +00:00
Leah Rowe 896f0ea1df util/nvmutil: split cmd init to new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 16:34:18 +00:00
Leah Rowe 697eda800a util/nvmutil: split flags init to new function
main is getting much smaller now

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 12:55:57 +00:00
Leah Rowe ab057e006c util/nvmutil: tidy up main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 12:50:18 +00:00
Leah Rowe 6de3968f2b util/nvmutil: split unveil code to new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 12:18:23 +00:00
Leah Rowe 9c23eac148 util/nvmutil: separate usage function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-02 12:17:07 +00:00
Leah Rowe 7e81c5c630 Re-add x230_12mb corebootfb config
also for other variants

i removed it because it was reported broken. it's not.

the removal was always temporary, pending further testing.
next time, i will be more sceptical.

everything works fine.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-26 00:58:06 +00:00
Leah Rowe 1d20042f9a nvmutil: simplify readGbe and writeGbe
the for loop only contains one line

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 14:22:35 +00:00
Leah Rowe 5a414ea4d6 nvmutil: centralise all errno handling
do it in the macro. this way, if a given error is
present, it's not overridden. this enables easier
debugging.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 14:01:11 +00:00
Leah Rowe c64a2655e9 nvmutil: rename ERR to SET_ERR, for clarity
i renamed filename to fname, so that certain lines would
still fit within 80 characters without introducing a new
line break.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 13:49:16 +00:00
Leah Rowe 678b9d859b nvmutil: split pread from readGbe
split it into readGbe_part, for code clarity.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 13:45:28 +00:00
Leah Rowe e1d8773c54 nvmutil: split pwrite handling from writeGbe
handle it in a separate function, for clarity.

the main function just checks each part whether it
changed, and then passes control to writeGbe_part.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 13:42:27 +00:00
Leah Rowe 261c41a3c3 nvmutil: simplify a few else statements
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 13:34:35 +00:00
Leah Rowe 8cf2558a6f nvmutil: don't hardcode errno to ECANCELED
use the ERR macro instead, so that an existing value
will not be overridden. this is useful for debugging.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 13:30:15 +00:00
Leah Rowe 50de561ac4 nvmutil: explain a few parts in nvmalloc
the current code is optimised for speed, but it's a bit
esoteric, so make it easier to understand.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 11:13:09 +00:00
Leah Rowe 061e6048a8 nvmutil: split malloc handling out of readGbe
this has to do with memory allocation, not actual reading
of the gbe file into memory. split it up, for clarity.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 11:10:12 +00:00
Leah Rowe 3d408317b1 nvmutil: further simplify nr/nw error handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 11:01:52 +00:00
Leah Rowe 35d8d0993f util/nvmutil: simplify nr/nw error handling
when nf and nr/nw are not the same, we know there
is an error condition, so defer to the following err()
call, but use ERR() there instead of hardcoding use
of ECANCELED.

this actually improves the error handling, by being
more verbose, while reducing the amount of logic.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 09:50:26 +00:00
Leah Rowe 4473179300 util/nvmutil: remove pointless diagnostics
we only need to know the number of bytes written or
read under error conditions.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 09:47:36 +00:00
Leah Rowe 45413f1209 util/nvmutil: say part number on read/write report
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-23 09:34:51 +00:00
Leah Rowe a55af90b6c vendor.sh: handle mfs in find_me
This makes the argument handling easier to understand,
since other arguments are also handled in find_me

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-22 17:18:51 +00:00
Leah Rowe a938309d35 vendor.sh: handle me_cleaner -p separately
this is a special mode that skips FPTR checks, which is
needed on the topton x2e_n150

we currently set this, when MEclean="n", but we may want to
skip cleaning while still checking FPTR on some boards (in
a future lbmk revision)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-22 17:15:24 +00:00
Leah Rowe 177f45355f vendor.sh: tidied up mecleaner argument handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-22 17:06:12 +00:00
Leah Rowe 182c1cd699 Merge pull request 'Provide x270 patch for correct VBT and HDA verb' (#405) from kittywitch/lbmk:x270-patch into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/405
2026-02-22 09:10:47 +01:00
Kat Inskip 913efaebe6 Provide x270 patch for correct VBT and HDA verb 2026-02-21 19:58:12 +00:00
Leah Rowe 0f93368ea0 get.sh: properly initialise _ua
it is currently only initialised inside case
conditions. this is fine on most shells, but
some of them can be a bit buggy here.

initialise it empty and then override.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-21 17:44:01 +00:00
Leah Rowe 4021617430 g43t_am3: make it 2mb, not 4mb
idk why i made it 4

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-21 16:28:17 +00:00
Leah Rowe 006571187b remove release=n on x270 port
this is a hangover from an earlier work, where we
had some issues prior to merging.

as it is, the port is ready for a future release.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-21 08:33:08 +00:00
Leah Rowe 2edd583aee Add ThinkPad X270 coreboot port from Kat Inskip
Courtesy of Kat Inskip who ported this board.

Headphone output doesn't work at the moment, due to incorrect verb.
Intel VBT is also wrong. Both are taken from another board.

This will be amended later with the correct verb and VBT.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-21 08:26:44 +00:00
Leah Rowe 1068acd2c0 coreboot/default: new rev ed5a993f
latest coreboot rev as of literally today

this is in preparation for a thinkpad x270 port
using a WIP patch that was contributed

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-19 15:36:22 +00:00
Leah Rowe e6d9b82c62 Merge pull request 'supermicro x11ssh_f: Use deguard-configured ME image instead of SPS and disable ME HECI in devicetree' (#404) from noisytoot/supermicro-x11ssh-f into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/404
2026-02-19 15:35:59 +01:00
Leah Rowe a2c5715589 util/grubpo: new util, for grub PO files
this is the program I recently wrote, that generated
the submodule entries for the GRUB PO file fix

this utility is for reference only. i'll probably do
away with the fix at some point, replacing it with
my own git-based submodule repository, containing the
PO files. this would make things easier, and then
that repository would contain the utility instead.

i'm just putting this in lbmk for now, so that we
have it somewhere.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-19 12:24:47 +00:00
Leah Rowe 5a8ad2d311 util/nvmutil: general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-19 12:23:57 +00:00
Leah Rowe a95cf1feeb util/spkmodem_recv: general code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-19 12:21:35 +00:00
Ron Nazarov 47bf8e69e8 supermicro x11ssh_f: Remove release="n"
Since we have redundant downloads for the ME image now, it's no longer
required.
2026-02-14 20:59:14 +00:00
Ron Nazarov 1017f16c3e supermicro x11ssh_f: Disable ME HECI in devicetree
Since we always use me_cleaner, this speeds up boot time by preventing
coreboot from wasting a few seconds waiting for HECI.
2026-02-14 20:17:41 +00:00
Ron Nazarov 80be5ce87e supermicro x11ssh_f: Use deguard-configured ME image instead of SPS
Using the same ME image as the 3050 Micro.  This fixes the lack of a
backup download URL for the ME and speeds up boot time, since MRC
caching is working with ME (unlike SPS).

Unfortunately, since the MFS partition must be preserved, this does
mean we need a larger ME region than with me_cleaned SPS.
2026-02-14 20:00:14 +00:00
Ron Nazarov 3c416c6396 Delete unused config/ifd/supermicro-x11-lga1151-series directory
Left over from the hyphen -> underscore renaming commit.
2026-02-14 19:46:04 +00:00
Leah Rowe d5a1de820b supermicro x11ssh_f: set release="n"
the lack of redundancy in Intel ME downloading is a current
release blocker with this board, so set it to release=n for
now.

it is quite possible to use deguard on this board, which does
have redundant downloading when used with lbmk.

although the board doesn't have bootguard, it is still possible
to use deguard. you can configure the generic ME image that it
fetches, and reconfigure it for each machine.

i've asked ron to look into this, on their test board.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-14 12:58:06 +00:00
Leah Rowe c0399adab3 supermicro x11ssh_f: use underscores in dir names
i don't like hyphens in file names, because of how lbmk
has historically handled directories and files in the past;
i've removed a lot of eval statements, to the extent that
it's no longer likely to be a problem (it's barely used now),
but i previously had a problem with using hyphens in config
names.

this design flaw (in lbmk) was fixed ages ago, but i still
maintain this policy. since that time, i use hyphens only.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-02-14 12:58:01 +00:00