# [SOLVED] Kernel files: Big increase in size with 5.x ?

## martin13

Hi,

please look at this:

```

/usr/src$ ls -lh linux*/vmlinux linux*/vmlinux.o

-rwxr-xr-x 1 root root  24M 10. Apr 2020  linux-4.9.217-gentoo/vmlinux

-rw-r--r-- 1 root root  27M 10. Apr 2020  linux-4.9.217-gentoo/vmlinux.o

-rwxr-xr-x 1 root root  24M 17. Mai 2020  linux-4.9.221-gentoo/vmlinux

-rw-r--r-- 1 root root  27M 17. Mai 2020  linux-4.9.221-gentoo/vmlinux.o

-rwxr-xr-x 1 root root  24M 15. Jul 2020  linux-4.9.228-gentoo/vmlinux

-rw-r--r-- 1 root root  27M 15. Jul 2020  linux-4.9.228-gentoo/vmlinux.o

-rwxr-xr-x 1 root root  24M  1. Sep 2020  linux-4.9.233-gentoo/vmlinux

-rw-r--r-- 1 root root  27M  1. Sep 2020  linux-4.9.233-gentoo/vmlinux.o

-rwxr-xr-x 1 root root  24M 30. Sep 2020  linux-4.9.236-gentoo/vmlinux

-rw-r--r-- 1 root root  27M 30. Sep 2020  linux-4.9.236-gentoo/vmlinux.o

-rwxr-xr-x 1 root root  24M 27. Okt 2020  linux-4.9.240-gentoo/vmlinux

-rw-r--r-- 1 root root  27M 27. Okt 2020  linux-4.9.240-gentoo/vmlinux.o

-rwxr-xr-x 1 root root  24M  5. Dez 2020  linux-4.9.246-gentoo/vmlinux

-rw-r--r-- 1 root root  27M  5. Dez 2020  linux-4.9.246-gentoo/vmlinux.o

-rwxr-xr-x 1 root root  24M 16. Feb 2021  linux-4.9.253-gentoo/vmlinux

-rw-r--r-- 1 root root  27M 16. Feb 2021  linux-4.9.253-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 856M  1. Mai 11:53 linux-5.4.109-gentoo/vmlinux

-rw-r--r-- 1 root root 967M  1. Mai 11:52 linux-5.4.109-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 856M 23. Jul 17:48 linux-5.4.131-gentoo/vmlinux

-rw-r--r-- 1 root root 967M 23. Jul 17:48 linux-5.4.131-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 857M 29. Aug 08:18 linux-5.4.134-gentoo/vmlinux

-rw-r--r-- 1 root root 967M 29. Aug 08:18 linux-5.4.134-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 857M 11. Sep 11:42 linux-5.4.143-gentoo/vmlinux

-rw-r--r-- 1 root root 967M 11. Sep 11:42 linux-5.4.143-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 856M  4. Apr 2021  linux-5.4.97-gentoo/vmlinux

-rw-r--r-- 1 root root 966M  4. Apr 2021  linux-5.4.97-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 857M 11. Sep 11:42 linux/vmlinux

-rw-r--r-- 1 root root 967M 11. Sep 11:42 linux/vmlinux.o

```

With kernels 5.x the size of these files has increased dramatically !

Does anyone have any idea why ?? The 4.x was with my old laptop and i use 5.x with the new one but can this be the only reason for 30 times bigger kernel files?Last edited by martin13 on Sat Oct 30, 2021 7:55 pm; edited 1 time in total

----------

## Perfect Gentleman

```
 /usr/src $ ls -lh linux*/vmlinux linux*/vmlinux.o

-rwxr-xr-x 1 root root 46M Oct 28 09:30 linux-5.14.15-gentoo/vmlinux

-rw-r--r-- 1 root root 48M Oct 28 09:30 linux-5.14.15-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 46M Oct 28 09:30 linux/vmlinux

-rw-r--r-- 1 root root 48M Oct 28 09:30 linux/vmlinux.o

```

```
 /boot $ ls -lh vm*

-rwxr-xr-x 1 root root 7.3M Oct 28 09:30 vmlinuz-5.14.15-gentoo
```

