From: Bruce Ashfield <bruce.ashfi...@gmail.com>

The ability to patch the kernel-yocto metadata was added to support
debug and easier test cycles on kernel-cache provided fragments. As
such, it was very simple and has limited functionality.

That being said, it is an available feature and can be improved to
handle patches that fail to apply.

The main kernel patching is already handled by the kern-tools, so
we extend the patching of the meta-data to same tools and inherit
more functinality from the scripts.

[YOCTO #15266]

Signed-off-by: Bruce Ashfield <bruce.ashfi...@gmail.com>
Signed-off-by: Richard Purdie <richard.pur...@linuxfoundation.org>
(cherry picked from commit e867addd6c2f508f7a95e72222e750d37f3d19d8)
Signed-off-by: Steve Sakoman <st...@sakoman.com>
---
 meta/classes-recipe/kernel-yocto.bbclass | 30 ++++++++++++++++++++----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/meta/classes-recipe/kernel-yocto.bbclass 
b/meta/classes-recipe/kernel-yocto.bbclass
index 4ac977b122..4b7c0b829f 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -176,12 +176,32 @@ do_kernel_metadata() {
                # kernel source tree, where they'll be used later.
                check_git_config
                patches="${@" ".join(find_patches(d,'kernel-meta'))}"
-               for p in $patches; do
+               if [ -n "$patches" ]; then
                    (
-                       cd ${WORKDIR}/kernel-meta
-                       git am -s $p
-                   )
-               done
+                           cd ${WORKDIR}/kernel-meta
+
+                           # take the SRC_URI patches, and create a series file
+                           # this is required to support some better processing
+                           # of issues with the patches
+                           rm -f series
+                           for p in $patches; do
+                               cp $p .
+                               echo "$(basename $p)" >> series
+                           done
+
+                           # process the series with kgit-s2q, which is what is
+                           # handling the rest of the kernel. This allows us
+                           # more flexibility for handling failures or advanced
+                           # mergeing functinoality
+                           message=$(kgit-s2q --gen -v --patches 
${WORKDIR}/kernel-meta 2>&1)
+                           if [ $? -ne 0 ]; then
+                               # setup to try the patch again
+                               kgit-s2q --prev
+                               bberror "Problem applying patches to: 
${WORKDIR}/kernel-meta"
+                               bbfatal_log "\n($message)"
+                           fi
+                       )
+               fi
        fi
 
        sccs_from_src_uri="${@" ".join(find_sccs(d))}"
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192218): 
https://lists.openembedded.org/g/openembedded-core/message/192218
Mute This Topic: https://lists.openembedded.org/mt/103130299/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to