The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] kbuild: Add vmlinux_install to facilitate debugging
@ 2024-10-07 16:07 Zach Wade
  2024-10-07 16:13 ` Zach Wade
  2024-10-08 17:39 ` Masahiro Yamada
  0 siblings, 2 replies; 3+ messages in thread
From: Zach Wade @ 2024-10-07 16:07 UTC (permalink / raw)
  To: masahiroy; +Cc: nathan, nicolas, linux-kbuild, linux-kernel, Zach Wade

When testing multiple versions of the kernel with the same source code,it 
is often necessary to recompile the kernel, which is time-consuming for 
small hosts. I need to cp vmlinux to the corresponding module directory.
I think adding this will make debugging the kernel a little more 
convenient.

Signed-off-by: Zach Wade <zachwade.k@gmail.com>
---
 Makefile | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Makefile b/Makefile
index c5493c0c0ca1..1caab011599f 100644
--- a/Makefile
+++ b/Makefile
@@ -1579,6 +1579,7 @@ help:
 	@echo  '* vmlinux	  - Build the bare kernel'
 	@echo  '* modules	  - Build all modules'
 	@echo  '  modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
+	@echo  '  vmlinux_install - Install vmlinux to INSTALL_MOD_PATH (default: /)'
 	@echo  '  vdso_install    - Install unstripped vdso to INSTALL_MOD_PATH (default: /)'
 	@echo  '  dir/            - Build all files in dir and below'
 	@echo  '  dir/file.[ois]  - Build specified target only'
@@ -1887,6 +1888,19 @@ modpost: $(if $(single-build),, $(if $(KBUILD_BUILTIN), vmlinux.o)) \
 	 $(if $(KBUILD_MODULES), modules_check)
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 
+# ---------------------------------------------------------------------------
+# vmlinux install
+
+PHONY += vmlinux_install
+
+vmlinux_install:
+	@if [ -f vmlinux ]; then \
+		echo "INSTALL ${MODLIB}/vmlinux"; \
+		cp -f vmlinux ${MODLIB}/ ; \
+	else \
+		echo "vmlinux file does not exist."; \
+	fi
+
 # Single targets
 # ---------------------------------------------------------------------------
 # To build individual files in subdirectories, you can do like this:
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: Add vmlinux_install to facilitate debugging
  2024-10-07 16:07 [PATCH] kbuild: Add vmlinux_install to facilitate debugging Zach Wade
@ 2024-10-07 16:13 ` Zach Wade
  2024-10-08 17:39 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Zach Wade @ 2024-10-07 16:13 UTC (permalink / raw)
  To: masahiroy; +Cc: nathan, nicolas, linux-kbuild, linux-kernel



On 2024/10/8 0:07, Zach Wade wrote:
> When testing multiple versions of the kernel with the same source code,it
> is often necessary to recompile the kernel, which is time-consuming for
> small hosts. I need to cp vmlinux to the corresponding module directory.
> I think adding this will make debugging the kernel a little more
> convenient.
> 
> Signed-off-by: Zach Wade <zachwade.k@gmail.com>
> ---
>   Makefile | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index c5493c0c0ca1..1caab011599f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1579,6 +1579,7 @@ help:
>   	@echo  '* vmlinux	  - Build the bare kernel'
>   	@echo  '* modules	  - Build all modules'
>   	@echo  '  modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
> +	@echo  '  vmlinux_install - Install vmlinux to INSTALL_MOD_PATH (default: /)'
>   	@echo  '  vdso_install    - Install unstripped vdso to INSTALL_MOD_PATH (default: /)'
>   	@echo  '  dir/            - Build all files in dir and below'
>   	@echo  '  dir/file.[ois]  - Build specified target only'
> @@ -1887,6 +1888,19 @@ modpost: $(if $(single-build),, $(if $(KBUILD_BUILTIN), vmlinux.o)) \
>   	 $(if $(KBUILD_MODULES), modules_check)
>   	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
>   
> +# ---------------------------------------------------------------------------
> +# vmlinux install
> +
> +PHONY += vmlinux_install
> +
> +vmlinux_install:
> +	@if [ -f vmlinux ]; then \
> +		echo "INSTALL ${MODLIB}/vmlinux"; \
> +		cp -f vmlinux ${MODLIB}/ ; \
> +	else \
> +		echo "vmlinux file does not exist."; \
> +	fi
> +
>   # Single targets
>   # ---------------------------------------------------------------------------
>   # To build individual files in subdirectories, you can do like this:

Hi Masahiro Yamada,

I think this patch will make me feel comfortable, so I submitted this 
change.
However, this submission may not be perfect. I just put forward my 
ideas. If you think it can be added, you are welcome to point out the 
parts that need to be modified. I will fix them as required and resubmit 
the v2 version.

Thanks,
Zach

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: Add vmlinux_install to facilitate debugging
  2024-10-07 16:07 [PATCH] kbuild: Add vmlinux_install to facilitate debugging Zach Wade
  2024-10-07 16:13 ` Zach Wade
@ 2024-10-08 17:39 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2024-10-08 17:39 UTC (permalink / raw)
  To: Zach Wade; +Cc: nathan, nicolas, linux-kbuild, linux-kernel

On Tue, Oct 8, 2024 at 1:07 AM Zach Wade <zachwade.k@gmail.com> wrote:
>
> When testing multiple versions of the kernel with the same source code,it
> is often necessary to recompile the kernel, which is time-consuming for
> small hosts. I need to cp vmlinux to the corresponding module directory.
> I think adding this will make debugging the kernel a little more
> convenient.
>
> Signed-off-by: Zach Wade <zachwade.k@gmail.com>
> ---
>  Makefile | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index c5493c0c0ca1..1caab011599f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1579,6 +1579,7 @@ help:
>         @echo  '* vmlinux         - Build the bare kernel'
>         @echo  '* modules         - Build all modules'
>         @echo  '  modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
> +       @echo  '  vmlinux_install - Install vmlinux to INSTALL_MOD_PATH (default: /)'
>         @echo  '  vdso_install    - Install unstripped vdso to INSTALL_MOD_PATH (default: /)'
>         @echo  '  dir/            - Build all files in dir and below'
>         @echo  '  dir/file.[ois]  - Build specified target only'
> @@ -1887,6 +1888,19 @@ modpost: $(if $(single-build),, $(if $(KBUILD_BUILTIN), vmlinux.o)) \
>          $(if $(KBUILD_MODULES), modules_check)
>         $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
>
> +# ---------------------------------------------------------------------------
> +# vmlinux install
> +
> +PHONY += vmlinux_install
> +
> +vmlinux_install:
> +       @if [ -f vmlinux ]; then \
> +               echo "INSTALL ${MODLIB}/vmlinux"; \
> +               cp -f vmlinux ${MODLIB}/ ; \
> +       else \
> +               echo "vmlinux file does not exist."; \
> +       fi
> +

This is a very niche use-case.
What if someone else wants to copy vmlinux to /boot/
instead of ${MODLIB}/ ?

People tend to have local scripts to meet personal demands.
The upstream is not a place for that.


>  # Single targets
>  # ---------------------------------------------------------------------------
>  # To build individual files in subdirectories, you can do like this:
> --
> 2.46.0
>
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-08 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 16:07 [PATCH] kbuild: Add vmlinux_install to facilitate debugging Zach Wade
2024-10-07 16:13 ` Zach Wade
2024-10-08 17:39 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox