Building coreboot from source (official script)

can you elaborate? the 15v2 has had coreboot support for some time now. Is your device still running the old AMI firmware? Can you define “messed up” – is the device bootable, or what’s the issue?

Yes, my Librem15v2 is still running the AMI firmware. The problem is that in order to migrate to Coreboot, you need to have some firmware files that can not be redistributed, therefore there is no way to start… Once it would be running Coreboot, the update script would handle everything in order to update to a newer version, but since I can not even replace the AMI frmware, I am stuck (I’ve posted a few times in this thread over the last months/years on this issue and last time, there was still no way forward).

Regarding my AMI bios, this is that the stupid “fastboot” option disables the keyboard, so I can not enter the bios anymore (I would need to reset the bios settings with a jumper on the motherboard, which I could not find). What makes it worst is that it boots in “power save” mode (set in the bios) and this makes the whole boot very, very slow, but I can not change it because of this “fastboot” option…

Mathias

This did it for me, thank you for your help!

my new script will download/flash a precompiled image – see the link/instructions I posted above. It should work for flashing on a device w/AMI firmware currently (it did here in my testing)

1 Like

Wow, that’s great news!! Potentially the only problem standing between my laptop and Coreboot is that your link does not work (anymore, I guess): https://source.puri.sm/coreboot/releases/raw/new_update_script/update_coreboot.sh The “raw” directory does not exist…

I edited my post the other day with an updated link, it’s the person who quoted me that I can’t update/edit. Go up slightly more to my actual post :slight_smile:

Thanks a lot! It worked surprisingly well and fast! Thanks a lot for making this happen!

Unfortunately, although the first reboot went smooth and fast, I had some troubles afterward: it seems that using the “i915.enable_psr=1” kernel command line option leads to GPU hangs (within a few seconds to a few minutes). I am using Debian Buster with Kde. I’ve now removed this option and so far, no hangs… I also miss the wifi. No way to find the Atheros card in dmesg or lspci or lsusb. Interestingly, I had done a “cbmem -c” dump just after the first reboot (so most probably, some stuff was still initialized from the AMI bios that ran before) and I’ve now done a new dump (after several cold starts). They don’t match… The dump after the first reboot can be found at https://pastebin.com/Bs4g4W7C while the dump after several cold starts is at https://pastebin.com/626jwNcR. (by the way, the Bluetooth is detected properly)

I also have some other problems: booting often hangs at “starting from HDD” (or something similar, ie before starting grub), “shutdown” does not work properly (ie the OS shuts down but the computer still runs, if I toggle the wifi kill-switch, the light turns on/off) so I have to long-press the on/off button. And if I try to start “Coreinfo” in Coreboot’s menu, the laptop just freezes…

I have tried to reflash (just to make sure), no difference. Should I try to build coreboot from the latest soucres (ie from git)?

is that a standard/default kernel param? I don’t have that on my PureOS setup

seems there is a change in the ME status between the two cbmem logs, let me look into that

[quote]
I also have some other problems: booting often hangs at “starting from HDD” (or something similar, ie before starting grub), “shutdown” does not work properly (ie the OS shuts down but the computer still runs, if I toggle the wifi kill-switch, the light turns on/off) so I have to long-press the on/off button. And if I try to start “Coreinfo” in Coreboot’s menu, the laptop just freezes…[/quote]

I’ll check these on my 15v2 here

[quote]
I have tried to reflash (just to make sure), no difference. Should I try to build coreboot from the latest soucres (ie from git)?[/quote]

no, that is build from the latest tag in our repo. Building from upstream coreboot would likely result in a few things being missed.

The i915.enable_psr=1 is not a standard kernel parameter, but this should become one relatively soon (this is the panel self-refresh for the Intel driver and the devs have declared this could now become default, it is considered stable enough).

Another interesting thing: as I am now connecting to the wifi through a (very old) usb dongle, I kept loosing the connection just after authentication. it turns out that by turning off the onboard wifi (using the hardware switch on the Librem), it now works properly. So somehow, although I could not see the onboard wifi, it was still interfering with the wifi dongle…

so here’s a comparison between my 15v2 (left) and your 2nd cbmem log (right):
https://www.diffchecker.com/26Ytt2sQ

the only differences are the previous power state, amount of RAM, bootorder, and some timestamps. So there’s nothing on the coreboot side which would indicate any problem.

can you provide the output of ‘sudo lspci -nn’ please? the wifi module should be present at 2:00.0

Ok, now it all makes sense… When you wrote that it looked like the ME image was missing some things, I remembered that just after flashing, I tried to checked if the ME had been cleaned. And by mistake (typing too fast and with [tab]), I ran me_cleaner on the freshly flashed system. So it must have removed some stuff from the already cleaned ME, making these bugs… (lspci did not have anything for the wifi module)

Now I’ve deleted my cached version of your firmware (basically deleting everything in the firmware/ directory of your script), and I have re-run your script. Tadaa! it works, the wifi is found and works! I’ll try putting back the i915.enable_psr kernel parameter and let you know…

