Skip to content

Commit

Permalink
[build]: build ARM kernel support from sonic-linux-kernel (sonic-net#…
Browse files Browse the repository at this point in the history
…3556)

* Makefile: ARM kernel support from sonic-linux-kernel
        * Fix for multiarch  build docker spawn
Platform: Install the DTB deb for the platform

Signed-off-by: Antony Rheneus <[email protected]>
  • Loading branch information
antony-rheneus authored and lguohan committed Oct 10, 2019
1 parent 150ed36 commit 2694e66
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
4 changes: 3 additions & 1 deletion Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ ifneq (,$(filter $(CONFIGURED_ARCH), armhf arm64))

DOCKER_MULTIARCH_CHECK := docker inspect --type image multiarch/qemu-user-static:register &> /dev/null || (echo "multiarch docker not found ..."; docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes)

DOCKER_SERVICE_MULTIARCH_CHECK := docker -H unix:///var/run/march/docker.sock info &> /dev/null || (echo "Docker march service not running..."; sudo rm -fr /var/run/march/*; (sudo $(SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH) &) &>/dev/null ; sleep 1; sudo $(SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH);)
DOCKER_SERVICE_MULTIARCH_CHECK := docker -H unix:///var/run/march/docker.sock info &> /dev/null || (echo "Docker march service not running..."; sudo rm -fr /var/run/march/; (sudo $(SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH) &) &>/dev/null ; sleep 1; sudo $(SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH);)

# Docker service to load the compiled dockers-*.gz
SONIC_NATIVE_DOCKERD_FOR_DOCKERFS := rm -fr $(PWD)/dockerfs/; mkdir -p $(PWD)/dockerfs/; sudo dockerd --storage-driver=overlay2 --iptables=false \
Expand Down Expand Up @@ -184,8 +184,10 @@ SONIC_BUILD_INSTRUCTION := make \
%::
ifneq (,$(filter $(CONFIGURED_ARCH), armhf arm64))
@$(DOCKER_MULTIARCH_CHECK)
ifneq ($(BLDENV), )
@$(DOCKER_SERVICE_MULTIARCH_CHECK)
@$(DOCKER_SERVICE_DOCKERFS_CHECK)
endif
endif
@$(OVERLAY_MODULE_CHECK)

Expand Down
7 changes: 1 addition & 6 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,11 @@ fi
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install busybox
echo '[INFO] Install SONiC linux kernel image'
## Note: duplicate apt-get command to ensure every line return zero
if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install cpio klibc-utils kmod libklibc udev linux-base
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/linux-image-*${CONFIGURED_ARCH}*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
fi
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/initramfs-tools-core_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/initramfs-tools_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/linux-image-${LINUX_KERNEL_VERSION}-${CONFIGURED_ARCH}_*.deb || \
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/linux-image-${LINUX_KERNEL_VERSION}-*_${CONFIGURED_ARCH}.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install acl
[[ $CONFIGURED_ARCH == amd64 ]] && sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install dmidecode
Expand Down
13 changes: 5 additions & 8 deletions platform/marvell-armhf/linux-kernel-armhf.mk
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# linux kernel package for marvell armhf

KVERSION = 4.9.168


LINUX_KERNEL = linux-image-4.9.168-armhf.deb
export LINUX_KERNEL

$(LINUX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/linux
SONIC_MAKE_DEBS += $(LINUX_KERNEL)
# Add platform specific DTB
LINUX_KERNEL_DTB = linux-image-4.9.168-armhf.deb
$(LINUX_KERNEL_DTB)_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/armhf/kernel/$(LINUX_KERNEL_DTB)
SONIC_ONLINE_DEBS += $(LINUX_KERNEL_DTB)
SONIC_STRETCH_DEBS += $(LINUX_KERNEL_DTB)
6 changes: 3 additions & 3 deletions platform/marvell-armhf/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
SHELL = /bin/bash
.SHELLFLAGS += -e

LINUX_KERNEL_MRVL_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/armhf/kernel/$(LINUX_KERNEL)
LINUX_KERNEL_MRVL_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/armhf/kernel/$(LINUX_KERNEL_DTB)

$(addprefix $(DEST)/, $(LINUX_KERNEL)): $(DEST)/% :
$(addprefix $(DEST)/, $(LINUX_KERNEL_DTB)): $(DEST)/% :
# get deb package
wget -O $(DEST)/$(LINUX_KERNEL) $(LINUX_KERNEL_MRVL_URL)
wget -O $(DEST)/$(LINUX_KERNEL_DTB) $(LINUX_KERNEL_MRVL_URL)

2 changes: 1 addition & 1 deletion platform/marvell-armhf/platform.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ echo "Preparing for installation ... "
kernel_addr=0x1100000
fdt_addr=0x1000000

image_name="/boot/zImage"
image_name="/vmlinuz"
fdt_name="/boot/armada-385-ET6448M_4G_Nand.dtb"

# global mount defines
Expand Down
4 changes: 4 additions & 0 deletions rules/linux-kernel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ KVERSION_SHORT = 4.9.0-9-2
KVERSION = $(KVERSION_SHORT)-$(CONFIGURED_ARCH)
KERNEL_VERSION = 4.9.168
KERNEL_SUBVERSION = 1+deb9u5
ifeq ($(CONFIGURED_ARCH), armhf)
# Override kernel version for ARMHF as it uses arm MP (multi-platform) for short version
KVERSION = $(KVERSION_SHORT)-armmp
endif

export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION

Expand Down
3 changes: 3 additions & 0 deletions sonic-slave-stretch/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ RUN apt-get update && apt-get install -y \
# For broadcom sdk build
{%- if CONFIGURED_ARCH == "amd64" %}
linux-compiler-gcc-6-x86 \
{%- endif %}
{%- if CONFIGURED_ARCH == "armhf" %}
linux-compiler-gcc-6-arm \
{%- endif %}
linux-kbuild-4.9 \
# teamd build
Expand Down

0 comments on commit 2694e66

Please sign in to comment.