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

Support to build armhf/arm64 platforms on arm based system #7731

Merged
merged 1 commit into from
Aug 12, 2021

Conversation

xumia
Copy link
Collaborator

@xumia xumia commented May 27, 2021

Why I did it

Support to build armhf/arm64 platforms on arm based system without qemu simulator.
When building the armhf/arm64 on arm based system, it is not necessary to use qemu simulator.

How I did it

Build armhf on armhf system, or build arm64 on arm64 system, by default, qemu simulator will not be used.
When building armhf on arm64, and you have enabled armhf docker, then it will build images without simulator automatically. It is based how the docker service is run.

Docker base image change:
For amd64, change from debian:to amd64/debian:
For arm64, change from multiarch/debian-debootstrap:arm64- to arm64v8/debian:
For armhf, change from multiarch/debian-debootstrap:armhf- to arm32v7/debian:
See https://github.com/docker-library/official-images#architectures-other-than-amd64
The mapping relations:
arm32v6 --- armel
arm32v7 --- armhf
arm64v8 --- arm64

Docker image armhf deprecated info: https://hub.docker.com/r/armhf/debian, using arm32v7 instead.

How to verify it

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

Description for the changelog

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

@xumia xumia added the Build label May 27, 2021
@xumia xumia requested review from lguohan and qiluo-msft as code owners May 27, 2021 10:35
@xumia xumia marked this pull request as draft May 27, 2021 15:35
Makefile.work Outdated
COMPILE_HOST_ARCH := armhf
else
COMPILE_HOST_ARCH := amd64
endif

COMPILE_HOST_ARCHS := $(COMPILE_HOST_ARCH) $(HOST_ARCHS)
Copy link
Collaborator

@qiluo-msft qiluo-msft May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HOST_ARCHS

COMPILE_HOST_ARCHS := $(COMPILE_HOST_ARCH) $(HOST_ARCHS)


not defined? #Closed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I search the repo and could not found HOST_ARCHS

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is not defined, normally, we are not necessary to define it, the default value is empty.
If we want to support build armhf on arm64, we can set HOST_ARCHS=armhf, it means that the architecture armhf is supported on arm64, although it does not match with "uname -m".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this paragraph is good code comment, could you add it? Otherwise user could not easily figure out this hidden feature.

Makefile.work Outdated Show resolved Hide resolved
Makefile.work Outdated
@@ -111,18 +113,13 @@ ifeq ($(ENABLE_DOCKER_BASE_PULL),)
override ENABLE_DOCKER_BASE_PULL = n
endif

ifeq ($(CONFIGURED_ARCH),amd64)
ifneq (,$(filter $(CONFIGURED_ARCH),amd64 $(COMPILE_HOST_ARCHS)))
Copy link
Collaborator

@qiluo-msft qiluo-msft May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some comment for complex condition check? #Closed

@@ -1,6 +1,6 @@
{% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %}
Copy link
Collaborator

@qiluo-msft qiluo-msft May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MULTIARCH_QEMU_ENVIRON

If removed, do we remove support on any platform? #Closed

Copy link
Collaborator Author

@xumia xumia May 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For armhf, we can always use multiarch/debian-debootstrap:armhf-jessie, it should not be relative to MULTIARCH_QEMU_ENVIRON yes or not.

Maybe we can simply use multiarch/debian-debootstrap:{% CONFIGURED_ARCH %}-jessie

Example:
docker run -it --rm multiarch/debian-debootstrap:amd64-buster uname -m
x86_64

@lguohan
Copy link
Collaborator

lguohan commented Aug 3, 2021

what about building arm64 on armhf? that is probably not supported, correct?

lguohan
lguohan previously approved these changes Aug 3, 2021
@xumia
Copy link
Collaborator Author

xumia commented Aug 11, 2021

what about building arm64 on armhf? that is probably not supported, correct?

It is not supported, it needs to use only qemu vm to support.

@xumia
Copy link
Collaborator Author

xumia commented Aug 11, 2021

@qiluo-msft , I do an improvement to detect the docker environment in the build time to decide whether the qemu simulator needed. When the docker arch of the build environment is the same as the build target, then no simulator required.

@xumia xumia marked this pull request as ready for review August 11, 2021 07:52
@xumia xumia merged commit a4405f0 into sonic-net:master Aug 12, 2021
@xumia xumia deleted the arm-on-arm branch August 12, 2021 14:24
xumia added a commit to xumia/sonic-buildimage-1 that referenced this pull request Aug 13, 2021
…#7731)

Why I did it
Support to build armhf/arm64 platforms on arm based system without qemu simulator.
When building the armhf/arm64 on arm based system, it is not necessary to use qemu simulator.

