Issue
I have been very interested in the Linux Kernel and operating systems in general. The thing i was wondering was, what is the file type or extension that a kernel has? It obviously doesn't have a .exe or .out extension because they are used for applications installed on operating systems.
Is a kernel just a Binary file?
Bonus question: I know that the Linux Kernel source code is divided over many .c files, but i was wondering if, when compiling, all these files are compiled into a single binary file or are the linked externally?
(I hope my queston(s) are not to vague)
Solution
The Linux Kernel (or any other OS Kernel) is just a binary image containing machine code for the target architecture. It is kinda like a statically linked executable, because there's no operating system to link any dependecy before it's running,so that once loaded in the main memory, it is able to execute without any other helper. This doesn't mean that it cannot load any other module dynamically. In Linux, this behavior is easily seen when you load a module from userspace (it's different process from loading a .so file tough).
That image may be compressed before being stored in the filesystem, and that's why you may get something like this output from "file":
file /boot/vmlinuz-2.6.39-400.215.7.el6uek.x86_64
/boot/vmlinuz-2.6.39-400.215.7.el6uek.x86_64: Linux kernel x86 boot executable bzImage, version 2.6.39-400.215.7.el6uek.x86_64 , RO-rootFS, swap_dev 0x3, Normal VGA
Answered By - Vitor Answer Checked By - Terry (WPSolving Volunteer)