Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1fa44b7
unit-tests: Add a unit-test coverage framework
vathpela Jul 30, 2026
ee36257
Make: use quiet and rmverbose everywhere
vathpela Sep 4, 2026
460963c
device-paths: efidp_data_address: compute the size right...
vathpela Aug 4, 2026
a255b5b
efidp: make efidp_make_generic() zero the buffer
vathpela Sep 4, 2026
a097930
dp: muzzle clang's infernal include checker.
vathpela Sep 4, 2026
67fdb62
tests: Don't use -fprofile-arcs and -ftest-coverage with --coverage
vathpela Sep 4, 2026
e1ed34b
device-paths: add ACPI Parallel port formatting
vathpela Aug 4, 2026
4cf0eca
device-paths: Fix formatting for some ACPI HID device paths
vathpela Aug 4, 2026
89a2ba4
unit-tests: Add a test for ACPI HID device paths.
vathpela Aug 4, 2026
7fa6a09
unit-tests: Add a test for ATAPI device paths.
vathpela Aug 4, 2026
6b30313
unit-tests: Add a test for EDD 0x10 device paths.
vathpela Aug 4, 2026
006ff77
dp-message: Fix efidp_make_emmc()
vathpela Aug 4, 2026
3f88794
unit-tests: Add a test for eMMC storage paths
vathpela Aug 4, 2026
95b4f17
device-paths: fix a size error in UCS2 formatting.
vathpela Aug 3, 2026
db76db2
device-paths: use the right structure offset for file names
vathpela Aug 4, 2026
77157f2
unit-tests: Add a test for File storage paths.
vathpela Aug 4, 2026
c1d9cc7
unit-tests: Add a test for HD storage paths.
vathpela Aug 4, 2026
3b49d95
unit-tests: Add a test for HW Vendor device paths.
vathpela Aug 4, 2026
c63c81a
unit-tests: Add a test for IPv4 device paths.
vathpela Aug 4, 2026
a47d429
unit-tests: Add a test for MAC Address device paths.
vathpela Aug 4, 2026
26bfc7c
unit-tests: Add a test for Media Vendor device paths.
vathpela Aug 4, 2026
11ab89e
unit-tests: Add a test for Message Vendor device paths.
vathpela Aug 4, 2026
1747897
unit-tests: Add a test for NVDIMM device paths.
vathpela Aug 4, 2026
c8f4f53
unit-tests: Add a test for NVMe device paths.
vathpela Aug 4, 2026
3c60b1d
unit-tests: Add a test for SAS device paths.
vathpela Aug 4, 2026
951114a
unit-tests: Add a test for SATA device paths.
vathpela Aug 4, 2026
4a74163
unit-tests: Add a test for SCSI device paths.
vathpela Aug 4, 2026
a3af145
unit-tests: Add a test for PCI device paths.
vathpela Aug 4, 2026
813cd9d
device-paths: efidp_set_node_data(): fix behavior and error explanation
vathpela Jul 30, 2026
ff2d190
device paths: make efidp_get_next_end() not loop on END_INSTANCE
vathpela Aug 5, 2026
b1d0466
device-paths: fix END_INSANCE formatting
vathpela Aug 5, 2026
5f187bf
device paths: fix a few wrong errnos
vathpela Aug 5, 2026
d9ab9de
unit-tests: test misc device path functions
vathpela Aug 4, 2026
20cfd13
device-paths: Add support for making IPv6 device paths.
vathpela Aug 4, 2026
01f89c0
unit-tests: Add a test for IPv6 device paths.
vathpela Aug 4, 2026
c9bbea4
device-paths: Implement efidp_make_uart()
vathpela Aug 4, 2026
aa871bb
unit-tests: Add a test for UART device paths.
vathpela Aug 4, 2026
04937ea
device-paths: implement efidp_make_uart_flow_control
vathpela Aug 4, 2026
8bec949
unit-tests: Add a test for UART Flow Control device paths.
vathpela Aug 4, 2026
19ee276
unit-tests: Add a test for BIOS Boot device paths.
vathpela Sep 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@
*.bin
*.C
/.cache/
/cov/
*.cer
*.E
*.env
*.esl
*.o
*.gcda
*.gcdo
*.gcov
*.map
*.o
*.profraw
*.pc
*.S
*.so
Expand Down
82 changes: 52 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endif

all : | efivar.spec src/include/version.mk prep
all clean install prep :
@set -e ; for x in $(SUBDIRS) ; do \
$(quiet)set -e ; for x in $(SUBDIRS) ; do \
$(MAKE) -C $$x $@ ; \
done

