Skip to content

Commit 686b9b1

Browse files
authored
Update Makefile to provision the ability of building with non-upstream patches (sonic-net#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 <[email protected]> * Fix external link approach Signed-off-by: Vivek Reddy <[email protected]> * Use MLNX_PATCH_LOC as an absolute path Signed-off-by: Vivek Reddy <[email protected]> * Use MLNX_PATCH_LOC as absolute path Signed-off-by: Vivek Reddy <[email protected]> * Update minor mistake Signed-off-by: Vivek Reddy <[email protected]> * Removed hard-coded req on compression algo Signed-off-by: Vivek Reddy <[email protected]> * Handle Comments Signed-off-by: Vivek Reddy <[email protected]> * Minor update Signed-off-by: Vivek Reddy <[email protected]> Signed-off-by: Vivek Reddy <[email protected]>
1 parent 3b95205 commit 686b9b1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Makefile

+22
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ SOURCE_FILE_BASE_URL="https://sonicstorage.blob.core.windows.net/debian-security
5656
DSC_FILE_URL = "$(SOURCE_FILE_BASE_URL)/$(DSC_FILE)"
5757
DEBIAN_FILE_URL = "$(SOURCE_FILE_BASE_URL)/$(DEBIAN_FILE)"
5858
ORIG_FILE_URL = "$(SOURCE_FILE_BASE_URL)/$(ORIG_FILE)"
59+
NON_UP_DIR = /tmp/non_upstream_patches
5960

6061
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
6162
# Obtaining the Debian kernel source
@@ -99,6 +100,27 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
99100
stg repair
100101
stg import -s ../patch/series
101102

103+
rm -rf $(NON_UP_DIR)
104+
mkdir -p $(NON_UP_DIR)
105+
106+
if [ ! -z ${EXTERNAL_KERNEL_PATCH_URL} ]; then
107+
wget $(EXTERNAL_KERNEL_PATCH_URL) -O patches.tar
108+
tar -xf patches.tar -C $(NON_UP_DIR)
109+
fi
110+
111+
# Precedence is given for external URL
112+
if [ -z ${EXTERNAL_KERNEL_PATCH_URL} ] && [ x${INCLUDE_EXTERNAL_PATCH_TAR} == xy ]; then
113+
if [ -f "$(EXTERNAL_KERNEL_PATCH_TAR)" ]; then
114+
tar -xf $(EXTERNAL_KERNEL_PATCH_TAR) -C $(NON_UP_DIR)
115+
fi
116+
fi
117+
118+
if [ -f "$(NON_UP_DIR)/series" ]; then
119+
echo "External Patches applied:"
120+
cat $(NON_UP_DIR)/series
121+
stg import -s $(NON_UP_DIR)/series
122+
fi
123+
102124
# Optionally add/remove kernel options
103125
if [ -f ../manage-config ]; then
104126
../manage-config $(CONFIGURED_ARCH) $(CONFIGURED_PLATFORM)

0 commit comments

Comments
 (0)