Message ID | 20231014141442.6352-1-olivierdautricourt@gmail.com |
---|---|
State | New |
Headers | show |
Series | [RFC] kernel.bbclass: make scripts_gdb when CONFIG_GDB_SCRIPTS=y and target is available | expand |
On Sat, Oct 14, 2023 at 10:14 AM Olivier Dautricourt <olivierdautricourt@gmail.com> wrote: > > Since Commit 67274c083438340ad16c ("scripts/gdb: delay generation of gdb > constants.py") in kernel source tree (>=V5.1), scripts_gdb target needs > explicit run to build scripts/gdb. (vmlinux-gdb.py script is used by gdb for > linux kernel integration). > > As this step was previously not needed, this suggest newer kernels builds > do not bundle it anymore, this change provides the same functionalities > for kernels >=V5.1 . It also suggests that very few people use the integration :) > > Signed-off-by: Olivier Dautricourt <olivierdautricourt@gmail.com> > --- > meta/classes-recipe/kernel.bbclass | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass > index 2ec9ea2091..5206b4f2a7 100644 > --- a/meta/classes-recipe/kernel.bbclass > +++ b/meta/classes-recipe/kernel.bbclass > @@ -394,6 +394,9 @@ kernel_do_compile() { > for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do > oe_runmake ${PARALLEL_MAKE} ${typeformake} ${KERNEL_EXTRA_ARGS} $use_alternate_initrd > done > + if (grep -q -i -e '^CONFIG_GDB_SCRIPTS=y$' .config && grep -q -e "^PHONY +=.*scripts_gdb" "${S}/Makefile"); then > + oe_runmake ${PARALLEL_MAKE} scripts_gdb > + fi We really try to avoid using any explicit checks for CONFIG_* in the kernel classes or using them to coordinate functionality. While I don't think that this is a significant issue here (since what is being built is small and it is isolated), it is something that could be coordinated via a distro feature as the main "on off" switch. We already have some debug distro features, and I could see this being something that could trigger when they are enabled (and for kernel-yocto derived kernels, it could also ensure that gdb functionality is enabled via a fragment). I'd also suggest that this could be placed into a separate task like we do for modules. Again, the build here is small, but it is something outside of the core kernel build which is the purpose of do_compile in the kernel classes. As a task, it also would be easy enough for other users to override if it causes them issues. Cheers, Bruce > } > > kernel_do_transform_kernel() { > -- > 2.42.0 >
On Sat, Oct 14, 2023 at 10:30:48AM -0400, Bruce Ashfield wrote: > On Sat, Oct 14, 2023 at 10:14 AM Olivier Dautricourt > <olivierdautricourt@gmail.com> wrote: > > > > Since Commit 67274c083438340ad16c ("scripts/gdb: delay generation of gdb > > constants.py") in kernel source tree (>=V5.1), scripts_gdb target needs > > explicit run to build scripts/gdb. (vmlinux-gdb.py script is used by gdb for > > linux kernel integration). > > > > As this step was previously not needed, this suggest newer kernels builds > > do not bundle it anymore, this change provides the same functionalities > > for kernels >=V5.1 . > > It also suggests that very few people use the integration :) > > > > > Signed-off-by: Olivier Dautricourt <olivierdautricourt@gmail.com> > > --- > > meta/classes-recipe/kernel.bbclass | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass > > index 2ec9ea2091..5206b4f2a7 100644 > > --- a/meta/classes-recipe/kernel.bbclass > > +++ b/meta/classes-recipe/kernel.bbclass > > @@ -394,6 +394,9 @@ kernel_do_compile() { > > for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do > > oe_runmake ${PARALLEL_MAKE} ${typeformake} ${KERNEL_EXTRA_ARGS} $use_alternate_initrd > > done > > + if (grep -q -i -e '^CONFIG_GDB_SCRIPTS=y$' .config && grep -q -e "^PHONY +=.*scripts_gdb" "${S}/Makefile"); then > > + oe_runmake ${PARALLEL_MAKE} scripts_gdb > > + fi > > We really try to avoid using any explicit checks for CONFIG_* in the kernel > classes or using them to coordinate functionality. While I don't think that this > is a significant issue here (since what is being built is small and it > is isolated), > it is something that could be coordinated via a distro feature as the main > "on off" switch. We already have some debug distro features, and I could see > this being something that could trigger when they are enabled (and for > kernel-yocto derived kernels, it could also ensure that gdb functionality is > enabled via a fragment). > > I'd also suggest that this could be placed into a separate task like we do > for modules. Again, the build here is small, but it is something outside of the > core kernel build which is the purpose of do_compile in the kernel classes. > As a task, it also would be easy enough for other users to override if it causes > them issues. > > Cheers, > > Bruce Thanks for the quick reply. I understood your points and i will see how to better integrate this. Kind Regards, Olivier
diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass index 2ec9ea2091..5206b4f2a7 100644 --- a/meta/classes-recipe/kernel.bbclass +++ b/meta/classes-recipe/kernel.bbclass @@ -394,6 +394,9 @@ kernel_do_compile() { for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do oe_runmake ${PARALLEL_MAKE} ${typeformake} ${KERNEL_EXTRA_ARGS} $use_alternate_initrd done + if (grep -q -i -e '^CONFIG_GDB_SCRIPTS=y$' .config && grep -q -e "^PHONY +=.*scripts_gdb" "${S}/Makefile"); then + oe_runmake ${PARALLEL_MAKE} scripts_gdb + fi } kernel_do_transform_kernel() {
Since Commit 67274c083438340ad16c ("scripts/gdb: delay generation of gdb constants.py") in kernel source tree (>=V5.1), scripts_gdb target needs explicit run to build scripts/gdb. (vmlinux-gdb.py script is used by gdb for linux kernel integration). As this step was previously not needed, this suggest newer kernels builds do not bundle it anymore, this change provides the same functionalities for kernels >=V5.1 . Signed-off-by: Olivier Dautricourt <olivierdautricourt@gmail.com> --- meta/classes-recipe/kernel.bbclass | 3 +++ 1 file changed, 3 insertions(+)