Skip to content

Commit

Permalink
linux: simplify LINUX_BUILD_CMDS
Browse files Browse the repository at this point in the history
We currently do the Linux build as follows:

   make <imagename>
   if modules enabled; make modules; fi

However, Clement Léger recently reported that due to us not using the
"all" target, the GDB scripts that the kernel can build when
CONFIG_GDB_SCRIPTS is enabled are not built, since upstream kernel
commit 67274c083438340ad16c1437caebc84e1253b224 (merged in v5.1) moved
that logic to a separate scripts_gdb target, which is a dependency of
the "all" target.

While we could add some more logic to explicit generate the
"scripts_gdb" target, this logic would fail on Linux < 5.1 for which
this make target doesn't exist.

So instead, let's simplify the build logic, and use:

  make all <imagename>

The "all" target automatically depends on "modules" if CONFIG_MODULES
is set, so we no longer need to explicit generate the "modules" target
separately.

As a result of this change, we may generate additional kernel images
compared to what was done previously, but such images would anyway not
be installed, and the additional build time is minimal.

We did some research as to why the kernel build was done like this in
Buildroot, and it's been like that since linux/linux.mk was added back
in 2010 by commit 487e21c ("New,
simpler, infrastructure for building the Linux kernel").

Reported-by: Clément Leger <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
Reviewed-by: "Yann E. MORIN" <[email protected]>
Reviewed-by: Peter Korsgaard <[email protected]>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
(cherry picked from commit ffbe46a)
Signed-off-by: Peter Korsgaard <[email protected]>
  • Loading branch information
tpetazzoni authored and jacmet committed Apr 24, 2019
1 parent e08d1aa commit 71ce6ef
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions linux/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,7 @@ define LINUX_BUILD_CMDS
$(foreach dts,$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)), \
cp -f $(dts) $(LINUX_ARCH_PATH)/boot/dts/
)
$(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_TARGET_NAME)
@if grep -q "CONFIG_MODULES=y" $(@D)/.config; then \
$(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ; \
fi
$(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) all $(LINUX_TARGET_NAME)
$(LINUX_BUILD_DTB)
$(LINUX_APPEND_DTB)
endef
Expand Down

0 comments on commit 71ce6ef

Please sign in to comment.