Setting battery threshold on a X230 with coreboot
The tpacpi-bat utility doesn't work after flashing coreboot. An alternative is using the coreboot util ectool. One can set the lower and upper charging threshold by writing the desired battery charge percentage (in hex) to addresses 0xb0 and 0xb1 respectively. So to start charging only when the battery is below 40% (0x28 in hex), one would execute:
ectool -w 0xb0 -z 0x28
To stop charging an 70% (0x46 in hex):
ectool -w 0xb1 -z 0x46
Hex values can be determined e.g. using printf:
$ printf '%x\n' 70
This can then be run as a script on startup to ensure permanence.