The main intention of this repository is to provide build scripts that are easy to handle than Marvell's build environment.
They are used in SolidRun to quickly build images for development where those images can be used to boot from SD card, SPI, eMMC, network TFTP (kernel) or used for root NFS
The sources are pulled from:
- arm-trusted firmware: https://github.com/ARM-software/arm-trusted-firmware.git
- mv-ddr-marvell: https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git
- u-boot: git://git.denx.de/u-boot.git v2019.10
- linux: https://github.com/torvalds/linux.git
- patches are supplied by Solid-Run in the patches/ directory
- binaries are supplied by Solid-Run in the binaries/ directory
The build script builds the u-boot, atf and linux components, integrate it with Ubuntu rootfs bootstrapped with multistrap. Buildroot is also built aside for future use.
- Automated build with run-docker.sh
THe run-docker.sh scripts automates building using docker. To build with the defaults just run it and it will create the docker container if needed and then start the buld.
The script optionally takes a list of actions to perform, passed to ./runme.sh (see below).
The --edit option allows manual editing of the docker image if needed. But is generally better to update the docker image definitin in docker/Dockerfile
The --board=n and --cp=n options sets BOARD_CONFIG and CP_NUM respectively selecting the target board type. See below for their usage. Defaults to BOARD_CONFIG=0 CP_NUM=3
Another board can be specified using --board=n --cp=n
- Build the Docker image (Just once):
docker build --build-arg user=$(whoami) --build-arg userid=$(id -u) -t cn913x_build docker/
To check if the image exists in you machine, you can use the following command:
docker images | grep cn913x_build
- Run the build script:
docker run --rm -i -t -v "$PWD":/cn913x_build_dir -v $HOME/.gitconfig:/etc/gitconfig cn913x_build bash -c "<ARGUMENTS> ./runme.sh"
The git configuration file is mounted, if your gitconfig file is not located in $HOME/.gitconfig, change the command accordingly.
Simply running ./runme.sh will check for required tools, clone and build images and place results in images/ directory.
The build process is divided in multiple steps, each step is detailed in runme.d/stepname.sh
The runme.sh script by default runs all steps needed for building an SD-Card image.
You can otionaly run the scrip with an explicit list of actions to perform.
In addition there is some supporting actions to aid in development
Standard steps in the order they are run:
tools : Ensures that the required host tools are available
sources : Download the required source repositories
ubuntu : Build a generic Ubuntu root filesystem (ext4) based on the minimal ubuntu-base filesystem.
u-boot : Build the u-boot boot loader and arm trusted firmware which loads u-boot
linux-config : Configure the linux kernel with default configuration from config/linux/
linux : Build the linux kernel
musdk : Build Marvell MUSDK
dpdk : Build DPDK
rootfs : Install kernel, MUSDK and DPDK in the root filesyetem
sdcard : Create an bootable SDCARD image
Extra steps for customizing the build
linux-menuconfig : Edit the kernel configuration settings
shell : Start a shell with the toolchain activated
Currently there no support of distro for auto detection of boot device, however it is under development.
The board can be configured based on the amount of CP# devices and to which carrier board it will fit. There are a few parameters that must be taken to account:
- CP_NUM: 1 - CN9130 2 - CN9131 3 - CN9132
- BOARD_CONFIG - defines the device tree based on the platform 0 - CN9132 CEx7 based on Clearfog Eval Board 1 - CN9130 SOM based on Clearfog Base 2 - CN9130 SOM based on Clearfog Pro
-
For CN9130 SOM base on Clearfog Base, run:
BOARD_CONFIG=1 CP_NUM=1 ./runme
generates images/cn9130-cf-base_config_1_ubuntu.img -
For CN9132 CEx7 base on Clearfog EVAL board, run:
BOARD_CONFIG=0 CP_NUM=3 ./runme
generates images/cn9132-cex7_config_0_ubuntu.img
The atf dram_port.c supports both CN9132 CEx7 SO-DIMM with SPD and CN9130 SOM with DDRs soldered on board which might have various configurations and are set according to boot straps MPPs[11:10]. In order to differentiate, it checks the first 196 Bytes of the EEPROM. If programming data on the EEPROM (address 0x53) is requiered, and is not related to the DDR configuration, it must be after the first 196 Bytes. Otherwise, the boot sequence will be corrupted.
For SD card bootable images:
Plug in a uSD into your machine and run the following, where sdX is the location of the SD card got probed into your machine -
sudo dd if=images/<image_name>.img of=/dev/sdX
In u-boot prompt, write the folloiwng command for loading ubuntu:
get_images=load mmc 1:1 $kernel_addr_r boot/Image; load mmc 1:1 $fdt_addr_r boot/<device_tree>.dtb; setenv root 'root=/dev/mmcblk1p1' rw; boot
To active the FAN on CEx7 platform, add to the command: 'mw 0xf2440144 0xffefffff; mw 0xf2440140 0x00100000;`
For burning u-boot image only on uSD card:
sudo dd if=images/flash-image.bin of=/dev/sdX bs=512 seek=4096
For SPI boot:
Burn the flash-image.bin onto a uSD to the system memory and flash it using the sf probe
and sf update
commands.
An example below loads the image through TFTP prototocl, flashes and then verifies the image -
sf probe; setenv ipaddr 192.168.15.223; setenv serverip 192.168.15.3; tftp 0xa0000000 cn9132-cex7_config_0_ubuntu.img ;sf update 0xa0000000 0 $filesize; sf read 0xa4000000 0 $filesize; cmp 0xa0000000 0xa4000000 $filesize
and then set boot DIP switch SW2 on COM to off/on/on/off/on from numbers 1 to 5 (notice the marking 'ON' on the DIP switch)
For eMMC boot:
Copy the image located at images/cn9132-cex7_config_0_ubuntu.img onto a SD card or a USB drive.
After booting the device from SD card, burn the image onto the eMMC:
mount /dev/mmcblk1p1 /mnt
sudo dd if=/mnt/cn9132-cex7_config_0_ubuntu.img of=/dev/mmcblk0 bs=512 seek=1
Then set the boot DIP switch and reset the system.
get_images=load mmc 0:1 $kernel_addr_r boot/Image; load mmc 0:1 $fdt_addr_r boot/cn9132-cex7.dtb; setenv root 'root=/dev/mmcblk0p1' rw; boot
Afterwards run update the RTC and update the repository -
dhclient -i eth2; ntpdate pool.ntp.org; apt update
DPDK has been tested only on ClearFog-Base CN9130 based product.
Please notice that the support is for ethernet ports that are directly connected to the SoC (i.e. no L2 DSA switch support).
The default DPDK version is v22.07, and the supported versions are v22.07 and v20.11.
Technically, any DPDK version can be used, but the DPDK patches should be ported to the wanted version.
Usually the porting is quite easy and takes a few minutes.
The closes supported version should be used as reference (usually, the only differences are the location of the changed lines).
The runme script will clone the version specified by the DPDK_RELEASE argument (or the default one), and will look for patches in patches/dpdk-{version} directory, so this directory should be created and the patches should be placed there.
Please note that dpdk compilation is highly dependent on the build environment, Docker is greatly recommended.
Please note that once DPDK is cloned, it won't be cloned again, even if the DPDK_RELEASE argument is different. Please delete the build/dpdk directory in order to invoke a new clone.
Allocate hugepages for DPDK, for example:
mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
echo 512 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
Insert MUSDK kernel modules
insmod /root/musdk_modules/mv_pp_uio.ko
insmod /root/musdk_modules/musdk_cma.ko
Run test-pmd In order to use all three interfaces, the next command can be used:
dpdk-testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth1,iface=eth2 -- --txd=1024 --txpkts=1500 --tx-first --auto-start --forward-mode=txonly --nb-cores=1 --stats-period=1
The output image will have the following DPDK applications:
- dpdk-testpmd
- dpdk-l2fwd
- dpdk-l3fwd
More applications can be copied from build/dpdk/build/examples
or build/dpdk/build/app
VPP is supported for all native interfaces of CN9130, CN9131, CN9132. However interfaces connected to managed ethernet switches (e.g. Clearfog Pro) are not supported.
Please see vpp.md for details.