[A few minutes later] I can confirm, “shutdown” works properly, and all my i915 kernel parameters work fine: i915.enable_psr=1 i915.enable_dc=2 i915.enable_fbc=1. And the boot is much faster. I was the bug here… So thanks again a lot for your help!

So, sorry it was my mistake (well, if me_cleaner could detect that it has already run, this would also be safer). But thanks for your hint, that was the key!

1 Like

no worries, I’m glad we got it figured out pretty quickly. I’ll add a note/warning to the script that the images already have ME Cleaner applied, and that doing so a 2nd time could cause issues.

1 Like

Ok, a little less upbeat than in my previous post… With Coreboot, the kernel command line options “i915.enable_psr=1” and “i915.enable_fbc=1” work but “i915.enable_dc=2” (enable deeper energy saving states) as well as “ath9k.ps_enable=1” (power saving mode for the wifi card) make the system crash at boot while they used to work when still using the AMI bios (with the same kernel version).

I’m not familiar with any of those command-line params, but given they aren’t defaults, that suggests the features aren’t stable enough to be enabled by default. I also know that the AMI firmware incorrectly advertises some features it doesn’t support, and disables some it should enable. I’d have to do some research on the appropriateness of the i915 ones for a Broadwell GT2 GPU, and then see if they should be supported, why they are causing a crash.

have you tried enabling the parameters one at a time to see which is responsible for the crashing?

#########################################
##  Purism Librem firmware updater 1.0 ##
#########################################

Which Librem device do you have?

# Broadwell/5th-Gen
1 - Librem 13 v1
2 - Librem 15 v2
# Skylake/6th-Gen
3 - Librem 13 v2
4 - Librem 13 v3
5 - Librem 15 v3
# Kabylake/7th-Gen
6 - Librem 13 v4
7 - Librem 15 v4

My spidey sense tells me it's a Librem 13 v2
running firmware coreboot 4.6-a86d1b-Purism-5

Enter your choice (1-7): 5

Which firmware type would you like to flash?

1 - Standard (v4.8.1-Purism-4)
2 - PureBoot (v4.8.1-Purism-4-HEADS-beta-2)

Enter your choice: 1

Checking for usable version of flashrom
$ echo $?
1

I ran sudo apt install flashrom and then ran the script again. The script then said

Checking for usable version of flashrom
Cloning flashrom git repo...done
Building flashrom from source...done

ok… :smiley:

About to flash now. If I’m not back in 5 minutes… just wait longer.

1 Like
Do you want to flash the coreboot update now (y/N) ?  y

coreboot flashing in progress. Do NOT interrupt this process.

Initializing internal Flash Programmer

ERROR!!! Error flashing coreboot!

doh.
Guess I have to do the iomem=relaxed thing. Can I do that by pressing escape at boot and fiddling around?

pastebin the time/date-stamped flashrom log
(I’ll add that note to the script)

Hmm, in grub I pressed c and then added iomem=relaxed to one of the lines…
Now I have this error in my flashrom log:

Found Programmer flash chip "Opaque flash chip" (16384 kB, Programmer-specific).
coreboot last image size (not ROM size) is 16777216 bytes.
Manufacturer: Purism
Mainboard ID: Librem 15 v3
This coreboot image (Purism:Librem 15 v3) does not appear to
be correct for the detected mainboard (Purism:Librem 13 v2).
Aborting. You can override this with -p internal:boardmismatch=force.
Restoring PCI config space for 00:1f:5 reg 0xdc

But my laptop really is a Librem 15 v3. It’s printed on the bottom. Did someone put wrong bios on my laptop at the factory?

let’s figure that out. can you pastebin the output from (sudo) dmidecode? May also need you to download or build the coreboot cbmem utility to pull the firmware boot log

edit: cbmem download: https://mrchromebox.tech/files/util/cbmem.tar.gz
extract, then run: sudo ./cbmem -1c > cbmem.log
and pastebin the full output

dmidecode: https://0bin.net/paste/s495FMgvlDIBY2R-#Gwdx1zCKAX6AdM8+CzEGVB18wW2v-dBGEMIsad0Z4sJ
cbmem: https://0bin.net/paste/NL0Y2EqjuvB3MkRG#nLX-3rl30zIWyPjW5pBSdqz5x93gl0jv0/4sbCp3gzy
flashrom log: https://0bin.net/paste/syd3CCd7ZSw5lx1I#UBaxkSwCp4mNqFQwTVWiNHyF7DIhOMlbGKSNon0My0S

sorry, I can’t post anymore today it seems, getting an alert I’ve reached the max for a new user :confused:

edit: added cbmem and flashrom logs

edit 2:
OK, let’s try ghostbin
https://ghostbin.com/paste/2f7y9

edit 3:
I have no idea why the above ghostbin disappeared. Let’s try again
https://ghostbin.com/paste/ef3h9

edit 4:
It does have the numpad on the right. I’ll try adding -p internal:boardmismatch=force.