Am 26.02.24 um 10:33 schrieb bzt:
Thank you for your answers!
But changes are that you will need at least libpci to configure the spi controller.
I don't think so, but I could replace libpci with a quick'n'dirty static direct-pci-access library if really that's the case. What I can replace is libusb, I certainly must omit that and all related code from libflashrom to make this work.
Maybe using execve(2) works for you?
No. The installer is an UEFI application, no libpci, no libusb, no system(), no execve() syscalls exists at all. The main issue here is, this environment isn't POSIX, much less Linux-compatible.
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?).
Yes, it's internal, an M25P80 compatible (at least, qemu's m25p80.c emulates the exact model I need to support, and flashrom.c also lists it with BUS_SPI). I need to flash coreboot into the motherboard's ROM as part of an automatic install process.
My problem is, I haven't seen anything like enabling/disabling drivers in the source (no "ifdef"s), which makes me wonder if disabling certain chips would actually strip their source code or not.
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.
Thank you, I'll look into that!
So what I want to achieve here is:
- create a stripped down libflashrom source code that contains only
internal SPI programmer, nothing else 2. compile it under Linux with flashrom utility and test it in qemu 3. if works well, start porting that smaller source code base to UEFI 4. finally add the stripped down, ported libflashrom to the existing installer UEFI application
Thank you for your answers again, I'll look into that test_build.sh, hopefully I can use it to shrink the source.
There used to be (I haven't checked recently) an option to restrict building to a specific bus type only, i.e. only allow SPI flash. Combining this with building only for specific programmers would probably yield most of the result you want.
In the past, I have successfully built flashrom with only the internal driver to forward all hardware accesses to SerialICE (dependency on an external lib), so what you want should be possible also from a technical perspective.
Regards, Carl-Daniel