From 8db3a99d113b48c5bed220e979a725bdba0693ee Mon Sep 17 00:00:00 2001 From: centecqianj <110279455+centecqianj@users.noreply.github.com> Date: Sat, 2 Dec 2023 08:07:52 +0800 Subject: [PATCH] [Bookworm] Upgrade centec platforms to Bookworm (#17364) How I did it Modified platform driver to comply with bookworm kernel. Modified python build commands for building whl packages. How to verify it Verify whether all the platform bookworm debs are built. make target/debs/bookworm/platform-modules-v682-48y8c-d_1.0_amd64.deb Load the platform debian into the device and install it in bookworm image. Verify the platform related CLI and the functionality Signed-off-by: centecqianj --- .../versions-deb-bullseye-arm64 | 2 +- .../sonic-platform-modules-e530/debian/rules | 2 +- .../pca954x/ctc-i2c-mux-pca954x.c | 3 +-- .../tsingma-bsp/src/rtc-sd2405/rtc-sd2405.c | 2 +- platform/centec/centec-dal/dal_kernel.c | 4 ++-- .../48x2q4z/modules/Makefile | 2 +- .../sonic-platform-modules-e582/debian/rules | 15 ++++++++------- .../pca954x/ctc-i2c-mux-pca954x.c | 3 +-- .../48x8c/modules/rtc-sd2405.c | 2 +- .../48y8c/modules/rtc-sd2405.c | 2 +- .../sonic-platform-modules-v682/debian/rules | 2 +- 11 files changed, 19 insertions(+), 20 deletions(-) diff --git a/files/build/versions/dockers/docker-syncd-centec/versions-deb-bullseye-arm64 b/files/build/versions/dockers/docker-syncd-centec/versions-deb-bullseye-arm64 index 0af33189f..1bbee2b22 100644 --- a/files/build/versions/dockers/docker-syncd-centec/versions-deb-bullseye-arm64 +++ b/files/build/versions/dockers/docker-syncd-centec/versions-deb-bullseye-arm64 @@ -1,7 +1,7 @@ dmsetup==2:1.02.175-2.1 iputils-ping==3:20210202-1 keyutils==1.6.1-2 -libdbus-1-dev==1.12.24-0+deb11u1 +libdbus-1-dev==1.12.28-0+deb11u1 libdevmapper1.02.1==2:1.02.175-2.1 libdpkg-perl==1.20.12 libevent-2.1-7==2.1.12-stable-1 diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/rules b/platform/centec-arm64/sonic-platform-modules-e530/debian/rules index 5351f7f36..555f29e37 100755 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/rules +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/rules @@ -48,7 +48,7 @@ build: (for mod in $(MODULE_DIRS); do \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ cd $${mod}; \ - python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + python3 -m build --wheel --no-isolation --outdir $(MOD_SRC_DIR)/$${mod}/modules; \ cd -; \ done) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/pca954x/ctc-i2c-mux-pca954x.c b/platform/centec-arm64/sonic-platform-modules-e530/pca954x/ctc-i2c-mux-pca954x.c index 3c14bae66..466b6d626 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/pca954x/ctc-i2c-mux-pca954x.c +++ b/platform/centec-arm64/sonic-platform-modules-e530/pca954x/ctc-i2c-mux-pca954x.c @@ -535,14 +535,13 @@ fail_cleanup: return ret; } -static int pca954x_remove(struct i2c_client *client) +static void pca954x_remove(struct i2c_client *client) { struct i2c_mux_core *muxc = i2c_get_clientdata(client); device_remove_file(&client->dev, &dev_attr_idle_state); pca954x_cleanup(muxc); - return 0; } #ifdef CONFIG_PM_SLEEP diff --git a/platform/centec-arm64/tsingma-bsp/src/rtc-sd2405/rtc-sd2405.c b/platform/centec-arm64/tsingma-bsp/src/rtc-sd2405/rtc-sd2405.c index 671784f11..f448b418b 100644 --- a/platform/centec-arm64/tsingma-bsp/src/rtc-sd2405/rtc-sd2405.c +++ b/platform/centec-arm64/tsingma-bsp/src/rtc-sd2405/rtc-sd2405.c @@ -210,7 +210,7 @@ sd2405_probe(struct i2c_client *client, const struct i2c_device_id *id) if (IS_ERR(rtc)) return PTR_ERR(rtc); rtc->ops = &sd2405_rtc_ops; - ret = rtc_register_device(rtc); + ret = devm_rtc_register_device(rtc); if (ret) return ret; diff --git a/platform/centec/centec-dal/dal_kernel.c b/platform/centec/centec-dal/dal_kernel.c index b70361825..9beeabdcd 100644 --- a/platform/centec/centec-dal/dal_kernel.c +++ b/platform/centec/centec-dal/dal_kernel.c @@ -1935,10 +1935,10 @@ int linux_dal_pcie_probe(struct pci_dev* pdev, const struct pci_device_id* id) pdev->vendor, pdev->device); } - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); if (ret) { - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (ret) { printk("Could not set PCI DMA Mask\n"); diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile index a7839bc06..14ab54bf1 100644 --- a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile @@ -1,3 +1,3 @@ -KBUILD_EXTRA_SYMBOLS = /sonic/platform/centec-arm64/sonic-platform-modules-e530/pca954x/Module.symvers +KBUILD_EXTRA_SYMBOLS = /sonic/platform/centec/sonic-platform-modules-e582/pca954x/Module.symvers obj-m := centec_e582_48x2q4z_platform.o diff --git a/platform/centec/sonic-platform-modules-e582/debian/rules b/platform/centec/sonic-platform-modules-e582/debian/rules index 4f7100f11..a2758ad38 100755 --- a/platform/centec/sonic-platform-modules-e582/debian/rules +++ b/platform/centec/sonic-platform-modules-e582/debian/rules @@ -6,21 +6,23 @@ KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) MODULE_DIRS:= 48x6q 48x2q4z -PCA954X_DIR := pca954x +KDAL_DIR := centec-dal/ +PCA954X_DIR := pca954x/ %: dh $@ override_dh_auto_build: - (for mod in $(MODULE_DIRS); do \ - make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + cp ../../centec/centec-dal/ $(MOD_SRC_DIR)/$(KDAL_DIR) -rf + (for mod in $(KDAL_DIR); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \ done) (for mod in $(PCA954X_DIR); do \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \ done) - rm $(MOD_SRC_DIR)/centec-dal -rf - cp $(MOD_SRC_DIR)/../centec-dal $(MOD_SRC_DIR)/centec-dal -rf - make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/centec-dal + (for mod in $(MODULE_DIRS); do \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + done) override_dh_auto_install: (for mod in $(MODULE_DIRS); do \ @@ -41,7 +43,6 @@ override_dh_clean: rm -rf $(MOD_SRC_DIR)/$${mod}/modules/*.ko; \ rm -rf debian/platform-modules-e582-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR)/*.ko; \ done) - make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/centec-dal clean; \ rm -rf $(MOD_SRC_DIR)/centec-dal/*.ko; \ rm $(MOD_SRC_DIR)/centec-dal -rf diff --git a/platform/centec/sonic-platform-modules-e582/pca954x/ctc-i2c-mux-pca954x.c b/platform/centec/sonic-platform-modules-e582/pca954x/ctc-i2c-mux-pca954x.c index 3c14bae66..466b6d626 100644 --- a/platform/centec/sonic-platform-modules-e582/pca954x/ctc-i2c-mux-pca954x.c +++ b/platform/centec/sonic-platform-modules-e582/pca954x/ctc-i2c-mux-pca954x.c @@ -535,14 +535,13 @@ fail_cleanup: return ret; } -static int pca954x_remove(struct i2c_client *client) +static void pca954x_remove(struct i2c_client *client) { struct i2c_mux_core *muxc = i2c_get_clientdata(client); device_remove_file(&client->dev, &dev_attr_idle_state); pca954x_cleanup(muxc); - return 0; } #ifdef CONFIG_PM_SLEEP diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/modules/rtc-sd2405.c b/platform/centec/sonic-platform-modules-v682/48x8c/modules/rtc-sd2405.c index c22ab3349..9307f1811 100644 --- a/platform/centec/sonic-platform-modules-v682/48x8c/modules/rtc-sd2405.c +++ b/platform/centec/sonic-platform-modules-v682/48x8c/modules/rtc-sd2405.c @@ -229,7 +229,7 @@ sd2405_probe(struct i2c_client *client, const struct i2c_device_id *id) i2c_set_clientdata(client, rtc); rtc->ops = &sd2405_rtc_ops; - return rtc_register_device(rtc); + return devm_rtc_register_device(rtc); } static struct i2c_device_id sd2405_id[] = { diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/modules/rtc-sd2405.c b/platform/centec/sonic-platform-modules-v682/48y8c/modules/rtc-sd2405.c index c22ab3349..9307f1811 100644 --- a/platform/centec/sonic-platform-modules-v682/48y8c/modules/rtc-sd2405.c +++ b/platform/centec/sonic-platform-modules-v682/48y8c/modules/rtc-sd2405.c @@ -229,7 +229,7 @@ sd2405_probe(struct i2c_client *client, const struct i2c_device_id *id) i2c_set_clientdata(client, rtc); rtc->ops = &sd2405_rtc_ops; - return rtc_register_device(rtc); + return devm_rtc_register_device(rtc); } static struct i2c_device_id sd2405_id[] = { diff --git a/platform/centec/sonic-platform-modules-v682/debian/rules b/platform/centec/sonic-platform-modules-v682/debian/rules index 2e0e0dc0f..bf49ae97a 100755 --- a/platform/centec/sonic-platform-modules-v682/debian/rules +++ b/platform/centec/sonic-platform-modules-v682/debian/rules @@ -41,7 +41,7 @@ build: (for mod in $(MODULE_DIRS); do \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ cd $${mod}; \ - python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + python3 -m build --wheel --no-isolation --outdir $(MOD_SRC_DIR)/$${mod}/modules; \ cd -; \ done) # third party driver for cpu card