rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Schier <nicolas@fjasle.eu>
To: Nick Desaulniers <nick.desaulniers@gmail.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Huacai Chen <chenhuacai@kernel.org>, WANG Xuerui <git@xen0n.name>,
	Guo Ren <guoren@kernel.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	asahi@lists.linux.dev, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] scripts: subarch.include: fix SUBARCH on MacOS hosts
Date: Tue, 15 Nov 2022 05:12:46 +0100	[thread overview]
Message-ID: <Y3MRvtwdjIwMHvRo@bergen.fjasle.eu> (raw)
In-Reply-To: <20221113233812.36784-1-nick.desaulniers@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2056 bytes --]

On Sun, 13 Nov 2022 15:38:09 -0800 Nick Desaulniers wrote:
> When building the Linux kernel on an aarch64 MacOS based host, if we don't
> specify a value for ARCH when invoking make, we default to arm and thus
> multi_v7_defconfig rather than the expected arm64 and arm64's defconfig.
> 
> This is because subarch.include invokes `uname -m` which on MacOS hosts
> evaluates to `arm64` but on Linux hosts evaluates to `aarch64`,
> 
> This allows us to build ARCH=arm64 natively on MacOS (as in ARCH need
> not be specified on an aarch64-based system).
> 
> Utilize a negative lookahead regular expression to avoid matching arm64.
> 
> Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
> ---
> This is only part 1 of
> https://github.com/ClangBuiltLinux/linux/commit/f06333e29addbc3d714adb340355f471c1dfe95a
> I'm still working on the rest...
> 
>  scripts/subarch.include | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/subarch.include b/scripts/subarch.include
> index 4bd327d0ae42..aa130286b627 100644
> --- a/scripts/subarch.include
> +++ b/scripts/subarch.include
> @@ -6,7 +6,7 @@
>  
>  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/arm\(?:\(?!64\).*\)/arm/ -e s/sa110/arm/ \

On my Debian's sed, this does not match any more at all, e.g.:

  $ echo armv4 | sed -e 's/arm\(?:\(?!64\).*\)/arm/'
  armv4
.

This one works for me, but does not look such advanced:

  $ echo arm64 | sed -e '/^arm64$/!s/arm.*/arm/'
  arm64
  $ echo armv4 | sed -e '/^arm64$/!s/arm.*/arm/'
  arm
.

Kind regards,
Nicolas

>  				  -e s/s390x/s390/ \
>  				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
>  				  -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
> -- 
> 2.37.0 (Apple Git-136)

-- 
epost|xmpp: nicolas@fjasle.eu          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-11-15  4:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-13 23:38 [PATCH] scripts: subarch.include: fix SUBARCH on MacOS hosts Nick Desaulniers
2022-11-15  4:12 ` Nicolas Schier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y3MRvtwdjIwMHvRo@bergen.fjasle.eu \
    --to=nicolas@fjasle.eu \
    --cc=asahi@lists.linux.dev \
    --cc=chenhuacai@kernel.org \
    --cc=git@xen0n.name \
    --cc=guoren@kernel.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nick.desaulniers@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).