Apply and commit a patch from bitbake recipe

孤街浪徒 提交于 2020-07-20 04:19:11

问题


I am observing that the yocto build system is just applying my patch instead of applying and committing the patch on the cloned git repo.

Original bitbake (u-boot-ti-staging_2018.01.bb) file.

require u-boot-ti.inc

PR = "r19"

BRANCH = "ti-u-boot-2018.01"

SRCREV = "8b2f1df4b55bc0797399a21d42ac191d44f99227"

Modified bitbake file, added SRC_URI to the file.

require u-boot-ti.inc

PR = "r19"

BRANCH = "ti-u-boot-2018.01"

SRCREV = "8b2f1df4b55bc0797399a21d42ac191d44f99227"

SRC_URI += "file://0001-Stopping-DHCP-server-giving-new-serverip.patch \
        "

I have added a patch file under files directory. The content of the patch (0001-Stopping-DHCP-server-giving-new-serverip.patch) file is as follows.

From cf97b6053f00afd496d01a892599cd8f4b254087 Mon Sep 17 00:00:00 2001
From: Sunny Shukla <sunny.shukla@xyz.com>
Date: Wed, 19 Sep 2018 18:23:49 +0530
Subject: [PATCH] Stopping DHCP server giving new serverip

Added CONFIG_BOOTP_SERVERIP in the config file, this
stops the DHCP server gives new "serverip" address and 
overrides the current one.
---
 include/configs/am335x_evm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 01f0277..4b3047d 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -18,6 +18,8 @@

 #include <configs/ti_am335x_common.h>

+#define CONFIG_BOOTP_SERVERIP
+
 #ifndef CONFIG_SPL_BUILD
 # define CONFIG_TIMESTAMP
 #endif
-- 
2.7.4

The patch is applying like someone is executing a "git apply 0001-Stopping-DHCP-server-giving-new-serverip.patch" command on top of the cloned git repo as show below. But rather I want that the patch must be applied like someone is executing a "git am 0001-Stopping-DHCP-server-giving-new-serverip.patch" command on top of the cloned git repo.

git status

On branch ti-u-boot-2018.01
Your branch is behind 'origin/ti-u-boot-2018.01' by 23 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   include/configs/am335x_evm.h

no changes added to commit (use "git add" and/or "git commit -a") 

I want this patch to be applied and committed on top of the cloned git repo. How to achieve that under a bitbake file?


回答1:


Yocto by default uses quilt when no patch tool is specified. You can specify

PATCHTOOL = "git"

in your recipe, so that Yocto automatically applies it using "git am".

See here for more details.

NOTE: This functionality will start adding an extra line to the patch's description like "%%original patch: 0001-Stopping-DHCP-server-giving-new-serverip.patch" while applying the patch. To get rid of it, comment the below line under "oe-core/meta/lib/oe/patch.py" file.

https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/lib/oe/patch.py#n519



来源:https://stackoverflow.com/questions/52423683/apply-and-commit-a-patch-from-bitbake-recipe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!