Hello! You can select which programmer(s) to enable and disable, at build time. You can enable just one programmer that you need (internal is it?).
An example can be a test_build.sh which is in the root of the tree. This script is what Jenkins runs, and it builds lots of things. But specifically to the subject, script loops through all the options for programmers, enables one option and disables the rest, and tries to build with this. Seems similar to what you want to achieve.
On Mon, Feb 26, 2024 at 3:21 AM Stefan Reinauer stefan.k.reinauer@gmail.com wrote:
On Sun, Feb 25, 2024, 01:06 bzt bztemail@gmail.com wrote:
Hi,
I've a question. I'm writing a software that installs a specific Linux distro on the target computer automatically. It also should flash coreboot as part of the install process, and that's where I'm stuck.
From what I've gathered, for that I would need a stripped down version of libflashrom that only has the internal SPI driver, nothing else (without laptop-checks, Paralell, LPC, NICs, external USB programmers etc.) What is the best way to achieve this?
I've already set up my test environment: I've configured and compiled qemu with "-enable-m25p80", which emulates lots of flash chips, among others the one that my target machine has. Then I can run qemu with "-device m25p80" and start a minimal Linux VM with the flashrom utility that I've compiled from source.
I've also cleaned up flashrom.c to only list the chips with the BUS_SPI interface (I need to support one specific chip only, but my understanding is, all of these use the same driver so it shouldn't be a problem having all these chips in this list). Now I need to remove files and functions that are not related to internal SPI, and I'm not sure how to proceed. Which would be the easiest and suggested way to have a stripped down libflashrom with just the internal SPI driver?
ps: unfortunately using flashrom as-is is out of question because it has way too many dependencies that the installer image simply does not have. For example, there's no libpci, libusb and no /dev/spidev device either, so I must restrict libflashrom to use its own driver, and also my installer can't call system(), so I must link it with libflashrom.
You did not mention the actual CPU architecture or mainboard you are running on, so I'd have to guess a bit here. But changes are that you will need at least libpci to configure the spi controller. You can configure a flashrom binary without USB support however.
You did not mention why system() is not an option. Maybe using execve(2) works for you?
Generally there is no difference in dependencies between libflashrom and flashrom. You can configure either without certain drivers to control dependencies. Check out Makefile or meson_options.txt
Stefan
flashrom mailing list -- flashrom@flashrom.org To unsubscribe send an email to flashrom-leave@flashrom.org