----------

## martin13

 *Perfect Gentleman wrote:*   

> 
> 
> ```
>  /usr/src $ ls -lh linux*/vmlinux linux*/vmlinux.o
> 
> ...

 

My kernel image in boot is bigger than yours but not 30 times bigger...

```

/boot $ ls -lh vm*

-rw-r--r-- 1 root root 6,9M 16. Feb 2021  vmlinuz-4.9.253-gentoo

-rw-r--r-- 1 root root  18M  1. Mai 12:15 vmlinuz-5.4.109-gentoo

-rw-r--r-- 1 root root  18M 23. Jul 17:49 vmlinuz-5.4.131-gentoo

-rw-r--r-- 1 root root  18M 29. Aug 08:20 vmlinuz-5.4.134-gentoo

-rw-r--r-- 1 root root  18M 11. Sep 11:43 vmlinuz-5.4.143-gentoo

-rw-r--r-- 1 root root  18M  6. Feb 2021  vmlinuz-5.4.92-gentoo

-rw-r--r-- 1 root root  18M  4. Apr 2021  vmlinuz-5.4.97-gentoo

-rw-r--r-- 1 root root  18M 20. Mär 2021  vmlinuz-5.4.97-gentoo.old

```

----------

## Hu

Were all these built with the same compiler, linker, and build options?  Do you embed an initramfs in some and not in others?  If you use an initramfs, how is it generated?

----------

## Tony0945

```
 ~ $ ls -lh /boot/vm*

-rw-r--r-- 1 root root 6.5M Aug  8  2019 /boot/vmlinuz-4.17.19-gentoo

-rw-r--r-- 1 root root 5.5M Jul 31 09:17 /boot/vmlinuz-5.10.27-gentoo

-rw-r--r-- 1 root root 5.6M Jul  2 19:29 /boot/vmlinuz-5.10.27-gentoo.old

-rw-r--r-- 1 root root 5.5M Oct 23 11:08 /boot/vmlinuz-5.10.52-gentoo

-rw-r--r-- 1 root root 5.5M Oct 23 10:42 /boot/vmlinuz-5.10.52-gentoo.old

-rw-r--r-- 1 root root 5.7M Jun 17 13:08 /boot/vmlinuz-5.4.109-gentoo

-rw-r--r-- 1 root root 5.7M Oct  4 08:12 /boot/vmlinuz-5.4.143-gentoo

-rw-r--r-- 1 root root 5.5M Feb  7  2021 /boot/vmlinuz-5.4.72-gentoo

-rw-r--r-- 1 root root 5.5M Feb  9  2021 /boot/vmlinuz-5.4.92-gentoo

-rw-r--r-- 1 root root 5.7M Jul  2 19:53 /boot/vmlinuz-5.4.97-gentoo

```

  No significant difference. 4.17 is actually bigger.   No initramfs. Custom kernel options. Basically, the only added in options in later kernels were due to "make oldconfig" picking up new options, mostly discarded.

I suspect OP is supporting a lot of hardware that he doesn't have.  Most new options seem to be hardware expansions.

----------

## martin13

 *Hu wrote:*   

> Were all these built with the same compiler, linker, and build options?  Do you embed an initramfs in some and not in others?  If you use an initramfs, how is it generated?

 

They were all built without initramfs. 

I'm relatively sure the build options (you mean these in make.conf ?) are unchanged.

The compiler / linker changed over the time with gentoo - it was the standard stable gcc. 

But there is this remarkable growing with the 5.x series. I can't imagine it's the gcc.

Are there any special kernel config options i did accidentially different ?

Thanks for trying to answer my question. I have enough diskspace but i'm just courius and wondering  :Smile: 

----------

## toralf

a shot in the dark: an activated "debug" in kernel config let the kernel size explode

----------

## martin13

 *Quote:*   

>  I suspect OP is supporting a lot of hardware that he doesn't have.  Most new options seem to be hardware expansions.

 

The laptop with the 4.x kernels was 12 years older than the new with 5.x kernel. But can this really make such a big difference approx. 30 times bigger ?

I created the config with make localyesconfig. (as usual for me)

----------

## NeddySeagoon

martin13,

Share your kernel .config on a pastebin,

I suspect that you are building the kernel without stripping, so it will be al ready for debug.

My kernels, (no initrd) 

```
$ ls -l /boot/EFI/EFI/SYSLINUX/

