[Skiboot] [PATCH] external/common: Adjust rules.mk to correctly use CROSS_COMPILE

oliver oohall at gmail.com
Wed Aug 3 13:40:00 AEST 2016


On Wed, Aug 3, 2016 at 5:10 AM, Patrick Williams <patrick at stwcx.xyz> wrote:
> On Tue, Aug 02, 2016 at 03:14:34PM +1000, Cyril Bur wrote:
>> diff --git a/external/common/rules.mk b/external/common/rules.mk
>> index bb12fd5..59e8905 100644
>> --- a/external/common/rules.mk
>> +++ b/external/common/rules.mk
>> @@ -1,5 +1,8 @@
>> -CC ?= $(CROSS_COMPILE)gcc
>> -LD ?= $(CROSS_COMPILE)ld
>> +ifdef CROSS_COMPILE
>> +CC = $(CROSS_COMPILE)gcc
>> +LD = $(CROSS_COMPILE)ld
>> +endif
>> +
>>  ARCH := $(shell $(GET_ARCH) "$(CROSS_COMPILE)")
>
> I don't see myself as a make expert, nor do I know what the best
> practices are in this regard.  Ultimately, you guys need to decide what
> is best for these makefiles but, with my current understanding, unless
> there is a corresponding change in both op-build and openbmc, this change
> will not work.
>
> I've already spent a lot of time in the last month on getting libflash
> / pflash makefiles set so we can do cross-compiling on ARM.  I know Joel,
> Brad and Stewart have also put in time in this area.  If this change
> goes in, I would prefer that someone volunteer to also do the
> corresponding updates to the op-build and openbmc distros.
>
> Now for my observations...
>
> There is currently a CROSS and a CROSS_COMPILE variable in skiboot.
> What is each for?

They do the same thing. Originally there was just CROSS, but linux
uses CROSS_COMPILE to set the toolchain prefix so it was added for
consistency.

>
> The ARCH variable is only set if CROSS_COMPILE is set with a proper
> prefix and the ARCH is critical for compiling libflash correctly.  Thus,
> with this change it will not be possible to set both a custom CC and
> allow the makefiles to continue to derive the ARCH from the prefix.  As
> I have previously stated, having CC overwritten by CROSS_COMPILE breaks
> a non-simple CC and ties you to gcc (precluding clang).  We don't expect
> distros to determine ARCH themselves, do we?

Sounds like this is the actual problem. There's nothing wrong with
having CROSS_COMPILE setting CC, it just needs to be opt-in and using
CROSS_COMPILE to find the target architecture forces you to set it.

>
> Even the op-build recipe for libflash sets both CC and CROSS_COMPILE, so
> this isn't just a Yocto "problem".
> https://github.com/open-power/op-build/blob/master/openpower/package/libflash/libflash.mk#L20

Yeah, my bad. This is really a skiboot externals problem that op-build
and openbmc are working around.

>
> --
> Patrick Williams
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
>


More information about the Skiboot mailing list