All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Herrmann <aherrman@arcor.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] x86: fix UTS_MACHINE to be "i386" for 32-bit build and "x86_64" for 64-bit build
Date: Sat, 17 Nov 2007 11:16:30 +0100	[thread overview]
Message-ID: <20071117101630.GA5102@devil> (raw)
In-Reply-To: <20071117075715.GB4723@uranus.ravnborg.org>

On Sat, Nov 17, 2007 at 08:57:15AM +0100, Sam Ravnborg wrote:
> > >
> > >Any good suggestions here???
> > >UTS_MACHINE is set in top-level Makefile and if we specify
> > >make ARCH=x86
> > >we do not know if i386 or x86_&4 is correct until the configuration
> > >has been read.
> > >
> > >Should we report a "make ARCH=x86" as uname -m == x86??
> > >
> > 
> > That would break 5 years of a stable ABI.  I don't think that is even 
> > remotely feasible.
> 
> I will try to cook up a patch that sets CONFIG_UTS_MACHINE
> and then we will use that value unless it is undefined in which
> case we fall back to UTS_MACHINE (as today).


IMHO we shouldn't add another config option.
Just correctly set UTS_MACHINE in arch/x86/Makefile will do it.

I wasn't aware where the machine name came from.
Now that I know that (and shamelessly copying ideas from s390;-)
it is easy to fix. See attached patch.

Testing a crosscompiled 32-bit-kernel I now get
    # uname -m
    i686
on my K7.

Other tests will follow. But patch looks sane and should go mainline asap, I think.


Regards,

Andreas

--
x86: fix UTS_MACHINE to be "i386" for 32-bit build and "x86_64" for 64-bit build.

Signed-off-by: Andreas Herrmann <aherrman@arcor.de>
---
 arch/x86/Makefile |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 116b03a..7aa1dc6 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -11,10 +11,9 @@ endif
 $(srctree)/arch/x86/Makefile%: ;
 
 ifeq ($(CONFIG_X86_32),y)
+        UTS_MACHINE := i386
         include $(srctree)/arch/x86/Makefile_32
 else
+        UTS_MACHINE := x86_64
         include $(srctree)/arch/x86/Makefile_64
 endif
-
-
-
-- 
1.5.3.4



  reply	other threads:[~2007-11-17  9:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-16 11:14 Kconfig: ARCH=x86 Andreas Herrmann
2007-11-16 12:37 ` Kconfig: ARCH=x86 causes wrong utsname.machine Andreas Herrmann
2007-11-16 15:20   ` H. Peter Anvin
2007-11-16 22:15     ` Sam Ravnborg
2007-11-16 22:58       ` H. Peter Anvin
2007-11-16 23:33         ` H. Peter Anvin
2007-11-17  7:57         ` Sam Ravnborg
2007-11-17 10:16           ` Andreas Herrmann [this message]
2007-11-16 12:43 ` Kconfig: ARCH=x86 Andreas Herrmann
2007-11-16 12:58 ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2007-11-17 14:37 [PATCH] x86: simplify "make ARCH=x86" and fix kconfig all.config Sam Ravnborg
2007-11-19  9:34 ` [PATCH] x86: fix UTS_MACHINE to be i386 for 32-bit build and x86_64 for 64-bit build Andreas Herrmann
2007-11-19 10:41   ` Sam Ravnborg
2007-11-19 16:00     ` Andreas Herrmann

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=20071117101630.GA5102@devil \
    --to=aherrman@arcor.de \
    --cc=hpa@zytor.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.