Commit Graph

991 Commits

Author SHA1 Message Date
Leah Rowe aad748c5ca inject.sh: simplify xbmkcheck initialisation
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-10 22:49:57 +01:00
Leah Rowe 8db320799b inject.sh: re-order variables
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-10 22:20:05 +01:00
Leah Rowe 6050cdd1db init.sh: much more thorough locale initialisation
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-10 19:35:17 +01:00
Leah Rowe 8c927b535d update header again
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-10 19:28:27 +01:00
Leah Rowe 5f0bd5ea10 xbmk: remove setvars function
only one file used it. i've replaced its use with
a simple awk call alongside eval.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-10 19:25:45 +01:00
Leah Rowe 8822c56815 mk: make it completely generic
commands now fed from a file, include/common.sh
which in turn also includes other lib files

this makes mk completely generic, and means
that changes will now be completely in sync
with cbmk, ensuring a lack of merge conflicts,
though the file was already pretty small anyway.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-10 18:05:57 +01:00
Leah Rowe 1ceeb0ab55 update lbmk headers
i made several modificatinos to several files
thus for in 2026, in the main part of the build system.

i've added 2026 to the ones that i modified.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-10 17:45:11 +01:00
Leah Rowe e973584123 mk: generalised dispatch loop
with this new function, i can turn commands on and
off by virtue of config. for now, behaviour is
unchanged, but this new design means i will be
able to disable certain commands in child processes

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-10 13:49:34 +01:00
Leah Rowe afdf8c7733 Revert "xbmk: general code cleanup"
This reverts commit 1b65e8914c.

NOTE: cleanup of xbmk_git_init was retained

this "cleanup" actually made the code harder to read.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-10 12:34:35 +01:00
Leah Rowe 01cb422c97 include/get.sh: 3-way merge on git am
this will make managing updates easier. which will
be soon, because i have a lot of patches.

no idea why i didn't add this before. normally, i just
copy a directory and git-fetch, then cherry-pick as
i please. this will make it trivial to just update
a revision and merge the patches. then i can just
intervene only when necessary, on a given src tree.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-06 10:16:00 +01:00
Leah Rowe 1b65e8914c xbmk: general code cleanup
make the code much easier to read

i also cleaned up the recent git identity check

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-30 11:58:11 +01:00
Zoomm Deka ab13b80250 fix git identity handling in xbmk_git_init
Signed-off-by: Zoomm Deka <zoomm10@gmail.com>
2026-07-28 03:02:02 +02:00
Leah Rowe 8b59310209 only disable git check for ./mk -b coreboot
the previous patch was half the battle. now that
annoying person who complained on irc should be
happy.

someone complained about having to enter git
name/email when just doing e.g. ./mk inject

a valid complaint, but their attitude kinda
stunk. oh well. this patch should satisfy them.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-27 23:35:38 +01:00
Leah Rowe 06fd12953f make the bitch on irc happy
some person complained about this. see diff.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-27 23:27:56 +01:00
Leah Rowe 1265eb5b63 init.sh: add a throught-provoking TODO
this will be revisited by October 2026 Leah.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-21 20:27:57 +01:00
Leah Rowe 56697c1da3 init.sh: add error check on mkdir in gentoo check
yes. i should have reviewed that patch properly.

the code should meet lbmk standards now.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-21 20:24:12 +01:00
Leah Rowe 8d9d1a88a0 init.sh: fix bad printf string in gentoo check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-21 20:23:12 +01:00
Leah Rowe e1384a1b9f init.sh: add -p on mkdir command in gentoo check
probably redundant, but can't hurt

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-21 20:21:44 +01:00
Leah Rowe 598a57639f init.sh: double-quote variables in gentoo check
yes. silly twit.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-21 20:21:23 +01:00
Leah Rowe 86142b7e81 init.sh: fix indentation in gentoo check
the submitted messed up indentation, yeah

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-21 20:19:53 +01:00
Leah Rowe 1514e82be0 init.sh: add --includes to git config check
just to be sure

this now matches util/gitconfig/gitconfig.sh in coreboot

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-21 20:12:44 +01:00
Leah Rowe 83842c9481 Merge pull request 'Add Gentoo dependencies.' (#428) from lordbaraa/lbmk:add-gentoo-dependencies into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/428
2026-07-21 20:43:00 +02:00
Leah Rowe 9dd6ed84ca init.sh: Don't check global git config
Some users have it in a file e.g. inside ~/.gitconfig

Those users are currently forced to set git config
globally by lbmk. We only need to check that a git
config is set, regardless of scope, because coreboot
needs it in parts of its build system when used on
lbmk.

This prevents a pointless error report for users who
have their git config on such a scope. Thanks go to
Hendrik Jäger for reporting this to me.

Yes, thank you. Further context:

https://lore.kernel.org/git/20260720113402.0dc16abe@frustcomp.hnjs.home.arpa/T/#u

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-07-21 19:34:26 +01:00
Baraa Al-Masri cf930f3b32 Add portage package use 2026-05-10 20:40:40 +03:00
Leah Rowe 7f4f07fc40 use old nvmutil for now, in lbmk
i'm trying to make nvmutil work on openbsd. the new code
in lbutils is a bit buggy, likely somewhere in mkhtemp.
i'm still debugging it.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-04-21 13:39:29 +01:00
Leah Rowe 01aa95ec15 Revert "lbmk: use mkhtemp in libreboot's build system"
This reverts commit e54862fccc.

nope. not ready yet. will fix it later.
2026-03-29 16:25:41 +01:00
Leah Rowe e54862fccc lbmk: use mkhtemp in libreboot's build system
i added a fake -t option, which doesn't actually
read optarg, so that -t usage can just override
the normal template. mkhtemp isn't ready for
distros yet, but it's ready for lbmk.

i hacked the makefile to also copy the binary to
mktemp, and i set PATH in lbmk so that this binary
is used insttead of the one on your system.

that way, upstream projects use it.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-29 16:08:00 +01:00
Leah Rowe 718095b0fe util/mkhtemp: extremely hardened mkhtemp
This will also be used in lbmk itself at some point,
which currently just uses regular mktemp, for tmpdir
handling during the build process.

Renamed util/nvmutil to util/libreboot-utils, which
now contains two tools. The new tool, mkhtemp, is a
hardened implementation of mktemp, which nvmutil
also uses now. Still experimental, but good enough
for nvmutil.

Mkhtemp attempts to provide TOCTOU resistance on
Linux, by using modern features in Linux such as
Openat2 (syscall) with O_EXCL and O_TMPFILE,
and many various security checks e.g.
inode/dev during creation. Checks are done constantly,
to try to detect race conditions. The code is very
strict about things like sticky bits in world writeable
directories, also ownership (it can be made to bar even
root access on files and directories it doesn't own).

It's a security-first implementation of mktemp, likely
even more secure than the OpenBSD mkstemp, but more
auditing and testing is needed - more features are
also planned, including a compatibility mode to make
it also work like traditional mktemp/mkstemp. The
intention, once this becomes stable, is that it will
become a modern drop-in replacement for mkstemp on
Linux and BSD systems.

Some legacy code has been removed, and in general
cleaned up. I wrote mkhtemp for nvmutil, as part of
its atomic write behaviour, but mktemp was the last
remaining liability, so I rewrote that too!

Docs/manpage/website will be made for mkhtemp once
the code is mature.

Other changes have also been made. This is from another
experimental branch of Libreboot, that I'm pushing
early. For example, nvmutil's state machine has been
tidied up, moving more logic back into main.

Mktemp is historically prone to race conditions,
e.g. symlink attacks, directory replacement, remounting
during operation, all sorts of things. Mkhtemp has
been written to solve, or otherwise mitigate, that
problem. Mkhtemp is currently experimental and will
require a major cleanup at some point, but it
already works well enough, and you can in fact use
it; at this time, the -d, -p and -q flags are
supported, and you can add a custom template at
the end, e.g.

mkhtemp -p test -d

Eventually, I will make this have complete parity
with the GNU and BSD implementations, so that it is
fully useable on existing setups, while optionally
providing the hardening as well.

A lot of code has also been tidied up. I didn't
track the changes I made with this one, because
it was a major re-write of nvmutil; it is now
libreboot-utils, and I will continue to write
more programs in here over time. It's basically
now a bunch of hardened wrappers around various
libc functions, e.g. there is also a secure I/O
wrapper for read/write.

There is a custom randomisation function, rlong,
which simply uses arc4random or getrandom, on
BSD and Linux respectively. Efforts are made to
make it as reliable as possible, to the extent
that it never returns with failure; in the unlikely
event that it fails, it aborts. It also sleeps
between failure, to mitigate certain DoS attacks.

You can just go in util/libreboot-utils and
type make, then you will have the nvmutil and
mkhtemp binaries, which you can just use. It
all works. Everything was massively rewritten.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-26 06:59:42 +00:00
Leah Rowe 1d17a8ffcf util/nvmutil: call it nvmutil in makefile
a package manager by the name "nvm" exists, as
i discovered.

this is a courtesy to them.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-03-08 01:11:52 +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 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 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
Ron Nazarov 2e98da9688 Add Supermicro X11SSH-F/LN4F port
Surprisingly, SeaBIOS VGA output works (coreboot documentation says it
doesn't).

I'm using a static CMOS option table currently (like most other boards
supported in libreboot), but maybe it would be better to switch to the
CBFS file option table.  The default option table enables
hyperthreading, overriding the compile-time setting.

I'm also using a ME/SPS image extracted from the official BIOS update
for this board.  Unfortunately, https://www.supermicro.com/Bios/* is
excluded from crawlers in robots.txt so it's not in archive.org, so I
haven't been able to find a backup download URL.  I also needed to set
the user-agent for fetching the update to "curl/8.6.0" because the
default user-agent override used by lbmk resulted in a 403 error.
deguard is not required (there's no bootguard on this board).

SPS does not implement CPU replacement detection which means that the
MRC cache does not work and RAM training needs to happen on every
boot.  To avoid this it may be possible to run ME instead of SPS on
this board, but I tried both the ME image used on the OptiPlex 3050
Micro in libreboot and one from the ASRock C236 WSI and they both hung
at "[INFO ] POST: 0x92" (POSTCODE_FSP_MEMORY_INIT).

The memtest86+ build included with libreboot doesn't work with USB
keyboards and this board doesn't have a PS/2 port, which is annoying.
2026-02-14 02:50:42 +00:00
Leah Rowe d5351aee37 inject: fix mac address insertion
during previous re-factoring, i sorted variable initialisations.

that was all well and good, but prior to that, i initialised
the new_mac string to empty at first, and then to
the "xx" letters; the latter made the first initialisation
redundant, but in the re-factoring, I put the blanking of
the string afterward.

this disabled mac address insertion, because the way the script
works is precisely to avoid mac address insertion when the mac
string is empty. this is used when running the "nuke" command.

silly me.

yes, i'm very silly. very very silly. so silly.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-12-25 13:41:37 +01:00
Leah Rowe 68e0b5dddc init.sh: Explicitly export UTF-8 locale
C.UTF-8, instead of just C.

This fixes a build issue in GRUB on my Arch Linux test bench.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-12-24 17:16:10 +01:00
Leah Rowe 1b10c072d3 tree.sh: tidy up check_gnu_path
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-11-15 16:57:48 +00:00
Leah Rowe 7ef7e02f73 lib.sh: reduce indentation in setvars
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-11-15 16:55:27 +00:00
Leah Rowe 214ed3efd2 get.sh: reduce indendation in fetch_targets
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-11-15 16:51:59 +00:00
Leah Rowe 9d6af0063b get.sh: reduce indentation in clone_project
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-11-15 16:51:10 +00:00
Leah Rowe d7869a56f5 WIP: chromebook integration script
I intend to merge every Chromebook that Mrchromebox supports,
into Libreboot, ready for the Libreboot 25.12 release. Work
is still ongoing, and several changes need to happen in lbmk.

I started working on it a few weeks ago (today is
14 November 2025 as I push this).

Still TODO:

* Automatically create lbmk coreboot targets, based
  on the configs present in MrChromebox git
* Re-work git repository management in lbmk, such that
  a list of upstreams is used, instead of a hardcoded
  list per configuration; this will allow us to use
  different remotes across the same project, even where
  they diverge. This would then allow us to use the
  MrChromebook repository directly, instead of cherry-picking
  patches into upstream coreboot
* The note above about remotes would also mean that we can
  use MrChromebox's own edk2 repository directly. All of this
  would reduce the burden on lbmk.git
* Support building edk2 payloads, exactly mirroring the
  setups used on MrChromebox builds

There are some things that need to be checked first, for
boards that use MMC-based or eMMC-based storage, for the
GRUB and SeaBIOS payloads, also U-Boot, because I will
also be using these.

As such, this current script shall sit in lbmk master, but
it is not yet finished.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-11-14 18:22:51 +00:00
Leah Rowe 25f523bbac get.sh: return clone_project if multi-tree
this is the true fix, replacing the fixes previously
reverted.

the problem with the old fix was that it was a hack,
and could result in the archived backup of a code repo
being the wrong one; the destination was the one for
the main repo, but what if we were cloning the backup?

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-17 22:40:29 +01:00
Leah Rowe bec7e6d4cb Revert "get.sh: don't frivolously copy tmp git clones"
This reverts commit b840cf3a83.
2025-10-17 22:32:43 +01:00
Leah Rowe f632b8aed7 Revert "get.sh: remove a redundant check"
This reverts commit e2a97455cc.
2025-10-17 22:32:35 +01:00
Leah Rowe e2a97455cc get.sh: remove a redundant check
loc is never empty.

if it is, it's a bug. don't hide bugs.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-17 21:01:31 +01:00
Leah Rowe b840cf3a83 get.sh: don't frivolously copy tmp git clones
this fixes a regression in a previous patch, this time
also taking account for the different cache locations.

all of get.sh needs to be purged, and re-written clean.
it looks clean. but it's years of hacks.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-17 20:57:18 +01:00
Leah Rowe 2aea7f6229 Revert "get.sh: make forcepull a macro"
This reverts commit b3232a7c4a.
2025-10-17 16:07:16 +01:00
Leah Rowe b3232a7c4a get.sh: make forcepull a macro
:

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-17 14:02:55 +01:00
Leah Rowe 54aa5b7d32 tree.sh: unify -f/-F in case/switch handling
they're the same commands, but -F does forcepull

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-10-17 13:57:14 +01:00