Skip to content

Commit fe524c3

Browse files
[platform][marvell] Arm 32-bit Arch support changes (#5749)
- Added Arm 32-bit arch build fixes - Added marvell armhf platform specific changes Signed-off-by: Sabareesh Kumar Anandan <sanandan@marvell.com>
1 parent 356522b commit fe524c3

10 files changed

Lines changed: 189 additions & 33 deletions

File tree

dockers/docker-orchagent/Dockerfile.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ RUN apt-get update && \
2727
{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
2828
# Fix for gcc/python not found in arm docker
2929
RUN apt-get install -f -y python2.7 python2.7-dev
30-
RUN apt-get install -y gcc-6
30+
RUN apt-get install -y gcc-8
3131
{% endif %}
3232
{% if CONFIGURED_ARCH == "armhf" %}
33-
RUN ln -s -f /usr/bin/gcc-6 /usr/bin/arm-linux-gnueabihf-gcc
33+
RUN ln -s -f /usr/bin/gcc-8 /usr/bin/arm-linux-gnueabihf-gcc
3434
{% endif %}
3535
{% if CONFIGURED_ARCH == "arm64" %}
36-
RUN ln -s -f /usr/bin/gcc-6 /usr/bin/aarch64-linux-gnu-gcc
36+
RUN ln -s -f /usr/bin/gcc-8 /usr/bin/aarch64-linux-gnu-gcc
3737
{% endif %}
3838

3939
RUN pip2 install \
@@ -46,7 +46,7 @@ RUN pip2 install \
4646

4747
{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
4848
# Remove installed gcc
49-
RUN apt-get remove -y gcc-6
49+
RUN apt-get remove -y gcc-8
5050
{% endif %}
5151

5252
{% if docker_orchagent_debs.strip() -%}

files/initramfs-tools/modules.arm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ m25p80
55
ubi
66
ubifs
77
squashfs
8+
marvell_nand
9+
i2c_mv64xxx
10+
ar7part
11+
ofpart
12+
mtdswap
13+
mtd_blkdevs
14+
adt7475

files/initramfs-tools/union-mount.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ case "${ROOT}" in
109109
ubi*)
110110
mtd=$(cat /proc/cmdline | sed -e 's/.*ubi.mtd=\([0-9]\) .*/\1/')
111111
if [ ! -f /dev/${ROOT}_0 ]; then
112-
ubiattach /dev/ubi_ctrl -m $mtd || true
112+
ubiattach /dev/ubi_ctrl -m $mtd 2>dev/null || true
113113
fi
114114
mount -t ubifs /dev/${ROOT}_0 ${rootmnt}/host
115115
;;

platform/marvell-armhf/platform.conf

Lines changed: 114 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,60 @@ fdt_addr=0x1000000
1010
initrd_addr=0x2000000
1111
VAR_LOG=512
1212

13-
kernel_fname="/boot/vmlinuz-4.9.0-9-2-armmp"
14-
initrd_fname="/boot/initrd.img-4.9.0-9-2-armmp"
13+
kernel_fname="/boot/vmlinuz-4.19.0-9-2-armmp"
14+
initrd_fname="/boot/initrd.img-4.19.0-9-2-armmp"
1515
fdt_fname="/boot/armada-385-ET6448M_4G_Nand.dtb"
1616

17+
if [ "$install_env" = "onie" ]; then
18+
MACH_FILE="/etc/machine.conf"
19+
else
20+
MACH_FILE="/host/machine.conf"
21+
fi
22+
# armhf-marvell_et6448m_52x-r0 - Platform = Et6448M
23+
# armhf-nokia_ixs7215_52x-r0 - Platform = Nokia IPD6448M
24+
PLATFORM=`sed -n 's/^onie_platform=\(.*\)/\1/p' $MACH_FILE`
25+
echo "Intalling SONiC from $install_env on Platform $PLATFORM"
26+
1727
# global mount defines
18-
demo_dev=ubi0
19-
mtd_dev=/dev/$(cat /proc/mtd | grep "SONIC" | grep -o "mtd[0-9]")
20-
mtd_num=$(echo $mtd_dev | grep -o "[0-9]")
28+
if [ "$PLATFORM" = "armhf-marvell_et6448m_52x-r0" ]; then
29+
demo_dev=ubi0
30+
mtd_dev=/dev/$(cat /proc/mtd | grep "SONIC" | grep -o "mtd[0-9]")
31+
mtd_num=$(echo $mtd_dev | grep -o "[0-9]")
32+
33+
fdt_fname="/boot/armada-385-ET6448M_4G_Nand.dtb"
34+
35+
BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}'
36+
UBI_LOAD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name;ubifsload $fdt_addr $fdt_name; ubifsload $initrd_addr $initrd_name'
37+
BOOTARGS_OLD='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs_old}'
38+
UBI_LOAD_OLD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name_old;ubifsload $fdt_addr $fdt_name_old; ubifsload $initrd_addr $initrd_name_old'
39+
UBIBOOTCMD='run ubi_sonic_boot_bootargs; run ubi_sonic_boot_load; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
40+
UBIBOOTCMD_OLD='run ubi_sonic_boot_bootargs_old; run ubi_sonic_boot_load_old; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
41+
LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
42+
43+
elif [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
44+
demo_dev=sda2
45+
46+
fdt_fname="/boot/armada-385-ipd6448m.dtb"
47+
48+
BOOTARGS='setenv bootargs root=/dev/'$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}'
49+
UBI_LOAD='scsi init; ext4load scsi 0:2 $kernel_addr $image_name; ext4load scsi 0:2 $fdt_addr $fdt_name; ext4load scsi 0:2 $initrd_addr $initrd_name'
50+
BOOTARGS_OLD='setenv bootargs root=/dev/'$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs_old}'
51+
UBI_LOAD_OLD='scsi init; ext4load scsi 0:2 $kernel_addr $image_name_old; ext4load scsi 0:2 $fdt_addr $fdt_name_old; ext4load scsi 0:2 $initrd_addr $initrd_name_old'
52+
UBIBOOTCMD='run ubi_sonic_boot_bootargs; run ubi_sonic_boot_load; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
53+
UBIBOOTCMD_OLD='run ubi_sonic_boot_bootargs_old; run ubi_sonic_boot_load_old; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
54+
LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
55+
56+
else
57+
echo "Unsupported Platform $PLAFORM"
58+
exit 2
59+
fi
2160
demo_mnt=/tmp
2261
FW_ENV_DEFAULT='/dev/mtd0 0x00500000 0x80000 0x100000 8'
2362
UBOOT_FW_DEFAULT=1
2463

