system76 / firmware-open

System76 Open Firmware
Other
957 stars 86 forks source link

add nix-shell file for building with nix #578

Open ahoneybun opened 3 weeks ago

ahoneybun commented 3 weeks ago

Once you enter shell in the firmware-open repo it will basically run though the install-deps and coreboot-sdk scripts so that you can build your firmware right after it is done. I tested with the qemu firmware test to make sure that it did work.

I'm going to test on Pop!_OS next as this was done on NixOS to be sure that I have all of the depends.

leviport commented 3 weeks ago

Can flashrom be added as well? I currently have to use flashrom in a Nix shell in order to use the ch341a to flash many of the newer BIOS chips, since the flashrom in Jammy is quite old.

ahoneybun commented 3 weeks ago

Yep I can add that! The reason for adding the shellHooks would be to run the shell command once and have everything ready to build firmware. I do note that every time that you enter the shell it would pull the latest code and recompile which can be a lot. Another reason for that would be to not have another script (we could add logic for NixOS in the current ones thought).

ahoneybun commented 3 weeks ago

Alright I was able to build and run the QEMU example on Pop!_OS 24.04 with nix now with the latest commit. I have not tested flashing the firmware yet.

leviport commented 3 weeks ago

Can you build firmware for one of our machines? I'm getting this failure when building galp5.

Makefile:303: *** Missing NSS. Please install libnss3-dev if it is not installed..  Stop.
make: *** [src/security/vboot/Makefile.mk:52: build/external/vboot_reference-romstage/vboot_fw.a] Error 2
make: *** Waiting for unfinished jobs....
Makefile:303: *** Missing NSS. Please install libnss3-dev if it is not installed..  Stop.
make: *** [src/security/vboot/Makefile.mk:54: build/external/vboot_reference-ramstage/vboot_fw.a] Error 2
Makefile:303: *** Missing NSS. Please install libnss3-dev if it is not installed..  Stop.
make: *** [src/security/vboot/Makefile.mk:55: build/external/vboot_reference-postcar/vboot_fw.a] Error 2
Makefile:303: *** Missing NSS. Please install libnss3-dev if it is not installed..  Stop.
make: *** [src/security/vboot/Makefile.mk:50: build/external/vboot_reference-bootblock/vboot_fw.a] Error 2
ahoneybun commented 3 weeks ago

I'll test the galp5 and fix that.

ahoneybun commented 3 weeks ago

Alright I was able to build firmware for the galp5, galp7 and addw3.

DrymarchonShaun commented 1 week ago

Might want to include the hidapi package as well, ./ec/scripts/ectool.sh needs it, on NixOS at least.

ahoneybun commented 6 days ago

Add that @DrymarchonShaun didn't cause any issues with building QEMU so it should be fine, does it fix your issue?

DrymarchonShaun commented 6 days ago

Yeah, that should do it.