mglae Thanks for mentioning the use of package.mk.
I found more about changing of the code in files and adding files, see
add nouveau - opensource nvidia driver by ToKe79 · Pull Request #5917 · LibreELEC/LibreELEC.tv
I am not sure if it is relevant for LibreELEC, but maybe for the Generic (non-legacy) image.
I did not test the legacy image, as I don't have nvidia card,…
github.com
After I have bought 2x2GB RAM, I expect to be able to compile and build LibreELEC on a x86_64 system (for cross-compiling my RPi4 and probably my RPi5 have not sufficient memory).