Compare commits

..

15 Commits

Author SHA1 Message Date
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 76e5a07774 Merge pull request 'void dependencies update' (#443) from lentrey/lbmk:master into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/443
2026-07-21 20:44:19 +02: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
lentrey e796a50fb0 void dependencies update 2026-07-20 18:06:41 -03:00
Leah Rowe 049ee793db nvmutil: macro safety
maximum safety.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-05-26 21:46:07 +01:00
Leah Rowe bc4bc4b67e nvmutil: fix error exits
ii used to rely on errno for exit status, but this was flawed.

when removing it, i neglected to adjust the actual error exits,
setting errno accordingly. this patch should fix it. this is
important for scripts that use nvmutil, which may rely on its
error status upon exit.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-05-26 18:48:27 +01:00
Baraa Al-Masri cf930f3b32 Add portage package use 2026-05-10 20:40:40 +03:00
Baraa Al-Masri 2cbdb59ccf Add Gentoo dependencies 2026-05-10 15:57:27 +03:00
4 changed files with 102 additions and 28 deletions
+25
View File
@@ -0,0 +1,25 @@
# SPDX-License-Identifier: GPL-3.0-or-later
pkg_add="emerge --ask --verbose --quiet"
pkglist=" \
sys-libs/ncurses dev-util/pkgconf sys-libs/libsepol app-arch/xz-utils \
sys-devel/m4 app-arch/unzip dev-lang/swig app-cdr/cdrtools sys-devel/flex \
sys-devel/bison dev-libs/openssl sys-apps/gawk net-misc/wget \
dev-perl/File-Slurp app-eselect/eselect-guile sys-apps/help2man \
dev-build/libtool dev-lang/nasm dev-libs/libtommath dev-scheme/guile \
dev-libs/libgpiod app-arch/sharutils dev-libs/libtomcrypt sys-devel/autogen \
media-libs/freetype sys-fs/e2fsprogs sys-fs/lvm2 dev-libs/libusb \
sys-block/parted sys-fs/mtools app-arch/lz4 dev-libs/leancrypto sys-fs/fuse \
sys-apps/dtc net-libs/gnutls net-misc/curl dev-build/cmake dev-vcs/git \
dev-util/ccache dev-embedded/libftdi app-arch/innoextract sys-devel/gcc \
sys-apps/pciutils app-crypt/efitools gnustep-base/gnustep-make gnustep-base/gnustep-base \
app-arch/unar app-arch/p7zip dev-lang/python dev-python/setuptools dev-python/ply \
sys-libs/libselinux dev-python/pyelftools dev-python/pycparser dev-python/cffi \
dev-python/pycryptodome app-text/doxygen media-fonts/unifont media-libs/libsdl2 \
sys-power/acpi_call sys-devel/crossdev \
"
pkg_use_file="/etc/portage/package.use/lbmk"
pkg_use="""
>=gnustep-base/gnustep-make-2.9.3-r2::gentoo native-exceptions
>=sys-devel/gcc-15.2.1::gentoo objc ada openmp multilib graphite sanitize pgo lto fortran cxx
"""
+4 -6
View File
@@ -1,5 +1,3 @@
# SPDX-License-Identifier: GPL-3.0-or-later
pkg_add="xbps-install"
pkglist=" \
acpica-utils autogen base-devel bison cmake \
@@ -7,8 +5,8 @@ cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc \
cross-arm-none-eabi-libstdc++ cross-arm-none-eabi-newlib curl \
dejavu-fonts-ttf device-mapper doxygen e2fsprogs flex font-unifont-bdf \
freetype freetype-devel fuse gawk gcc-ada gdb gettext gettext-devel git \
help2man innoextract libftdi1 libpciaccess libusb libuuid-devel nasm ncurses \
ncurses-devel openssl openssl-devel p7zip parted pciutils perl perl-LWP \
python python3 python3-setuptools rsync sharutils subversion texinfo \
unar unzip wget xz zlib ccache \
gnutls-devel help2man innoextract libftdi1 libpciaccess libusb libuuid-devel \
nasm ncurses ncurses-devel openssl openssl-devel p7zip parted pciutils perl \
perl-LWP python python3 python3-devel python3-setuptools rsync sharutils \
subversion swig texinfo unar unzip wget xz zlib ccache \
"
+19 -2
View File
@@ -12,6 +12,7 @@ export LC_ALL=C.UTF-8
projectname="libreboot"
projectsite="https://libreboot.org/"
# TODO: consider just erroring here instead of hardcoding a default
if [ -z "${PATH+x}" ]; then
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
@@ -87,6 +88,22 @@ xbmkpkg()
err "pkg_add/pkglist not both set" "xbmkpkg" "$@"
fi
if [ "$2" == "gentoo" ]; then
if [ -z "$pkg_use" ] || [ -z "$pkg_use_file" ]; then
err "pkg_use/pkg_use_file not both set" "xbmkpkg" "$@"
fi
printf "Updating package use...\n"
printf "Writing into %s" "$pkg_use_file..."
if [ ! -d "`dirname $pkg_use_file`" ]; then
x_ mkdir -p "`dirname $pkg_use_file`"
fi
printf "%s\n" "$pkg_use" >> "$pkg_use_file"
fi
x_ $pkg_add $pkglist
if [ -n "$aur_notice" ]; then
@@ -434,8 +451,8 @@ xbmk_set_mirror()
xbmk_git_init()
{
for gitarg in "--global user.name" "--global user.email"; do
gitcmd="git config $gitarg"
for gitarg in "user.name" "user.email"; do
gitcmd="git config --includes $gitarg"
if ! $gitcmd 1>/dev/null 2>/dev/null; then
err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" \
"xbmk_git_init" "$@"
+50 -16
View File
@@ -77,26 +77,41 @@ op_t op[] = {
};
void (*cmd)(void) = NULL;
#define err_if(x) if (x) err(EXIT_FAILURE, "%s", filename)
#define err_if(x) \
do { \
if (x) { \
err(EXIT_FAILURE, "%s", filename); \
} \
} while(0)
#define xopen(f,l,p) \
do { \
if ((f = open_on_eintr(l, p)) == -1) \
if ((f = open_on_eintr(l, p)) == -1) { \
err(EXIT_FAILURE, "%s", l); \
if (fstat(f, &st) == -1) \
} \
if (fstat(f, &st) == -1) { \
err(EXIT_FAILURE, "%s", l); \
} \
} while(0)
#define word(pos16, partnum) ((uint16_t *) gbe[partnum])[pos16]
#define setWord(pos16, p, val16) if (word(pos16, p) != val16) \
nvmPartChanged[p] = 1 | (word(pos16, p) = val16)
#define word(pos16, partnum) \
(((uint16_t *) gbe[partnum])[pos16])
#define SUCCESS(x) ((x) >= 0)
#define setWord(pos16, p, val16) \
do { \
if (word(pos16, p) != val16) { \
nvmPartChanged[p] = 1 | (word(pos16, p) = val16); \
} \
} while(0)
#define SUCCESS(x) \
((x) >= 0)
#define reset_caller_errno(return_value) \
do { \
if (SUCCESS(return_value) && (!errno)) \
if (SUCCESS(return_value) && (!errno)) { \
errno = saved_errno; \
} \
} while (0)
int
@@ -283,7 +298,7 @@ cmd_setmac(void)
if (mac_updated)
return;
errno = EINVAL;
errno = ECANCELED;
err(EXIT_FAILURE, "Error updating MAC address");
}
@@ -376,6 +391,11 @@ cmd_dump(void)
printf("MAC (part %d): ", partnum);
macf(partnum);
hexdump(partnum);
if (numInvalid > 1) {
errno = EINVAL;
err(EXIT_FAILURE, "dump: No valid checksums");
}
}
}
@@ -407,6 +427,7 @@ hexdump(int partnum)
}
}
/* WARNING: Cannot fail. Make sure the file is valid. */
void
cmd_setchecksum(void)
{
@@ -420,22 +441,30 @@ cmd_setchecksum(void)
void
cmd_brick(void)
{
if (goodChecksum(part))
if (goodChecksum(part)) {
setWord(NVM_CHECKSUM_WORD, part,
((word(NVM_CHECKSUM_WORD, part)) ^ 0xFF));
} else {
errno = ECANCELED;
err(EXIT_FAILURE, "brick: Bad checksum in part %d", part);
}
}
void
cmd_copy(void)
{
nvmPartChanged[part ^ 1] = goodChecksum(part);
if (!nvmPartChanged[part ^ 1]) {
errno = ECANCELED;
err(EXIT_FAILURE, "copy: Bad checksum in part %d", part);
}
}
void
cmd_swap(void) {
if(!(goodChecksum(0) || goodChecksum(1))) {
errno = EINVAL;
err(EXIT_FAILURE, "Invalid checksums");
errno = ECANCELED;
err(EXIT_FAILURE, "swap: Bad checksums");
}
gbe[0] ^= gbe[1];
@@ -502,8 +531,10 @@ xclose(int *fd)
int saved_errno = errno;
int rval = 0;
if (fd == NULL)
if (fd == NULL) {
errno = EBADF;
err(EXIT_FAILURE, "xclose: null pointer");
}
if (*fd < 0)
return;
@@ -710,21 +741,24 @@ if_err_sys(int condition)
#define fs_err_retry() \
do { \
if ((rval == -1) && \
(errno == EINTR)) \
(errno == EINTR)) { \
return 1; \
if (rval >= 0 && !errno) \
} \
if (rval >= 0 && !errno) { \
errno = saved_errno; \
return 0; \
} \
} while(0)
int
fs_retry(int saved_errno, int rval)
{
fs_err_retry();
return 0;
}
int
rw_retry(int saved_errno, ssize_t rval)
{
fs_err_retry();
return 0;
}