Skip to content

Commit

Permalink
Support centec platform (sonic-net#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
Min Yao authored and lguohan committed Mar 4, 2017
1 parent 22ea540 commit 426589a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions debian/syncd.init
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ start_mlnx()
echo "DEVICE_MAC_ADDRESS=$ALIGNED_MAC_ADDRESS" >> /tmp/sai.profile
}

start_centec()
{
[ -e /dev/linux_dal ] || mknod /dev/linux_dal c 198 0
[ -e /dev/net/tun ] || ( mkdir -p /dev/net && mknod /dev/net/tun c 10 200 )

# Read MAC address and align the last 6 bits.
MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'`
last_byte=`python -c "print '$MAC_ADDRESS'[-2:]"`
aligned_last_byte=`python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')"` # put mask and take away the 0x prefix
ALIGNED_MAC_ADDRESS=`python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'"` # put aligned byte into the end of MAC

# Write MAC address into /tmp/profile file.
cat $HWSKU_DIR/sai.profile > /tmp/sai.profile
echo "DEVICE_MAC_ADDRESS=$ALIGNED_MAC_ADDRESS" >> /tmp/sai.profile
}

start_cavium()
{
export XP_ROOT=/usr/bin/
Expand All @@ -81,6 +97,9 @@ start)
elif [ $sonic_asic_type == "cavium" ]; then
DAEMON_ARGS+=" -p $HWSKU_DIR/sai.profile "
start_cavium
elif [ $sonic_asic_type == "centec" ]; then
start_centec
DAEMON_ARGS+=" -p /tmp/sai.profile "
else
echo "Unknown asic type $sonic_asic_type"
exit 1
Expand Down

0 comments on commit 426589a

Please sign in to comment.