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

Add support for loongarch64 #3969

Merged
merged 1 commit into from
Jan 9, 2024
Merged

Add support for loongarch64 #3969

merged 1 commit into from
Jan 9, 2024

Conversation

yzewei
Copy link
Contributor

@yzewei yzewei commented Jan 8, 2024

- What I did
Add binfmt support for loongarch64 architecture.
- How I did it
Update pkg/binfmt/Dockerfile and pkg/binfmt/etc/binfmt.d/00_linuxkit.conf
Add QEMU masks and magics to loongarch
- How to verify it
docker buildx build --load -t linuxkit/binfmt:addloongarch64 -f Dockerfile .
docker run --rm --privileged -it linuxkit/binfmt:addloongarch64
docker run --rm -it yangzewei2023/debian:sid uname -a
Linux 2a333d9eb0ea 6.1.0-11-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-4 (2023-08-08) loongarch64 GNU/Linux
- Description for the changelog

Add support for cross-building loongarch64 images

- A picture of a cute animal (not mandatory but encouraged)
image

@deitch
Copy link
Collaborator

deitch commented Jan 8, 2024

I am not sure I understand the purpose. I understand adding loongarch64 support to binfmt. But linuxkit/binfmt is used almost exclusively inside linuxkit images, i.e. to be able to run other commands inside a linuxkit image running somewhere (virtual, cloud, metal, etc.). Nothing stops you from using them elsewhere, but that is the primary purpose. Is that what you are after?

If so, you need to update all of the dependencies so that CI will pick it up. From within the root, run:

./scripts/update-component-sha.sh --pkg pkg/binfmt

That will update all of the tests and examples and everything else that use linuxkit/binfmt, and so ensure that CI catches it.

Signed-off-by: yzewei <yangzewei@loongson.cn>
@yzewei
Copy link
Contributor Author

yzewei commented Jan 9, 2024

I am not sure I understand the purpose. I understand adding loongarch64 support to binfmt. But linuxkit/binfmt is used almost exclusively inside linuxkit images, i.e. to be able to run other commands inside a linuxkit image running somewhere (virtual, cloud, metal, etc.). Nothing stops you from using them elsewhere, but that is the primary purpose. Is that what you are after?

If so, you need to update all of the dependencies so that CI will pick it up. From within the root, run:

./scripts/update-component-sha.sh --pkg pkg/binfmt

That will update all of the tests and examples and everything else that use linuxkit/binfmt, and so ensure that CI catches it.

Thank you, adding loongarch64 support allows users to build loongarch64 in other architectures. Since the mainstream architecture is mainly amd64 at this stage, I think this is necessary for lovers who want to use the loongarch64 architecture.

@deitch
Copy link
Collaborator

deitch commented Jan 9, 2024

Thank you, adding loongarch64 support allows users to build loongarch64 in other architectures. Since the mainstream architecture is mainly amd64 at this stage, I think this is necessary for lovers who want to use the loongarch64 architecture

That is what I am trying to understand. The mainstream architecture is equally amd64 and arm64 (we used to have s390x support, but it was not being used by anyone seriously, and getting a build server was difficult, so we dropped it).

It depends what you mean by "allows users to build loongarch64 in other architectures".

  • If you mean, "I want to run a linuxkit-composed OS image, and then run loongarch64 process (or containers) on it", then, yes, what you did should do it.
  • If you mean, "I want to build linuxkit-composed OS images for loongarch64", then this part is just a drop in the bucket. You would need to extend all images, update some parts of the linuxkit binary, update build pipelines, create kernels, and a whole bunch I am missing.

Which are you after?

@yzewei
Copy link
Contributor Author

yzewei commented Jan 9, 2024

Thank you, adding loongarch64 support allows users to build loongarch64 in other architectures. Since the mainstream architecture is mainly amd64 at this stage, I think this is necessary for lovers who want to use the loongarch64 architecture

That is what I am trying to understand. The mainstream architecture is equally amd64 and arm64 (we used to have s390x support, but it was not being used by anyone seriously, and getting a build server was difficult, so we dropped it).

It depends what you mean by "allows users to build loongarch64 in other architectures".

  • If you mean, "I want to run a linuxkit-composed OS image, and then run loongarch64 process (or containers) on it", then, yes, what you did should do it.
  • If you mean, "I want to build linuxkit-composed OS images for loongarch64", then this part is just a drop in the bucket. You would need to extend all images, update some parts of the linuxkit binary, update build pipelines, create kernels, and a whole bunch I am missing.

Which are you after?

Thank you for your patience. As you said, linuxkit is huge scale. At the current stage, what I want to run a linuxkit-composed OS image, and then run loongarch64 process (or containers) on it.

@deitch
Copy link
Collaborator

deitch commented Jan 9, 2024

In that case, I think this works. Let's run CI and be sure it is clean.

@yzewei
Copy link
Contributor Author

yzewei commented Jan 9, 2024

In that case, I think this works. Let's run CI and be sure it is clean.

There seems to be no problem.

@deitch deitch merged commit 1957c8d into linuxkit:master Jan 9, 2024
22 checks passed
deitch added a commit to deitch/linuxkit that referenced this pull request Jan 24, 2024
Add support for loongarch64

Signed-off-by: Avi Deitcher <avi@deitcher.net>
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

Successfully merging this pull request may close these issues.

None yet

2 participants