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

Provision the ability to apply the non upstream patches in any order #313

Merged
merged 4 commits into from
Apr 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 30 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,36 @@ ORIG_FILE_URL = "$(SOURCE_FILE_BASE_URL)/$(ORIG_FILE)"
NON_UP_DIR = /tmp/non_upstream_patches

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Include any non upstream patches
rm -rf $(NON_UP_DIR)
mkdir -p $(NON_UP_DIR)

if [ x${INCLUDE_EXTERNAL_PATCHES} == xy ]; then
if [ ! -z ${EXTERNAL_KERNEL_PATCH_URL} ]; then
wget $(EXTERNAL_KERNEL_PATCH_URL) -O patches.tar
tar -xf patches.tar -C $(NON_UP_DIR)
else
if [ -d "$(EXTERNAL_KERNEL_PATCH_LOC)" ]; then
cp -r $(EXTERNAL_KERNEL_PATCH_LOC)/* $(NON_UP_DIR)/
fi
fi
fi

if [ -f "$(NON_UP_DIR)/series.patch" ]; then
saiarcot895 marked this conversation as resolved.
Show resolved Hide resolved
echo "Patch the series file"
cat $(NON_UP_DIR)/series.patch
pushd patch
# clear any unstaged changes
git stash -- series
git apply $(NON_UP_DIR)/series.patch
popd

if [ -d "$(NON_UP_DIR)/patches" ]; then
echo "Copy the non upstream patches"
cp $(NON_UP_DIR)/patches/*.patch patch/
fi
fi

# Obtaining the Debian kernel source
rm -rf $(BUILD_DIR)
wget -O $(DSC_FILE) $(DSC_FILE_URL)
Expand Down Expand Up @@ -102,27 +132,6 @@ $(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) $(SECURE_UPGRADE_MODE) $(SECURE_UPGRADE_DEV_SIGNING_CERT)
Expand Down