How I did it
Build armhf on armhf system, or build arm64 on arm64 system, by default, qemu simulator will not be used.
When building armhf on arm64, and you have enabled armhf docker, then it will build images without simulator automatically. It is based how the docker service is run.

Docker base image change:
For amd64, change from debian:to amd64/debian:
For arm64, change from multiarch/debian-debootstrap:arm64- to arm64v8/debian:
For armhf, change from multiarch/debian-debootstrap:armhf- to arm32v7/debian:
See https://github.com/docker-library/official-images#architectures-other-than-amd64
The mapping relations:
arm32v6 --- armel
arm32v7 --- armhf
arm64v8 --- arm64

Docker image armhf deprecated info: https://hub.docker.com/r/armhf/debian, using arm32v7 instead.
xumia added a commit to xumia/sonic-buildimage-1 that referenced this pull request Aug 13, 2021
…#7731)

Why I did it
Support to build armhf/arm64 platforms on arm based system without qemu simulator.
When building the armhf/arm64 on arm based system, it is not necessary to use qemu simulator.

How I did it
Build armhf on armhf system, or build arm64 on arm64 system, by default, qemu simulator will not be used.
When building armhf on arm64, and you have enabled armhf docker, then it will build images without simulator automatically. It is based how the docker service is run.

Docker base image change:
For amd64, change from debian:to amd64/debian:
For arm64, change from multiarch/debian-debootstrap:arm64- to arm64v8/debian:
For armhf, change from multiarch/debian-debootstrap:armhf- to arm32v7/debian:
See https://github.com/docker-library/official-images#architectures-other-than-amd64
The mapping relations:
arm32v6 --- armel
arm32v7 --- armhf
arm64v8 --- arm64

Docker image armhf deprecated info: https://hub.docker.com/r/armhf/debian, using arm32v7 instead.
xumia added a commit that referenced this pull request Aug 13, 2021
…8458)

Why I did it
Support to build armhf/arm64 platforms on arm based system without qemu simulator.
When building the armhf/arm64 on arm based system, it is not necessary to use qemu simulator.

How I did it
Build armhf on armhf system, or build arm64 on arm64 system, by default, qemu simulator will not be used.
When building armhf on arm64, and you have enabled armhf docker, then it will build images without simulator automatically. It is based how the docker service is run.

Docker base image change:
For amd64, change from debian:to amd64/debian:
For arm64, change from multiarch/debian-debootstrap:arm64- to arm64v8/debian:
For armhf, change from multiarch/debian-debootstrap:armhf- to arm32v7/debian:
See https://github.com/docker-library/official-images#architectures-other-than-amd64
The mapping relations:
arm32v6 --- armel
arm32v7 --- armhf
arm64v8 --- arm64

Docker image armhf deprecated info: https://hub.docker.com/r/armhf/debian, using arm32v7 instead.
xumia added a commit to xumia/sonic-buildimage-1 that referenced this pull request Apr 14, 2022
…#7731)

Why I did it
Support to build armhf/arm64 platforms on arm based system without qemu simulator.
When building the armhf/arm64 on arm based system, it is not necessary to use qemu simulator.

How I did it
Build armhf on armhf system, or build arm64 on arm64 system, by default, qemu simulator will not be used.
When building armhf on arm64, and you have enabled armhf docker, then it will build images without simulator automatically. It is based how the docker service is run.

Docker base image change:
For amd64, change from debian:to amd64/debian:
For arm64, change from multiarch/debian-debootstrap:arm64- to arm64v8/debian:
For armhf, change from multiarch/debian-debootstrap:armhf- to arm32v7/debian:
See https://github.com/docker-library/official-images#architectures-other-than-amd64
The mapping relations:
arm32v6 --- armel
arm32v7 --- armhf
arm64v8 --- arm64

Docker image armhf deprecated info: https://hub.docker.com/r/armhf/debian, using arm32v7 instead.
xumia added a commit that referenced this pull request Apr 15, 2022
…10577)

Why I did it
Support to build armhf/arm64 platforms on arm based system without qemu simulator.
When building the armhf/arm64 on arm based system, it is not necessary to use qemu simulator.

How I did it
Build armhf on armhf system, or build arm64 on arm64 system, by default, qemu simulator will not be used.
When building armhf on arm64, and you have enabled armhf docker, then it will build images without simulator automatically. It is based how the docker service is run.

Docker base image change:
For amd64, change from debian:to amd64/debian:
For arm64, change from multiarch/debian-debootstrap:arm64- to arm64v8/debian:
For armhf, change from multiarch/debian-debootstrap:armhf- to arm32v7/debian:
See https://github.com/docker-library/official-images#architectures-other-than-amd64
The mapping relations:
arm32v6 --- armel
arm32v7 --- armhf
arm64v8 --- arm64

Docker image armhf deprecated info: https://hub.docker.com/r/armhf/debian, using arm32v7 instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants