[Mellanox] Facilitate automatic integration of sdk kernel patches (#14652)

#### Why I did it

Facilitate Automatic integration of sdk kernel patches into SONiC. 

**Inputs to the Script:**
1) `MLNX_SDK_VERSION` Eg: `4.5.4206`
2) `MLNX_SDK_ISSU_VERSION` Eg: `101` 
 **Note: If nothing is provided the one already present in the sdk.mk file is used**
3) `MLNX_SDK_SOURCE_BASE_URL:` 
 **Note: If nothing is provided the upstream sdk drivers url is used**
4) `CREATE_BRANCH: (y|n)` Creates a branch instead of a commit (optional, default: n) 
5) `BRANCH_SONIC`:  Only relevant when CREATE_BRANCH is y. `Default: master`. 

Note: These should be provided through `SONIC_OVERRIDE_BUILD_VARS ` parameter

**Output:**
1) Script creates a commit in sonic-linux-kernel with any updates to sdk-kernel patches in sonic in accordance with the version provided by  `MLNX_SDK_VERSION`

**Note: Script Doesn't commit anything to linux-kernel when there aren't any changes required..**  

#### How I did it

1) Added a new make target which can be invoked by calling `make integrate-mlnx-sdk`

```
user@server:/sonic-buildimage/src/sonic-linux-kernel$ git rev-parse --abbrev-ref HEAD
master_6f38dca_integrate_4.5.4206

user@server:/sonic-buildimage/src/sonic-linux-kernel$ git log --oneline -n 1
d64d1e7 (HEAD -> master_6f38dca_integrate_4.5.4206) Intgerate MLNX SDK 4.5.4206 Kernel Patches
```

Changes made will be summarized under `sonic-buildimage/integrate-mlnx-sdk_user.out` file. Debugging and troubleshooting output is written to `sonic-buildimage/integrate-mlnx-sdk.log` files

[log_files.zip](https://github.com/sonic-net/sonic-buildimage/files/11226441/log_files.zip)


#### Limitations:
1) Assumes that the sdk kernel patches are always upstreamed

#### How to verify it

Build the Kernel and test
This commit is contained in:
Vivek
2023-05-29 22:24:06 -07:00
committed by GitHub
parent 220ea74cbb
commit 6852fcdc24
8 changed files with 601 additions and 26 deletions

View File

@@ -110,14 +110,6 @@ def load_patch_table(path, k_version):
table.append(table_line)
return table
def build_commit_description(changes):
if not changes:
return ""
content = "\n"
content = content + " ## Patch List\n"
for key, value in changes.items():
content = content + f"* {key} : {value}\n"
return content
class Data:
# list of new upstream patches
@@ -394,17 +386,12 @@ class PostProcess(HwMgmtAction):
old_non_up_patches = [ptch.strip() for ptch in Data.old_non_up]
return old_up_patches, old_non_up_patches
def parse_id(self, id_):
if id_:
id_ = "https://github.com/gregkh/linux/commit/" + id_
return id_
def create_commit_msg(self, table):
title = COMMIT_TITLE.format(self.args.hw_mgmt_ver)
changes_slk, changes_sb = {}, {}
old_up_patches, old_non_up_patches = self.list_patches()
for patch in table:
id_ = self.parse_id(patch.get(COMMIT_ID, ""))
id_ = parse_id(patch.get(COMMIT_ID, ""))
patch_ = patch.get(PATCH_NAME)
if patch_ in Data.new_up and patch_ not in old_up_patches:
changes_slk[patch_] = id_