-
Notifications
You must be signed in to change notification settings - Fork 1.8k
PDE migration to bullseye #10836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
PDE migration to bullseye #10836
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d3c6a49
PDE migration to bullseye
geans-pin 5ddcf76
PDE migration to bullseye
geans-pin a4506a7
PDE migration to bullseye +3
geans-pin 120b1c8
PDE Migration to bullseye +4
geans-pin fc8eb3d
PDE Migration to bullseye +5
geans-pin a6e6d15
PDE migration to bullseye +6
geans-pin 045c989
PDE migration to bullseye +7
geans-pin 9f14a7e
PDE migration to bullseye +8
geans-pin 676e386
PDE migration to bullseye +9
geans-pin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,254 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| CMD_SYNCD=/usr/bin/syncd | ||
|
|
||
| # dsserve: domain socket server for stdio | ||
| CMD_DSSERVE=/usr/bin/dsserve | ||
| CMD_DSSERVE_ARGS="$CMD_SYNCD --diag" | ||
|
|
||
| ENABLE_SAITHRIFT=0 | ||
|
|
||
| PLATFORM_DIR=/usr/share/sonic/platform | ||
| HWSKU_DIR=/usr/share/sonic/hwsku | ||
|
|
||
| SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) | ||
|
|
||
| if [ -x $CMD_DSSERVE ]; then | ||
| CMD=$CMD_DSSERVE | ||
| CMD_ARGS=$CMD_DSSERVE_ARGS | ||
| else | ||
| CMD=$CMD_SYNCD | ||
| CMD_ARGS= | ||
| fi | ||
|
|
||
| # Use temporary view between init and apply | ||
| CMD_ARGS+=" -u" | ||
|
|
||
| case "$(cat /proc/cmdline)" in | ||
| *SONIC_BOOT_TYPE=fastfast*) | ||
| if [ -e /var/warmboot/warm-starting ]; then | ||
| FASTFAST_REBOOT='yes' | ||
| fi | ||
| ;; | ||
| *SONIC_BOOT_TYPE=fast*|*fast-reboot*) | ||
| FAST_REBOOT='yes' | ||
| ;; | ||
| *) | ||
| FAST_REBOOT='no' | ||
| FASTFAST_REBOOT='no' | ||
| ;; | ||
| esac | ||
|
|
||
|
|
||
| function check_warm_boot() | ||
| { | ||
| # FIXME: if we want to continue start option approach, then we need to add | ||
| # code here to support redis database query. | ||
| # SYSTEM_WARM_START=`sonic-db-cli STATE_DB hget "WARM_RESTART_ENABLE_TABLE|system" enable` | ||
| # SERVICE_WARM_START=`sonic-db-cli STATE_DB hget "WARM_RESTART_ENABLE_TABLE|${SERVICE}" enable` | ||
| # SYSTEM_WARM_START could be empty, always make WARM_BOOT meaningful. | ||
| # if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then | ||
| # WARM_BOOT="true" | ||
| # else | ||
| WARM_BOOT="false" | ||
| # fi | ||
| } | ||
|
|
||
|
|
||
| function set_start_type() | ||
| { | ||
| if [ x"$WARM_BOOT" == x"true" ]; then | ||
| CMD_ARGS+=" -t warm" | ||
| elif [ x"$FAST_REBOOT" == x"yes" ]; then | ||
| CMD_ARGS+=" -t fast" | ||
| elif [ x"$FASTFAST_REBOOT" == x"yes" ]; then | ||
| CMD_ARGS+=" -t fastfast" | ||
| fi | ||
| } | ||
|
|
||
|
|
||
| config_syncd_bcm() | ||
| { | ||
| PLATFORM_COMMON_DIR=/usr/share/sonic/device/x86_64-broadcom_common | ||
| PLT_CONFIG_BCM=$(find $HWSKU_DIR -name '*.bcm') | ||
|
|
||
| if [ ! -z "$PLT_CONFIG_BCM" ]; then | ||
| cp -f $HWSKU_DIR/*.config.bcm /tmp | ||
| cp -f /etc/sai.d/sai.profile /tmp | ||
| CONFIG_BCM=$(find /tmp -name '*.bcm') | ||
| SAI_PROFILE=$(find /tmp -name 'sai.profile') | ||
| sed -i 's+/usr/share/sonic/hwsku+/tmp+g' $SAI_PROFILE | ||
|
|
||
| #Get first three characters of chip id | ||
| readline=$(grep '0x14e4' /proc/linux-kernel-bde) | ||
| chip_id=${readline#*0x14e4:0x} | ||
| chip_id=${chip_id::3} | ||
| COMMON_CONFIG_BCM=$(find $PLATFORM_COMMON_DIR/x86_64-broadcom_${chip_id} -name '*.bcm') | ||
|
|
||
| if [ -f $PLATFORM_COMMON_DIR/x86_64-broadcom_${chip_id}/*.bcm ]; then | ||
| for file in $CONFIG_BCM; do | ||
| echo "" >> $file | ||
| echo "# Start of chip common properties" >> $file | ||
| while read line | ||
| do | ||
| line=$( echo $line | xargs ) | ||
| if [ ! -z "$line" ];then | ||
| if [ "${line::1}" == '#' ];then | ||
| echo $line >> $file | ||
| else | ||
| sedline=${line%=*} | ||
| if grep -q $sedline $file ;then | ||
| echo "Keep the config $(grep $sedline $file) in $file" | ||
| else | ||
| echo $line >> $file | ||
| fi | ||
| fi | ||
| fi | ||
| done < $COMMON_CONFIG_BCM | ||
| echo "# End of chip common properties" >> $file | ||
| done | ||
| echo "Merging $PLT_CONFIG_BCM with $COMMON_CONFIG_BCM, merge files stored in $CONFIG_BCM" | ||
| fi | ||
| #sync the file system | ||
| sync | ||
|
|
||
| # copy the final config.bcm and sai.profile to the shared folder for 'show tech' | ||
| cp -f /tmp/sai.profile /var/run/sswsyncd/ | ||
| cp -f /tmp/*.bcm /var/run/sswsyncd/ | ||
| fi | ||
|
|
||
| if [ -f "/tmp/sai.profile" ]; then | ||
| CMD_ARGS+=" -p /tmp/sai.profile" | ||
| elif [ -f "/etc/sai.d/sai.profile" ]; then | ||
| CMD_ARGS+=" -p /etc/sai.d/sai.profile" | ||
| else | ||
| CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" | ||
| fi | ||
|
|
||
| [ -e /dev/linux-bcm-knet ] || mknod /dev/linux-bcm-knet c 122 0 | ||
| [ -e /dev/linux-user-bde ] || mknod /dev/linux-user-bde c 126 0 | ||
| [ -e /dev/linux-kernel-bde ] || mknod /dev/linux-kernel-bde c 127 0 | ||
| } | ||
|
|
||
| config_syncd_mlnx() | ||
| { | ||
| CMD_ARGS+=" -p /tmp/sai.profile" | ||
|
|
||
| [ -e /dev/sxdevs/sxcdev ] || ( mkdir -p /dev/sxdevs && mknod /dev/sxdevs/sxcdev c 231 193 ) | ||
|
|
||
| # Read MAC address | ||
| MAC_ADDRESS="$(sonic-cfggen -d -v DEVICE_METADATA.localhost.mac)" | ||
|
|
||
| # Write MAC address into /tmp/profile file. | ||
| cat $HWSKU_DIR/sai.profile > /tmp/sai.profile | ||
| echo "DEVICE_MAC_ADDRESS=$MAC_ADDRESS" >> /tmp/sai.profile | ||
| echo "SAI_WARM_BOOT_WRITE_FILE=/var/warmboot/" >> /tmp/sai.profile | ||
| } | ||
|
|
||
| config_syncd_centec() | ||
| { | ||
| CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" | ||
|
|
||
| [ -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 ) | ||
| } | ||
|
|
||
| config_syncd_cavium() | ||
| { | ||
| CMD_ARGS+=" -p $HWSKU_DIR/sai.profile -d" | ||
|
|
||
| export XP_ROOT=/usr/bin/ | ||
|
|
||
| # Wait until redis-server starts | ||
| until [ $(sonic-db-cli PING | grep -c PONG) -gt 0 ]; do | ||
| sleep 1 | ||
| done | ||
| } | ||
|
|
||
| config_syncd_marvell() | ||
| { | ||
| CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" | ||
|
|
||
| [ -e /dev/net/tun ] || ( mkdir -p /dev/net && mknod /dev/net/tun c 10 200 ) | ||
| } | ||
|
|
||
| config_syncd_barefoot() | ||
| { | ||
| PROFILE_FILE="$HWSKU_DIR/sai.profile" | ||
| if [ ! -f $PROFILE_FILE ]; then | ||
| # default profile file | ||
| PROFILE_FILE="/tmp/sai.profile" | ||
| echo "SAI_KEY_WARM_BOOT_WRITE_FILE=/var/warmboot/sai-warmboot.bin" > $PROFILE_FILE | ||
| echo "SAI_KEY_WARM_BOOT_READ_FILE=/var/warmboot/sai-warmboot.bin" >> $PROFILE_FILE | ||
| fi | ||
| CMD_ARGS+=" -p $PROFILE_FILE" | ||
|
|
||
| # Check and load SDE profile | ||
| P4_PROFILE=$(sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["p4_profile"]') | ||
| if [[ -n "$P4_PROFILE" ]]; then | ||
| if [[ ( -d /opt/bfn/install_${P4_PROFILE} ) && ( -L /opt/bfn/install || ! -e /opt/bfn/install ) ]]; then | ||
| ln -srfn /opt/bfn/install_${P4_PROFILE} /opt/bfn/install | ||
| fi | ||
| fi | ||
| export PYTHONHOME=/opt/bfn/install/ | ||
| export PYTHONPATH=/opt/bfn/install/ | ||
| export ONIE_PLATFORM=`grep onie_platform /etc/machine.conf | awk 'BEGIN { FS = "=" } ; { print $2 }'` | ||
| export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/bfn/install/lib/platform/$ONIE_PLATFORM:/opt/bfn/install/lib:/opt/bfn/install/lib/tofinopd/switch | ||
| ./opt/bfn/install/bin/dma_setup.sh | ||
| } | ||
|
|
||
| config_syncd_nephos() | ||
| { | ||
| CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" | ||
| } | ||
|
|
||
| config_syncd_vs() | ||
| { | ||
| CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" | ||
| } | ||
|
|
||
| config_syncd_innovium() | ||
| { | ||
| CMD_ARGS+=" -p $HWSKU_DIR/sai.profile" | ||
| ulimit -s 65536 | ||
| export II_ROOT="/var/log/invm" | ||
| export II_APPEND_LOG=1 | ||
| mkdir -p $II_ROOT | ||
| } | ||
|
|
||
| config_syncd() | ||
| { | ||
| check_warm_boot | ||
|
|
||
| if [ "$SONIC_ASIC_TYPE" == "broadcom" ]; then | ||
| config_syncd_bcm | ||
| elif [ "$SONIC_ASIC_TYPE" == "mellanox" ]; then | ||
| config_syncd_mlnx | ||
| elif [ "$SONIC_ASIC_TYPE" == "cavium" ]; then | ||
| config_syncd_cavium | ||
| elif [ "$SONIC_ASIC_TYPE" == "centec" ]; then | ||
| config_syncd_centec | ||
| elif [ "$SONIC_ASIC_TYPE" == "marvell" ]; then | ||
| config_syncd_marvell | ||
| elif [ "$SONIC_ASIC_TYPE" == "barefoot" ]; then | ||
| config_syncd_barefoot | ||
| elif [ "$SONIC_ASIC_TYPE" == "nephos" ]; then | ||
| config_syncd_nephos | ||
| elif [ "$SONIC_ASIC_TYPE" == "vs" ]; then | ||
| config_syncd_vs | ||
| elif [ "$SONIC_ASIC_TYPE" == "innovium" ]; then | ||
| config_syncd_innovium | ||
| else | ||
| echo "Unknown ASIC type $SONIC_ASIC_TYPE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| set_start_type | ||
|
|
||
| if [ ${ENABLE_SAITHRIFT} == 1 ]; then | ||
| CMD_ARGS+=" -r -m $HWSKU_DIR/port_config.ini" | ||
| fi | ||
|
|
||
| [ -r $PLATFORM_DIR/syncd.conf ] && . $PLATFORM_DIR/syncd.conf | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.