Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building bootloader with just build color results in error #335

Open
hugoender opened this issue Jun 15, 2023 · 7 comments
Open

Building bootloader with just build color results in error #335

hugoender opened this issue Jun 15, 2023 · 7 comments

Comments

@hugoender
Copy link
Contributor

Tried building the bootloader as per the DEVELOPMENT.md documentation and it results in the following error:

error: Justfile does not contain recipes 'build' or 'color'.

Screenshot from 2023-06-14 22-33-21

@jeandudey
Copy link
Contributor

Sorry, the instruction is a bit outdated, to build the bootloader you need to do:

just build-bootloader color # or mono

Building the mono bootloader is not currently supported, however if you still want to build it in the https://github.com/Foundation-Devices/passport-firmware it can be done.

@hugoender
Copy link
Contributor Author

@jeandudey I tried that and it gave another error:

docker run --rm -v "$PWD":/workspace -u $(id -u):$(id -g) -v $(pwd):/workspace -w /workspace -e MPY_CROSS="/workspace/mpy-cross/mpy-cross-docker" --entrypoint bash ${DOCKER_IMAGE} -c 'export PATH=$PATH:/workspace/ports/stm32/boards/Passport/tools/cosign/x86/release;just ports/stm32/boards/Passport/bootloader/build color'
docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
error: Recipe `run-in-docker` failed on line 86 with exit code 126

Screenshot from 2023-06-15 18-51-05

Based on the error message it seems like it's a permission issue and maybe I have to add my username to some Docker permission? If so, might want to update the documentation to handle this error.

@hugoender
Copy link
Contributor Author

Any help with this would be greatly appreciated. Building firmware and bootloader from source are the two remaining obstacles preventing me from ordering a Passport.

@jeandudey
Copy link
Contributor

Based on the error message it seems like it's a permission issue and maybe I have to add my username to some Docker permission?

Yes, you have to add your user to the docker group in your system, it may vary per system (different distributions use different commands to add users to groups) so it isn't included in the documentation to add the user to the docker group, it also can have security implications for some people.

For example, any user in the docker group can be used to perform privilege escalation:

https://fosterelli.co/privilege-escalation-via-docker.html

An alternative to adding yourself to the docker group would be running the just build-bootloader color as root but that comes with other implications, e.g. just has to be installed system-wide and output files of the compilation will be owned by the root user.

That said, I will look into making it easier to compile with Docker without resorting to adding an user to the docker group.

@hugoender
Copy link
Contributor Author

Thank you for the detailed response. I learned something new. I guess I'll wait for you to make it not require adding user to docker group before I buy a Passport so I can ensure that I can build from source without any security implications.

@jeandudey
Copy link
Contributor

jeandudey commented Jul 14, 2023

The #355 pull request should allow to build the firmware without using Docker, instead Podman can be used and is rootless by default.

This will be available when the 2.3.0 firmware is released.

@jeandudey
Copy link
Contributor

@hugoender closing this one as just build-bootloader color should work now with the 2.3.0 release (also on main branch). If it doesn't work please re-open it and I will look into it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants