Skip to content
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

Added BUILD flags to provision for building the kernel with non-upstream patches #12428

Merged
merged 12 commits into from
Oct 31, 2022

Conversation

vivekrnv
Copy link
Contributor

@vivekrnv vivekrnv commented Oct 18, 2022

Signed-off-by: Vivek Reddy vkarri@nvidia.com

Why I did it

Provide a way to include non-upstream kernel patches in the kernel build process

Requires sonic-net/sonic-linux-kernel#296 and can be merged in any order

How I did it

Introduced two new environment variables:

EXTERNAL_KERNEL_PATCH_URL = <url to the archive containing patches>, empty by default
INCLUDE_EXTERNAL_PATCH_TAR= <y|n to include the patches under platform/ folder> 'n' by default

Note: For INCLUDE_EXTERNAL_PATCH_TAR to work, the platform has to override EXTERNAL_KERNEL_PATCH_TAR variable. And the variable should be a path pointing to the tarball containing patches

Use SONIC_OVERRIDE_BUILD_VARS to fuse in these env variables:

- NOJESSIE=1 NOSTRETCH=1 NOBUSTER=1 make SONIC_OVERRIDE_BUILD_VARS=' INCLUDE_EXTERNAL_PATCH_TAR=y ' target/debs/bullseye/linux-headers-5.10.0-12-2-common_5.10.103-1_all.deb
- NOJESSIE=1 NOSTRETCH=1 NOBUSTER=1 make SONIC_OVERRIDE_BUILD_VARS=' EXTERNAL_KERNEL_PATCH_URL=http://<url-root>/loc/patches.tar.gz ' target/debs/bullseye/linux-headers-5.10.0-12-2-common_5.10.103-1_all.deb

Structure of the patch tar archive

  1. It should contain a file named series. series should provide an order of which the patches have to be applied
  2. All the patches should be present in the archive in the same folder where series resides.
  3. Developers should make sure patches apply cleanly over the existing patches present in the sonic-linux-kernel/ repo.
admin@build-server:/sonic-buildimage/platform/mellanox/non-upstream-patches$ tar -tf patches.tar.gz
./
./mlx5-Implement-get_module_eeprom_by_page.patch
./mlx5-Add-support-for-DSFP-module-EEPROM-dumps.patch
./series
./mlx5-Refactor-module-EEPROM-query.patch

How to verify it

  1. Build the kernel
  2. Check if the patches are applied on the kernel source
vkarri@build-server:/sonic-buildimage/src/sonic-linux-kernel/linux-5.10.103$ git log --oneline -n 4
a524105fc (HEAD -> master, refs/patches/master/mlx5-Add-support-for-DSFP-module-EEPROM-dumps.patch) From 4c88fa412a100f925b8ab1aa952a672895f69d35 Mon Sep 17 00:00:00 2001 Subject: net/mlx5: Add support for DSFP module EEPROM dumps

8f366b27c (refs/patches/master/mlx5-Implement-get_module_eeprom_by_page.patch) From e109d2b204daa223e6d3cdaa369071c3ea96dcbf Mon Sep 17 00:00:00 2001 Subject: net/mlx5: Implement get_module_eeprom_by_page()

eb9bddfad (refs/patches/master/mlx5-Refactor-module-EEPROM-query.patch) From e19b0a3474ab9ef90dd110af9f39fc87329755f1 Mon Sep 17 00:00:00 2001 Subject: net/mlx5: Refactor module EEPROM query

cf79fff3a (refs/patches/master/armhf_secondary_boot_online.patch) From 500d48948f43d18a07894b5fd4f891afbade1d79 Mon Sep 17 00:00:00 2001

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205

Description for the changelog

Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

vivekrnv and others added 4 commits October 7, 2022 17:46
Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
@vivekrnv vivekrnv changed the title Added BUILD time flags to provision for including Non Upstream kernel patches Added BUILD flags to provision for building the kernel with non-upstream patches Oct 18, 2022
@vivekrnv vivekrnv marked this pull request as ready for review October 18, 2022 06:01
Copy link
Contributor

@paulmenzel paulmenzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use imperative mood in git commit messages summaries/titles, and merge/pull request summaries/titles. s/Added/Add/

### Structure of the patch archive

1. The tarball should be gzip compressed i.e. of extension .tar.gz
2. It should contain a file named series. series should provide an order of which the patches have to be applied
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please elaborate, how to create such a series file.

@@ -51,4 +51,9 @@ $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(APPLIBS) $(SX_COMPLIB) $(SXD_LIBS) $(SX_
# Force the target bootloader for mellanox platforms to grub regardless of arch
TARGET_BOOTLOADER = grub

# Set y to include non upstream patches for mellanox
INCLUDE_MLNX_PATCHES = n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Can’t patches for other subsystems be included?

Copy link
Contributor Author

@vivekrnv vivekrnv Oct 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other subsystems planning to include non-upstream patches can use EXTERNAL_KERNEL_PATCHES flag to provide a public accessible link to the tarball

@liat-grozovik
Copy link
Collaborator

@saiarcot895 please review

@vivekrnv vivekrnv requested a review from saiarcot895 October 18, 2022 22:42
@vivekrnv
Copy link
Contributor Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vivekrnv
Copy link
Contributor Author

@saiarcot895, I've updated the pr according to the comments given sonic-net/sonic-linux-kernel#296. Can you also review this?

@saiarcot895 saiarcot895 merged commit 5d83d42 into sonic-net:master Oct 31, 2022
Junchao-Mellanox pushed a commit to Junchao-Mellanox/sonic-buildimage that referenced this pull request Jan 27, 2025
…eam patches (sonic-net#12428)

* Added ENV vars for non-upstream patches

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>

* Made MLNX_PATCH_LOC an absolute path

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>

* Added non-upstream-patches dir

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>

* Update README.md

* Addressed comments

* Env vars updated

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>

* Readme updated

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants