1

I have an ARM Linux system running kernel version 2.4, but I'm not sure if the processor has a memory-management unit, so how can I tell whether the system is running a uClinux kernel or a vanilla Linux kernel? The system does not have uname.

1 Answer 1

3

I think 2.4 supports the uname system call. Try this

/*
 * Author: NagaChaitanya Vellanki
 */
#include <sys/utsname.h>
#include <stdio.h>
#include <errno.h>

int main() {
  struct utsname buf;
  if(uname(&buf) != -1) {
    printf("Operating System name: %s\n", buf.sysname);
    printf("Node name: %s\n", buf.nodename);
    printf("Release: %s\n", buf.release);
    printf("Version: %s\n", buf.version);
    printf("Machine: %s\n", buf.machine);
  } else {
    printf("Error: %s\n", strerror(errno));
  }
  return 0;
}

To compile

  gcc -o uname uname.c

Sample output on my raspberry-pi

./uname                                                                                                     
Operating System name: Linux
Node name: naga-playground
Release: 4.4.11-v7+
Version: #888 SMP Mon May 23 20:10:33 BST 2016
Machine: armv7l

Try these if available as suggested by man-page

cat /proc/sys/kernel/osrelease                                                                              
4.4.11-v7+

cat /proc/sys/kernel/ostype                                                                                 
Linux

cat /proc/sys/kernel/version                                                                                
#888 SMP Mon May 23 20:10:33 BST 2016

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .