* Actually there is no standard to what `uname` reports [1]. What is more different OS report different tings [2]. So this change only moves alignment from BSD to Linux. * Only option `-m` option (MACHINE) is defined by POSIX and means "Write the name of the hardware type on which the system is running to standard output.". * Option `-p` (PROCESSOR) is not defined by POSIX but widely used.
My proposition is to leave `uname -m` untouched (it prints out CONFIG_ARCH) and implement `uname -p` in a way that would give detailed information about the processor (i.e. riscv32, riscv64, armv6l, armv7l, i386, i686, x86_6x, amd64, etc). This maintains self-compatibility and bring new feature that gives better information about underlying CPU. RISC-V part is obvious riscv32 or riscv64. ARM is not that obvious because there is at least arm64, aarch64, armv6l, armv7l, etc. Last two come from Android which handles different underlying architectures and for me this should be the way to follow as we plan to have distro too one day. [1] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/uname.html [2] https://en.wikipedia.org/wiki/Uname -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info On Wed, Dec 2, 2026 at 4:44 AM Tomek CEDRO <[email protected]> wrote: > > Just as Greg noticed in the PR comment arm64 is used by the BSD world. > I dug deeper and this turns out `uname -m` is for PLATFORM (i.e. > arm64, riscv) versus `uname -p` is for PROCESSOR (i.e. aarch64, > riscv32, riscv64) discrepancy. > > So maybe we only need to update the uname -p part that reports unknown > at the moment? > > Also no other OS uses risc-v but riscv - this one may need an update. > > Full details in > https://github.com/apache/nuttx/pull/22584#issuecomment-7334112153 > > -- > CeDeROM, SQ7MHZ, http://www.tomek.cedro.info > > On Tue, Dec 1, 2026 at 4:56 PM Tomek CEDRO <[email protected]> wrote: > > > > Thank you Marco for raising the discussion :-) > > > > I am for the alignment with the other OS just to mark the change as > > breaking in case someone uses build / test scripts to be updated :-) > > > > I can see 3 choices here in general: > > > > 1. Most invasive (least welcome): Update CONFIG_ARCH to use widely > > used nomenclature to align with other OS/RTOS. This would also imply > > renaming directories. Strongly breaking change. > > > > 2. Least invasive (most welcome): As Marco proposing keep CONFIG_ARCH > > but change what uname reports to align with other OS. Sources > > structure remains untouched. > > > > 3. Non-invasive (for consideration): As proposed on the PR we can add > > a Kconfig string such as LIBC_UNAME_MACHINE, defaulting to > > CONFIG_ARCH. Anyone who wants the Linux names (for example, for > > scripting-language platform detection, which seems to be the > > motivation) can opt in per board or defconfig. The current behaviour > > stays the default. But this may result in strong inconsisencies. > > > > Thus I am for option (2) as proposed by Marco :-) > > > > -- > > CeDeROM, SQ7MHZ, http://www.tomek.cedro.info > > > > On Tue, Dec 1, 2026 at 12:37 PM Marco C. <[email protected]> wrote: > > > > > > Hello, > > > > > > CONTRIBUTING.md 1.13 asks for a discussion on dev@ before the vote on a > > > breaking change. This is the discussion for: > > > > > > https://github.com/apache/nuttx/pull/22584 > > > > > > What changes: uname() gives the Linux machine name on two architectures: > > > "aarch64" instead of "arm64", and "riscv64" or "riscv32" instead of > > > "risc-v". The other architectures keep CONFIG_ARCH (x86_64 already gives > > > "x86_64"). The change is the same in flat, protected and kernel builds. > > > > > > Why: scripts and language runtimes detect the platform with "uname -m" or > > > uname() and compare the result with the Linux names. With "arm64" and > > > "risc-v", each of them needs a special case for NuttX. > > > > > > Who is affected: NSH "uname -m" and "uname -a", the assert dump header and > > > the core dump note show the new name. In nuttx and nuttx-apps, only > > > boards/risc-v/erbium/minion/tools/test_emu.py compared the name; the PR > > > updates it. nxpkg and nxdiag use CONFIG_ARCH and do not change. > > > Out-of-tree > > > code that compares the machine field with "arm64" or "risc-v" is affected. > > > > > > Quick fix: accept "aarch64", "riscv64" and "riscv32" too, or compare > > > CONFIG_ARCH at build time. > > > > > > The alternative: Tomasz proposed a Kconfig option (default CONFIG_ARCH) to > > > select the Linux names. Then the same CPU has two names, and portable > > > programs must accept both. I prefer one name, the same as Linux. > > > > > > I will add build and runtime logs from real hardware (1.14) to the PR, and > > > start the vote after this discussion. Please send your comments here or in > > > the PR. > > > > > > Best regards, > > > Marco Casaroli
