Search code examples
clinuxlinux-kernellinux-device-driveruser-mode-linux

Compiling a program for user mode Linux


I've just implemented a "pseudo" device driver and want to test it. What can I do as a test is just:

echo "something"> /dev/mydev
cat /dev/mydev

My driver supports more advanced functionality and I implemented a test program to test these functionaries. However I'm not able to run it on UML (Error: Floating point exception). I believe there is a "special" way of compiling user programs for UML?

Could you please give a starting point for this? How should I compile the test program?

p.s. Testing program is very simple and above error is not caused by the bug in the program. p.p.s. For compiling the module I had ready Makefile, so it was easy :)

Thanks in advance.

EDIT: Both host and UML kernels are of same version 2.6.35

EDIT: I believe I need to show kernel source directory, plus some compiler options, also something like ARCH=um?

EDIT: Currently I'm compiling without any options. gcc test.c. Even the "Hello world" program is not working on the UML. Maybe i've to change something on UML compilation?


Solution

  • The solution for the problem is found (thanks to my classmates and professor):

    the glibc versions of the compile environment should match with UML. So compiling --static option solves the problem.