zephyr/samples/posix/uname
Alberto Escolar Piedras cb2016c2a0 samples/posix: Use hwmv2 native targets identifiers
For the 64 bit targets, change identifiers to the new hwmv2 ones.
And remove redundant overlays (which were equal for the 32
and 64 bit versions)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-15 16:13:12 +01:00
..
src posix: uname: move uname shell from sample 2024-01-18 10:54:32 +01:00
CMakeLists.txt
Makefile.host samples: posix: uname: add Makefile to compile on POSIX OS 2024-01-18 10:54:32 +01:00
prj.conf posix: uname: move uname shell from sample 2024-01-18 10:54:32 +01:00
README.rst samples: doc: Added/Updated README and Makefile for POSIX samples 2024-01-19 10:32:23 +01:00
sample.yaml samples/posix: Use hwmv2 native targets identifiers 2024-03-15 16:13:12 +01:00

.. _posix-uname-sample:

POSIX uname()
#############

Overview
********

In this sample application, the POSIX `uname()`_ function is used to acquire system information and
it is output to the console. Additionally, uname is added as a shell command and system information
is displayed according to the option(s) provided for the command.

Building and Running
********************

This project outputs to the console. It can be built and executed on QEMU as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/posix/uname
   :host-os: unix
   :board: qemu_x86
   :goals: run
   :compact:

For comparison, to build directly for your host OS if it is POSIX compliant (for ex. Linux):

.. code-block:: console

   cd samples/posix/uname
   make -f Makefile.host

The make output file will be located in samples/posix/uname/build.

Sample Output
=============

.. code-block:: console

    Printing everything in utsname...
    sysname[7]: Zephyr
    nodename[7]: zephyr
    release[13]: 3.5.99
    version[61]: zephyr-v3.5.0-3515-g10156f5f1d9c Jan  9 2024 22:23:04
    machine[4]: x86


    uart:~$ uname -a
    Zephyr zephyr 3.5.99 zephyr-v3.5.0-3515-g10156f5f1d9c Jan  9 2024 22:23:04 x86 qemu_x86
    uart:~$ uname -smi
    Zephyr x86 qemu_x86

.. _uname(): https://pubs.opengroup.org/onlinepubs/9699919799/functions/uname.html