Building coreboot from source (official script)

Thank you so much @MrChromebox. Once I installed the build dependencies this worked great. Now my Librem 13 boots straight from my Nitrokey storage. I’ve even managed to get the luks smartcard script to work :smile:

I think I’ll wait a bit to try flashing HEADS on it though as I’m running Debian Testing & don’t have a Librem key yet.

How are ya’ll getting past the megadown issue?

I downloaded the file manually, renamed it to “me_11_repository.rar”, and moved the file into “/home/anon/building-coreboot/coreboot/megadown”

Then when running the script: “chmod +x build_coreboot.sh && ./build_coreboot.sh”, it runs up to:

"Downloading ME 11 Repository from https://mega.nz/#!6JlAla6a!hvulc0ZYCj19OzOZoyKimZSh8bxHw9Qmy6bQ8h_xKTU
Please be patient while the download finishes…

Reading link metadata…" … and just stops.

Am I missing a step? I followed all other steps from https://puri.sm/coreboot/, and tried to follow the error workarounds from here, with no luck.

Any ideas? Thanks!

@dc3p
Don’t move the file to “/home/anon/building-coreboot/coreboot/megadown”.
Move it to “/home/anon/building-coreboot/coreboot/”.

Everything else is fine.

1 Like

And I am off to the races! Thank you very much.

1 Like

Which option should I select when prompted for serial?

Which serial number do you want to set :
1 - Extracted from the coreboot image (L15V4US1903073)
2 - Fetch the serial number from your local system
3 - Enter serial number manually
4 - Do not set a serial number

Enter your choice (default: 1): 1

@dc3p
Just my two cents, but taking option no. 1 always worked for me. Plus I think that serial is (in the end) not that important.

If someone else could elaborate on my statement, that would be great :slight_smile:

1 Like

I’ve hit another wall:

Building GCC v6.3.0 for target ... failed. Check 'build-i386-elf-GCC/build.log'.
make[2]: *** [Makefile:26: build_gcc] Error 1
make[1]: *** [Makefile:48: build-i386] Error 2
make: *** [util/crossgcc/Makefile.inc:46: crossgcc-i386] Error 2

the log it points to says:

sem_attr.adb:50:16: warning: use clause for package "Sdefault" has no effect
make[1]: *** [../../gcc-6.3.0/gcc/ada/gcc-interface/Make-lang.in:119: ada/sem_attr.o] Error 1
make[1]: *** Waiting for unfinished jobs....
../../gcc-6.3.0/gcc/ada/sem_case.adb: In function 'Sem_Case.Check_Choice_Set':
../../gcc-6.3.0/gcc/ada/sem_case.adb:848:37: warning: 'Prev_Choice' may be used uninitialized in this function [-Wmaybe-uninitialized]
make[1]: Leaving directory '/home/anon/building-coreboot/coreboot/util/crossgcc/build-i386-elf-GCC/gcc'
make: *** [Makefile:4108: all-gcc] Error 2
/bin/bash ../gcc-6.3.0/mkinstalldirs /home/anon/building-coreboot/coreboot/util/crossgcc/xgcc /home/anon/building-coreboot/coreboot/util/crossgcc/xgcc
/bin/bash: line 3: cd: i386-elf/libgcc: No such file or directory
make: *** [Makefile:10796: install-target-libgcc] Error 1

Reading up says this could be due to multiple repos or having a newer version of gcc installed? The only non-PureOS green repo I have is the Debian main.

I can remove the Debian repo if needed, or downgrade gcc if needed (I would need a little help with the latter, if that was the case).

Thanks for all the help you have provided so far.

I just tried disabling the Debian repos and installing gcc-3; the build fails with the same errors as above.

I’m sorry all, but is this the solution to both the broken build and being able to alter boot order?

I just ran through MrChromebox’ script, and it worked like a charm! Sorry for all the posts, but I appreciate all of your help.

One last question is: I have a Librem Key coming soon. Is there any harm in installing PureBoot / heads now and setting up the key when it comes in, or do you need to have the key at initial run?

you’d have to configure it to either use a different validation method in the meantime, or simply ignore all the warnings etc until you got the librem key to set everything up. I’d probably just wait since there’s no benefit in flashing the Pureboot firmware ahead of time

1 Like

yes. flashing the precompiled firmware has no dependencies beyond those needed for flashrom to flash it, and everything is downloaded from Purism servers. The updater script also provides the option to customize the boot order prior to flashing when using the standard/SeaBIOS firmware.

1 Like

You rock, good sir! Thank you again.

I successfully ran the update script, changed the boot order, everything is good there. I also flashed heads to the system, and that is running OK - thought without a Librem Key.

I have a Yubikey, and was going to try setting up yubikey-luks, but i think i need standard firmware – not heads.

When trying to flash back to coreboot, i get:

Initializing internal Flash Programmer

ERROR!!! Error flashing coreboot!

Can you not go back once heads is installed?

there shouldn’t be an issue flashing back to the standard firmware after flashing the Heads firmware, I went back/forth several times here to verify everything was ok. What Librem, OS, etc are you using? Can you pastebin the most recent flashrom log file in the update directory?

Thanks for your assistance!

Librem 15v4, PureOS up-to-date, running KDE

    flashrom v1.0 on Linux 4.19.0-4-amd64 (x86_64)
    flashrom was built with libpci 3.5.2, GCC 8.3.0, little endian
    Command line (7 args): ./flashrom/flashrom -p internal:laptop=force_I_want_a_brick,ich_spi_mode=hwseq -w coreboot-l15v4.rom -V -o ./flashrom-20190326-191804.log
    Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
    Initializing internal programmer
    Found candidate at: 00000500-00000510
    Found coreboot table at 0x00000500.
    Error accessing high tables, 0x100000 bytes at 0x000000007aace000
    /dev/mem mmap failed: Operation not permitted
    Failed getting access to coreboot high tables.
    Using Internal DMI decoder.
    Error accessing DMI Table, 0x1000 bytes at 0x000000007aa98000
    /dev/mem mmap failed: Operation not permitted

I also tried trashing and redownloading all of the flashing resources, which made no difference.

1 Like

looks like a permissions issue (cannot access /dev/mem), so looks like you need to manually edit the kernel boot parameters used by Heads and add ‘iomem=relaxed’ to them before booting. This is a not-uncommon issue with flashrom and kernels which tightly lock down /dev/mem

edit: just to make sure, you did run the script w/ sudo, right?

1 Like

Correct, I did run the script with sudo.

As for boot parameters, I know how to do that with grub, but not with heads. I looked everywhere to try finding a place and can’t find anything.

Could you point me in the right direction?

I’m not seeing an easy way to do it from Heads, might be easiest just to throw the firmware on a USB stick and flash from the Heads menu that way

1 Like

Any news for those of us with a Librem15v2? Is there a tweaked version of the script used for the old librem13 that could migrate us to Coreboot? It’s great to see that Librem15v2 is supported by your script to update Coreboot, but since we can not get any firmware to start with, we are still stuck. And my bios got messed up, either I get Coreboot or I need to perform a “clean cmos” on it…

Mathias