Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp380072imj; Sat, 16 Feb 2019 02:26:20 -0800 (PST) X-Google-Smtp-Source: AHgI3IZq0OCZonjkHdJ4wDDBI5jKmXfLGMuQsJfdq3HXqILxBGCp1vdMlcyuIr5pFNNlSs8nvPkh X-Received: by 2002:a63:d34a:: with SMTP id u10mr9715517pgi.301.1550312780415; Sat, 16 Feb 2019 02:26:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550312780; cv=none; d=google.com; s=arc-20160816; b=GdfkJHI1Ez45DKHuldO37uEM7Maciw3t59KoMM5c5N81WhsUSmFbFYG6ylORni3vT2 1D3dOiJm47Ie8Htzo/5ulT3cL/JPQWYQZSgORiO5JdnxhgetHSbmofFscBX/GTnzl1nR 3601uVTN2UyHXm46lQZW3I+3SzR4U+GfhEavaTp61UraS1d+pbovAwzmWuXt78h7rQik yRvfftiHZhFj4TQFMwnGjbODkH1U2MY7yvsrB4mct8CJvwpD5ivi4CaDJrpdeZTFhyl1 AVtV6UPqfIjb9KkNKvqz9I4sMRgwRK3A26uVyf2eAsIuji5uqv9B6JTpsOomoSnstMGl 57kg== 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:dkim-signature:dkim-filter; bh=kYWVuWCPdFD9cz/1DU1jn/YsGrYBPicxpCpcOQRS/wY=; b=i2qOdapJ/PenqkTMUiKFRGkW5ELVyG5Hz1UUPWxGKMOzPrStAnFG5BnxA+8cQ72dVd 1zLveoVHJ6Zg4fu9+jfSCawZkpOETF0z2gVkRy3bf1eZ/T+xJO2XzDW0BC+DoHNyfYuz p41H7VYt158Evj1GY0kxszFfwzMsdqe0PUB0Idtq1gZAXHSFbPWMZjJHio0l5EBpx7Nl lnuiACwrvl/jiCddLnOPGiEibQlw333b14ISrXpN77d1Fqm053kCXvKhqoQWHa6V2rU5 d4NLfT4T9JMAaS3oqo79sMdbqg0pFYtAPWWh19fcRNSv6QG0zz2DAhGlh/XGi6nP3pqU Xw4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="j/2FkjGE"; 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 l24si7503501pgj.171.2019.02.16.02.26.04; Sat, 16 Feb 2019 02:26:20 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="j/2FkjGE"; 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 S2390429AbfBPCZz (ORCPT + 99 others); Fri, 15 Feb 2019 21:25:55 -0500 Received: from conssluserg-04.nifty.com ([210.131.2.83]:19356 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727348AbfBPCZz (ORCPT ); Fri, 15 Feb 2019 21:25:55 -0500 Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172]) (authenticated) by conssluserg-04.nifty.com with ESMTP id x1G2PdbS032473 for ; Sat, 16 Feb 2019 11:25:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com x1G2PdbS032473 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1550283940; bh=kYWVuWCPdFD9cz/1DU1jn/YsGrYBPicxpCpcOQRS/wY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=j/2FkjGEcQ4vsg5o6IkCYWmyWxGUDxxjgyx8xdxqGo2WFgEyA487vi+n+Cr8ip16O wjUFuCrA/ie5mLl0woCMgmBZhGHl+4qhmv9/BCfbuBZe9nutlC0lI/N/CJljdSq38j xZqli8xUPRtaLDfX1HjbOxxQzlaAvxak1bC15rYGoq7DK8NUTUe7cbnmqM+6xM/npa je+irbjjKfKdOeBKowvhrjHJuo+yMYNB9iZF3qud8MnHGYbAai7csQ0xv4l2juSCKg GzK4ZMjCE3Pr/qxADFT0uVtoPaeLs9PrpfeuO4v38RBwzsDLKehuUzNKdgYYo8+Oke 7ef3WdvljAUfw== X-Nifty-SrcIP: [209.85.221.172] Received: by mail-vk1-f172.google.com with SMTP id v131so2458474vkd.3 for ; Fri, 15 Feb 2019 18:25:40 -0800 (PST) X-Gm-Message-State: AHQUAubDBLTPYgGDc+9ngHkXyQ4Vaxcld7OkjBDeO9K+uPhx6YR7dayU U5Tb19sAgdbjqlf7UqKNzjP4tpQzaIB+8kELV28= X-Received: by 2002:a1f:9350:: with SMTP id v77mr6703657vkd.64.1550283939252; Fri, 15 Feb 2019 18:25:39 -0800 (PST) MIME-Version: 1.0 References: <1550223519-18290-1-git-send-email-yamada.masahiro@socionext.com> In-Reply-To: From: Masahiro Yamada Date: Sat, 16 Feb 2019 11:25:03 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] powerpc: use $(origin ARCH) to select KBUILD_DEFCONFIG To: Mathieu Malaterre Cc: linuxppc-dev , Michael Ellerman , 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 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. If you mimic x86, the following will work: 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