Appendix A: Building Nokia community SONiC from the open-source repository

Users can build Nokia community SONiC from the open-source SONiC project, including environment setup and image compilation.

This section describes how to build Nokia community SONiC software using the open-source SONiC repository. The procedures apply to supported Nokia hardware platforms.

After completing the build process, perform an upgrade as needed. See Upgrading the Nokia community SONiC software image for more information.

Building the Nokia community SONiC software image

Build the Nokia community SONiC image from source using the open-source SONiC build framework.

This task describes how to compile a Nokia community SONiC image. It follows the open-source SONiC build process with Nokia-specific board support packages (BSPs) and platform adapters.
Note: The following task provides an example of how to perform a build for a Nokia community SONiC Broadcom-based (x86) platform. Contact your Nokia technical support representative if you require build information for other supported Nokia community SONiC platforms.

The following are required to perform the build:

  • Ubuntu 20.04 build server with docker and python3 installed
  • administrative access and sufficient disk space
  • Internet access to clone community SONiC repositories from GitHub
  1. Install and set up Docker.
    If Docker was installed via snap, first remove it. Then add the Docker repository and install the Docker Engine and related tools.
    # If your Ubuntu 20.04 server already includes an instance of docker installed by snap, the SONIC build may not work. Please uninstall it first 
    
    >> sudo snap remove docker 
    
    # and follow the instructions below to install docker 
    
    >> sudo apt-get update
    >> sudo apt-get install ca-certificates curl 
    >> sudo install -m 0755 -d /etc/apt/keyrings 
    >> sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo tee \ /etc/apt/keyrings/docker.asc > /dev/null 
    >> sudo chmod a+r /etc/apt/keyrings/docker.asc 
    >> echo \
    "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \ https://download.docker.com/linux/ubuntu \
    $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \ 
    | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 
    >> sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin dockercompose-plugin 
    >> sudo gpasswd -a ${USER} docker 
    >> newgrp docker
  2. Use the Python pip utility to install the j2cli template utility used by the community SONiC build systems.
    >> sudo apt install python3-pip
    >> pip install j2cli
    >> export PATH="$HOME/.local/bin:$PATH"
    >> source ~/.bashrc
  3. Clone the community SONiC build repository.
    1. Download the community SONiC build framework.
    2. Switch to the working directory.
      The following example shows cloning a community SONiC 202505 build.
    git clone https://github.com/sonic-net/sonic-buildimage.git -b 202505
    cd sonic-buildimage
  4. Run the following command to initialize the sub-repositories, fetch sub-modules, and prepare the build environment.
    make init
  5. Configure the Broadcom build settings.
    make configure PLATFORM=broadcom
  6. Start the compilation to build the image.
    The build time depends on the server resources and network speed.
    make SONIC_BUILD_JOBS=4 target/sonic-broadcom.bin
    The output directory contains the built image file, for example sonic-broadcom.bin.

You can now use the generated image to upgrade a device. See Upgrading the Nokia community SONiC software image for instructions.