The Computer Oracle

Compiling the Linux kernel, how much size is needed?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Quirky Dreamscape Looping

--

Chapters
00:00 Compiling The Linux Kernel, How Much Size Is Needed?
00:54 Answer 1 Score 8
01:19 Answer 2 Score 3
02:04 Answer 3 Score 2
02:28 Accepted Answer Score 1
02:48 Answer 5 Score 0
03:03 Thank you

--

Full question
https://superuser.com/questions/130381/c...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #kernel #diskspace #compile

#avk47



ANSWER 1

Score 8


On my recent AMD64 build of 4.4.0-57 on Ubuntu 16.04, I needed about 14.5 GB of space for the build outputs.

That seems a a lot and it seems that is mostly transiently needed files (e.g., .o files resulting from compiling a .c file).




ANSWER 2

Score 3


Refer to this link >> https://ubuntuforums.org/showthread.php?t=2266609

I compiled/made linux kernel 4.0.0-rc1 on my HP Stream 13 (2GB RAM, dual core Intel Celeron N2840) based on the clear instruction on https://wiki.ubuntu.com/KernelTeam/GitKernelBuild, and this is my experience:

After the "git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git" the disk in use in the separate kernel directory: 1691 MB

During the make/compile, the disk space in use went up to 15674 MB. So: more than 15GB ...

Total compile time was: 299 minutes, or 5 hours. Quite long, probably caused by my slow CPU and slow disk.




ANSWER 3

Score 2


From Guide,

NOTE: If you do not have lot of disk space in /usr/src then you can unpack the kernel source package on any partition where you have free disk space (like /home). Because kernel compile needs lot of disk space for object files like *.o. For this reason the /usr/src/linux MUST be a soft link pointing to your source directory.




ACCEPTED ANSWER

Score 1


An april 2010 linux kernel is about 60MB bzip2 archive, which after unpacking and compiling takes about 400-500MB.

You can check your directory size with du -hs like:

/mnt/storage/linux-2.6.33$ du -hs                               
437M    .



ANSWER 5

Score 0


It seems that the size requirement either has increased over the years or is greater for the realtime kernel. My linux-rt-devel directory is ~36GB:

du -sh linux-rt-5.15/
36G     linux-rt-5.15/