Librem 14 - Falling battery max charge percent

From the error message it sounds like /lib/modules/5.1.0.0-7-amd64/build doesn’t exist. You should be able to run make as a regular user without any additional arguments from the directory with the Makefile. This will produce a librem_ec_acpi.ko file in the same directory. You can use insmod to load it right away. Or move it to /lib/modules/5.1.0.0-7-amd64/kernel/drivers to have it auto loaded by the kernel. Replace 5.1.0.0-7-amd64 with the proper kernel version. To check what you’re currently running use the command:
uname -r

Thanks for the answer. Unfortunately it did not help me.
The error is the same and no .ko file in my librem-ec-acpi-dkms directory.
I tried installing PureOs10 devel from the homepage and fully updated it. This didn’t help either.
How can I get this /lib/modules/5.1.0.0-7-amd64/build working?

uname -r gives me: 5.10.0 - 7 - amd64

Searching the WWW helped. Solution:
sudo apt install linux-headers-5.10.0-7-amd64

For anyone else just change it accordingly to your kernel version. sudo apt search linux-headers may help.

Just wanted to let readers and purism know I had the same firmware bug as [L14 Battery] Constant discharge + Charge in Qubes.
My librem was not charging at all after the battery drained the first time.
I hope Purism finds a way to easily fix the firmware for users.
There seem to be a issue with the battery charging in general (see other forum posts).