Add task to create kernel config fragments
v2 cover Add task to create kernel config fragments
Changes in v2:
- address Darren
- task name, using diffconfig
- except on failure
- space after ','
- printing the path to fragment
- address RP's comments (import os)
Hi,
These patches add a new task called fragmentconfig which should be used when the user need to extract a diff between two kernel config files.
For instance:
bitbake -c menuconfig linux-yoco
[do some changes and save]
bitbake -c fragmentconfig linux-yocto
See the fragment.cfg in $WORKDIR/fragment.cfg
This closes [YOCTO #3862]
Thanks.
João Henrique Ferreira de Freitas (2):
kernel-yocto: Add do_diffconfig task
cml1.bbclass: Add diffconfig task to cml1
meta/classes/cml1.bbclass | 33 +++++++++++++++++++++++++++++++++ meta/classes/kernel-yocto.bbclass | 2 ++ 2 files changed, 35 insertions(+)
Signature · 1 line
1.8.3.2
PATCH v2 1/2 kernel-yocto: Add do_diffconfig task
Instead of using 'diff' command between two kernel config files, the task diffconfig does the job creating the file $WORKDIR/fragment.cfg that user should review and use.
[YOCTO #3862]
--- meta/classes/kernel-yocto.bbclass | 2 ++ 1 file changed, 2 insertions(+)
meta/classes/kernel-yocto.bbclass +2 -0
@@ -411,3 +411,5 @@ do_kernel_link_vmlinux() { OE_TERMINAL_EXPORTS += "GUILT_BASE KBUILD_OUTPUT" GUILT_BASE = "meta" KBUILD_OUTPUT = "${B}" + +do_diffconfig[depends] += "virtual/kernel:do_kernel_configme"
Signature · 1 line
1.8.3.2
Re: [PATCH v2 1/2] kernel-yocto: Add do_diffconfig task
Quoted 7 lines · João Henrique Ferreira de Freitas
Instead of using 'diff' command between two kernel config files, the task diffconfig does the job creating the file $WORKDIR/fragment.cfg that user should review and use.
[YOCTO #3862]
Signed-off-by João Henrique Ferreira de Freitas <[email protected]>
Signature · 3 lines
Darren Hart Yocto Project - Linux Kernel Intel Open Source Technology Center
PATCH v2 2/2 cml1.bbclass: Add diffconfig task to cml1
In reply to João Henrique Ferreira de Freitasdiffconfig() is a new task that makes a diff between the old and new config files and writes to the fragment.cfg result file. menuconfig() always copy the original config file, so the user doesn't need to copy it.
--- meta/classes/cml1.bbclass | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
meta/classes/cml1.bbclass +33 -0
@@ -16,8 +16,11 @@ HOST_LOADLIBES = "-lncurses" TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo" python do_menuconfig() { + import shutil + try: mtime = os.path.getmtime(".config") + shutil.copy(".config", ".config.orig") except OSError: mtime = 0
@@ -38,3 +41,33 @@ do_menuconfig[depends] += "ncurses-native:do_populate_sysroot" do_menuconfig[nostamp] = "1" addtask menuconfig after do_configure +python do_diffconfig() { + import shutil + import subprocess + + workdir = d.getVar('WORKDIR', True) + fragment = workdir + '/fragment.cfg' + configorig = '.config.orig' + config = '.config' + + try: + md5newconfig = bb.utils.md5_file(configorig) + md5config = bb.utils.md5_file(config) + isdiff = md5newconfig != md5config + except IOError as e: + bb.fatal("No config files found. Did you do menuconfig ?\n%s" % e) + + if isdiff: + statement = 'diff -Nurp ' + configorig + ' ' + config + '| sed -n "s/^\+//p" >' + fragment + subprocess.call(statement, shell=True) + + shutil.copy(configorig, config) + + bb.plain("Config fragment has been dumped into:\n %s" % fragment) + else: + if os.path.exists(fragment): + os.unlink(fragment) +} + +do_diffconfig[nostamp] = "1" +addtask diffconfig
Signature · 1 line
1.8.3.2
Re: [PATCH v2 2/2] cml1.bbclass: Add diffconfig task to cml1
Quoted 6 lines · João Henrique Ferreira de Freitas
diffconfig()is a new task that makes a diff between the old and new config files and writes to the fragment.cfg result file.menuconfig()always copy the original config file, so the user doesn't need to copy it.Signed-off-by João Henrique Ferreira de Freitas <[email protected]>
Signature · 3 lines
Darren Hart Yocto Project - Linux Kernel Intel Open Source Technology Center
Hello Joao,
Quoted 18 lines · João Henrique Ferreira de Freitas
Changes in v2:
- address Darren
- task name, using diffconfig
- except on failure
- space after ','
- printing the path to fragment- address RP's comments (import os)
Hi,
These patches add a new task called fragmentconfig which should be used when the user need to extract a diff between two kernel config files.
For instance:
bitbake -c menuconfig linux-yoco
Quoted 7 lines
[do some changes and save]
bitbake -c fragmentconfig linux-yocto
See the fragment.cfg in $WORKDIR/fragment.cfg
This closes [YOCTO #3862]
I do like the patchset except that his cover letter seems outdate as the task now is diffconfig. Maybe you could add another task too, which we use quite often in meta-fsl-arm, savedefconfig. This would easy people to generate strimmed versions for use.
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Hi Otavio,
Quoted 2 lines
I do like the patchset except that his cover letter seems outdate as the task now is diffconfig.
You are right.
Quoted 4 lines
Maybe you could add another task too,
which we use quite often in meta-fsl-arm, savedefconfig. This would easy people to generate strimmed versions for use.
Yes, after this patch is accepted, I will prepare the savedefconfig task (cml1.bbclass).
Thanks.
Quoted 5 lines
--
Otavio SalvadorO.S. Systems
http://www.ossystems.com.br http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Signature · 2 lines
João Henrique Ferreira de Freitas - joaohf_at_gmail.com Campinas-SP-Brasil
Hello Joao,
Quoted 7 lines · João Henrique Freitas
Quoted 2 lines
I do like the patchset except that his cover letter seems outdate as the task now is diffconfig.
You are right.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Maybe you could add another task too,
which we use quite often in meta-fsl-arm, savedefconfig. This would easy people to generate strimmed versions for use.Yes, after this patch is accepted, I will prepare the savedefconfig task (cml1.bbclass).
Great; thanks.
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750