total 21822

-rwxr-xr-x 1 root root 7701664 Oct 17 13:20 5.14.12-gentoo

-rwxr-xr-x 1 root root 6336640 Sep 25 11:50 5.14.7-gentoo

-rwxr-xr-x 1 root root 7708640 Sep 28 17:46 5.14.8-gentoo
```

== edit ==

```
CONFIG_STRIP_ASM_SYMS=y
```

is correct.

----------

## martin13

 *toralf wrote:*   

> a shot in the dark: an activated "debug" in kernel config let the kernel size explode

 

Good shot !  :Smile: 

```

/boot $ grep DEBUG config-4.9.253-gentoo config-5.4.97-gentoo | grep -v \#

config-4.9.253-gentoo:CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y

config-4.9.253-gentoo:CONFIG_DEBUG_RODATA=y

config-4.9.253-gentoo:CONFIG_SLUB_DEBUG=y

config-4.9.253-gentoo:CONFIG_HAVE_DMA_API_DEBUG=y

config-4.9.253-gentoo:CONFIG_X86_DEBUGCTLMSR=y

config-4.9.253-gentoo:CONFIG_PM_DEBUG=y

config-4.9.253-gentoo:CONFIG_PM_SLEEP_DEBUG=y

config-4.9.253-gentoo:CONFIG_DEBUG_DEVRES=y

config-4.9.253-gentoo:CONFIG_PNP_DEBUG_MESSAGES=y

config-4.9.253-gentoo:CONFIG_VIDEO_ADV_DEBUG=y

config-4.9.253-gentoo:CONFIG_DEBUG_FS=y

config-4.9.253-gentoo:CONFIG_DEBUG_KERNEL=y

config-4.9.253-gentoo:CONFIG_HAVE_DEBUG_KMEMLEAK=y

config-4.9.253-gentoo:CONFIG_DEBUG_STACK_USAGE=y

config-4.9.253-gentoo:CONFIG_DEBUG_MEMORY_INIT=y

config-4.9.253-gentoo:CONFIG_HAVE_DEBUG_STACKOVERFLOW=y

config-4.9.253-gentoo:CONFIG_DEBUG_STACKOVERFLOW=y

config-4.9.253-gentoo:CONFIG_DEBUG_BUGVERBOSE=y

config-4.9.253-gentoo:CONFIG_DEBUG_BOOT_PARAMS=y

config-4.9.253-gentoo:CONFIG_X86_DEBUG_FPU=y

config-5.4.97-gentoo:CONFIG_SLUB_DEBUG=y

config-5.4.97-gentoo:CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y

config-5.4.97-gentoo:CONFIG_IOSF_MBI_DEBUG=y

config-5.4.97-gentoo:CONFIG_KVM_DEBUG_FS=y

config-5.4.97-gentoo:CONFIG_X86_DEBUGCTLMSR=y

config-5.4.97-gentoo:CONFIG_PM_DEBUG=y

config-5.4.97-gentoo:CONFIG_PM_ADVANCED_DEBUG=y

config-5.4.97-gentoo:CONFIG_PM_SLEEP_DEBUG=y

config-5.4.97-gentoo:CONFIG_ACPI_DEBUGGER=y

config-5.4.97-gentoo:CONFIG_ACPI_DEBUGGER_USER=y

config-5.4.97-gentoo:CONFIG_ACPI_DEBUG=y

config-5.4.97-gentoo:CONFIG_BLK_DEBUG_FS=y

config-5.4.97-gentoo:CONFIG_BLK_DEBUG_FS_ZONED=y

config-5.4.97-gentoo:CONFIG_BT_DEBUGFS=y

config-5.4.97-gentoo:CONFIG_CFG80211_DEBUGFS=y

config-5.4.97-gentoo:CONFIG_MAC80211_DEBUGFS=y

config-5.4.97-gentoo:CONFIG_IWLWIFI_DEBUGFS=y

config-5.4.97-gentoo:CONFIG_DYNAMIC_DEBUG=y

config-5.4.97-gentoo:CONFIG_DEBUG_INFO=y

config-5.4.97-gentoo:CONFIG_DEBUG_INFO_DWARF4=y

config-5.4.97-gentoo:CONFIG_DEBUG_FS=y

config-5.4.97-gentoo:CONFIG_DEBUG_KERNEL=y

config-5.4.97-gentoo:CONFIG_DEBUG_MISC=y

config-5.4.97-gentoo:CONFIG_HAVE_DEBUG_KMEMLEAK=y

config-5.4.97-gentoo:CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y

config-5.4.97-gentoo:CONFIG_SCHED_DEBUG=y

config-5.4.97-gentoo:CONFIG_LOCK_DEBUGGING_SUPPORT=y

config-5.4.97-gentoo:CONFIG_DEBUG_BUGVERBOSE=y

config-5.4.97-gentoo:CONFIG_DEBUG_WX=y

config-5.4.97-gentoo:CONFIG_X86_DEBUG_FPU=y

```

Do you think the reason could be :

DEBUG_INFO=y ??

DEBUG_KERNEL=y we have in both configs...

----------

## martin13

Hi NeddySeagoon,

it is a special honor for me to write to you  :Smile: 

 *Quote:*   

> 
> 
> My kernels, (no initrd) 
> 
> ```
> ...

 

I'm talking about the sizes under /usr/src/linux (see above) - the sizes in /boot are quite ok - do they have special compression ?

 *Quote:*   

> 
> 
> ```
> CONFIG_STRIP_ASM_SYMS=y
> ```
> ...

 

```

grep CONFIG_STRIP_ASM_SYMS config-4.9.253-gentoo config-5.4.97-gentoo 

config-4.9.253-gentoo:# CONFIG_STRIP_ASM_SYMS is not set

config-5.4.97-gentoo:# CONFIG_STRIP_ASM_SYMS is not set

```

So the stripping is not the reason for the difference i think?

----------

## martin13

 *toralf wrote:*   

> a shot in the dark: an activated "debug" in kernel config let the kernel size explode

 

Here is a "diff" between the 4.x debug options  and the 5.x debug options

```

-CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y

-CONFIG_DEBUG_RODATA=y

 CONFIG_SLUB_DEBUG=y

-CONFIG_HAVE_DMA_API_DEBUG=y

+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y

+CONFIG_IOSF_MBI_DEBUG=y

+CONFIG_KVM_DEBUG_FS=y

 CONFIG_X86_DEBUGCTLMSR=y

 CONFIG_PM_DEBUG=y

+CONFIG_PM_ADVANCED_DEBUG=y

 CONFIG_PM_SLEEP_DEBUG=y

-CONFIG_DEBUG_DEVRES=y

-CONFIG_PNP_DEBUG_MESSAGES=y

-CONFIG_VIDEO_ADV_DEBUG=y

+CONFIG_ACPI_DEBUGGER=y

+CONFIG_ACPI_DEBUGGER_USER=y

+CONFIG_ACPI_DEBUG=y

+CONFIG_BLK_DEBUG_FS=y

+CONFIG_BLK_DEBUG_FS_ZONED=y

+CONFIG_BT_DEBUGFS=y

+CONFIG_CFG80211_DEBUGFS=y

+CONFIG_MAC80211_DEBUGFS=y

+CONFIG_IWLWIFI_DEBUGFS=y

+CONFIG_DYNAMIC_DEBUG=y

+CONFIG_DEBUG_INFO=y

+CONFIG_DEBUG_INFO_DWARF4=y

 CONFIG_DEBUG_FS=y

 CONFIG_DEBUG_KERNEL=y

+CONFIG_DEBUG_MISC=y

 CONFIG_HAVE_DEBUG_KMEMLEAK=y

-CONFIG_DEBUG_STACK_USAGE=y

-CONFIG_DEBUG_MEMORY_INIT=y

-CONFIG_HAVE_DEBUG_STACKOVERFLOW=y

-CONFIG_DEBUG_STACKOVERFLOW=y

+CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y

+CONFIG_SCHED_DEBUG=y

+CONFIG_LOCK_DEBUGGING_SUPPORT=y

 CONFIG_DEBUG_BUGVERBOSE=y

-CONFIG_DEBUG_BOOT_PARAMS=y

+CONFIG_DEBUG_WX=y

 CONFIG_X86_DEBUG_FPU=y

```

----------

## NeddySeagoon

martin13,

How the kernels in /boot are compressed is a kernel config option. The default on x86 (32 or 64 bit) is bzip but its user selectable.

In the build tree I have

```
$ ls /usr/src/*/vm* -lh

-rwxr-xr-x 1 root root  50M Oct 17 13:20 /usr/src/linux-5.14.12-gentoo/vmlinux

-rw-r--r-- 1 root root  45M Oct 17 13:20 /usr/src/linux-5.14.12-gentoo/vmlinux.o

-rw-r--r-- 1 root root 556K Oct 17 13:20 /usr/src/linux-5.14.12-gentoo/vmlinux.symvers

-rwxr-xr-x 1 root root  50M Sep 28 17:45 /usr/src/linux-5.14.8-gentoo/vmlinux

-rw-r--r-- 1 root root  45M Sep 28 17:45 /usr/src/linux-5.14.8-gentoo/vmlinux.o

-rw-r--r-- 1 root root 557K Sep 28 17:45 /usr/src/linux-5.14.8-gentoo/vmlinux.symvers
```

If the extra bloat in your kernel is debug information, its text, so it will compress very well.

Taken with your statement that the kernels in /boot are OK, there is some support for the debug theory.

It seems that all your kernels are suboptimal with regards to assembler symbol stripping, so its probablfy not a resaon for the size delta.

Unless the 5.x kernel has a lot more symbols to strip.

----------

## martin13

 *NeddySeagoon wrote:*   

> martin13,
> 
> ...
> 
> Taken with your statement that the kernels in /boot are OK, there is some support for the debug theory.
> ...

 

+1 for the "debug theory":

In the "midnight commander viewer" i get:

/usr/src/linux-4.9.253-gentoo/vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=a58bf1060a987362e780382d6ae65d5db5ff49a4, not stripped

but

/usr/src/linux-5.4.109-gentoo/vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=b62ee54f55eee3ff18a880ed8f2ea91c957163f2, with debug_info, not stripped

PS.

How can i get this information on the console? (which program)

----------

## martin13

 *martin13 wrote:*   

>  *NeddySeagoon wrote:*   martin13,
> 
> ...
> 
> Taken with your statement that the kernels in /boot are OK, there is some support for the debug theory.
> ...

 

Does someone maybe know an easy method for removing all these debug information? 

I'm afraid removing only all "debug lines" in .config is not the right way...?

----------

## NeddySeagoon

martin13,

Use 

```
make menuconfig
```

 and the search.

Not all those symbols are user visible knobs. 

```
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
```

is set by your ARCH. You will not see it in menuconfig.

That's normal.

Don't even think of using $EDITOR on the .config file. You will end up with an illegal .config, which if you are lucky, will fail to build.

When you are not lucky, the kernel will be broken in all sorts of ways that are rarely seen, so nobody knows how to fix.

When you change one entry in menuconfig, it may change lots more without telling you. 

You are unlikely to get that right with $EDITOR and it matters.

----------

## martin13

OK - In the kernel configuration section:

* General setup

i disabled "Configure standard kernel features (expert users)" because i had:

```

/boot $ grep -i config_expert config-4.9.253-gentoo config-5.4.97-gentoo 

config-4.9.253-gentoo:# CONFIG_EXPERT is not set

config-5.4.97-gentoo:CONFIG_EXPERT=y

```

after that is was possible to disable   "Kernel debugging"

in the section:

* Kernel hacking

Now i have:

```

-rwxr-xr-x 1 root root 79M 30. Okt 21:52 /usr/src/linux/vmlinux

```

which is way better  :Smile: 

Thanks a lot for all your kind help and time !!

