Skip to contentSkip to conversation

Huge difference in build sizes

DISCUSSION Raghavendra 4 participants 10 messages Dec 2, 2014 – Dec 3, 2014

lore
Share & tools
lore
#0 lore raw

Hello all,

I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this, I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's configuration, and the compiler which came with the distro. I've noticed that there is a huge difference in the size of the .ko file between the Ubuntu's kernel and the kernel which I've compiled. Sample results are :

$ du -sh usb-storage.ko
It shows : 56K for the Ubuntu's 3.2 kernel
                 1.3M for the custom kernel that I've compiled

I've tested the same thing for a simple hello world module :

$ du -sh hello.ko
It shows : 4.0k for the Ubuntu's 3.2 kernel
                 56k for the custom kernel that I've compiled

What could be the reason for this huge amount of difference of storage space in spite of using the same config file and compiler?

Thanks in advance.

Raghavendra

-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------

#1 lore raw
Quoted 12 lines · Raghavendra

Hello all,

I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this, I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's configuration, and the compiler which came with the distro. I've noticed that there is a huge difference in the size of the .ko file between the Ubuntu's kernel and the kernel which I've compiled. Sample results are :

$ du -sh usb-storage.ko
It shows : 56K for the Ubuntu's 3.2 kernel
                 1.3M for the custom kernel that I've compiled
Quoted 7 lines

I've tested the same thing for a simple hello world module :

$ du -sh hello.ko
It shows : 4.0k for the Ubuntu's 3.2 kernel
                 56k for the custom kernel that I've compiled

What could be the reason for this huge amount of difference of storage space in spite of using the same config file and compiler?

Are you sure that you have build with the same optimization flags?

I guess that "-O2" is missing in the big example. Could you double check?

Regards

Quoted 21 lines

Thanks in advance.

Raghavendra

-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Signature · 1 line
Simplicity is the ultimate sophistication
#2 lore raw

Hello Tinti,

Thank you for the reply.

Quoted 18 lines · Vin?cius Tinti
Quoted 17 lines · Raghavendra

Hello all,

I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this, I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's configuration, and the compiler which came with the distro. I've noticed that there is a huge difference in the size of the .ko file between the Ubuntu's kernel and the kernel which I've compiled. Sample results are :

$ du -sh usb-storage.ko
It shows : 56K for the Ubuntu's 3.2 kernel
                  1.3M for the custom kernel that I've compiled

I've tested the same thing for a simple hello world module :

$ du -sh hello.ko
It shows : 4.0k for the Ubuntu's 3.2 kernel
                  56k for the custom kernel that I've compiled
Quoted 5 lines
Quoted 2 lines

What could be the reason for this huge amount of difference of storage space in spite of using the same config file and compiler?

Are you sure that you have build with the same optimization flags?

I guess that "-O2" is missing in the big example. Could you double check?

Actually, I haven't use any optimization flags. I've just hit 'make' from the command line while compiling for both the kernels. I even checked the Makefile of both the kernels. -O2 flag is used in the same way in both the Makefiles.

Regards,
Raghavendra

Quoted 24 lines

Regards

Quoted 21 lines

Thanks in advance.

Raghavendra

-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------

#3 lore raw
Quoted 28 lines · Raghavendra

Hello Tinti,

Thank you for the reply.

Quoted 23 lines · Vin?cius Tinti
Quoted 20 lines · Raghavendra

Hello all,

I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this, I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's configuration, and the compiler which came with the distro. I've noticed that there is a huge difference in the size of the .ko file between the Ubuntu's kernel and the kernel which I've compiled. Sample results are :

$ du -sh usb-storage.ko
It shows : 56K for the Ubuntu's 3.2 kernel
                  1.3M for the custom kernel that I've compiled

I've tested the same thing for a simple hello world module :

$ du -sh hello.ko
It shows : 4.0k for the Ubuntu's 3.2 kernel
                  56k for the custom kernel that I've compiled

What could be the reason for this huge amount of difference of storage space in spite of using the same config file and compiler?

Quoted 8 lines
Quoted 3 lines

Are you sure that you have build with the same optimization flags?

I guess that "-O2" is missing in the big example. Could you double check?

Actually, I haven't use any optimization flags. I've just hit 'make' from the command line while compiling for both the kernels. I even checked the Makefile of both the kernels. -O2 flag is used in the same way in both the Makefiles.

Strange. Can you try this?

Quoted 44 lines

Regards,
Raghavendra

Quoted 26 lines

Regards

Quoted 23 lines

Thanks in advance.

Raghavendra

-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.

-------------------------------------------------------------------------------------------------------------------------------

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------

Signature · 1 line
Simplicity is the ultimate sophistication
#4 lore raw
Quoted 31 lines · Vin?cius Tinti
Quoted 30 lines · Raghavendra

Hello Tinti,

Thank you for the reply.

Quoted 25 lines · Vin?cius Tinti
Quoted 13 lines · Raghavendra

Hello all,

I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this, I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's configuration, and the compiler which came with the distro. I've noticed that there is a huge difference in the size of the .ko file between the Ubuntu's kernel and the kernel which I've compiled. Sample results are :

$ du -sh usb-storage.ko
It shows : 56K for the Ubuntu's 3.2 kernel
                  1.3M for the custom kernel that I've compiled
Quoted 7 lines

I've tested the same thing for a simple hello world module :

$ du -sh hello.ko
It shows : 4.0k for the Ubuntu's 3.2 kernel
                  56k for the custom kernel that I've compiled

What could be the reason for this huge amount of difference of storage space in spite of using the same config file and compiler?

Are you sure that you have build with the same optimization flags?

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

I guess that "-O2" is missing in the big example. Could you double check?

Actually, I haven't use any optimization flags. I've just hit 'make' from the command line while compiling for both the kernels. I even checked the Makefile of both the kernels. -O2 flag is used in the same way in both the Makefiles.

Strange. Can you try this?

Opps.
http://stackoverflow.com/questions/1999654/how-can-i-tell-if-a-library-was-compiled-with-g

Maybe there are debug symbols in one of the kernels. Dunno.

Quoted 50 lines
Quoted 37 lines

Regards,
Raghavendra

Quoted 26 lines

Regards

Quoted 23 lines

Thanks in advance.

Raghavendra

-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.

-------------------------------------------------------------------------------------------------------------------------------

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

Quoted 8 lines

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------

--
Simplicity is the ultimate sophistication

Signature · 1 line
Simplicity is the ultimate sophistication
#5 lore raw
In reply to Raghavendra
Quoted 12 lines · Raghavendra

Hello all,

I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this, I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's configuration, and the compiler which came with the distro. I've noticed that there is a huge difference in the size of the .ko file between the Ubuntu's kernel and the kernel which I've compiled. Sample results are :

$ du -sh usb-storage.ko
It shows : 56K for the Ubuntu's 3.2 kernel
                 1.3M for the custom kernel that I've compiled
Quoted 7 lines

I've tested the same thing for a simple hello world module :

$ du -sh hello.ko
It shows : 4.0k for the Ubuntu's 3.2 kernel
                 56k for the custom kernel that I've compiled

What could be the reason for this huge amount of difference of storage space in spite of using the same config file and compiler?

You have not "stripped" the debug symbols from the kernel you built, which is what Ubuntu does as part of their build process. I suggest turning off that kernel configuration option, as it's probably not needed for your development.

Hope this helps,

greg k-h

#6 lore raw

Hello Greg,

Thank you for the reply.

Quoted 18 lines · Greg KH
Quoted 17 lines · Raghavendra

Hello all,

I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this, I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's configuration, and the compiler which came with the distro. I've noticed that there is a huge difference in the size of the .ko file between the Ubuntu's kernel and the kernel which I've compiled. Sample results are :

$ du -sh usb-storage.ko
It shows : 56K for the Ubuntu's 3.2 kernel
                  1.3M for the custom kernel that I've compiled

I've tested the same thing for a simple hello world module :

$ du -sh hello.ko
It shows : 4.0k for the Ubuntu's 3.2 kernel
                  56k for the custom kernel that I've compiled
Quoted 6 lines
Quoted 2 lines

What could be the reason for this huge amount of difference of storage space in spite of using the same config file and compiler?

You have not "stripped" the debug symbols from the kernel you built, which is what Ubuntu does as part of their build process. I suggest turning off that kernel configuration option, as it's probably not needed for your development.

If you are referring to the option "CONFIG_DEBUG_INFO", then it is said to 'y' in both the kernel's configuration files.
Is there any other config. option or compiler flags that I need to look for?

Quoted 4 lines

Hope this helps,

greg k-h

Thanks,
Raghavendra

-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------

#7 lore raw
Quoted 25 lines · Raghavendra

Hello Greg,

Thank you for the reply.

Quoted 20 lines · Greg KH
Quoted 19 lines · Raghavendra

Hello all,

I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this, I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's configuration, and the compiler which came with the distro. I've noticed that there is a huge difference in the size of the .ko file between the Ubuntu's kernel and the kernel which I've compiled. Sample results are :

$ du -sh usb-storage.ko
It shows : 56K for the Ubuntu's 3.2 kernel
                 1.3M for the custom kernel that I've compiled

I've tested the same thing for a simple hello world module :

$ du -sh hello.ko
It shows : 4.0k for the Ubuntu's 3.2 kernel
                 56k for the custom kernel that I've compiled

What could be the reason for this huge amount of difference of storage space in spite of using the same config file and compiler?

Quoted 7 lines
Quoted 4 lines

You have not "stripped" the debug symbols from the kernel you built, which is what Ubuntu does as part of their build process. I suggest turning off that kernel configuration option, as it's probably not needed for your development.

If you are referring to the option "CONFIG_DEBUG_INFO", then it is said to 'y' in both the kernel's configuration files.
Is there any other config. option or compiler flags that I need to look for?

That's a good one to turn off, start with that and see what happens.

#8 lore raw
Quoted 26 lines · Greg KH
Quoted 25 lines · Raghavendra

Hello Greg,

Thank you for the reply.

Quoted 20 lines · Greg KH
Quoted 19 lines · Raghavendra

Hello all,

I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this, I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's configuration, and the compiler which came with the distro. I've noticed that there is a huge difference in the size of the .ko file between the Ubuntu's kernel and the kernel which I've compiled. Sample results are :

$ du -sh usb-storage.ko
It shows : 56K for the Ubuntu's 3.2 kernel
                  1.3M for the custom kernel that I've compiled

I've tested the same thing for a simple hello world module :

$ du -sh hello.ko
It shows : 4.0k for the Ubuntu's 3.2 kernel
                  56k for the custom kernel that I've compiled

What could be the reason for this huge amount of difference of storage space in spite of using the same config file and compiler?

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

You have not "stripped" the debug symbols from the kernel you built, which is what Ubuntu does as part of their build process. I suggest turning off that kernel configuration option, as it's probably not needed for your development.

If you are referring to the option "CONFIG_DEBUG_INFO", then it is said to 'y' in both the kernel's configuration files.
Is there any other config. option or compiler flags that I need to look for?

That's a good one to turn off, start with that and see what happens.

Yeah, I turned off the config option and compared the sizes. Now, both result in the same build size. Thanks for the suggestion Greg. Still, my concern is that the distro's build is generating a small build size in spite of having the option 'CONFIG_DEBUG_INFO' set to 'y'. Any thoughts?

Thanks,
Raghavendra

-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------

#9 lore raw
Quoted 15 lines · Raghavendra
Quoted 11 lines · Greg KH
Quoted 10 lines · Raghavendra

Hello Greg,

Thank you for the reply.

Quoted 4 lines · Greg KH

You have not "stripped" the debug symbols from the kernel you built, which is what Ubuntu does as part of their build process. I suggest turning off that kernel configuration option, as it's probably not needed for your development.

If you are referring to the option "CONFIG_DEBUG_INFO", then it is said

to

Quoted 2 lines
Quoted 2 lines

'y' in both the kernel's configuration files.
Is there any other config. option or compiler flags that I need to look

Quoted 8 lines

for?

Quoted 2 lines

That's a good one to turn off, start with that and see what happens.

Yeah, I turned off the config option and compared the sizes. Now, both result in the same build size. Thanks for the suggestion Greg. Still, my concern is that the distro's build is generating a small build size in spite of having the option 'CONFIG_DEBUG_INFO' set to 'y'. Any thoughts?

Well, the distribution is for sure building the debug info. But later on,
they strip out the debug info and creates a 2nd kernel package (and 2nd packages for all modules) with the debug info. Thus, the regular kernel image and modules appears as stripped ones on your system.

Cheers,
Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141203/34160eb1/attachment-0001.html