Hi everyone! My name is Utkarsh Mahajan. I'm a 2nd year ECE student from NITK, India. I am passionate about Computer architecture and working on low level stuff. I recently found out about coreboot through gsoc. I am very much interested in contributing towards this repository.
Related to coreboot, I have a decent knowledge of c and just started playing with x86_64 assembly a month ago. So I recently started off by reading a bit of docs available on coreboot's website and tried out building an image file for i386 and testing it using QEMU. Which I was successfully able to do.
Then I started exploring other parts of the docs and later tried understanding the code base but had a hard time understanding it so I am currently trying to understand specific tools used like kconfig and about makefiles from publicly available sources.
I'm specifically interested in the project "*Provide toolchain binaries*", But I wasn't able to understand what exactly is to be done in the project. As far from the written text, I understood that we need to provide package installers for the compiler so that for example coreboot could be installed from AUR helpers if an arch aur version was made. But then there's written about crossgcc, that we need something to replace it for individual architecture like x86_64 if i'm not wrong. If anyone could help me clarify about the project and could redirect me towards a few resources where I could gain enough knowledge to be able to work on coreboot and this project, it would be really helpful.
On Tue, 2022-03-15 at 04:39 +0530, Utkarsh M wrote:
Hi everyone! My name is Utkarsh Mahajan. I'm a 2nd year ECE student from NITK, India. I am passionate about Computer architecture and working on low level stuff. I recently found out about coreboot through gsoc. I am very much interested in contributing towards this repository.
Related to coreboot, I have a decent knowledge of c and just started playing with x86_64 assembly a month ago. So I recently started off by reading a bit of docs available on coreboot's website and tried out building an image file for i386 and testing it using QEMU. Which I was successfully able to do.
Welcome and awesome!
Then I started exploring other parts of the docs and later tried understanding the code base but had a hard time understanding it so I am currently trying to understand specific tools used like kconfig and about makefiles from publicly available sources.
If you have any questions, please let us know.
I'm specifically interested in the project "Provide toolchain binaries", But I wasn't able to understand what exactly is to be done in the project. As far from the written text, I understood that we need to provide package installers for the compiler so that for example coreboot could be installed from AUR helpers if an arch aur version was made.
Correct. Did you also see this document [1]?
But then there's written about crossgcc, that we need something to replace it for individual architecture like x86_64 if i'm not wrong. If anyone could help me clarify about the project and could redirect me towards a few resources where I could gain enough knowledge to be able to work on coreboot and this project, it would be really helpful.
In order to build coreboot you need to build the toolchain for the specific target architecture. This is not the architecture of your host you are building on, but the architecture of the device you want to run coreboot on. The command "make help" gives you an overview which target architectures are supported.
The project is about packaging the toolchain for different distros, like Arch, Debian/Ubuntu, openSUSE. Maybe even some *BSD (OpenBSD, FreeBSD, ...) systems? :). So you need to get familiar with their packaging system, how to make the package usable,
I packaged the coreboot toolchain for NixOS [2][3]. Maybe it helps and gives an idea of what needs to be done. Though, NixOS works a little different than other distros.
So to get the coreboot version string and git revision appended to the usual version string of the tools, I had to extend the buildgcc script with a new command/parameter allowing to store the coreboot version string in a file and hook it up in the postFetch phase, because there the .git folder still exists. The .git folder is deleted at the end of postFetch phase making the build reproducible.
After the postFetch phase, the internet connection is cut off, so that no program can download any more things. This is another requirement for reproducible builds.
So it's needed to prepare the environment first, which is done in the postPatch phase. This phase hooks up stable.nix [4], which is just a collection of the sources needed for the stable build of the toolchain. The postPatch phase creates symlinks from their location to the place where buildgcc expects the files.
Even it is hooked up after postFetch, the Nix evaluator is aware of that and it will download all remote available ressources at the beginning so that they are available later. I use a script [5] to update the ressources in stable.nix when a new coreboot release is out.
In buildPhase I just read the coreboot version and run the command to build the toolchain. I use the variable `DEST` so that the result is moved to the final package folder later.
In my case, "common" is a function taking the argument "arch". So at the bottom of default.nix, you can see that I iterate over different target architectures and build the toolchain for them using the common function. The result are different packages using the scheme coreboot- toolchain.<architecture>, as you can see in the package search [2].
I hope that helps and that it isn't too confusing :)
// Felix
[1] https://docs.google.com/document/d/1LU8CTITfqhJU_G_XHwvSkHAQQWed0_FLWPPoBfcp... [2] https://search.nixos.org/packages?channel=unstable&from=0&size=50&am... [3] https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/tools/... [4] https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/tools/... [5] https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/tools/...