----------

## pietinger

 *martin13 wrote:*   

> i disabled "Configure standard kernel features (expert users)" because i had:
> 
> [...]
> 
> after that is was possible to disable   "Kernel debugging"

 

My recommendation is: Dont do this. You will need both options enabled if you want to secure your kernel with this:

https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings

If you want do KSPP, then:

1.) Enable both options again in "make menuconfig" (save and exit)

2.) Search with "less .config" (and / ) all of your *_debug settings. Look in which "chapter" it is - scroll up and look which is the title of the main section; this is to find it easier in:

3.) Go again into "make menuconfig" and disable the most you have found (you will not find every as @NeddySeagon already said) - except these debug settings recommended in KSPP

3b). If you really dont find one search with / in your make menuconfig (you can type the name without leading CONFIG_)

4.) Do the KSPP

5.) Do your make and make install and make modules_install (if you have modules); and all other things for your bootmanager

You should have then a clean, fast, small AND hardened kernel  :Wink: 

----------

## figueroa

I know I'm a bit late to this party, but this is from two different machines, one amd64 and the other x86 desktops, different kernel series, somewhat bog standard, no initramfs (except intel-microcode), similar config options for both machines:

amd64:

```
$ ls -lh /usr/src/linux*/vmlinux /usr/src/linux*/vmlinux.o

-rwxr-xr-x 1 root root 51M Jul 21 12:56 /usr/src/linux-5.4.134-gentoo/vmlinux*

-rw-r--r-- 1 root root 46M Jul 21 12:56 /usr/src/linux-5.4.134-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 52M Sep 25 22:41 /usr/src/linux-5.4.143-gentoo/vmlinux*

-rw-r--r-- 1 root root 48M Sep 25 22:41 /usr/src/linux-5.4.143-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 52M Oct 30 13:44 /usr/src/linux-5.4.154-gentoo/vmlinux*

-rw-r--r-- 1 root root 47M Oct 30 13:44 /usr/src/linux-5.4.154-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 52M Oct 30 13:44 /usr/src/linux/vmlinux*

-rw-r--r-- 1 root root 47M Oct 30 13:44 /usr/src/linux/vmlinux.o

$ ls -lh /boot/kern*

-rw-r--r-- 1 root root 7.9M Jul 21 13:05 /boot/kernel-5.4.134-gentoo

-rw-r--r-- 1 root root 8.2M Sep 25 22:43 /boot/kernel-5.4.143-gentoo

-rw-r--r-- 1 root root 8.0M Oct 30 22:26 /boot/kernel-5.4.154-gentoo

```

x86

```
$ ls -lh /usr/src/linux*/vmlinux /usr/src/linux*/vmlinux.o

-rwxr-xr-x 1 root root 15M Jul 21 13:04 /usr/src/linux-4.9.276-gentoo/vmlinux*

-rw-r--r-- 1 root root 18M Jul 21 13:04 /usr/src/linux-4.9.276-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 15M Aug 30 14:07 /usr/src/linux-4.9.281-gentoo/vmlinux*

-rw-r--r-- 1 root root 18M Aug 30 14:07 /usr/src/linux-4.9.281-gentoo/vmlinux.o

-rwxr-xr-x 1 root root 15M Aug 30 14:07 /usr/src/linux/vmlinux*

-rw-r--r-- 1 root root 18M Aug 30 14:07 /usr/src/linux/vmlinux.o

$ ls -lh /boot/kern*

-rw-r--r-- 1 root root 5.9M Jul 21 13:09 /boot/kernel-4.9.276-gentoo

-rw-r--r-- 1 root root 5.9M Aug 30 15:55 /boot/kernel-4.9.281-gentoo
```

Conclusion: Yes, kernel's have gotten larger, but not THAT large.

----------

## martin13

 *pietinger wrote:*   

>  *martin13 wrote:*   i disabled "Configure standard kernel features (expert users)" because i had:
> 
> [...]
> 
> after that is was possible to disable   "Kernel debugging" 
> ...

 

So, i think the "size-mystery" is finally solved now.

The only one option which bloated the files so much was DEBUG_INFO !!

If i deactivate "Compile the kernel with debug info" the sizes are normal again and i can  leave unchanged

```

CONFIG_EXPERT=y

CONFIG_DEBUG_KERNEL=y

```

like you suggested !

Some additional information:

```

 Symbol: DEBUG_INFO [=y]                

  │ Type  : bool                                

  │ Prompt: Compile the kernel with debug info  

  │   Location: 

  │     -> Kernel hacking         

  │ (1)   -> Compile-time checks and compiler options  

  │   Defined at lib/Kconfig.debug:171    

  │   Depends on: DEBUG_KERNEL [=y] && !COMPILE_TEST [=n]

CONFIG_DEBUG_INFO:                                       

  │          

  │ If you say Y here the resulting kernel image will include       

  │ debugging info resulting in a larger kernel image.                     

  │ This adds debug symbols to the kernel and modules (gcc -g), and 

  │ is needed if you intend to use kernel crashdump or binary object   

  │ tools like crash, kgdb, LKCD, gdb, etc on the kernel.                 

  │ Say Y here only if you plan to debug the kernel.    

  │                                         

  │ If unsure, say N

```

Thank you all again for your help !

----------

## Tony0945

I turned off DEBUG_INFO as recommended and saved a whole 32 bytes! Not M not K, BYTES.

```
-rw-r--r-- 1 root root 5748544 Oct 23 11:08 /boot/vmlinuz-5.10.52-gentoo.old

-rw-r--r-- 1 root root 5748512 Oct 31 08:32 /boot/vmlinuz-5.10.52-gentoo
```

----------

## martin13

 *Tony0945 wrote:*   

> I turned off DEBUG_INFO as recommended and saved a whole 32 bytes! Not M not K, BYTES.
> 
> ```
> -rw-r--r-- 1 root root 5748544 Oct 23 11:08 /boot/vmlinuz-5.10.52-gentoo.old
> 
> ...

 

We were talking about the sizes in /usr/src/linux* not /boot - but anyway - it's crazy - so little change with your config ...

Can we have a look and you execute:

```

/boot $ grep DEBUG $your_config | grep -v \#

```

?

----------

## Tony0945

```
 # zgrep DEBUG /proc/config.gz |grep -v \#

CONFIG_SLUB_DEBUG=y

CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y

CONFIG_X86_DEBUGCTLMSR=y

CONFIG_PM_DEBUG=y

CONFIG_BLK_DEBUG_FS=y

CONFIG_HWMON_DEBUG_CHIP=y

CONFIG_VIDEO_ADV_DEBUG=y

CONFIG_NOUVEAU_DEBUG=5

CONFIG_NOUVEAU_DEBUG_DEFAULT=3

CONFIG_NOUVEAU_DEBUG_MMU=y

CONFIG_CIFS_DEBUG=y

CONFIG_DEBUG_BUGVERBOSE=y

CONFIG_DEBUG_INFO=y

CONFIG_DEBUG_FS=y

CONFIG_DEBUG_FS_ALLOW_ALL=y

CONFIG_DEBUG_KERNEL=y

CONFIG_DEBUG_MISC=y

CONFIG_ARCH_HAS_DEBUG_WX=y

CONFIG_HAVE_DEBUG_KMEMLEAK=y

CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y

CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y

CONFIG_DEBUG_MEMORY_INIT=y

CONFIG_DEBUG_PREEMPT=y

CONFIG_LOCK_DEBUGGING_SUPPORT=y

CONFIG_DEBUG_MUTEXES=y

CONFIG_X86_DEBUG_FPU=y

```

Why would I care about the size in /usr/src/linux?  The boot size is what affects loading time and memory.

----------

## martin13

 *Tony0945 wrote:*   

> 
> 
> ```
>  # zgrep DEBUG /proc/config.gz |grep -v \#
> 
> ...

 

I've no idea why the "behaviour" on your side is so different.  :Sad: 

I normally also don't care about files in /usr/src/linux - but it was rapidly growing (multiple GBs per kernel - see my first post)

