Well I finally found a solution. So basically the reason I went on the venture was because of trying to use megacli which is a utility from lsi to interact with the raid controllers and drives. Basically when I ran the utility it would error out with no info. A strace of the execution made me see that it made a call to uname to see the kernel version and thought maybe it was an issue with kernel version. After some googling I found that megacli is looking for a 2.6 kernel and thats why I tried what I did. Obviously that didnt work.
So that made me think, what If I could fool the system into thinking its using 2.6?
The answer is to fake a uname syscall via LD_PRELOAD;
#vi fake-uname.c
###################################################
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <stdio.h>
#include <string.h>
int uname(struct utsname *buf)
{
int ret;
ret = syscall(SYS_uname, buf);
printf("uname release: \"%s\"\n", buf->release);
strcpy(buf->release, "2.6.40");
printf("uname release set to: \"%s\"\n", buf->release);
printf("uname version: \"%s\"\n", buf->version);
return ret;
}
###########################################################
Save it as fake-uname.c, and compile it with
# gcc -Wall -fPIC -c fake-uname.c
# gcc -Wall -shared -o libfake-uname.so fake-uname.o
Now we get libfake-uname.so, use LD_PRELOAD=./libfake-uname.so to preload it, over uname from glibc:
Gentoo-11 tmp # LD_PRELOAD=./libfake-uname.so LD_LIBRARY_PATH=./opt/lsi/3rdpartylibs/x86_64 ./opt/MegaRAID/MegaCli/MegaCli64 -adpCount
uname release: "3.0.3-tinycore"
uname release set to: "2.6.40"
uname version: "#1 SMP Mon Aug 1 02:33:28 UTC 2011"