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 2 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
52 changes: 31 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,37 @@ 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 [ ! -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_PATCHES} == xy ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we had a discussion on the variable naming in #296, but since this is being renamed to INCLUDE_EXTERNAL_PATCHES, can EXTERNAL_KERNEL_PATCH_URL fall under that, such that if INCLUDE_EXTERNAL_PATCHES is set to n, then nothing happens, even if EXTERNAL_KERNEL_PATCH_URL is specified?

Copy link
Contributor Author

@vivekrnv vivekrnv Mar 31, 2023

Choose a reason for hiding this comment

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

That means user has to provide both EXTERNAL_KERNEL_PATCH_URL & INCLUDE_EXTERNAL_PATCHES, if they wish to use non-upstream patches from an external URL. Why have two control options? INCLUDE_EXTERNAL_PATCHES is for locally saved non-up patches. atleast that's how i thought of

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@saiarcot895 Do you think it makes more sense to make INCLUDE_EXTERNAL_PATCHES a mandatory parameter.

Copy link
Contributor

Choose a reason for hiding this comment

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

My thought was that because of the name INCLUDE_EXTERNAL_PATCHES, it is a parameter whether to include external patches at all, and that EXTERNAL_KERNEL_PATCH_URL is one source of those external patches.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, will update it then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handled

if [ -d "$(EXTERNAL_KERNEL_PATCH_LOC)" ]; then
cp -r $(EXTERNAL_KERNEL_PATCH_LOC)/* $(NON_UP_DIR)/
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 +133,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