Skip to content

Commit

Permalink
kernel: speed up build system by getting rid of redundant work
Browse files Browse the repository at this point in the history
KERNELRELEASE contains a $(shell) call which is evaluated over and over
again.
The call to checksyscalls.sh is unnecessary for LEDE and also takes a
few seconds to complete.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Mar 16, 2017
1 parent a9c96ef commit 1f12a3d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/kernel-defaults.mk
Expand Up @@ -23,7 +23,9 @@ KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
CONFIG_SHELL="$(BASH)" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID))
$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \
KERNELRELEASE=$(LINUX_VERSION) \
cmd_syscalls=

ifdef CONFIG_STRIP_KERNEL_EXPORTS
KERNEL_MAKEOPTS += \
Expand Down

12 comments on commit 1f12a3d

@kodewdle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commit broke one of my Makefiles for a kernel driver, i reverted it then it compiled fine.
the Makefile has include $(INCLUDE_DIR)/kernel-defaults.mk up top and $(KERNEL_MAKEOPTS) inside of Build/Compile.
the error trying to build the module said "*** No targets. Stop." then failed.

@nbd168
Copy link
Contributor Author

@nbd168 nbd168 commented on 1f12a3d Mar 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will rework it to make it compatible again

@nbd168
Copy link
Contributor Author

@nbd168 nbd168 commented on 1f12a3d Mar 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kodewdle
Copy link

@kodewdle kodewdle commented on 1f12a3d Mar 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pulled your repo (at that commit), built successfully, added module, built, and failed (same issue *** No targets. Stop.) :(
built using: $(MAKE) $(KERNEL_MAKEOPTS); also just to be sure: i pulled this git again and made sure this commit was reverted still then successfully built the package.
also i reverted this commit inside of your repo and it builds fine on there too (thought i should check that as well).

@nbd168
Copy link
Contributor Author

@nbd168 nbd168 commented on 1f12a3d Mar 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you switch to my staging tree entirely, or did you merge this into your clone of the LEDE tree?
In my tests, this commit did make some packages work that were using $(MAKE) $(KERNEL_MAKEOPTS)

@kodewdle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i switched to your tree entirely. i cloned it and tried to build with it. it built successfully without the module but once i loaded the module and tried to rebuild with it, it failed. until i reverted this commit here in your tree, then it would build fine on yours

@nbd168
Copy link
Contributor Author

@nbd168 nbd168 commented on 1f12a3d Mar 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What module is this?

@kodewdle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a realtek driver for a usb card (one that im using through my router right now to send this message):
https://forum.lede-project.org/t/rtl8812au-and-or-rtl8814au-drivers/67/21

@nbd168
Copy link
Contributor Author

@nbd168 nbd168 commented on 1f12a3d Mar 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please show me your makefile

@kodewdle
Copy link

@kodewdle kodewdle commented on 1f12a3d Mar 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here ya go :) https://gist.github.com/kodewdle/3537b45981392dc4e403cbe005374957

edit: just an update. i pulled your repo at (https://git.lede-project.org/?p=lede/nbd/staging.git;a=commitdiff;h=5dd9423df3b2197e2b56e2dd0de9f696ecd11176) and it's the same for me, unless i revert this commit, it wont build. more specifically, if i remove this line from your /include/kernel.mk: KERNELRELEASE=$(LINUX_VERSION) \ inside of KERNEL_MAKEOPTS := \. after removing that, it builds fine. even when i remove include $(INCLUDE_DIR)/kernel-defaults.mk and switch $(MAKE) $(KERNEL_MAKEOPTS) to $(KERNEL_MAKE) inside of my Makefile.

edit two: i don't know if this applies to only this module specifically or something but if that's the case, it would be easier to just change $(MAKE) $(KERNEL_MAKEOPTS) to $(MAKE) $(subst KERNELRELEASE=$(LINUX_VERSION) ,,$(KERNEL_MAKEOPTS)) in the Makefile, i suppose? doing this (as im sure you know) just removes that variable and allows it to build, without reverting this commit completely.

@nbd168
Copy link
Contributor Author

@nbd168 nbd168 commented on 1f12a3d Mar 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend adding $(filter-out KERNELRELEASE=%,$(KERNEL_MAKE_FLAGS)) to RUN_STUFF and leaving out KERNEL_MAKEOPTS.

@kodewdle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! :)

Please sign in to comment.