Hi,
1.) make with multiple targets
When running
$ make -j4 clean all
I get error from make (probably in scripts/Makefile.modbuiltin):
Output from above with V=1:
make -f ./scripts/Makefile.modbuiltin obj=drivers/tty/vt
make -f ./scripts/Makefile.modbuiltin obj=drivers/video/backlight
(for m in ; do echo kernel/$m; done; \
cat /dev/null ) > drivers/tty/vt/modules.builtin
(for m in ; do echo kernel/$m; done; \
cat /dev/null ) > drivers/video/backlight/modules.builtin
(for m in ; do echo kernel/$m; done; \
cat /dev/null drivers/tty/ipwireless/modules.builtin drivers/tty/serial/modules.builtin drivers/tty/vt/modules.builtin) > drivers/tty/modules.builtin
make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev
make -f ./scripts/Makefile.modbuiltin obj=drivers/virt
make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev/core
(for m in ; do echo kernel/$m; done; \
cat /dev/null ) > drivers/virt/modules.builtin
(for m in ; do echo kernel/$m; done; \
cat /dev/null ) > drivers/video/fbdev/core/modules.builtin
make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev/omap2
make -f ./scripts/Makefile.modbuiltin obj=drivers/watchdog
(for m in drivers/watchdog/pretimeout_panic.ko; do echo kernel/$m; done; \
cat /dev/null ) > drivers/watchdog/modules.builtin
g++ -shared -o scripts/gcc-plugins/cyc_complexity_plugin.so scripts/gcc-plugins/cyc_complexity_plugin.o
make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev/omap2/omapfb
make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev/omap2/omapfb/displays
(for m in ; do echo kernel/$m; done; \
cat /dev/null ) > drivers/video/fbdev/omap2/omapfb/displays/modules.builtin
make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev/omap2/omapfb/dss
(for m in ; do echo kernel/$m; done; \
cat /dev/null ) > drivers/video/fbdev/omap2/omapfb/dss/modules.builtin
(for m in ; do echo kernel/$m; done; \
cat /dev/null drivers/video/fbdev/omap2/omapfb/displays/modules.builtin drivers/video/fbdev/omap2/omapfb/dss/modules.builtin) > drivers/video/fbdev/omap2/omapfb/modules.builtin
(for m in ; do echo kernel/$m; done; \
cat /dev/null drivers/video/fbdev/omap2/omapfb/modules.builtin) > drivers/video/fbdev/omap2/modules.builtin
(for m in ; do echo kernel/$m; done; \
cat /dev/null drivers/video/fbdev/core/modules.builtin drivers/video/fbdev/omap2/modules.builtin) > drivers/video/fbdev/modules.builtin
(for m in ; do echo kernel/$m; done; \
cat /dev/null drivers/video/backlight/modules.builtin drivers/video/fbdev/modules.builtin) > drivers/video/modules.builtin
(for m in ; do echo kernel/$m; done; \
cat /dev/null drivers/accessibility/modules.builtin drivers/amba/modules.builtin drivers/android/modules.builtin drivers/auxdisplay/modules.builtin drivers/base/modules.builtin drivers/block/modules.builtin drivers/bus/modules.builtin drivers/cdrom/modules.builtin drivers/char/modules.builtin drivers/char/ipmi/modules.builtin drivers/clk/modules.builtin drivers/clocksource/modules.builtin drivers/crypto/modules.builtin drivers/dax/modules.builtin drivers/devfreq/modules.builtin drivers/dma-buf/modules.builtin drivers/extcon/modules.builtin drivers/firewire/modules.builtin drivers/firmware/modules.builtin drivers/gpio/modules.builtin drivers/gpu/modules.builtin drivers/hwtracing/intel_th/modules.builtin drivers/i2c/modules.builtin drivers/idle/modules.builtin drivers/iommu/modules.builtin drivers/irqchip/modules.builtin drivers/leds/modules.builtin drivers/lguest/modules.builtin drivers/macintosh/modules.builtin drivers/mailbox/modules.builtin drivers/md/modules.builtin drivers/media/modules.builtin drivers/memory/modules.builtin drivers/mfd/modules.builtin drivers/misc/modules.builtin drivers/mmc/modules.builtin drivers/net/modules.builtin drivers/nfc/modules.builtin drivers/nvme/modules.builtin drivers/of/modules.builtin drivers/pci/dwc/modules.builtin drivers/phy/modules.builtin drivers/platform/modules.builtin drivers/power/modules.builtin drivers/powercap/modules.builtin drivers/ptp/modules.builtin drivers/pwm/modules.builtin drivers/ras/modules.builtin drivers/regulator/modules.builtin drivers/reset/modules.builtin drivers/soc/modules.builtin drivers/staging/modules.builtin drivers/tty/modules.builtin drivers/usb/modules.builtin drivers/video/modules.builtin drivers/virt/modules.builtin drivers/watchdog/modules.builtin) > drivers/modules.builtin
cat: drivers/accessibility/modules.builtin: No such file or directory
cat: drivers/amba/modules.builtin: No such file or directory
cat: drivers/android/modules.builtin: No such file or directory
cat: drivers/auxdisplay/modules.builtin: No such file or directory
cat: drivers/base/modules.builtin: No such file or directory
cat: drivers/block/modules.builtin: No such file or directory
cat: drivers/bus/modules.builtin: No such file or directory
cat: drivers/cdrom/modules.builtin: No such file or directory
cat: drivers/char/modules.builtin: No such file or directory
cat: drivers/char/ipmi/modules.builtin: No such file or directory
cat: drivers/clk/modules.builtin: No such file or directory
cat: drivers/clocksource/modules.builtin: No such file or directory
cat: drivers/crypto/modules.builtin: No such file or directory
cat: drivers/dax/modules.builtin: No such file or directory
cat: drivers/devfreq/modules.builtin: No such file or directory
cat: drivers/dma-buf/modules.builtin: No such file or directory
cat: drivers/extcon/modules.builtin: No such file or directory
cat: drivers/firewire/modules.builtin: No such file or directory
cat: drivers/firmware/modules.builtin: No such file or directory
cat: drivers/gpio/modules.builtin: No such file or directory
cat: drivers/gpu/modules.builtin: No such file or directory
cat: drivers/hwtracing/intel_th/modules.builtin: No such file or directory
cat: drivers/i2c/modules.builtin: No such file or directory
cat: drivers/idle/modules.builtin: No such file or directory
cat: drivers/iommu/modules.builtin: No such file or directory
cat: drivers/irqchip/modules.builtin: No such file or directory
cat: drivers/leds/modules.builtin: No such file or directory
cat: drivers/lguest/modules.builtin: No such file or directory
cat: drivers/macintosh/modules.builtin: No such file or directory
cat: drivers/mailbox/modules.builtin: No such file or directory
cat: drivers/md/modules.builtin: No such file or directory
cat: drivers/memory/modules.builtin: No such file or directory
cat: drivers/mfd/modules.builtin: No such file or directory
cat: drivers/misc/modules.builtin: No such file or directory
cat: drivers/mmc/modules.builtin: No such file or directory
make[1]: *** [scripts/Makefile.modbuiltin:42: drivers/modules.builtin] Error 1
make: *** [Makefile:1224: drivers/modules.builtin] Error 2
make: *** Waiting for unfinished jobs....
g++ -Wp,-MD,scripts/gcc-plugins/.randomize_layout_plugin.o.d -O2 -I/usr/lib/gcc/x86_64-redhat-linux/7/plugin/include -Iscripts/gcc-plugins -std=gnu++98 -fno-rtti -fno-exceptions -fasynchronous-unwind-tables -ggdb -Wno-narrowing -Wno-unused-variable -fPIC -c -o scripts/gcc-plugins/randomize_layout_plugin.o scripts/gcc-plugins/randomize_layout_plugin.c
g++ -shared -o scripts/gcc-plugins/structleak_plugin.so scripts/gcc-plugins/structleak_plugin.o
g++ -shared -o scripts/gcc-plugins/latent_entropy_plugin.so scripts/gcc-plugins/latent_entropy_plugin.o
g++ -shared -o scripts/gcc-plugins/randomize_layout_plugin.so scripts/gcc-plugins/randomize_layout_plugin.o
make: Leaving directory '/home/thomas/git/linux'
but when running
$ make clean all
everything seems to work as expected. Bug or feature?
2.) compile modpost with debug symbols, -g
how do I compile the modpost helper program with debug symbols? In what
makefile, kbuild file do I need to add the compiler flag?
Any help would be appreciated!
with kind regards
thomas
[adding linux-kbuild]
On 08/10/2017 08:42 AM, Thomas Meyer wrote:
> Hi,
>
> 1.) make with multiple targets
>
> When running
> $ make -j4 clean all
> I get error from make (probably in scripts/Makefile.modbuiltin):
> Output from above with V=1:
>
> make -f ./scripts/Makefile.modbuiltin obj=drivers/tty/vt
> make -f ./scripts/Makefile.modbuiltin obj=drivers/video/backlight
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null ) > drivers/tty/vt/modules.builtin
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null ) > drivers/video/backlight/modules.builtin
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null drivers/tty/ipwireless/modules.builtin drivers/tty/serial/modules.builtin drivers/tty/vt/modules.builtin) > drivers/tty/modules.builtin
> make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev
> make -f ./scripts/Makefile.modbuiltin obj=drivers/virt
> make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev/core
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null ) > drivers/virt/modules.builtin
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null ) > drivers/video/fbdev/core/modules.builtin
> make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev/omap2
> make -f ./scripts/Makefile.modbuiltin obj=drivers/watchdog
> (for m in drivers/watchdog/pretimeout_panic.ko; do echo kernel/$m; done; \
> cat /dev/null ) > drivers/watchdog/modules.builtin
> g++ -shared -o scripts/gcc-plugins/cyc_complexity_plugin.so scripts/gcc-plugins/cyc_complexity_plugin.o
> make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev/omap2/omapfb
> make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev/omap2/omapfb/displays
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null ) > drivers/video/fbdev/omap2/omapfb/displays/modules.builtin
> make -f ./scripts/Makefile.modbuiltin obj=drivers/video/fbdev/omap2/omapfb/dss
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null ) > drivers/video/fbdev/omap2/omapfb/dss/modules.builtin
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null drivers/video/fbdev/omap2/omapfb/displays/modules.builtin drivers/video/fbdev/omap2/omapfb/dss/modules.builtin) > drivers/video/fbdev/omap2/omapfb/modules.builtin
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null drivers/video/fbdev/omap2/omapfb/modules.builtin) > drivers/video/fbdev/omap2/modules.builtin
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null drivers/video/fbdev/core/modules.builtin drivers/video/fbdev/omap2/modules.builtin) > drivers/video/fbdev/modules.builtin
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null drivers/video/backlight/modules.builtin drivers/video/fbdev/modules.builtin) > drivers/video/modules.builtin
> (for m in ; do echo kernel/$m; done; \
> cat /dev/null drivers/accessibility/modules.builtin drivers/amba/modules.builtin drivers/android/modules.builtin drivers/auxdisplay/modules.builtin drivers/base/modules.builtin drivers/block/modules.builtin drivers/bus/modules.builtin drivers/cdrom/modules.builtin drivers/char/modules.builtin drivers/char/ipmi/modules.builtin drivers/clk/modules.builtin drivers/clocksource/modules.builtin drivers/crypto/modules.builtin drivers/dax/modules.builtin drivers/devfreq/modules.builtin drivers/dma-buf/modules.builtin drivers/extcon/modules.builtin drivers/firewire/modules.builtin drivers/firmware/modules.builtin drivers/gpio/modules.builtin drivers/gpu/modules.builtin drivers/hwtracing/intel_th/modules.builtin drivers/i2c/modules.builtin drivers/idle/modules.builtin drivers/iommu/modules.builtin drivers/irqchip/modules.builtin drivers/leds/modules.builtin drivers/lguest/modules.builtin drivers/macintosh/modules.builtin drivers/mailbox/modules.builtin drivers/md/modules.builtin drivers/media/modules.builtin drivers/memory/modules.builtin drivers/mfd/modules.builtin drivers/misc/modules.builtin drivers/mmc/modules.builtin drivers/net/modules.builtin drivers/nfc/modules.builtin drivers/nvme/modules.builtin drivers/of/modules.builtin drivers/pci/dwc/modules.builtin drivers/phy/modules.builtin drivers/platform/modules.builtin drivers/power/modules.builtin drivers/powercap/modules.builtin drivers/ptp/modules.builtin drivers/pwm/modules.builtin drivers/ras/modules.builtin drivers/regulator/modules.builtin drivers/reset/modules.builtin drivers/soc/modules.builtin drivers/staging/modules.builtin drivers/tty/modules.builtin drivers/usb/modules.builtin drivers/video/modules.builtin drivers/virt/modules.builtin drivers/watchdog/modules.builtin) > drivers/modules.builtin
> cat: drivers/accessibility/modules.builtin: No such file or directory
> cat: drivers/amba/modules.builtin: No such file or directory
> cat: drivers/android/modules.builtin: No such file or directory
> cat: drivers/auxdisplay/modules.builtin: No such file or directory
> cat: drivers/base/modules.builtin: No such file or directory
> cat: drivers/block/modules.builtin: No such file or directory
> cat: drivers/bus/modules.builtin: No such file or directory
> cat: drivers/cdrom/modules.builtin: No such file or directory
> cat: drivers/char/modules.builtin: No such file or directory
> cat: drivers/char/ipmi/modules.builtin: No such file or directory
> cat: drivers/clk/modules.builtin: No such file or directory
> cat: drivers/clocksource/modules.builtin: No such file or directory
> cat: drivers/crypto/modules.builtin: No such file or directory
> cat: drivers/dax/modules.builtin: No such file or directory
> cat: drivers/devfreq/modules.builtin: No such file or directory
> cat: drivers/dma-buf/modules.builtin: No such file or directory
> cat: drivers/extcon/modules.builtin: No such file or directory
> cat: drivers/firewire/modules.builtin: No such file or directory
> cat: drivers/firmware/modules.builtin: No such file or directory
> cat: drivers/gpio/modules.builtin: No such file or directory
> cat: drivers/gpu/modules.builtin: No such file or directory
> cat: drivers/hwtracing/intel_th/modules.builtin: No such file or directory
> cat: drivers/i2c/modules.builtin: No such file or directory
> cat: drivers/idle/modules.builtin: No such file or directory
> cat: drivers/iommu/modules.builtin: No such file or directory
> cat: drivers/irqchip/modules.builtin: No such file or directory
> cat: drivers/leds/modules.builtin: No such file or directory
> cat: drivers/lguest/modules.builtin: No such file or directory
> cat: drivers/macintosh/modules.builtin: No such file or directory
> cat: drivers/mailbox/modules.builtin: No such file or directory
> cat: drivers/md/modules.builtin: No such file or directory
> cat: drivers/memory/modules.builtin: No such file or directory
> cat: drivers/mfd/modules.builtin: No such file or directory
> cat: drivers/misc/modules.builtin: No such file or directory
> cat: drivers/mmc/modules.builtin: No such file or directory
> make[1]: *** [scripts/Makefile.modbuiltin:42: drivers/modules.builtin] Error 1
> make: *** [Makefile:1224: drivers/modules.builtin] Error 2
> make: *** Waiting for unfinished jobs....
> g++ -Wp,-MD,scripts/gcc-plugins/.randomize_layout_plugin.o.d -O2 -I/usr/lib/gcc/x86_64-redhat-linux/7/plugin/include -Iscripts/gcc-plugins -std=gnu++98 -fno-rtti -fno-exceptions -fasynchronous-unwind-tables -ggdb -Wno-narrowing -Wno-unused-variable -fPIC -c -o scripts/gcc-plugins/randomize_layout_plugin.o scripts/gcc-plugins/randomize_layout_plugin.c
> g++ -shared -o scripts/gcc-plugins/structleak_plugin.so scripts/gcc-plugins/structleak_plugin.o
> g++ -shared -o scripts/gcc-plugins/latent_entropy_plugin.so scripts/gcc-plugins/latent_entropy_plugin.o
> g++ -shared -o scripts/gcc-plugins/randomize_layout_plugin.so scripts/gcc-plugins/randomize_layout_plugin.o
> make: Leaving directory '/home/thomas/git/linux'
>
> but when running
> $ make clean all
> everything seems to work as expected. Bug or feature?
>
> 2.) compile modpost with debug symbols, -g
> how do I compile the modpost helper program with debug symbols? In what
> makefile, kbuild file do I need to add the compiler flag?
> Any help would be appreciated!
>
> with kind regards
> thomas
>
--
~Randy
On Thu, Aug 10, 2017 at 11:28 AM, Randy Dunlap <[email protected]> wrote:
> [adding linux-kbuild]
>
> On 08/10/2017 08:42 AM, Thomas Meyer wrote:
>> Hi,
>>
>> 1.) make with multiple targets
>>
>> When running
>> $ make -j4 clean all
>> I get error from make (probably in scripts/Makefile.modbuiltin):
With 4.13-rc4 I can get a similar build failure on my Fedora 26 workstation with
make allnoconfig; make -j2 clean all
/bin/sh: scripts/mod/empty.o: No such file or directory
make[2]: *** [scripts/mod/Makefile:24: scripts/mod/elfconfig.h] Error 1
make[1]: *** [scripts/Makefile.build:561: scripts/mod] Error 2
Here's an ugly workaround for that test case.
diff --git a/Makefile b/Makefile
index 6eba23bcb5ad..6a1fd24dcf31 100644
--- a/Makefile
+++ b/Makefile
@@ -1297,6 +1297,7 @@ MRPROPER_FILES += .config .config.old .version
.old_version \
# clean - Delete most, but leave enough to build external modules
#
+.NOTPARALLEL: clean
clean: rm-dirs := $(CLEAN_DIRS)
clean: rm-files := $(CLEAN_FILES)
clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs)
Documentation samples)
--
Jim
On Thu, 10 Aug 2017 17:42:51 +0200, Thomas Meyer said:
> 1.) make with multiple targets
>
> When running
> $ make -j4 clean all
> I get error from make (probably in scripts/Makefile.modbuiltin):
> Output from above with V=1:
Possibly unrelated, but I suspect there's a bunch of weirdness lurking in there.
I often end up building lots of kernels (especially during a bisect), and
I've noticed that if I do a 'git bisect good/bad' and then do
make modconfig; make -j4 it will in fact do 4 streams.
But if I just say 'make -j4' and it decides it needs to do a modconfig,
it will then apparently lose the -j4 somewhere and run just one stream.
(But if it doesn't do a modconfig, the -j4 works...)
Hi.
2017-08-11 7:11 GMT+09:00 Jim Davis <[email protected]>:
> On Thu, Aug 10, 2017 at 11:28 AM, Randy Dunlap <[email protected]> wrote:
>> [adding linux-kbuild]
>>
>> On 08/10/2017 08:42 AM, Thomas Meyer wrote:
>>> Hi,
>>>
>>> 1.) make with multiple targets
>>>
>>> When running
>>> $ make -j4 clean all
>>> I get error from make (probably in scripts/Makefile.modbuiltin):
>
> With 4.13-rc4 I can get a similar build failure on my Fedora 26 workstation with
>
> make allnoconfig; make -j2 clean all
>
> /bin/sh: scripts/mod/empty.o: No such file or directory
> make[2]: *** [scripts/mod/Makefile:24: scripts/mod/elfconfig.h] Error 1
> make[1]: *** [scripts/Makefile.build:561: scripts/mod] Error 2
>
> Here's an ugly workaround for that test case.
>
> diff --git a/Makefile b/Makefile
> index 6eba23bcb5ad..6a1fd24dcf31 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1297,6 +1297,7 @@ MRPROPER_FILES += .config .config.old .version
> .old_version \
>
> # clean - Delete most, but leave enough to build external modules
> #
> +.NOTPARALLEL: clean
> clean: rm-dirs := $(CLEAN_DIRS)
> clean: rm-files := $(CLEAN_FILES)
> clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs)
> Documentation samples)
>
If config targets and build targets are given from the command line
(for example, "make -j8 defconfig all"
they are processed one by one.
Kbuild does not cater to the mixture of clean targets and build targets,
but I do not know why.
I wrote as follows.
--- a/Makefile
+++ b/Makefile
@@ -482,7 +482,8 @@ uapi-asm-generic:
version_h := include/generated/uapi/linux/version.h
old_version_h := include/linux/version.h
-no-dot-config-targets := clean mrproper distclean \
+clean-targets := %clean mrproper cleandocs
+no-dot-config-targets := $(clean-targets) \
cscope gtags TAGS tags help% %docs check% coccicheck \
$(version_h) headers_% archheaders archscripts \
kernelversion %src-pkg
@@ -505,6 +506,14 @@ ifeq ($(KBUILD_EXTMOD),)
endif
endif
endif
+
+# For "make -j clean all", "make mrproper defconfig all", etc.
+ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)
+ ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)
+ mixed-targets := 1
+ endif
+endif
+
# install and module_install need also be processed one by one
ifneq ($(filter install,$(MAKECMDGOALS)),)
ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
--
Best Regards
Masahiro Yamada
Hi.
2017-08-11 3:28 GMT+09:00 Randy Dunlap <[email protected]>:
>> 2.) compile modpost with debug symbols, -g
>> how do I compile the modpost helper program with debug symbols? In what
>> makefile, kbuild file do I need to add the compiler flag?
>> Any help would be appreciated!
If you want to pass extra options to the build command of host-programs,
HOST_EXTRACFLAGS is supported.
For example, HOST_EXTRACFLAGS=-g
--
Best Regards
Masahiro Yamada
Hi Masahiro
>
> Kbuild does not cater to the mixture of clean targets and build targets,
> but I do not know why.
The details has long escaped me but in general we do not want to
have a job deleting all .o files running in parallel with a job that
creates .o files.
So we wanted the following to work:
$make mrproper defconfig
make would in the standard configuration execute "mrproper" and "defconfig"
in parallel which would result in a broken build.
This is the background for some of the ugly hacks in the
top-level makefile.
Sam
On Sat, Aug 12, 2017 at 12:11:50PM +0900, Masahiro Yamada wrote:
> Hi.
>
>
> 2017-08-11 7:11 GMT+09:00 Jim Davis <[email protected]>:
> > On Thu, Aug 10, 2017 at 11:28 AM, Randy Dunlap <[email protected]> wrote:
> >> [adding linux-kbuild]
> >>
> >> On 08/10/2017 08:42 AM, Thomas Meyer wrote:
> >>> Hi,
> >>>
> >>> 1.) make with multiple targets
> >>>
> >>> When running
> >>> $ make -j4 clean all
> >>> I get error from make (probably in scripts/Makefile.modbuiltin):
> >
> > With 4.13-rc4 I can get a similar build failure on my Fedora 26 workstation with
> >
> > make allnoconfig; make -j2 clean all
> >
> > /bin/sh: scripts/mod/empty.o: No such file or directory
> > make[2]: *** [scripts/mod/Makefile:24: scripts/mod/elfconfig.h] Error 1
> > make[1]: *** [scripts/Makefile.build:561: scripts/mod] Error 2
> >
> > Here's an ugly workaround for that test case.
> >
> > diff --git a/Makefile b/Makefile
> > index 6eba23bcb5ad..6a1fd24dcf31 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1297,6 +1297,7 @@ MRPROPER_FILES += .config .config.old .version
> > .old_version \
> >
> > # clean - Delete most, but leave enough to build external modules
> > #
> > +.NOTPARALLEL: clean
> > clean: rm-dirs := $(CLEAN_DIRS)
> > clean: rm-files := $(CLEAN_FILES)
> > clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs)
> > Documentation samples)
> >
>
>
> If config targets and build targets are given from the command line
> (for example, "make -j8 defconfig all"
> they are processed one by one.
Hi,
yes, after studying the top level Makefile I also stumbled upon the
__build_one_by_one mechanism.
>
> Kbuild does not cater to the mixture of clean targets and build targets,
> but I do not know why.
Yes, good question. Two answers I can think of: Either it did work once and
broke or "make -j4 clean all" never worked, but nobody did care about.
Although it is strange to see that the Makefile already have the special case of
"mixed" targets, so somebody did care about at least of some similar special
case.
>
> I wrote as follows.
>
>
>
> --- a/Makefile
> +++ b/Makefile
> @@ -482,7 +482,8 @@ uapi-asm-generic:
> version_h := include/generated/uapi/linux/version.h
> old_version_h := include/linux/version.h
>
> -no-dot-config-targets := clean mrproper distclean \
> +clean-targets := %clean mrproper cleandocs
> +no-dot-config-targets := $(clean-targets) \
> cscope gtags TAGS tags help% %docs check% coccicheck \
> $(version_h) headers_% archheaders archscripts \
> kernelversion %src-pkg
> @@ -505,6 +506,14 @@ ifeq ($(KBUILD_EXTMOD),)
> endif
> endif
> endif
> +
> +# For "make -j clean all", "make mrproper defconfig all", etc.
> +ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)
> + ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)
> + mixed-targets := 1
> + endif
> +endif
> +
> # install and module_install need also be processed one by one
> ifneq ($(filter install,$(MAKECMDGOALS)),)
> ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
>
Yes, above patch does fix the bug and fixes "make -j4 clean all".
with kind regards
thomas
>
> --
> Best Regards
> Masahiro Yamada
On Sat, Aug 12, 2017 at 12:15:11PM +0900, Masahiro Yamada wrote:
> Hi.
>
> 2017-08-11 3:28 GMT+09:00 Randy Dunlap <[email protected]>:
>
> >> 2.) compile modpost with debug symbols, -g
> >> how do I compile the modpost helper program with debug symbols? In what
> >> makefile, kbuild file do I need to add the compiler flag?
> >> Any help would be appreciated!
>
>
> If you want to pass extra options to the build command of host-programs,
> HOST_EXTRACFLAGS is supported.
>
> For example, HOST_EXTRACFLAGS=-g
Yes, after reading Documentation/kbuild/makefiles.txt and studying the
top level Makefile I was able to figure it out by myself.
But many thanks for the hint!
Now I just need to find out why an UML kernel with CONFIG_GCOV fails to
build all modules. modpost abends with missing symbols
__gcov_init, etc.
with kind regards
thomas
>
>
>
>
>
> --
> Best Regards
> Masahiro Yamada