I wasn't recommending anything but the DEBUG_INFO=n solved my problem on my side so i wanted to document this here just in case it's useful for others  -so sorry for the noise ;-(Last edited by martin13 on Sun Oct 31, 2021 5:01 pm; edited 1 time in total

----------

## martin13

 *Tony0945 wrote:*   

> I turned off DEBUG_INFO as recommended and saved a whole 32 bytes! Not M not K, BYTES.
> 
> ```
> -rw-r--r-- 1 root root 5748544 Oct 23 11:08 /boot/vmlinuz-5.10.52-gentoo.old
> 
> ...

 

You also don't have neither modules nor initramfs ?

----------

## martin13

 *Tony0945 wrote:*   

> I turned off DEBUG_INFO as recommended and saved a whole 32 bytes! Not M not K, BYTES.
> 
> ```
> -rw-r--r-- 1 root root 5748544 Oct 23 11:08 /boot/vmlinuz-5.10.52-gentoo.old
> 
> ...

 

With CONFIG_DEBUG_INFO=n

```

$ file /usr/src/linux/vmlinux

/usr/src/linux/vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=b1ea3ba26eea1d35003623cdb52ca74de335ab34, not stripped

```

With CONFIG_DEBUG_INFO=y

```

$ file /usr/src/linux-5.4.97-gentoo/vmlinux

/usr/src/linux-5.4.97-gentoo/vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=76939748d9b1441fb6ee67d71ee4b5b656405b59, with debug_info, not stripped

```

What says "file" about the files in /usr/src/linux* on your side?

Does stripping remove the debug information?

----------

## figueroa

@Tony0945 -- Some people care about size in /usr/src because they (like me) keep multiple kernel sources and excessively large files take away from their comfortable elbow room. On most, but not all, systems, I have plenty of elbow room. One thing about Gentoo, it takes plenty of elbow room to maintain.

----------

## Tony0945

modules, yes

initramfs, no

----------

## martin13

 *Tony0945 wrote:*   

> modules, yes
> 
> initramfs, no

 

So perhaps little more difference in size on your side is visible in the "modules department" ( /lib/modules/ or similiar) ??

My kernel has no modules.

----------

## Tony0945

maybe nouveau has grown. that would make sense

EDIT:

shrunk actually

```
~ $ ls -ltrh `locate nouveau.ko|grep /lib/modules`

-rw-r--r-- 1 root root 163M Aug  8  2019 /lib/modules/4.17.19-gentoo/kernel/drivers/gpu/drm/nouveau/nouveau.ko

-rw-r--r-- 1 root root 195M Dec  5  2020 /lib/modules/5.4.80-gentoo-r1/kernel/drivers/gpu/drm/nouveau/nouveau.ko

-rw-r--r-- 1 root root 196M Feb  7  2021 /lib/modules/5.4.72-gentoo/kernel/drivers/gpu/drm/nouveau/nouveau.ko

-rw-r--r-- 1 root root 195M Feb  9  2021 /lib/modules/5.4.92-gentoo/kernel/drivers/gpu/drm/nouveau/nouveau.ko

-rw-r--r-- 1 root root 185M Jun  2 09:11 /lib/modules/5.10.27-gentooASUS/kernel/drivers/gpu/drm/nouveau/nouveau.ko

-rw-r--r-- 1 root root 131M Jun 17 13:08 /lib/modules/5.4.109-gentoo/kernel/drivers/gpu/drm/nouveau/nouveau.ko

-rw-r--r-- 1 root root 131M Jul  2 19:53 /lib/modules/5.4.97-gentoo/kernel/drivers/gpu/drm/nouveau/nouveau.ko

-rw-r--r-- 1 root root 277M Jul 31 09:17 /lib/modules/5.10.27-gentoo/kernel/drivers/gpu/drm/nouveau/nouveau.ko

-rw-r--r-- 1 root root 195M Oct  4 08:12 /lib/modules/5.4.143-gentoo/kernel/drivers/gpu/drm/nouveau/nouveau.ko

-rw-r--r-- 1 root root 4.1M Oct 31 08:31 /lib/modules/5.10.52-gentoo/kernel/drivers/gpu/drm/nouveau/nouveau.ko

```

----------

