[RFC 0/1][Unstable] Use cross compilers when updating Ubuntu kernel configs

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Thu Aug 23 17:08:17 UTC 2018


On Thu, Aug 23, 2018 at 11:42:49AM -0500, Seth Forshee wrote:
> I've pushed the following patch to the unstable kernel tree to fix a
> problem I encountered, however I wanted to get some feedback on it to
> see if anyone had objections or better ideas.
> 
> The problem is that Kconfig files have started invoking scripts which
> test compiler features to determine values for config options. Here's an
> example from arch/powerpc/Kconfig:
> 
>   config MPROFILE_KERNEL
> 	depends on PPC64 && CPU_LITTLE_ENDIAN
> 	def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)

Yeah, I have read about it on Kees Cook post that ended up on Debian Planet. He
mentioned STACKPROTECTOR_STRONG, as an example.

I don't have a better suggestion for now, but this is going to be a pain. I
will need a larger SSD to run this locally. Sighs.

Now, thinking about it: we have the enforcer that will make the build fail if
some config options are not present. That way, we end up testing the toolchain
as well. And we ADT for the toolchain running with at least our main package as
a trigger. So, at least, from the point of verifying certain options end up on
the final config, we have things that will work for us.

Now, for our workflow, I find your solution the best we can do right now. So,
thanks for fixing this.

Cascardo.

> 
> This test fails when updating configs on my amd64 box and the option is
> set to n, however with the powerpc64le compiler the test passes and the
> option is set to y. As a result, this option has been off in our config
> files but then gets flipped on in the kernels we build.
> 
> The solution I came up with is to detect when the target architecture
> does not match the host architecture and set CROSS_COMPILE in the
> environment for "make *config" in our kernelconfig script. This works,
> but it does require having cross toolchains available with the same
> version and features as the ones that will be used to build the kernel.
> In practice this probably means that when running updateconfigs, etc.
> you'll need to use a chroot for the target series with cross toolchains
> for all supported architectures installed (we should be able to add a
> cranky command to ease the pain).
> 
> So, any comment or better ideas? Otherwise, I guess this serves as a
> heads up of workflow changes that will be needed for cosmic onward.
> 
> Thanks,
> Seth
> 
> ---
> 
> Seth Forshee (1):
>   UBUNTU: [Debian] set CROSS_COMPILE when generating kernel configs
> 
>  debian/scripts/misc/kernelconfig | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team




More information about the kernel-team mailing list