Expand All @@ -29,13 +29,13 @@ $(SUBDIRS) :
$(MAKE) -C $@ all

brick : all
@echo -n $(info this is the rule for brick PWD:$(PWD) MAKECMDGOALS:$(MAKECMDGOALS))
@set -e ; for x in $(SUBDIRS) ; do \
$(quiet)echo -n $(info this is the rule for brick PWD:$(PWD) MAKECMDGOALS:$(MAKECMDGOALS))
$(quiet)set -e ; for x in $(SUBDIRS) ; do \
$(MAKE) -C $${x} test ; \
done

a :
@if [ $${EUID} != 0 ]; then \
$(quiet)if [ $${EUID} != 0 ]; then \
echo no 1>&2 ; \
exit 1 ; \
fi
Expand All @@ -46,44 +46,66 @@ efivar.spec : | Makefile src/include/version.mk

clean : clean-toplevel
clean-toplevel:
@rm -vf efivar.spec vgcore.* core.*
@$(MAKE) -C tests clean
$(quiet)rm $(rmverbose) -f efivar.spec vgcore.* core.*
$(quiet)$(MAKE) -C tests clean

compile_commands.json : Makefile
make clean
bear -- make COMPILER=clang test all
$(quiet)make clean
$(quiet)bear -- make COMPILER=clang test all

TEST_COVERAGE ?=
TEST_LTO ?=

test-clean :
$(quiet)$(MAKE) -C tests clean
$(quiet)$(MAKE) -C src test-clean

test : all
@$(MAKE) -C tests
$(quiet)$(MAKE) -C tests "$@"
$(quiet)$(MAKE) -C src \
TEST_COVERAGE="$(TEST_COVERAGE)" \
TEST_LTO="$(TEST_LTO)" \
test-clean test

UNIT_TESTS = $(patsubst src/%.c,%,$(wildcard src/test-*.c))

$(UNIT_TESTS) : | all
$(UNIT_TESTS) :
$(quiet)$(MAKE) -C src \
TEST_COVERAGE="$(TEST_COVERAGE)" \
TEST_LTO="$(TEST_LTO)" \
test-clean $@

unit-tests : $(UNIT_TESTS)

test-archive: abicheck efivar.spec
@rm -rf /tmp/efivar-$(GITTAG) /tmp/efivar-$(GITTAG)-tmp
@mkdir -p /tmp/efivar-$(GITTAG)-tmp
@git archive --format=tar $(shell git branch | awk '/^*/ { print $$2 }') | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; tar x )
@git diff | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; patch -s -p1 -b -z .gitdiff )
@mv /tmp/efivar-$(GITTAG)-tmp/ /tmp/efivar-$(GITTAG)/
@cp efivar.spec /tmp/efivar-$(GITTAG)/
@dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efivar-$(GITTAG).tar.bz2 efivar-$(GITTAG)
@rm -rf /tmp/efivar-$(GITTAG)
@echo "The archive is in efivar-$(GITTAG).tar.bz2"
$(quiet)rm $(rmverbose) -rf /tmp/efivar-$(GITTAG) /tmp/efivar-$(GITTAG)-tmp
$(quiet)mkdir -p /tmp/efivar-$(GITTAG)-tmp
$(quiet)git archive --format=tar $(shell git branch | awk '/^*/ { print $$2 }') | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; tar x )
$(quiet)git diff | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; patch -s -p1 -b -z .gitdiff )
$(quiet)mv /tmp/efivar-$(GITTAG)-tmp/ /tmp/efivar-$(GITTAG)/
$(quiet)cp efivar.spec /tmp/efivar-$(GITTAG)/
$(quiet)dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efivar-$(GITTAG).tar.bz2 efivar-$(GITTAG)
$(quiet)rm $(rmverbose) -rf /tmp/efivar-$(GITTAG)
$(quiet)echo "The archive is in efivar-$(GITTAG).tar.bz2"

bumpver :
@echo VERSION=$(GITTAG) > src/include/version.mk
@git add src/include/version.mk
git commit -m "Bump version to $(GITTAG)" -s
$(quiet)echo VERSION=$(GITTAG) > src/include/version.mk
$(quiet)git add src/include/version.mk
$(quiet)git commit -m "Bump version to $(GITTAG)" -s

tag:
git tag -s $(GITTAG) refs/heads/master
$(quiet)git tag -s $(GITTAG) refs/heads/master

