# Kernel size.



## sossego (Apr 21, 2010)

When comparing the sizes of Linux and FreeBSD kernels, is this based upon source, build size, or both?


----------



## anomie (Apr 21, 2010)

Any particular reference for what you're talking about?  

Could be (either|both).


----------



## sossego (Apr 21, 2010)

The recent news that the Linux kernel is too bloated. I also believe that DutchDaemon on one of these forums mentioned that the kernel is streamlined. The kernel here is about 139M while the Linux kernel source was 312+ megabytes when unpacked.


----------



## Oko (Apr 22, 2010)

sossego said:
			
		

> The recent news that the Linux kernel is too bloated. I also believe that DutchDaemon on one of these forums mentioned that the kernel is streamlined. The kernel here is about 139M while the Linux kernel source was 312+ megabytes when unpacked.




Over here we are not yet that advanced to use 139M kernel.

```
$ uname -a
OpenBSD oko.gsu.edu 4.6 GENERIC.MP#168 amd64
$ du -h /bsd
7.0M    /bsd
```

and that is generic kernel we are talking about. I could proably easily trim that to about 1.4M if I have to use
it as live floopy OS.


----------



## phoenix (Apr 22, 2010)

Compiled size is a useless metric, as it depends on how many drivers you include, which compiler you use, which compiler options, etc.  With a lot of care, one could probably come up with a bootable kernel under a MB.  Is it useful, though?

Lines of Code (LoC) is also a useless measure, as it depends on the coding style used (does { by itself count as a LoC?), the number/length of comments, etc.


----------



## sossego (Apr 22, 2010)

I should have said that the folder named kernel was of that size, Oko; but, Since I didn't, I can understand your reply.  How do I get the same results for FreeBSD as Oko did for OpenBSD?


----------



## sossego (Apr 22, 2010)

I found it,

```
timey# ls -ld /boot/kernel/kernel
-r-xr-xr-x  1 root  wheel  11492703 Nov 21 10:48 /boot/kernel/kernel
```
I'm guessing now that bloat has less to do with physical size and more to do with how much is added to the kernel.


----------



## vermaden (Apr 22, 2010)

Also, Linux kernel is compressed with *gzip(1)* by default while FreeBSD not, but it may be compressed with *gzip(1)* if You wish.


----------



## graudeejs (Apr 22, 2010)

vermaden said:
			
		

> Also, Linux kernel is compressed with *gzip(1)* by default while FreeBSD not, but it may be compressed with *gzip(1)* if You wish.



How?
This might be very useful to me


----------



## vermaden (Apr 22, 2010)

killasmurf86 said:
			
		

> How?
> This might be very useful to me




```
# cd /boot/kernel
# gzip -9 kernel
# reboot
```


----------



## graudeejs (Apr 22, 2010)

vermaden said:
			
		

> ```
> # cd /boot/kernel
> # gzip -9 kernel
> # reboot
> ```



And I can boot with that?
Can I compress modules?


----------

