On 10/14/2023 1:48 AM, guangyuan wang wrote:
Hi
I note that the Nuttx supports POSIX well. And I'd like to check whether I
could use Nuttx core to replace the Linux core in Ubuntu OS.
No, probably not. It depends on what you mean and how much effort you
want to put into it. Remember that you don't really interface with
Linux at all. Linux does not provide the POSIX application interface.
That POSIX interface comes from the C-library, probably GLIBC. Hence
they are together referred to as GNU/Linux.
So maybe you are really asking, "Can the Linux GLIBC be used with
NuttX?" and the answer is NO. Why not? The interface between GLIBC and
Linux is not POSIX. It is a custom, non-standard, non-portable
interface based on Linux system calls.
And the same is true for NuttX. The NuttX LibC interfaces with the RTOS
via non-standard, incompatible system interfaces.
So no you cannot use GLIBC with NuttX and so you cannot "replace the
Linux core in Ubuntu OS" with NuttX.
You possibly could replace Linux+GLIBC with NuttX+C library but most
Ubuntu applications would not run for the same reason that you cannot
run most applications with uCLinux without modification of the
application. That is due to differences in the hardware that works only
in the FLAT build (no MMU). Could you replace Linux+GLIBC if you use
the KERNEL build? In principle, you probably could. But I imagine that
would take some effort. Other people have been developing with the
KERNEL build recently, so I don't know the current state and cannot
address that.