Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3270575imc; Wed, 13 Mar 2019 13:18:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqywMe7YHCSRn133H1I9fnIeJE1yUYop/402Y4LvS3E6rC6aiRb3kA1I+xEQA3odnsI51s5u X-Received: by 2002:a62:ea08:: with SMTP id t8mr45395243pfh.60.1552508320546; Wed, 13 Mar 2019 13:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552508320; cv=none; d=google.com; s=arc-20160816; b=oTGeEKzTkO6PKDXIts64v+/PbE3IC2RJ9hpr8YgY63HJkPf293l+r3n50Fi8BjMQ6Z jKfInK0qWPKs5BneeaUY3UsjaMR8iCKFPwgctM7WpMwwOcVDis6t0kcWEFc5yU4edB7H M2lphDrGrNV2BDg1qK4371Tv6CG1oGBJyfYXKALDuh5anTv3D2kiS3TQdqKr3flONq5D tDPZIfkox4coNevfxuPt5u2p8wu0ZokzzcNVwZBDcyYUeg06QrxX5ceLhLY+Kh+FpkqG IQuBvDcxK5FZ7693cSVNjtsF5OqxfMXRGTQBmtUBevz6PZPnMULdJvhqKom9pgs3Z2jY CEeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=g/mXpmakv6imNbTS8MmVhOFORBB0KE0VQhcEqeFl01w=; b=NNpxvnEyj4F2sYg5LT/8frH6fgbM2Y7XHH2l7gblG0aN+VrkbPFC3+34TYHvx0yb/8 yE+znpY8NIUBgb5IwsCfWDd8dGyVufs0NyPDQgxKWE1Py70yt7kHSRLl5j94+Bi68Hgi 6nvOV+YwRjCYcUlUTMcCgnBFYg5ZdKY7gV96qaTyAYRpsv990+vbawyNdgT1VfSZJW6g 0fH/dakKlPU6adZwDKH/xnuDqubtZTJE3EgZXfeL0KcBkdcRxjv4CKyIdZLIWHCpSNy/ LqDRG899StFc+T1GZLkAoZuo60XCvfZQpWFx+CAKWbtJovLXzDoshJOIZ8T/UfejsXZt ok7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s78si11149784pfa.161.2019.03.13.13.18.24; Wed, 13 Mar 2019 13:18:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727129AbfCMURu (ORCPT + 99 others); Wed, 13 Mar 2019 16:17:50 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:37953 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726263AbfCMURu (ORCPT ); Wed, 13 Mar 2019 16:17:50 -0400 Received: by mail-ot1-f66.google.com with SMTP id m1so2998631otf.5 for ; Wed, 13 Mar 2019 13:17:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g/mXpmakv6imNbTS8MmVhOFORBB0KE0VQhcEqeFl01w=; b=ZT4Za+xgwRR80v54ZQAnpmALmyoxfstweNJAUkbPMBdXXBVaPSG1wnpfDgXsIBt8aA AZxkPuAVU+GJmHFBYVMDo0TSiq2Yfor0j3aEdRvSb0XKdA3YjBZB7v22eiFvTtpxCS4E rzrupmookyRjDtDIgLmt4+G/cp0gF33yWpL12DY7+XiB/kisbWs4xyCII27BMAYwcYqG T4CW9VYEKQjIsEXkQoP9UOr5g/QhaDBdzqaRunfXVHPdChjz2GSLvkwoffxRCw1X4jGM hX8AUIGp4wZZauPIyH+6lMmm5lofYvn9nmtoeD5TdEVhZD5t9z76YehXx17iYUu2BkRd zEKQ== X-Gm-Message-State: APjAAAUZWl0m1jkxCJ5NLpki6DkKp7hxkYPflze5iz6Fq11jrY8j1PSZ +rPqlVFQiXC0uaWmNeHC9tdCKq+rEAQvG3PVIqI= X-Received: by 2002:a9d:7841:: with SMTP id c1mr29656545otm.354.1552508268714; Wed, 13 Mar 2019 13:17:48 -0700 (PDT) MIME-Version: 1.0 References: <1550223519-18290-1-git-send-email-yamada.masahiro@socionext.com> In-Reply-To: From: Mathieu Malaterre Date: Wed, 13 Mar 2019 21:17:37 +0100 Message-ID: Subject: Re: [PATCH] powerpc: use $(origin ARCH) to select KBUILD_DEFCONFIG To: Michael Ellerman Cc: Masahiro Yamada , linuxppc-dev , Paul Mackerras , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 16, 2019 at 3:26 AM Masahiro Yamada wrote: > > On Sat, Feb 16, 2019 at 1:11 AM Mathieu Malaterre wrote: > > > > On Fri, Feb 15, 2019 at 10:41 AM Masahiro Yamada > > wrote: > > > > > > I often test all Kconfig commands for all architectures. To ease my > > > workflow, I want 'make defconfig' at least working without any cross > > > compiler. > > > > > > Currently, arch/powerpc/Makefile checks CROSS_COMPILE to decide the > > > default defconfig source. > > > > > > If CROSS_COMPILE is unset, it is likely to be the native build, so > > > 'uname -m' is useful to choose the defconfig. If CROSS_COMPILE is set, > > > the user is cross-building (i.e. 'uname -m' is probably x86_64), so > > > it falls back to ppc64_defconfig. Yup, make sense. > > > > > > However, I want to run 'make ARCH=* defconfig' without setting > > > CROSS_COMPILE for each architecture. > > > > > > My suggestion is to check $(origin ARCH). > > > > > > When you cross-compile the kernel, you need to set ARCH from your > > > environment or from the command line. > > > > > > For the native build, you do not need to set ARCH. The default in > > > the top Makefile is used: > > > > > > ARCH ?= $(SUBARCH) > > > > > > Hence, $(origin ARCH) returns 'file'. > > > > > > Before this commit, 'make ARCH=powerpc defconfig' failed: > > > > In case you have not seen it, please check: > > > > http://patchwork.ozlabs.org/patch/1037835/ > > > I did not know that because I do not subscribe to ppc ML. > > > Michael's patch looks good to me. OK > > If you mimic x86, the following will work: > Nice! Michael do you have a preference ? > > > diff --git a/Makefile b/Makefile > index 86cf35d..eb9552d 100644 > --- a/Makefile > +++ b/Makefile > @@ -356,6 +356,11 @@ ifeq ($(ARCH),sh64) > SRCARCH := sh > endif > > +# Additional ARCH settings for powerpc > +ifneq ($(filter ppc%,$(ARCH)),) > + SRCARCH := powerpc > +endif > + > KCONFIG_CONFIG ?= .config > export KCONFIG_CONFIG > > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile > index 488c9ed..ff01fef 100644 > --- a/arch/powerpc/Makefile > +++ b/arch/powerpc/Makefile > @@ -34,10 +34,10 @@ ifdef CONFIG_PPC_BOOK3S_32 > KBUILD_CFLAGS += -mcpu=powerpc > endif > > -ifeq ($(CROSS_COMPILE),) > -KBUILD_DEFCONFIG := $(shell uname -m)_defconfig > -else > +ifeq ($(ARCH),powerpc) > KBUILD_DEFCONFIG := ppc64_defconfig > +else > +KBUILD_DEFCONFIG := $(ARCH)_defconfig > endif > > ifdef CONFIG_PPC64 > diff --git a/scripts/subarch.include b/scripts/subarch.include > index 6506828..c98323f 100644 > --- a/scripts/subarch.include > +++ b/scripts/subarch.include > @@ -8,6 +8,6 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e > s/x86_64/x86/ \ > -e s/sun4u/sparc64/ \ > -e s/arm.*/arm/ -e s/sa110/arm/ \ > -e s/s390x/s390/ -e s/parisc64/parisc/ \ > - -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ > + -e s/mips.*/mips/ \ > -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ > -e s/riscv.*/riscv/) > > > > > > > > > -- > Best Regards > Masahiro Yamada