6

Moved from Stack Overflow, where I realize it was off-topic since it was asking for sources - far as I can tell, the rules forbid that there but not here.

I know that the kernel in Android is now mostly the Linux kernel with a few exceptions like wakelocks (as described by John Stultz.) But is it close enough to be compliant with the Linux Standard Base? (Or for that matter with POSIX and/or the Single Unix Specification?)

I'm writing about this in an academic term paper, so as well as the answer itself it would be great to have a relatively reliable source I can cite for it: a peer-reviewed article or book would be ideal, but something from Google's developer docs or a person with established cred (Torvalds, Andrew Josey, etc.) would be fine.

6

The LSB, POSIX, and the Single UNIX Specification all significantly involve userland. Simply using a kernel that is also used as the basis of a "unix-like", "mostly POSIX compliant" operating system -- GNU/Linux -- is not sufficient to make Android such as well. There are, however, some *nix-ish elements, such as the shell, which is a "largely compatible" Korn shell implementation (on pre-4.0, it may actually be the ash shell, which is used on embedded GNU/Linux systems via busybox) and various POSIX-y command line utilities to go along with it. There is not the complete set most people would recognize from the "unix-like" world, however.

is it close enough to be compliant with the Linux Standard Base?

A centrepiece of the LSB is the filesystem hierarchy, and Android does not use this. LSB really adds stuff to POSIX, and since Android is not nearly that, it is even further from being LSB compliant. This is pretty explicitly not a goal for the platform, I believe. The linux kernel was used for its own properties, and not because it could be used as the core of a POSIX system; it was taken up by GNU originally for both reasons.

To clarify this distinction regarding a user space oriented specification -- such as POSIX, Unix, or the LSB extensions -- consider some of the things POSIX has to say about the native C library. This is where we run into platform specific things such as networking and most system calls, such as read() -- read() isn't, in fact, standard C. It's a Unix thing, historically. POSIX does define these as interfaces but they are implemented in the userland C library, then everything else uses this library as its foundation. The C library on GNU/Linux is the GNU C Library, a completely separate work from the kernel. Although these two things work together as the core of the OS, none of the standards under discussion here say anything about how this must happen, and so in effect, they don't say anything about what the kernel is or must do. They say a lot of things about what the C library is and must do, meaning, if you wrote a C library to work with a given kernel -- any kernel, regardless of form or characteristics -- and that library provides a user land API that satisfies the POSIX spec, you have a POSIX compliant OS.

LSB does, I think, have some things to say about /proc, which linux provides as a kernel interface. However, the fact that this (for example) is provided directly by the kernel does not mean that the LSB says it has to be -- it just says this should/could be available, and if so what the nature of the information is.

  • Thank you. I probably should have been clearer that I'm specifically interested in the kernel itself - which, I understand from sources like the Stultz above, is very similar to the mainline Linux kernel but not exactly. Would the Android variant of the Linux kernel itself be considered LSB (or POSIX) compliant? – Displaced Hoser Jul 28 '14 at 18:30
  • 2
    Just to clarify: there's no such thing as a "POSIX kernel", because POSIX doesn't specify anything about it. Those specifications are about a userland interface, which can imply things about the kernel, but they don't say anything directly about it. So you are kind of off on an oxymoronical path...the LSB, as mentioned, is just extensions to POSIX. The linux kernel actually isn't "LSB compliant" because LSB is simply about userspace tools and interfaces. Presumably, you could rig any kernel up that way with enough tricks. So looking at Android in relation to LSB and POSIX... – goldilocks Jul 28 '14 at 19:18
  • 1
    ...again, it's a question about the user space. You can evaluate the Android kernel in relation to the vanilla linux kernel, but that really doesn't have anything to do with any particular standard. It's contrasting one specific piece of implemented software in relation to the specific details of an other. There aren't any external standards involved you could reference, AFAIK. – goldilocks Jul 28 '14 at 19:20
  • 2
    Put another way: in theory you could have a 100% POSIX compliant OS with no kernel at all, or rather, one which just required certain things from a kernel. POSIX itself doesn't say anything about this because it's about what and not how. And that "what" is in user space; part of the how is of course a kernel, but there are no specification, requirements, limitations placed upon it. – goldilocks Jul 28 '14 at 19:24
  • I've added a final few paragraphs about this ("To clarify this distinction regarding a user space oriented specification...") – goldilocks Jul 28 '14 at 19:48
4

The word “Linux” has two meanings. The most common meaning, by far, is the Linux operating system, also known as GNU/Linux or GNU/X11/Apache/Linux/TeX/Perl/Python/FreeCiv, which is an imitation of the Unix operating system. The word “Linux” can also mean the Linux kernel, which is the kernel of the Linux operating system.

Android is a completely different operating system, which happens to also use the Linux kernel. The Linux Standard Base is a specification of operating systems. It is only meant to apply to the Linux operating system, not to Android. Android doesn't comply with the LSB¹. The LSB doesn't apply to the kernel as such, because normal application code doesn't interact with the kernel directly, only through interfaces such as the standard library and the /proc directory; in principle, it would be possible to comply with the LSB with a kernel other than Linux (although in practice there would be a lot of features to emulate).

Android doesn't comply with Unix specifications such as POSIX either; Android isn't a Unix-like operating system. Linux does by and large comply with POSIX (a few versions of a few distributions have been formally certified as compliant).

¹ It is possible to install a Linux system alongside Android and running from the same kernel. But then you aren't running “Android” anymore, you're running Android and Linux together.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.