Subject: Re: CVS commit: src/usr.sbin/amd/libamu
To: None <>
From: Izumi Tsutsui <>
List: source-changes
Date: 08/10/2005 13:14:14
In article <> wrote:

> Amd(8) have ${arch} and ${karch} selectors. ${arch} is fetched from
> the compile-time HOST_ARCH string (it's now ${MACHINE} string). And
> ${karch} is fetched from uname(3).

I guess HOST_ARCH means "host running amd," not compile host. Right?
IIRC, the host machine's architecture (HOST_ARCH) like "sun4" is
used to switch libkvm binaries on SunOS.

On NetBSD, we have already common libkvm binaries among machines
which have the same CPU but have different kvm architecture
(like sun3, sun3x, and hp300 etc).

I don't know the difference of ${arch} and ${karch} usage on amd, but
if we have complete binary compatibility among the same MACHINE_ARCH
machines (and I think we actually do), we don't have to provide
keywords about ${MACHINE} for each host.

> For such purpose, using ${karch} selector soleved the problem.
> Or should we also set ${karch} from uname(3)?

In src/dist/am-utils/amd/amd.c, HOST_ARCH (which is ${MACHINE} now)
is reffered around lines 247 through 262:
  /* name of current architecture */
  gopt.arch = HOST_ARCH;

   * kernel architecture: this you must get from uname() if possible.
#if defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME)
  if (uname(&un) >= 0)
    gopt.karch = un.machine;
#endif /* defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME) */
    gopt.karch = HOST_ARCH;

IMHO, we should use only uname(3) for both arch and karch
and remove HOST_ARCH (which is now target ${MACHINE}) strings
from the text section of amd(8) binary. (by #ifdef __NetBSD__ ?)
Izumi Tsutsui