From 686b9b16acc1f453cae2a697e9d8009c441c0ab0 Mon Sep 17 00:00:00 2001 From: Vivek Date: Thu, 27 Oct 2022 17:03:59 -0700 Subject: [PATCH] Update Makefile to provision the ability of building with non-upstream 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 * Fix external link approach Signed-off-by: Vivek Reddy * Use MLNX_PATCH_LOC as an absolute path Signed-off-by: Vivek Reddy * Use MLNX_PATCH_LOC as absolute path Signed-off-by: Vivek Reddy * Update minor mistake Signed-off-by: Vivek Reddy * Removed hard-coded req on compression algo Signed-off-by: Vivek Reddy * Handle Comments Signed-off-by: Vivek Reddy * Minor update Signed-off-by: Vivek Reddy Signed-off-by: Vivek Reddy --- Makefile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Makefile b/Makefile index cd1edfcf7..be23e3847 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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)