Skip to content

Commit

Permalink
Update Makefile to provision the ability of building with non-upstrea…
Browse files Browse the repository at this point in the history
…m patches (#296)

* Update Makefile to include non-upstream patches

This adds the ability to include patches that are not yet upstream into the kernel build. This is not meant to be used in regular SONiC builds.

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

* Fix external link approach

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

* Use MLNX_PATCH_LOC as an absolute path

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

* Use MLNX_PATCH_LOC as absolute path

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

* Update minor mistake

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

* Removed hard-coded req on compression algo

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

* Handle Comments

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

* Minor update

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

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
  • Loading branch information
vivekrnv authored Oct 28, 2022
1 parent 3b95205 commit 686b9b1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ SOURCE_FILE_BASE_URL="https://sonicstorage.blob.core.windows.net/debian-security
DSC_FILE_URL = "$(SOURCE_FILE_BASE_URL)/$(DSC_FILE)"
DEBIAN_FILE_URL = "$(SOURCE_FILE_BASE_URL)/$(DEBIAN_FILE)"
ORIG_FILE_URL = "$(SOURCE_FILE_BASE_URL)/$(ORIG_FILE)"
NON_UP_DIR = /tmp/non_upstream_patches

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Obtaining the Debian kernel source
Expand Down Expand Up @@ -99,6 +100,27 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
stg repair
stg import -s ../patch/series

rm -rf $(NON_UP_DIR)
mkdir -p $(NON_UP_DIR)

if [ ! -z ${EXTERNAL_KERNEL_PATCH_URL} ]; then
wget $(EXTERNAL_KERNEL_PATCH_URL) -O patches.tar
tar -xf patches.tar -C $(NON_UP_DIR)
fi

# Precedence is given for external URL
if [ -z ${EXTERNAL_KERNEL_PATCH_URL} ] && [ x${INCLUDE_EXTERNAL_PATCH_TAR} == xy ]; then
if [ -f "$(EXTERNAL_KERNEL_PATCH_TAR)" ]; then
tar -xf $(EXTERNAL_KERNEL_PATCH_TAR) -C $(NON_UP_DIR)
fi
fi

if [ -f "$(NON_UP_DIR)/series" ]; then
echo "External Patches applied:"
cat $(NON_UP_DIR)/series
stg import -s $(NON_UP_DIR)/series
fi

# Optionally add/remove kernel options
if [ -f ../manage-config ]; then
../manage-config $(CONFIGURED_ARCH) $(CONFIGURED_PLATFORM)
Expand Down

0 comments on commit 686b9b1

Please sign in to comment.