25-
# Skip VID Header in UBIFS
26-
BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num',8192 rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}'
27-
UBI_LOAD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name;ubifsload $fdt_addr $fdt_name; ubifsload $initrd_addr $initrd_name'
28-
BOOTARGS_OLD='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num',8192 rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs_old}'
29-
UBI_LOAD_OLD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name_old;ubifsload $fdt_addr $fdt_name_old; ubifsload $initrd_addr $initrd_name_old'
30-
UBIBOOTCMD='run ubi_sonic_boot_bootargs; run ubi_sonic_boot_load; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
31-
UBIBOOTCMD_OLD='run ubi_sonic_boot_bootargs_old; run ubi_sonic_boot_load_old; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
32-
LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
33-
3464
prepare_boot_menu() {
65+
echo "Sync up cache ..."
66+
sync
3567
echo "Setting up U-Boot environment..."
3668

3769
DTB_HAS_ENV_BLK=$(grep uboot-env /proc/mtd | sed -e 's/:.*$//')
@@ -68,6 +100,12 @@ prepare_boot_menu() {
68100
echo $FW_ENV_DEFAULT > /etc/fw_env.config
69101
echo "Using pre-configured uboot env"
70102
fi
103+
if [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
104+
FW_ENV_DEFAULT='/dev/mtd0 0x00100000 0x10000 0x10000'
105+
echo $FW_ENV_DEFAULT > /etc/fw_env.config
106+
echo "Using pre-configured uboot env for armhf-nokia_ixs7215_52x-r0"
107+
fi
108+
71109
image_name=${image_dir}${kernel_fname}
72110
initrd_name=${image_dir}${initrd_fname}
73111
fdt_name=${image_dir}${fdt_fname}
@@ -108,8 +146,8 @@ prepare_boot_menu() {
108146
BORDER='echo "---------------------------------------------------";echo;'
109147
fw_setenv ${FW_ARG} print_menu $BORDER $BOOT1 $BOOT2 $BOOT3 $BORDER > /dev/null
110148

111-
fw_setenv ${FW_ARG} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG" > /dev/null
112-
fw_setenv ${FW_ARG} linuxargs_old "net.ifnames=0 loopfstype=squashfs loop=$image_dir_old/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG" > /dev/null
149+
fw_setenv ${FW_ARG} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG loglevel=4" > /dev/null
150+
fw_setenv ${FW_ARG} linuxargs_old "net.ifnames=0 loopfstype=squashfs loop=$image_dir_old/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG loglevel=4" > /dev/null
113151

114152
# Set boot configs
115153
fw_setenv ${FW_ARG} kernel_addr $kernel_addr > /dev/null
@@ -122,6 +160,9 @@ prepare_boot_menu() {
122160
else
123161
fw_setenv ${FW_ARG} mtdparts 'mtdparts=armada-nand:4m(uboot)ro,5m@5m(uboot-env),20m@10m(ONIE),-(SONIC)' > /dev/null
124162
fi
163+
if [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
164+
fw_setenv ${FW_ARG} mtdparts 'mtdparts=spi0.0:4m(boot),-(spi-rootfs)' > /dev/null
165+
fi
125166
fw_setenv ${FW_ARG} ubi_sonic_boot_mount_ubi 'ubi part SONIC; ubifsmount ubi0' > /dev/null
126167
fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs $BOOTARGS > /dev/null
127168
fw_setenv ${FW_ARG} ubi_sonic_boot_load $UBI_LOAD > /dev/null
@@ -153,9 +194,52 @@ create_ubi_partition() {
153194
ubimkvol /dev/$demo_dev -N $demo_dev -s 3900MiB
154195
}
155196

197+
create_gpt_partition() {
198+
blk_dev="/dev/sda"
199+
demo_part=$(sgdisk -p $blk_dev | grep -e "$demo_volume_label" -e "$legacy_volume_label" | awk '{print $1}')
200+
# ONIE partition size 168MB
201+
onie_part_size=168
202+
203+
if [ -z "$demo_part" ] ; then
204+
# Partition Does NOT Exists
205+
echo "SONIC label [$demo_volume_label] is NOT found in Partition"
206+
echo "Proceeding to create partition"
207+
208+
attr_bitmask="0x0"
209+
210+
sgdisk --new=${demo_part}::+${onie_part_size}MB \
211+
--attributes=${demo_part}:=:$attr_bitmask \
212+
--change-name=${demo_part}:$demo_volume_label $blk_dev \
213+
|| {
214+
echo "Warning: The first trial of creating partition failed, trying the largest aligned available block of sectors on the disk"
215+
begin=$(sgdisk -F $blk_dev)
216+
end=$(sgdisk -E $blk_dev)
217+
sgdisk --new=${demo_part}:$begin:$end \
218+
--attributes=${demo_part}:=:$attr_bitmask \
219+
--change-name=${demo_part}:$demo_volume_label $blk_dev
220+
} || {
221+
echo "Error: Unable to create partition $demo_part on $blk_dev"
222+
exit 1
223+
}
224+
partprobe || true
225+
else
226+
# Partition Exists
227+
echo "Partition exists $demo_part on $blk_dev"
228+
fi
229+
230+
# Make filesystem
231+
mkfs.ext4 -L $demo_volume_label /dev/$demo_dev
232+
}
233+
156234
create_partition() {
157235
# Platform speicific partition
158-
create_ubi_partition
236+
if [ "$PLATFORM" = "armhf-marvell_et6448m_52x-r0" ]; then
237+
echo "Doing UBI partition"
238+
create_ubi_partition
239+
else
240+
echo "Doing GPT partition"
241+
create_gpt_partition
242+
fi
159243
}
160244

161245
mount_partition() {
@@ -166,14 +250,22 @@ mount_partition() {
166250
}
167251

168252
echo "Mounting $demo_dev on $demo_mnt "
169-
trap_push "${onie_bin} umount /dev/ubi0_0|| true"
170-
mount -t ubifs /dev/ubi0_0 $demo_mnt || {
171-
echo "Failed"
172-
}
253+
if [ "$PLATFORM" = "armhf-marvell_et6448m_52x-r0" ]; then
254+
trap_push "${onie_bin} umount /dev/ubi0_0|| true"
255+
mount -t ubifs /dev/ubi0_0 $demo_mnt || {
256+
echo "mount -t ubifs /dev/ubi0_0 $demo_mnt Failed"
257+
exit 1
258+
}
259+
else
260+
trap_push "${onie_bin} umount /dev/sda2|| true"
261+
mount -t ext4 /dev/sda2 $demo_mnt || {
262+
echo "mount -t ext4 /dev/sda2 $demo_mnt Failed"
263+
exit 1
264+
}
265+
fi
173266
}
174267

175268
bootloader_menu_config() {
176269
# Update uboot Environment
177270
prepare_boot_menu
178271
}
179-

platform/marvell-armhf/sai.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Marvell SAI
22

3-
export MRVL_SAI_VERSION = 1.5.1
4-
export MRVL_SAI = mrvllibsai_$(PLATFORM_ARCH)_$(MRVL_SAI_VERSION).deb
3+
export MRVL_SAI_VERSION = 1.6.3
4+
export MRVL_SAI = mrvllibsai_m0_MASTER_$(PLATFORM_ARCH)_$(MRVL_SAI_VERSION).deb
55

66
$(MRVL_SAI)_SRC_PATH = $(PLATFORM_PATH)/sai
77
$(eval $(call add_conflict_package,$(MRVL_SAI),$(LIBSAIVS_DEV)))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
et6448m_plt_setup.sh usr/sbin
2+
entropy.py etc/
3+
inband_mgmt.sh etc/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/python
2+
import fcntl, struct
3+
import time
4+
5+
RNDADDENTROPY=0x40085203
6+
7+
def avail():
8+
with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail:
9+
return int(avail.read())
10+
11+
while 1:
12+
while avail() < 2048:
13+
with open('/dev/urandom', 'rb') as urnd, open("/dev/random", mode='wb') as rnd:
14+
d = urnd.read(512)
15+
t = struct.pack('ii', 4 * len(d), len(d)) + d
16+
fcntl.ioctl(rnd, RNDADDENTROPY, t)
17+
time.sleep(30)

platform/marvell-armhf/sonic-platform-et6448m/et6448m_plt_setup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ main()
5252
{
5353
fw_uboot_env_cfg
5454
et6448m_profile
55+
56+
python /etc/entropy.py &
57+
/bin/sh /etc/inband_mgmt.sh
5558
}
5659

5760
main $@
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
3+
#inband_mgmt
4+
5+
inband_mgmt(){
6+
7+
# The intent of this sequence is to ensure 12c bus enumeration order by
8+
# controlling the order in which the various i2c device drivers are
9+
# loaded. Hence the drivers are unloaded and then reloaded in the prescribed
10+
# order.
11+
# NOTE: In the nokia platform the following sequence is performed by the Nokia
12+
# platform service init script and thus should not be performed here
13+
grep ^onie_platform /host/machine.conf 2>/dev/null | grep nokia >/dev/null
14+
if [ $? != 0 ]; then
15+
rmmod i2c-dev
16+
rmmod i2c_mux_gpio
17+
rmmod i2c_mv64xxx
18+
modprobe i2c_mv64xxx
19+
modprobe i2c-dev
20+
modprobe i2c_mux_gpio
21+
sleep 60
22+
fi
23+
while :; do
24+
ip -br link show eth0 2> /dev/null
25+
if [ $? -eq 0 ]; then
26+
ip address show eth0 | grep -qw "inet" 2>/dev/null
27+
if [ $? -ne 0 ]; then
28+
ifconfig eth0 down
29+
systemctl restart networking
30+
fi
31+
sleep 120
32+
else
33+
sleep 3
34+
fi
35+
done
36+
}
37+
(inband_mgmt > /dev/null)&

sonic-slave-buster/Dockerfile.j2

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{%- if CONFIGURED_ARCH == "armhf" %}
2+
FROM multiarch/qemu-user-static:x86_64-arm-5.0.0-2 as qemu
23
FROM multiarch/debian-debootstrap:armhf-buster
4+
COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin
35
{%- elif CONFIGURED_ARCH == "arm64" %}
46
FROM multiarch/debian-debootstrap:arm64-buster
57
{%- else -%}
@@ -438,11 +440,7 @@ RUN add-apt-repository \
438440
$(lsb_release -cs) \
439441
stable"
440442
RUN apt-get update
441-
{%- if CONFIGURED_ARCH == "amd64" %}
442443
RUN apt-get install -y docker-ce=5:18.09.5~3-0~debian-buster docker-ce-cli=5:18.09.5~3-0~debian-buster
443-
{%- else %}
444-
RUN apt-get install -y docker-ce=18.06.3~ce~3-0~debian
445-
{%- endif %}
446444
RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker
447445
RUN update-alternatives --set iptables /usr/sbin/iptables-legacy
448446

0 commit comments

Comments
 (0)