jmbaur / tinyboot

A linuxboot payload for coreboot
MIT License
13 stars 1 forks source link

README.md out of date or missing something obvious! #20

Open tlaurion opened 1 month ago

tlaurion commented 1 month ago

Hey @jmbaur ! Frist, amazing work here and this project is inspiring in a lot of regards (linuxboot/heads maintainer here)

I did not have enough nix knowledge before to be able to test this project. Now I somewhat do, but still not enough to understand where I fail to produce qemu x86 target

Here's a summary of my understanding:

But it doesn't :) From my understanding, I would have expected to be able to do nix build .#coreboot-qemu-x86_64

But nope.

What Am I missing?

tlaurion commented 1 month ago

From https://github.com/jmbaur/tinyboot/blob/f35cf5a87207ff7b093b0c68fd24b7cf818d5290/README.md#usage

It should be as simple as: nix run github:jmbaur/tinyboot#coreboot-<your_board>.config.build.installScript

user@heads-tests-deb12-nix:~/tinyboot$ nix run github:jmbaur/tinyboot#coreboot-qemu-x86_64.config.build.installScript
error: flake 'github:jmbaur/tinyboot' does not provide attribute 'apps.x86_64-linux.coreboot-qemu-x86_64.config.build.installScript', 'packages.x86_64-linux.coreboot-qemu-x86_64.config.build.installScript', 'legacyPackages.x86_64-linux.coreboot-qemu-x86_64.config.build.installScript' or 'coreboot-qemu-x86_64.config.build.installScript'
jmbaur commented 1 month ago

Hi @tlaurion, thanks for the appreciation! Most of this work has been experimental, and a work-in-progress, but at points has been something that I've used on a daily basis on some chromebooks I have. There's been a rewrite of the original rust codebase to zig for a few reasons (final binary size being one of them), and the port is not yet complete, so I wouldn't expect everthing to work quite yet.

Regarding your description of the nix setup, most of it is correct. I apologize about the lacking/incorrect documentation, I'll work on fixing that up. nix build .#coreboot-qemu-x86_64 doesn't work because that attribute is an output from lib.evalModules. You should be able to run nix build .#coreboot-qemu-x86_64.config.build.firmware and that should be something you can pass to qemu-system-x86_64 -bios ... to boot up a full coreboot image. I don't regularly test the qemu coreboot builds though, as for development (with zig build run), I'm just doing direct boot into the linux kernel (i.e. qemu-system-x86_64 -kernel ...).

jmbaur commented 1 month ago

It looks like the current build of coreboot-qemu-x86_64.config.build.firmware is broken right now due to some invalid fetches from review.coreboot.org for the amd_blobs repo.

jmbaur commented 1 month ago

~Should be fixed with c32354b63b2265962f29a365ee64c5643cda1c83~

Actually seems like something is not working quite well with fetching from review.coreboot.org...

coreboot> error: RPC failed; curl 92 HTTP/2 stream 3 was not closed cleanly: PROTOCOL_ERROR (err 1)
coreboot> error: 30 bytes of body are still expected
coreboot> fatal: expected flush after ref listing
coreboot> remote: Counting objects: 802524, done

Edit: sorry for the churn, switched to using the mirrors on github, try from main

jmbaur commented 1 month ago

Hey @tlaurion, I ended up changing the attribute path for building the coreboot builds since it makes more sense to be able to run a build command like you had expected. You should now be able to do something like nix build .#tinyboot-qemu-x86_64 and get a full coreboot ROM file.

tlaurion commented 1 month ago

Builds! Thanks! Happy to finally test this :)

tlaurion commented 1 month ago

Well. It built, but then how to run it?

EDIT

user@heads-tests-deb12-nix:~/tinyboot$ find /nix/store/*tinyboot*
/nix/store/1j9sd3mkng1k3xl8pdi5qdv1dvzg0ps1-tinyboot-0.1.0.drv
/nix/store/bdx4q1cnwp08a5p40v5nrwknbg267447-tinyboot-qemu-x86_64
/nix/store/cd9v8x64nv1qb1v7a2v3j4gg91hjigp2-tinyboot-0.1.0
/nix/store/cd9v8x64nv1qb1v7a2v3j4gg91hjigp2-tinyboot-0.1.0/bin
/nix/store/cd9v8x64nv1qb1v7a2v3j4gg91hjigp2-tinyboot-0.1.0/bin/tboot-nixos-install
/nix/store/cd9v8x64nv1qb1v7a2v3j4gg91hjigp2-tinyboot-0.1.0/bin/tboot-bless-boot-generator
/nix/store/cd9v8x64nv1qb1v7a2v3j4gg91hjigp2-tinyboot-0.1.0/bin/xmodem
/nix/store/cd9v8x64nv1qb1v7a2v3j4gg91hjigp2-tinyboot-0.1.0/bin/tboot-bless-boot
/nix/store/cd9v8x64nv1qb1v7a2v3j4gg91hjigp2-tinyboot-0.1.0/tboot-loader.cpio.xz
/nix/store/kdc81bx17lvjw37n9xlmjiy3a63nj6n2-tinyboot-qemu-x86_64.drv

No kernel?

EDIT: okok qemu-system-x86_64 -machine q35 -bios /nix/store/bdx4q1cnwp08a5p40v5nrwknbg267447-tinyboot-qemu-x86_64

tlaurion commented 1 month ago

Would be nice if you provided a lillte more information then the now updated README.md not explaining how to reproduce testing environement a little mode detailed