[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>
This commit is contained in:
parent
356522bfcd
commit
fe524c37e7
@ -27,13 +27,13 @@ RUN apt-get update && \
|
||||
{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
|
||||
# Fix for gcc/python not found in arm docker
|
||||
RUN apt-get install -f -y python2.7 python2.7-dev
|
||||
RUN apt-get install -y gcc-6
|
||||
RUN apt-get install -y gcc-8
|
||||
{% endif %}
|
||||
{% if CONFIGURED_ARCH == "armhf" %}
|
||||
RUN ln -s -f /usr/bin/gcc-6 /usr/bin/arm-linux-gnueabihf-gcc
|
||||
RUN ln -s -f /usr/bin/gcc-8 /usr/bin/arm-linux-gnueabihf-gcc
|
||||
{% endif %}
|
||||
{% if CONFIGURED_ARCH == "arm64" %}
|
||||
RUN ln -s -f /usr/bin/gcc-6 /usr/bin/aarch64-linux-gnu-gcc
|
||||
RUN ln -s -f /usr/bin/gcc-8 /usr/bin/aarch64-linux-gnu-gcc
|
||||
{% endif %}
|
||||
|
||||
RUN pip2 install \
|
||||
@ -46,7 +46,7 @@ RUN pip2 install \
|
||||
|
||||
{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
|
||||
# Remove installed gcc
|
||||
RUN apt-get remove -y gcc-6
|
||||
RUN apt-get remove -y gcc-8
|
||||
{% endif %}
|
||||
|
||||
{% if docker_orchagent_debs.strip() -%}
|
||||
|
@ -5,3 +5,10 @@ m25p80
|
||||
ubi
|
||||
ubifs
|
||||
squashfs
|
||||
marvell_nand
|
||||
i2c_mv64xxx
|
||||
ar7part
|
||||
ofpart
|
||||
mtdswap
|
||||
mtd_blkdevs
|
||||
adt7475
|
||||
|
@ -109,7 +109,7 @@ case "${ROOT}" in
|
||||
ubi*)
|
||||
mtd=$(cat /proc/cmdline | sed -e 's/.*ubi.mtd=\([0-9]\) .*/\1/')
|
||||
if [ ! -f /dev/${ROOT}_0 ]; then
|
||||
ubiattach /dev/ubi_ctrl -m $mtd || true
|
||||
ubiattach /dev/ubi_ctrl -m $mtd 2>dev/null || true
|
||||
fi
|
||||
mount -t ubifs /dev/${ROOT}_0 ${rootmnt}/host
|
||||
;;
|
||||
|
@ -10,28 +10,60 @@ fdt_addr=0x1000000
|
||||
initrd_addr=0x2000000
|
||||
VAR_LOG=512
|
||||
|
||||
kernel_fname="/boot/vmlinuz-4.9.0-9-2-armmp"
|
||||
initrd_fname="/boot/initrd.img-4.9.0-9-2-armmp"
|
||||
kernel_fname="/boot/vmlinuz-4.19.0-9-2-armmp"
|
||||
initrd_fname="/boot/initrd.img-4.19.0-9-2-armmp"
|
||||
fdt_fname="/boot/armada-385-ET6448M_4G_Nand.dtb"
|
||||
|
||||
if [ "$install_env" = "onie" ]; then
|
||||
MACH_FILE="/etc/machine.conf"
|
||||
else
|
||||
MACH_FILE="/host/machine.conf"
|
||||
fi
|
||||
# armhf-marvell_et6448m_52x-r0 - Platform = Et6448M
|
||||
# armhf-nokia_ixs7215_52x-r0 - Platform = Nokia IPD6448M
|
||||
PLATFORM=`sed -n 's/^onie_platform=\(.*\)/\1/p' $MACH_FILE`
|
||||
echo "Intalling SONiC from $install_env on Platform $PLATFORM"
|
||||
|
||||
# global mount defines
|
||||
demo_dev=ubi0
|
||||
mtd_dev=/dev/$(cat /proc/mtd | grep "SONIC" | grep -o "mtd[0-9]")
|
||||
mtd_num=$(echo $mtd_dev | grep -o "[0-9]")
|
||||
if [ "$PLATFORM" = "armhf-marvell_et6448m_52x-r0" ]; then
|
||||
demo_dev=ubi0
|
||||
mtd_dev=/dev/$(cat /proc/mtd | grep "SONIC" | grep -o "mtd[0-9]")
|
||||
mtd_num=$(echo $mtd_dev | grep -o "[0-9]")
|
||||
|
||||
fdt_fname="/boot/armada-385-ET6448M_4G_Nand.dtb"
|
||||
|
||||
BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}'
|
||||
UBI_LOAD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name;ubifsload $fdt_addr $fdt_name; ubifsload $initrd_addr $initrd_name'
|
||||
BOOTARGS_OLD='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs_old}'
|
||||
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'
|
||||
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'
|
||||
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'
|
||||
LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
|
||||
|
||||
elif [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
|
||||
demo_dev=sda2
|
||||
|
||||
fdt_fname="/boot/armada-385-ipd6448m.dtb"
|
||||
|
||||
BOOTARGS='setenv bootargs root=/dev/'$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}'
|
||||
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'
|
||||
BOOTARGS_OLD='setenv bootargs root=/dev/'$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs_old}'
|
||||
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'
|
||||
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'
|
||||
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'
|
||||
LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
|
||||
|
||||
else
|
||||
echo "Unsupported Platform $PLAFORM"
|
||||
exit 2
|
||||
fi
|
||||
demo_mnt=/tmp
|
||||
FW_ENV_DEFAULT='/dev/mtd0 0x00500000 0x80000 0x100000 8'
|
||||
UBOOT_FW_DEFAULT=1
|
||||
|
||||
# Skip VID Header in UBIFS
|
||||
BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num',8192 rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}'
|
||||
UBI_LOAD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name;ubifsload $fdt_addr $fdt_name; ubifsload $initrd_addr $initrd_name'
|
||||
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}'
|
||||
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'
|
||||
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'
|
||||
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'
|
||||
LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
|
||||
|
||||
prepare_boot_menu() {
|
||||
echo "Sync up cache ..."
|
||||
sync
|
||||
echo "Setting up U-Boot environment..."
|
||||
|
||||
DTB_HAS_ENV_BLK=$(grep uboot-env /proc/mtd | sed -e 's/:.*$//')
|
||||
@ -68,6 +100,12 @@ prepare_boot_menu() {
|
||||
echo $FW_ENV_DEFAULT > /etc/fw_env.config
|
||||
echo "Using pre-configured uboot env"
|
||||
fi
|
||||
if [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
|
||||
FW_ENV_DEFAULT='/dev/mtd0 0x00100000 0x10000 0x10000'
|
||||
echo $FW_ENV_DEFAULT > /etc/fw_env.config
|
||||
echo "Using pre-configured uboot env for armhf-nokia_ixs7215_52x-r0"
|
||||
fi
|
||||
|
||||
image_name=${image_dir}${kernel_fname}
|
||||
initrd_name=${image_dir}${initrd_fname}
|
||||
fdt_name=${image_dir}${fdt_fname}
|
||||
@ -108,8 +146,8 @@ prepare_boot_menu() {
|
||||
BORDER='echo "---------------------------------------------------";echo;'
|
||||
fw_setenv ${FW_ARG} print_menu $BORDER $BOOT1 $BOOT2 $BOOT3 $BORDER > /dev/null
|
||||
|
||||
fw_setenv ${FW_ARG} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG" > /dev/null
|
||||
fw_setenv ${FW_ARG} linuxargs_old "net.ifnames=0 loopfstype=squashfs loop=$image_dir_old/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG" > /dev/null
|
||||
fw_setenv ${FW_ARG} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG loglevel=4" > /dev/null
|
||||
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
|
||||
|
||||
# Set boot configs
|
||||
fw_setenv ${FW_ARG} kernel_addr $kernel_addr > /dev/null
|
||||
@ -122,6 +160,9 @@ prepare_boot_menu() {
|
||||
else
|
||||
fw_setenv ${FW_ARG} mtdparts 'mtdparts=armada-nand:4m(uboot)ro,5m@5m(uboot-env),20m@10m(ONIE),-(SONIC)' > /dev/null
|
||||
fi
|
||||
if [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
|
||||
fw_setenv ${FW_ARG} mtdparts 'mtdparts=spi0.0:4m(boot),-(spi-rootfs)' > /dev/null
|
||||
fi
|
||||
fw_setenv ${FW_ARG} ubi_sonic_boot_mount_ubi 'ubi part SONIC; ubifsmount ubi0' > /dev/null
|
||||
fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs $BOOTARGS > /dev/null
|
||||
fw_setenv ${FW_ARG} ubi_sonic_boot_load $UBI_LOAD > /dev/null
|
||||
@ -153,9 +194,52 @@ create_ubi_partition() {
|
||||
ubimkvol /dev/$demo_dev -N $demo_dev -s 3900MiB
|
||||
}
|
||||
|
||||
create_gpt_partition() {
|
||||
blk_dev="/dev/sda"
|
||||
demo_part=$(sgdisk -p $blk_dev | grep -e "$demo_volume_label" -e "$legacy_volume_label" | awk '{print $1}')
|
||||
# ONIE partition size 168MB
|
||||
onie_part_size=168
|
||||
|
||||
if [ -z "$demo_part" ] ; then
|
||||
# Partition Does NOT Exists
|
||||
echo "SONIC label [$demo_volume_label] is NOT found in Partition"
|
||||
echo "Proceeding to create partition"
|
||||
|
||||
attr_bitmask="0x0"
|
||||
|
||||
sgdisk --new=${demo_part}::+${onie_part_size}MB \
|
||||
--attributes=${demo_part}:=:$attr_bitmask \
|
||||
--change-name=${demo_part}:$demo_volume_label $blk_dev \
|
||||
|| {
|
||||
echo "Warning: The first trial of creating partition failed, trying the largest aligned available block of sectors on the disk"
|
||||
begin=$(sgdisk -F $blk_dev)
|
||||
end=$(sgdisk -E $blk_dev)
|
||||
sgdisk --new=${demo_part}:$begin:$end \
|
||||
--attributes=${demo_part}:=:$attr_bitmask \
|
||||
--change-name=${demo_part}:$demo_volume_label $blk_dev
|
||||
} || {
|
||||
echo "Error: Unable to create partition $demo_part on $blk_dev"
|
||||
exit 1
|
||||
}
|
||||
partprobe || true
|
||||
else
|
||||
# Partition Exists
|
||||
echo "Partition exists $demo_part on $blk_dev"
|
||||
fi
|
||||
|
||||
# Make filesystem
|
||||
mkfs.ext4 -L $demo_volume_label /dev/$demo_dev
|
||||
}
|
||||
|
||||
create_partition() {
|
||||
# Platform speicific partition
|
||||
if [ "$PLATFORM" = "armhf-marvell_et6448m_52x-r0" ]; then
|
||||
echo "Doing UBI partition"
|
||||
create_ubi_partition
|
||||
else
|
||||
echo "Doing GPT partition"
|
||||
create_gpt_partition
|
||||
fi
|
||||
}
|
||||
|
||||
mount_partition() {
|
||||
@ -166,14 +250,22 @@ mount_partition() {
|
||||
}
|
||||
|
||||
echo "Mounting $demo_dev on $demo_mnt "
|
||||
if [ "$PLATFORM" = "armhf-marvell_et6448m_52x-r0" ]; then
|
||||
trap_push "${onie_bin} umount /dev/ubi0_0|| true"
|
||||
mount -t ubifs /dev/ubi0_0 $demo_mnt || {
|
||||
echo "Failed"
|
||||
echo "mount -t ubifs /dev/ubi0_0 $demo_mnt Failed"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
trap_push "${onie_bin} umount /dev/sda2|| true"
|
||||
mount -t ext4 /dev/sda2 $demo_mnt || {
|
||||
echo "mount -t ext4 /dev/sda2 $demo_mnt Failed"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
bootloader_menu_config() {
|
||||
# Update uboot Environment
|
||||
prepare_boot_menu
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Marvell SAI
|
||||
|
||||
export MRVL_SAI_VERSION = 1.5.1
|
||||
export MRVL_SAI = mrvllibsai_$(PLATFORM_ARCH)_$(MRVL_SAI_VERSION).deb
|
||||
export MRVL_SAI_VERSION = 1.6.3
|
||||
export MRVL_SAI = mrvllibsai_m0_MASTER_$(PLATFORM_ARCH)_$(MRVL_SAI_VERSION).deb
|
||||
|
||||
$(MRVL_SAI)_SRC_PATH = $(PLATFORM_PATH)/sai
|
||||
$(eval $(call add_conflict_package,$(MRVL_SAI),$(LIBSAIVS_DEV)))
|
||||
|
@ -1 +1,3 @@
|
||||
et6448m_plt_setup.sh usr/sbin
|
||||
entropy.py etc/
|
||||
inband_mgmt.sh etc/
|
||||
|
17
platform/marvell-armhf/sonic-platform-et6448m/entropy.py
Normal file
17
platform/marvell-armhf/sonic-platform-et6448m/entropy.py
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/python
|
||||
import fcntl, struct
|
||||
import time
|
||||
|
||||
RNDADDENTROPY=0x40085203
|
||||
|
||||
def avail():
|
||||
with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail:
|
||||
return int(avail.read())
|
||||
|
||||
while 1:
|
||||
while avail() < 2048:
|
||||
with open('/dev/urandom', 'rb') as urnd, open("/dev/random", mode='wb') as rnd:
|
||||
d = urnd.read(512)
|
||||
t = struct.pack('ii', 4 * len(d), len(d)) + d
|
||||
fcntl.ioctl(rnd, RNDADDENTROPY, t)
|
||||
time.sleep(30)
|
@ -52,6 +52,9 @@ main()
|
||||
{
|
||||
fw_uboot_env_cfg
|
||||
et6448m_profile
|
||||
|
||||
python /etc/entropy.py &
|
||||
/bin/sh /etc/inband_mgmt.sh
|
||||
}
|
||||
|
||||
main $@
|
||||
|
37
platform/marvell-armhf/sonic-platform-et6448m/inband_mgmt.sh
Normal file
37
platform/marvell-armhf/sonic-platform-et6448m/inband_mgmt.sh
Normal file
@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
#inband_mgmt
|
||||
|
||||
inband_mgmt(){
|
||||
|
||||
# The intent of this sequence is to ensure 12c bus enumeration order by
|
||||
# controlling the order in which the various i2c device drivers are
|
||||
# loaded. Hence the drivers are unloaded and then reloaded in the prescribed
|
||||
# order.
|
||||
# NOTE: In the nokia platform the following sequence is performed by the Nokia
|
||||
# platform service init script and thus should not be performed here
|
||||
grep ^onie_platform /host/machine.conf 2>/dev/null | grep nokia >/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
rmmod i2c-dev
|
||||
rmmod i2c_mux_gpio
|
||||
rmmod i2c_mv64xxx
|
||||
modprobe i2c_mv64xxx
|
||||
modprobe i2c-dev
|
||||
modprobe i2c_mux_gpio
|
||||
sleep 60
|
||||
fi
|
||||
while :; do
|
||||
ip -br link show eth0 2> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
ip address show eth0 | grep -qw "inet" 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
ifconfig eth0 down
|
||||
systemctl restart networking
|
||||
fi
|
||||
sleep 120
|
||||
else
|
||||
sleep 3
|
||||
fi
|
||||
done
|
||||
}
|
||||
(inband_mgmt > /dev/null)&
|
@ -1,5 +1,7 @@
|
||||
{%- if CONFIGURED_ARCH == "armhf" %}
|
||||
FROM multiarch/qemu-user-static:x86_64-arm-5.0.0-2 as qemu
|
||||
FROM multiarch/debian-debootstrap:armhf-buster
|
||||
COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin
|
||||
{%- elif CONFIGURED_ARCH == "arm64" %}
|
||||
FROM multiarch/debian-debootstrap:arm64-buster
|
||||
{%- else -%}
|
||||
@ -438,11 +440,7 @@ RUN add-apt-repository \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
RUN apt-get update
|
||||
{%- if CONFIGURED_ARCH == "amd64" %}
|
||||
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
|
||||
{%- else %}
|
||||
RUN apt-get install -y docker-ce=18.06.3~ce~3-0~debian
|
||||
{%- endif %}
|
||||
RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker
|
||||
RUN update-alternatives --set iptables /usr/sbin/iptables-legacy
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user