-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
SONIC Multi Architecture Support #632
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
01b9aec
SONIC Multi Arch
antony-rheneus 3489b21
Updated notes
antony-rheneus d453cbf
Updated notes
antony-rheneus d76d9cb
Updated notes
antony-rheneus b93acc7
Updated sonic installer
antony-rheneus 826f9ea
Updated sonic installer
antony-rheneus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
# SONIC ARM Architecture support | ||
|
||
[![Marvell Technologies](https://www.marvell.com/content/dam/marvell/en/rebrand/marvell-logo3.svg)](https://www.marvell.com/) | ||
|
||
# Description | ||
|
||
- This document describes enhancement in SONIC build script to support ARM32 and ARM64 | ||
|
||
Support for ARM architecture needs changes in the following modules | ||
|
||
- sonic-slave | ||
- dockers | ||
- rules | ||
- Makefile | ||
- Buildscript | ||
- Repo list | ||
- Onie Build | ||
|
||
|
||
|
||
### User Input | ||
|
||
Similar to configuring the platform in the Make, architecture should be user driven. | ||
|
||
* [SONIC_ARCH] - make configure PLATFORM=[ASIC_VENDOR] PLATFORM_ARCH=[armhf] | ||
* Default is X86_64 | ||
|
||
### Dockers | ||
Since all the modules and code are compiled inside docker environment, the docker image should be based on multiarch/[distribution]-[arm_arch] | ||
|
||
Below dockers use the debian distribution which will now be based on the CPU Architecture distribution. | ||
```sh | ||
dockers/docker-base | ||
dockers/docker-base-stretch | ||
dockers/docker-ptf | ||
``` | ||
|
||
### Developer Notes | ||
Following are the variables used in make files | ||
PLATFORM_ARCH : specifies the target architecture, if not set amd64 is chosen | ||
CONFIGURED_ARCH : In Makefiles, no where amd64 should be hardcoded, instead $(CONFIGURED_ARCH) has to be used | ||
```sh | ||
Example: in place of amd64 in below target CONFIGURED_ARCH is replaced | ||
LINUX_IMAGE = linux-image-$(KVERSION)_$(KERNEL_VERSION)-$(KERNEL_SUBVERSION)_amd64.deb | ||
LINUX_IMAGE = linux-image-$(KVERSION)_$(KERNEL_VERSION)-$(KERNEL_SUBVERSION)_$(CONFIGURED_ARCH).deb | ||
``` | ||
|
||
|
||
### SONIC Slave Docker | ||
|
||
sonic-slave docker provides build environment for the rest of the dockers, it should be able to run the different architecture on the host cpu architecture. | ||
|
||
To do such cross compilation, we can make use of binfmt-misc to run target arch binary using qemu-static binary to run on the host cpu architecture. | ||
|
||
```sh | ||
sonic-slave-arm64 | ||
sonic-slave-armhf | ||
``` | ||
|
||
qemu static binaries need to be installed and docker for multiarch/qemu-user-static:register is enabled to run. | ||
|
||
### Miscellaneous | ||
|
||
Architecture specific packages need to installed or ignored. | ||
Like ixgbe and grub are specific to X86 architecture, which need to be excluded. | ||
|
||
|
||
### Platform | ||
|
||
Same platform or board can have variants in CPU vendor. To address this, platform can be made ARCH specific, and customized changes can be added in this platform specific make infra. | ||
|
||
```sh | ||
platform/marvell-armhf/docker-syncd-mrvl-rpc.mk | ||
platform/marvell-armhf/docker-syncd-mrvl-rpc/99-syncd.conf | ||
platform/marvell-armhf/docker-syncd-mrvl-rpc/Dockerfile.j2 | ||
platform/marvell-armhf/docker-syncd-mrvl-rpc/ptf_nn_agent.conf | ||
platform/marvell-armhf/docker-syncd-mrvl.mk | ||
platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 | ||
platform/marvell-armhf/docker-syncd-mrvl/start.sh | ||
platform/marvell-armhf/docker-syncd-mrvl/supervisord.conf | ||
platform/marvell-armhf/docker-syncd-mrvl/syncd.sh | ||
platform/marvell-armhf/libsaithrift-dev.mk | ||
platform/marvell-armhf/linux-kernel-armhf.mk | ||
platform/marvell-armhf/one-image.mk | ||
platform/marvell-armhf/platform.conf | ||
platform/marvell-armhf/rules.mk | ||
platform/marvell-armhf/sai.mk | ||
platform/marvell-armhf/sai/Makefile | ||
``` | ||
|
||
#### Rule/makefile | ||
|
||
Hardcoded "amd64" need to be replaced with Makefile variable which hold the target architecture. | ||
* amd64 | ||
* armhf | ||
* arm64 | ||
|
||
```sh | ||
rules/bash.mk | ||
rules/docker-base-stretch.mk | ||
rules/docker-base.mk | ||
rules/docker-ptf.mk | ||
rules/docker-snmp-sv2.mk | ||
rules/frr.mk | ||
rules/gobgp.mk | ||
rules/hiredis.mk | ||
rules/iproute2.mk | ||
rules/isc-dhcp.mk | ||
rules/libnl3.mk | ||
rules/libteam.mk | ||
rules/libyang.mk | ||
rules/linux-kernel.mk | ||
rules/lldpd.mk | ||
rules/lm-sensors.mk | ||
rules/mpdecimal.mk | ||
rules/python3.mk | ||
rules/quagga.mk | ||
rules/radvd.mk | ||
rules/redis.mk | ||
rules/sairedis.mk | ||
rules/smartmontools.mk | ||
rules/snmpd.mk | ||
rules/socat.mk | ||
rules/swig.mk | ||
rules/swss-common.mk | ||
rules/swss.mk | ||
rules/tacacs.mk | ||
rules/telemetry.mk | ||
rules/thrift.mk | ||
slave.mk | ||
src/bash/Makefile | ||
src/hiredis/Makefile | ||
src/iproute2/Makefile | ||
src/isc-dhcp/Makefile | ||
src/libnl3/Makefile | ||
src/libteam/Makefile | ||
src/lm-sensors/Makefile | ||
src/mpdecimal/Makefile | ||
src/python3/Makefile | ||
src/radvd/Makefile | ||
src/redis/Makefile | ||
src/smartmontools/Makefile | ||
src/snmpd/Makefile | ||
src/socat/Makefile | ||
src/tacacs/nss/Makefile | ||
src/tacacs/pam/Makefile | ||
src/thrift/Makefile | ||
|
||
``` | ||
|
||
### Repo list | ||
Below repo sources list need to updated as the azure debian repo doesn't have arm packages | ||
|
||
|
||
```sh | ||
files/apt/sources.list-armhf | ||
files/build_templates/sonic_debian_extension.j2 | ||
|
||
``` | ||
|
||
#### Onie Image | ||
|
||
Onie image configuration and build script should be updated for the uboot specific environment for ARM. | ||
|
||
### Kernel ARM support | ||
|
||
Submodule sonic-linux-kernel Makefile and patch need to be updated to compile for respective ARM architecture. As kernel .config will be generated using debian build infra, dpkg env variables need to properly updated to select the architecture. | ||
|
||
- src/sonic-linux-kernel | ||
|
||
### Custom Kernel (Expert Mode) | ||
|
||
Based on architecture the linux kernel may vary and need to be changed to custom kernel rather that the SONIC default kernel version. | ||
This can be addressed in platform specific makefiles. | ||
|
||
- platform/marvell-armhf/linux-kernel-armhf.mk | ||
|
||
|
||
### Usage for ARM Architecture | ||
To build Arm32 bit for (ARMHF) plaform | ||
|
||
# Execute make configure once to configure ASIC and ARCH | ||
make configure PLATFORM=[ASIC_VENDOR] SONIC_ARCH=armhf | ||
**example**: | ||
make configure PLATFORM=marvell-armhf SONIC_ARCH=armhf | ||
|
||
To build Arm64 bit for plaform | ||
|
||
# Execute make configure once to configure ASIC and ARCH | ||
make configure PLATFORM=[ASIC_VENDOR] SONIC_ARCH=arm64 | ||
**example**: | ||
make configure PLATFORM=marvell-arm64 SONIC_ARCH=arm64 | ||
|
||
---- | ||
Author | ||
====== | ||
Antony Rheneus [[email protected]] | ||
Copyright Marvell Technologies | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the update. can we get more details on this one? how sonic installer works on arm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done