archive: abicheck bumpver abidw tag efivar.spec
@rm -rf /tmp/efivar-$(GITTAG) /tmp/efivar-$(GITTAG)-tmp
@mkdir -p /tmp/efivar-$(GITTAG)-tmp
@git archive --format=tar $(GITTAG) | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; tar x )
@mv /tmp/efivar-$(GITTAG)-tmp/ /tmp/efivar-$(GITTAG)/
@cp efivar.spec /tmp/efivar-$(GITTAG)/
@dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efivar-$(GITTAG).tar.bz2 efivar-$(GITTAG)
@rm -rf /tmp/efivar-$(GITTAG)
@echo "The archive is in efivar-$(GITTAG).tar.bz2"
$(quiet)rm -rf /tmp/efivar-$(GITTAG) /tmp/efivar-$(GITTAG)-tmp
$(quiet)mkdir -p /tmp/efivar-$(GITTAG)-tmp
$(quiet)git archive --format=tar $(GITTAG) | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; tar x )
$(quiet)mv /tmp/efivar-$(GITTAG)-tmp/ /tmp/efivar-$(GITTAG)/
$(quiet)cp efivar.spec /tmp/efivar-$(GITTAG)/
$(quiet)dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efivar-$(GITTAG).tar.bz2 efivar-$(GITTAG)
$(quiet)rm $(rmverbose) -rf /tmp/efivar-$(GITTAG)
$(quiet)echo "The archive is in efivar-$(GITTAG).tar.bz2"

.PHONY: $(SUBDIRS)
.PHONY: a abiclean abicheck abidw abiupdate all archive
Expand Down
10 changes: 5 additions & 5 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ MAN3TARGETS = efi_append_variable.3 \
all : $(MAN1TARGETS) $(MAN3TARGETS)

clean :
@rm -f efisecdb.1 sbchooser.1
$(quiet)rm $(rmverbose) -f efisecdb.1 sbchooser.1

prep :

test :

install : $(MAN1TARGETS) $(MAN3TARGETS)
$(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man1
$(foreach x, $(MAN1TARGETS), $(INSTALL) -m 644 $(x) $(DESTDIR)/$(MANDIR)/man1/;)
$(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man3
$(foreach x, $(MAN3TARGETS), $(INSTALL) -m 644 $(x) $(DESTDIR)/$(MANDIR)/man3/;)
$(quiet)$(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man1
$(quiet)$(foreach x, $(MAN1TARGETS), $(INSTALL) -m 644 $(x) $(DESTDIR)/$(MANDIR)/man1/;)
$(quiet)$(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man3
$(quiet)$(foreach x, $(MAN3TARGETS), $(INSTALL) -m 644 $(x) $(DESTDIR)/$(MANDIR)/man3/;)

.PHONY: all clean install

Expand Down
9 changes: 8 additions & 1 deletion docs/efidp_make_generic.3
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.SH NAME
efidp_make_generic, efidp_make_end_instance, efidp_make_end_entire,
efidp_make_vendor, efidp_make_file, efidp_make_hd, efidp_make_nvme,
efidp_make_sas, efidp_make_ipv4, efidp_make_mac_addr, efidp_make_sata,
efidp_make_sas, efidp_make_ipv4, efidp_make_ipv6, efidp_make_mac_addr, efidp_make_sata,
efidp_make_scsi, efidp_make_acpi_hid, efidp_make_acpi_hid_ex, efidp_make_edd10,
efidp_make_pci, efidp_make_hw_vendor, efidp_make_msg_vendor, efidp_make_media_vendor \-
Create EFI Device Path node data structures for specific device types
Expand Down Expand Up @@ -62,6 +62,13 @@ Format EFI Device Path structures as printable strings.
uint16_t \fIlocal_port\fB, uint16_t \fIremote_port\fB,
uint16_t \fIprotocol\fB, int \fIis_static\fB);\fR

\fBssize_t \fRefidp_make_ipv6\fB(\kZuint8_t *\fIbuf\fB, ssize_t \fIsize\fB,
.ta \nZu
uint8_t \fIlocal[16]\fB, uint8_t \fIremote[16]\fB,
uint16_t \fIlocal_port\fB, uint16_t \fIremote_port\fB,
uint16_t \fIprotocol\fB, uint8_t \fIip_addr_origin\fB,
uint8_t \fIprefix_length\fB, uint8_t \fIgateway[16]\fB);\fR

\fBssize_t \fRefidp_make_mac_addr\fB(\kZuint8_t *\fIbuf\fB, ssize_t \fIsize\fB,
.ta \nZu
uint8_t \fIif_type\fB,
Expand Down
5 changes: 4 additions & 1 deletion src/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!guids.S
*.bin
/cov/
/efivar
efivar-guids.h
efivar-static
Expand All @@ -8,6 +8,9 @@ efisecdb-static
makeguids
guid-symbols.c
guids.lds
!guids.S
sbchooser
test-*
!test-*.c
thread-test
util-makeguids.c
64 changes: 43 additions & 21 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LIBEFISEC_OBJECTS = $(patsubst %.c,%.o,$(LIBEFISEC_SOURCES))
LIBEFIBOOT_SOURCES = crc32.c creator.c disk.c gpt.c loadopt.c path-helpers.c \
linux.c $(sort $(wildcard linux-*.c))
LIBEFIBOOT_OBJECTS = $(patsubst %.c,%.o,$(LIBEFIBOOT_SOURCES))
LIBEFIVAR_SOURCES = crc32.c dp.c dp-acpi.c dp-hw.c dp-media.c dp-message.c \
LIBEFIVAR_SOURCES = crc32.c dp.c dp-acpi.c dp-biosboot.c dp-hw.c dp-media.c dp-message.c \
efivarfs.c error.c export.c guid.c guid-symbols.c \
lib.c vars.c time.c
LIBEFIVAR_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(LIBEFIVAR_SOURCES)))
Expand All @@ -34,7 +34,7 @@ MAKEGUIDS_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(MAKEGUIDS_SOURCES)))
MAKEGUIDS_OUTPUT = $(GENERATED_SOURCES)

