Help! Trying to build coreboot for Librem 13v1 but missing MRC, PCH, and VGABIOS

I could really use some help. I have a Librem 13v1 that I have unfortunately lost the BIOS password to. To make matters worse it’s set to ask for the BIOS password on boot, thus preventing me from flashing BIOS using the laptop itself.

I have managed to extract the contents of the flash memory (MX25L6406E) using a Raspberry Pi. Three extractions with flashrom yielded the same result, so I’m fairly certain it’s not corrupted.

Since this Librem has never been flashed it’s still running AMI BIOS. As I don’t have a backup without the BIOS password set, my wish is to flash it with coreboot instead.

Here’s where I am right now:

The official script (1) requires some firmware I don’t seem to have.

I was able to extract the following from the memory dump by using ifdtool:
descriptor.bin - The Intel Descriptor
me.bin - The Intel Management Engine image

This one it seems the script will download for me:
cpu_microcode_blob.bin - The CPU Microcode Update

But these three I have no clue how to get:
mrc.bin- The Memory Reference Code
refcode.elf - The PCH Reference Code
vgabios.bin - The VGA BIOS

Here’s the output from ifdtool:
youser@critter:~/coreboot$ ./coreboot/util/ifdtool/ifdtool -x read1.bin
File read1.bin is 8388608 bytes
Flash Region 0 (Flash Descriptor): 00000000 - 00000fff
Flash Region 1 (BIOS): 00200000 - 007fffff
Flash Region 2 (Intel ME): 00001000 - 001fffff
Flash Region 3 (GbE): 00fff000 - 00000fff (unused)
Flash Region 4 (Platform Data): 00fff000 - 00000fff (unused)

Please advise. Thank you.

1: Building coreboot from source (official script)

Hi,
Yes, the build script is meant for people already running coreboot, and the binaries are retrieved from the dumped coreboot image itself. What you can do however is to use the purism-librem-coreboot-updater script instead.

That script was meant to run on the librem itself, and to update the machine from AMI (or an older coreboot) into coreboot. That script hasn’t been updated in a while, and it builds an outdated coreboot image. It’s also not meant to compile coreboot itself, instead it downloads a pre-built coreboot image (with the binary blobs stripped from it) from my personal server… Then it downloads the binary blobs separately and ‘reconstitutes’ the original coreboot image before flashing it.
You will probably need to adapt the script but if you can figure out how to dump your flash using a Rpi and use ifdtool, you should be able to manage it on your own. I would suggest you just ‘apt-get install purism-librem-coreboot-updater’ in a PureOS Live USB image, so it can bring with it all the tools/dependencies that it needs, create the (old) coreboot image that way, then copy over the resulting coreboot.rom image and use that as the ‘base’ for the build script so it can extract the binary blobs from it and you get a built-from-source latest version coreboot instead.

Basically, starting at line 782 the script runs various steps, you’ll need to change the ‘check_machine’ call or function which validates that it is running on a librem then sets a few important variable and creates the cache directory. So, replace it simply with :

    ORIG_FILENAME="factory_bios_backup.rom"
    VENDOR=1
    IS_LIBREM13V1=1
    CACHE_DIR="${CACHE_HOME}/purism-librem-coreboot-updater/librem13v1"
    mkdir -p "${CACHE_DIR}"
    cd "${CACHE_DIR}"

You’ll also need to copy your dumped rom (read1.bin) to ~/.cache/purism-librem-coreboot-updater/librem13v1/factory_bios_backup.rom

Then remove the call to backup_original_rom since you already did that, Then after the call to ‘build_cbfs_image’, your ‘coreboot.rom’ file should be ready.

You could also just read the code of the script to figure out how/where it gets the MRC and REFCODE files from (it downloads a chromebook recovery image, mounts the image I think, then extracts their own coreboot updater script, and extracts the coreboot file from the shell script then extracts the binaries from that image), and how it gets the vgabios (it uses UEFITool to get the vgabios file from the original AMI image) and then you can do it manually instead, but I suggest to instead just let the script do its thing instead, just make sure you don’t flash your other machine or something…

Let me know if you are having any issues with that.

Thank you! I successfully flashed coreboot on my Librem by following your suggestions.