Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need to recompile the kernel with minimum configuration so that after compiling its size stay below 950 KB and it should boot correctly after compilation. I need to compile with minimum possible features just to boot from the kernel. How can I do this?

share|improve this question
Without knowing what computer you are running on, it is impossible to suggest a kernel configuration that is guaranteed to boot. Different features might be needed for different types of computers. –  jmtd Sep 9 '11 at 9:29
Why on earth do you want it to be so small? I don't think you can get that small these days outside of an embedded system type config. –  psusi Sep 9 '11 at 18:15
The target machine in hp nc6400 laptop with standard hardware. And I want minimum possible configuration to boot. I have already shrunk the kernel image to 2MB I just have to bring it down below 950KB. –  Omayr Sep 11 '11 at 12:50
You should probably not waste your time on compiling a custom kernel. See my answer, below, for the reasons why. –  jasonspiro Dec 4 at 0:38

3 Answers 3

940K is a hard target to hit. The kernel can be configured with various options. The special make target allnoconfig answers No to every configuration question. The resulting kernel has all optional features disabled, so the result should theoretically be the smallest possible image for that version of the kernel. However, it would in all likelihood be a very useless kernel.

On an x86 system here, a Linux 3.0 kernel compiled with allnoconfig and compressed with bzip2 (i.e., the bzImage) comes out at 767K, which is uncomfortably close to your 950K target. Enabling configuration options to support loadable modules, your specific hardware, etc. will be necessary to have a useful kernel and will inflate that figure.

share|improve this answer
thanks for the response. The target system is an hp nc6400 laptop with standard hardware. Could you also elaborate allnoconfig kernel if you are talking about a different version then I guess it will be use less because I have to shrink the size of that specific kernel image ( The vmlinuz after compilation should be below 950 KB. –  Omayr Sep 11 '11 at 11:02
I'll revise my answer to expand on what 'allnoconfig' means. –  jmtd Sep 13 '11 at 8:30
Thanks jmtd for elaborating on my concern. In a nutshell can you tell me with your experience that is it possible to compile a bootable kernel with size less than 950K. Also "allnoconfig" would most probably won't work unless I mark 'yes' all minimum options that are required to boot into the system. –  Omayr Sep 13 '11 at 22:11

A custom-built kernel will likely not run your software measurably faster. And if your laptop is a HP nc6400 (RB515UA) then it came with 1024 MB of memory (ref). So a 950 KB custom kernel would save memory, but your total memory usage would decrease by only a tiny amount (less than 1%). So compiling a custom kernel would not be worth the effort.

If you want Ubuntu to run faster on your PC, consider:

  • Installing more RAM.
  • Replacing your hard drive with a Seagate Momentus XT. It's a hybrid hard drive which is supposed to cache frequently-used files, like your desktop environment and web browser, on its solid-state flash chips. It could improve your computer's startup speed by one-third or more. I've used one. It worked fine with Ubuntu.
  • Installing XFCE, a lightweight desktop environment: it only takes a few simple steps.

What are the slowest operations on your computer? What operations would you most like to speed up?

share|improve this answer
This isn't true. Custom build kernel loads faster and it's faster in the usage because you don't need every module. It's also better because it COMPILE faster. If you frequently update your kernel your answers it not helpful at all. And you save a lot of disk space because not every module get compiled. Most likely you can compile for the computer and some compile flags. –  Phpdna Jan 27 '12 at 13:59
1. Indeed, a custom kernel starts up faster. But a stock kernel probably only takes about 10 seconds to start up on modern hardware. To shave off some of those 10 seconds, you'll have to spend time compiling your kernel, and maybe watching it compile, and installing it, and maybe troubleshooting afterwards. In your case, where you're trying to build a tiny kernel, the time you spend customizing your kernel will exceed the startup time you'll save over the years. 2. If you can find some benchmarks which contradict these, please tell us. –  jasonspiro Mar 28 '12 at 3:56

To make the kernel really small check lspci -vvv to determine the modules to make it bootable, disable all kernel hacking tree, enable small kernel size and use lzma method to compress the kernel. Eventually disable initramfs it can save some kb. My kernel size is 3,3M big with lzma but with bzip2 3,8M but I don't use small size kernel. Most likely lzma compression isn't available for all kernels.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.