util-makeguids.c : util.c
cp util.c util-makeguids.c
$(quiet)cp util.c util-makeguids.c

ALL_SOURCES=$(LIBEFISEC_SOURCES) $(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES) \
$(MAKEGUIDS_SOURCES) $(GENERATED_SOURCES) $(EFIVAR_SOURCES) \
Expand All @@ -54,13 +54,13 @@ $(BINTARGETS) : | $(LIBTARGETS) $(PCTARGETS)
$(STATICTARGETS) : | $(STATICLIBTARGETS) $(PCTARGETS)

abiclean :
@rm -vf $(patsubst %.so,%.abixml,$@)
$(quiet)rm $(rmverbose) -f $(patsubst %.so,%.abixml,$@)

abixml : | $(LIBTARGETS)
abixml : $(patsubst %.so,%.abixml,$(LIBTARGETS))

abidw : $(patsubst %.so,%.abixml,$(LIBTARGETS))
git commit -s --amend $^
$(quiet)git commit -s --amend $^

abicheck : $(patsubst %.so,%.abicheck,$(LIBTARGETS))

Expand All @@ -75,7 +75,7 @@ makeguids : $(MAKEGUIDS_OBJECTS)

$(MAKEGUIDS_OUTPUT) : makeguids
$(MAKEGUIDS_OUTPUT) : guids.txt
@set -e ; \
$(quiet)set -e ; \
missing=no ; \
for x in $$(cat guids.txt | awk '{ print $$2 }' | grep -v ^zz) ; do \
if ! grep -q "efi_guid_$${x}" libefivar.map.in ; then \
Expand All @@ -86,7 +86,7 @@ $(MAKEGUIDS_OUTPUT) : guids.txt
if [ "$${missing}" != "no" ]; then \
exit 1 ; \
fi
./makeguids guids.txt guid-symbols.c include/efivar/efivar-guids.h
$(quiet)./makeguids guids.txt guid-symbols.c include/efivar/efivar-guids.h

prep : makeguids $(GENERATED_SOURCES)

Expand Down Expand Up @@ -142,32 +142,54 @@ thread-test.o : private CFLAGS=$(HOST_CFLAGS) -I$(TOPDIR)/src/include/efivar
thread-test : private LIBS=pthread efivar

deps : $(ALL_SOURCES)
@$(MAKE) -f $(SRCDIR)/include/deps.mk deps SOURCES="$(ALL_SOURCES)"
$(quiet)$(MAKE) -f $(SRCDIR)/include/deps.mk deps SOURCES="$(ALL_SOURCES)"

clean :
@rm -rfv *~ *.o *.a *.E *.so *.so.* *.pc *.bin .*.d *.map \
$(quiet)rm -rf $(rmverbose) \
*~ *.o *.a *.E *.so *.so.* *.pc *.bin .*.d *.map \
makeguids guid-symbols.c util-makeguids.c \
include/efivar/efivar-guids.h $(TARGETS) \
$(STATICTARGETS)
@# remove the deps files we used to create, as well.
@rm -rfv .*.P .*.h.P *.S.P include/efivar/.*.h.P
$(quiet)# remove the deps files we used to create, as well.
$(quiet)rm -rf $(rmverbose) .*.P .*.h.P *.S.P include/efivar/.*.h.P
$(quiet)$(MAKE) -f test.mk clean

install : all
$(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)
$(foreach x,$(LIBTARGETS), \
$(quiet)$(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)
$(quiet)$(foreach x,$(LIBTARGETS), \
$(INSTALL) -m 755 $(x) $(DESTDIR)$(LIBDIR)/$(x).1.$(VERSION) ;\
ln -fs $(x).1.$(VERSION) $(DESTDIR)$(LIBDIR)/$(x).1 ;\
ln -fs $(x).1.$(VERSION) $(DESTDIR)$(LIBDIR)/$(x) ;\
)
$(INSTALL) -d -m 755 $(DESTDIR)$(PCDIR)
$(foreach x, $(PCTARGETS), $(INSTALL) -m 644 $(x) $(DESTDIR)$(PCDIR) ;)
$(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/efivar
$(foreach x, $(sort $(wildcard $(TOPDIR)/src/include/efivar/*.h)), $(INSTALL) -m 644 $(x) $(DESTDIR)$(INCLUDEDIR)/efivar/$(notdir $(x));)
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
$(foreach x, $(filter-out %-test,$(BINTARGETS)), $(INSTALL) -m 755 $(x) $(DESTDIR)$(BINDIR);)

test : all
$(MAKE) -C test $@
$(quiet)$(INSTALL) -d -m 755 $(DESTDIR)$(PCDIR)
$(quiet)$(foreach x, $(PCTARGETS), $(INSTALL) -m 644 $(x) $(DESTDIR)$(PCDIR) ;)
$(quiet)$(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/efivar
$(quiet)$(foreach x, $(sort $(wildcard $(TOPDIR)/src/include/efivar/*.h)), $(INSTALL) -m 644 $(x) $(DESTDIR)$(INCLUDEDIR)/efivar/$(notdir $(x));)
$(quiet)$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
$(quiet)$(foreach x, $(filter-out %-test,$(BINTARGETS)), $(INSTALL) -m 755 $(x) $(DESTDIR)$(BINDIR);)


TESTS = $(patsubst %.c,%,$(wildcard test-*.c))

test : | all
test : $(TESTS)

test-clean :
$(quiet)$(MAKE) -C test clean
$(quiet)$(MAKE) -f test.mk clean

$(TESTS) : | all
$(TESTS) :
$(quiet)$(MAKE) -f test.mk \
CC="$(CC)" \
COMPILER="$(COMPILER)" \
CFLAGS="$(CFLAGS)" \
OPTIMIZATIONS="$(OPTIMIZATIONS)" \
TEST_LTO="$(TEST_LTO)" \
TEST_COVERAGE="$(TEST_COVERAGE)" \
LIBEFIVAR_OBJECTS="$(LIBEFIVAR_OBJECTS)" \
LIBEFIBOOT_OBJECTS="$(LIBEFIBOOT_OBJECTS)" \
"$@"

.PHONY: abiclean abicheck abidw abixml all
.PHONY: clean deps install test
Expand Down
7 changes: 6 additions & 1 deletion src/dp-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ _format_acpi_dn(unsigned char *buf, size_t size, const_efidp dp)
"Serial(0x%"PRIx32")",
dp->acpi_hid.uid);
break;
case EFIDP_ACPI_PARALLEL_HID:
format(buf, size, off, "Parallel",
"Parallel(0x%"PRIx32")",
dp->acpi_hid.uid);
break;
case EFIDP_ACPI_NVDIMM_HID: {
int rc;
const_efidp next = NULL;
Expand Down Expand Up @@ -253,7 +258,7 @@ _format_acpi_dn(unsigned char *buf, size_t size, const_efidp dp)
case EFIDP_ACPI_HID:
debug("Decoding ACPI HID");
format(buf, size, off, "Acpi",
"Acpi(0x%08x,0x%"PRIx32")",
"Acpi(0x%"PRIx32",0x%"PRIx32")",
dp->acpi_hid.hid, dp->acpi_hid.uid);
break;
default:
Expand Down
Loading
Loading