-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Feature to run an option platform specific script on the first boot #2531
Conversation
…rst installation. We added the ability to run an optional platform specific script when the onie image is installed. This will be useful in the case of doing some switch specifc tasks.
files/image_config/platform/rc.local
Outdated
@@ -351,6 +351,10 @@ if [ -f $FIRST_BOOT_FILE ]; then | |||
mv /host/grub.cfg /host/grub/grub.cfg | |||
fi | |||
|
|||
# If there is a platform dependant script, execute it | |||
if [ -x /usr/share/sonic/device/${onie_platform}/platform_setup ]; then | |||
/usr/share/sonic/device/${onie_platform}/platform_setup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to be $platform, not all platform are onie platform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
porting guide needs to be updated. https://github.com/Azure/SONiC/wiki/Porting-Guide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I committed changes to use platform instead of device_platform.
Regarding the proposed changes in the wiki file Porting-Guide.md, how can I submit them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to open a pull request against the https://github.com/Azure/SONiC repo using the same procedure you used to generate this pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see Porting-Guide.md when I clone [email protected]:Azure/SONiC.git
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, because it's part of the wiki, and GitHub treats the wiki differently than the repo itself. For now, you can open an issue in that repo and paste your proposed changes for the file in the description.
9ce532d
to
8142b86
Compare
Just to clarify, this platform_setup is after we install the platform drivers? usually, what type of operation are we doing here? I would like to set expectation of the platform setup and typical use cases, so that user would not abuse this mechanism. for example, why cannot user do the platform init in their platform debian package. |
Here is the typical scenario in our case. We are adding support for XMC card (such as BCM9COMX2XMC). They can be used in various switches (Tomahawk, Trident2, Trident3, etc.). We need then a way to dynamically adjust the hardware SKU depending of the device which has been detected. Having the ability to run a script early allow me to create dynamically the hw sku file. |
I was able to perform the platform initialization using the platform debian package. Therefore, the new feature I was proposing is no longer needed. |
Update sonic-utilities submodule pointer to include the following: * 2ef5b31e [GCU] Add PFC_WD RDMA validator ([sonic-net#2619](sonic-net/sonic-utilities#2619)) * c7aa8416 [show][muxcable] increase timeout for displaying HW_STATUS ([sonic-net#2712](sonic-net/sonic-utilities#2712)) * 2fc2b826 YANG validation for ConfigDB Updates: MIRROR_SESSION use case ([sonic-net#2430](sonic-net/sonic-utilities#2430)) * e16bdaae Fix non-zero status exit on non secure boot system ([sonic-net#2715](sonic-net/sonic-utilities#2715)) * 90d70152 [route_check] implement a check for FRR routes not marked offloaded ([sonic-net#2531](sonic-net/sonic-utilities#2531)) * c2bc150a [warm/fast-reboot] Backup logs from tmpfs to disk during fast/warm shutdown ([sonic-net#2714](sonic-net/sonic-utilities#2714)) * a015834d [db_migrator] Add missing attribute 'weight' to route entries in APPL DB ([sonic-net#2691](sonic-net/sonic-utilities#2691)) * cd519aac [ci] Fix pipeline issue caused by sonic-slave-* change. ([sonic-net#2709](sonic-net/sonic-utilities#2709)) * 2680e6f3 [dhcp_relay] Fix dhcp_relay restart error while add/del vlan ([sonic-net#2688](sonic-net/sonic-utilities#2688)) Signed-off-by: AntonHryshchuk <[email protected]>
Update sonic-utilities submodule pointer to include the following: * e6179afa Remove timer from FAST_REBOOT STATE_DB entry and use finalizer ([sonic-net#2621](sonic-net/sonic-utilities#2621)) * ff688323 [route_check] fix IPv6 address handling ([sonic-net#2722](sonic-net/sonic-utilities#2722)) * 7a604c51 update fast-reboot ([sonic-net#2728](sonic-net/sonic-utilities#2728)) * 9f83ace9 [GCU] Add vlanintf-validator ([sonic-net#2697](sonic-net/sonic-utilities#2697)) * 338d1c05 Check SONiC dependencies before installation. ([sonic-net#2716](sonic-net/sonic-utilities#2716)) * 64d2efd2 Improve show acl commands ([sonic-net#2667](sonic-net/sonic-utilities#2667)) * 2ef5b31e [GCU] Add PFC_WD RDMA validator ([sonic-net#2619](sonic-net/sonic-utilities#2619)) * c7aa8416 [show][muxcable] increase timeout for displaying HW_STATUS ([sonic-net#2712](sonic-net/sonic-utilities#2712)) * 2fc2b826 YANG validation for ConfigDB Updates: MIRROR_SESSION use case ([sonic-net#2430](sonic-net/sonic-utilities#2430)) * e16bdaae Fix non-zero status exit on non secure boot system ([sonic-net#2715](sonic-net/sonic-utilities#2715)) * 90d70152 [route_check] implement a check for FRR routes not marked offloaded ([sonic-net#2531](sonic-net/sonic-utilities#2531)) * c2bc150a [warm/fast-reboot] Backup logs from tmpfs to disk during fast/warm shutdown ([sonic-net#2714](sonic-net/sonic-utilities#2714)) * a015834d [db_migrator] Add missing attribute 'weight' to route entries in APPL DB ([sonic-net#2691](sonic-net/sonic-utilities#2691)) * cd519aac [ci] Fix pipeline issue caused by sonic-slave-* change. ([sonic-net#2709](sonic-net/sonic-utilities#2709)) * 2680e6f3 [dhcp_relay] Fix dhcp_relay restart error while add/del vlan ([sonic-net#2688](sonic-net/sonic-utilities#2688)) Signed-off-by: dprital <[email protected]>
Why I did it 832ef9c4 - Fix bug in GCU vlanintf_validator ([Bcm SAI] ugprade Broadcom SAI to version 3.3.5.4m-1 #2765) (5 minutes ago) [jingwenxie] 53f611b7 - Revert "Convert IPv6 addresses to lowercase in apply-patch (Add Pegatron project to branch 201807 #2299)" (Add note for running out of disk space in /var/lib/docker to README.md #2758) (20 hours ago) [jingwenxie] 79a21cef - Revert frr route check ([mlnx] fix url inconsistency in fw.mk #2761) (8 minutes ago) [StormLiangMS] 824680ed - Resolved rc!=0 problem by replacing fgrep with awk. Added ipv4 filtering to get only v4 peers in case of show ip bgp neighbors (Improve eeprom access reliability #2756) (30 hours ago) [saurabh17g] 10f31ea6 - Revert "Replace pickle by json (Add autoneg to 7170-Q59S20 #2636)" ([hostcfgd] Default value of fallthrough for authentication set to be False. #2746) (7 days ago) [Mai Bui] 05fa7513 - Fix the show interface counters throwing exception on device with no external interfaces ([docker-platform-monitor]: Add smartmontools 6.6-1 #2703) (11 days ago) [abdosi] f27dea0c - [route_check] remove check-frr_patch mock ([minigraph]: Mark both ERSPAN and ERSPANv6 as mirror ACL tables #2732) (11 days ago) [Stepan Blyshchak] 2d95529d - Revert "Update load minigraph to load backend acl (mlnx msn2010: default config_db.json generation with sonic-cfggen is not working #2236)" (swss stretch update broke restore_neighbors.py for neigh service #2735) (12 days ago) [Neetha John] c869c970 - (master) Update the ref guide to reflect the vlan brief output ([teamd] update teamd docker to stretch and fix teamd_init failure #2731) (2 weeks ago) [Vivek] 76457141 - Fix fast-reboot DB migration ([teamd]: update teamd docker to stretch #2734) (2 weeks ago) [Aryeh Feigin] f7f783bc - Enhance the logic to wait for all buffer tables to be removed in _clear_qos ([sfputil] Not able to read out values of voltage/temp/power on some cables #2720) (2 weeks ago) [Stephen Sun] e6179afa - Remove timer from FAST_REBOOT STATE_DB entry and use finalizer (Rollback kernel submodule update. #2621) (3 weeks ago) [Aryeh Feigin] ff688323 - [route_check] fix IPv6 address handling ([docker pmon] install fancontrol & sensord #2722) (3 weeks ago) [Stepan Blyshchak] 7a604c51 - update fast-reboot ([201811][sairedis][swss] advance sub module head of sairedis and swss #2728) (3 weeks ago) [jhli-cisco] 9f83ace9 - [GCU] Add vlanintf-validator (Revert "[device/celestica] blacklist gpio_ich kernel module on haliburton" #2697) (3 weeks ago) [jingwenxie] 338d1c05 - Check SONiC dependencies before installation. ([sonic-slave]: Add iproute2 dependencies in stretch docker #2716) (3 weeks ago) [Liu Shilong] 64d2efd2 - Improve show acl commands ([sonic-utilities] update submodule #2667) (3 weeks ago) [bingwang-ms] 2ef5b31e - [GCU] Add PFC_WD RDMA validator ([sub module] advance sonic-utilities sub module for 201811 branch #2619) (3 weeks ago) [isabelmsft] c7aa8416 - [show][muxcable] increase timeout for displaying HW_STATUS (Fixing get_transceiver_change_event #2712) (3 weeks ago) [vdahiya12] 2fc2b826 - YANG validation for ConfigDB Updates: MIRROR_SESSION use case ([mellanox] Update SDK to 4.3.0132 #2430) (3 weeks ago) [isabelmsft] e16bdaae - Fix non-zero status exit on non secure boot system ([service] add warmboot finializer service #2715) (3 weeks ago) [kellyyeh] 90d70152 - [route_check] implement a check for FRR routes not marked offloaded (Feature to run an option platform specific script on the first boot #2531) (3 weeks ago) [Stepan Blyshchak] c2bc150a - [warm/fast-reboot] Backup logs from tmpfs to disk during fast/warm shutdown ([swss]: update swss docker to stretch #2714) (3 weeks ago) [Vaibhav Hemant Dixit] a015834d - [db_migrator] Add missing attribute 'weight' to route entries in APPL DB ([device/celestica] blacklist gpio_ich kernel module on seastone #2691) (4 weeks ago) [Vaibhav Hemant Dixit] cd519aac - [ci] Fix pipeline issue caused by sonic-slave-* change. ([201803] Modify Debian apt repos to reflect changes made by maintainers #2709) (4 weeks ago) [Liu Shilong] 2680e6f3 - [dhcp_relay] Fix dhcp_relay restart error while add/del vlan ([thrift] add a patch to revert THRIFT-3650 #2688) (4 weeks ago) [Yaqiang Zhu] How I did it How to verify it
- What I did
I added the ability to run an optional platform specific script on the first boot. This will be useful in the case of doing some switch specific setup and initialization.
- How I did it
Add a few lines in the files/image_config/platform/rc.local in the section which is run only on the first boot. We test for the existence of a file named platform_setup, and this file has execute flag set, the script will be executed.
- How to verify it
Create a shell script named platform_setup,. store it in the device directory, under the onie platform directory.
- Description for the changelog
Added the feature to run an option platform specific script on the first boot
- A picture of a cute animal (not mandatory but encouraged)