Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Kernel files: Big increase in size with 5.x ?
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sat Oct 30, 2021 9:13 am    Post subject: [SOLVED] Kernel files: Big increase in size with 5.x ? Reply with quote

Hi,

please look at this:

Code:

/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
Back to top
View user's profile Send private message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1256

PostPosted: Sat Oct 30, 2021 9:26 am    Post subject: Reply with quote

Code:
 /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

Code:
 /boot $ ls -lh vm*
-rwxr-xr-x 1 root root 7.3M Oct 28 09:30 vmlinuz-5.14.15-gentoo
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sat Oct 30, 2021 9:36 am    Post subject: Reply with quote

Perfect Gentleman wrote:
Code:
 /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

Code:
 /boot $ ls -lh vm*
-rwxr-xr-x 1 root root 7.3M Oct 28 09:30 vmlinuz-5.14.15-gentoo


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

/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

Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23103

PostPosted: Sat Oct 30, 2021 4:08 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Sat Oct 30, 2021 4:15 pm    Post subject: Reply with quote

Code:
 ~ $ 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.
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sat Oct 30, 2021 4:23 pm    Post subject: Reply with quote

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 :-)
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3943
Location: Hamburg

PostPosted: Sat Oct 30, 2021 4:31 pm    Post subject: Reply with quote

a shot in the dark: an activated "debug" in kernel config let the kernel size explode
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sat Oct 30, 2021 4:34 pm    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54851
Location: 56N 3W

PostPosted: Sat Oct 30, 2021 4:42 pm    Post subject: Reply with quote

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)
Code:
$ 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 ==

Code:
CONFIG_STRIP_ASM_SYMS=y
is correct.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sat Oct 30, 2021 5:33 pm    Post subject: Reply with quote

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


Good shot ! :-)

Code:

/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...
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sat Oct 30, 2021 5:45 pm    Post subject: Reply with quote

Hi NeddySeagoon,

it is a special honor for me to write to you :-)

Quote:

My kernels, (no initrd)
Code:
$ 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



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:

Code:
CONFIG_STRIP_ASM_SYMS=y
is correct.


Code:

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?
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sat Oct 30, 2021 5:56 pm    Post subject: Reply with quote

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

Code:

-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
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54851
Location: 56N 3W

PostPosted: Sat Oct 30, 2021 6:39 pm    Post subject: Reply with quote

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
Code:
$ 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.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sat Oct 30, 2021 7:26 pm    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sat Oct 30, 2021 7:32 pm    Post subject: Reply with quote

martin13 wrote:
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":



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...?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54851
Location: 56N 3W

PostPosted: Sat Oct 30, 2021 7:42 pm    Post subject: Reply with quote

martin13,

Use
Code:
make menuconfig
and the search.
Not all those symbols are user visible knobs.
Code:
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.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sat Oct 30, 2021 8:08 pm    Post subject: Reply with quote

OK - In the kernel configuration section:

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


Code:

/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:
Code:

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

which is way better :-)


Thanks a lot for all your kind help and time !!
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5394
Location: Bavaria

PostPosted: Sat Oct 30, 2021 9:42 pm    Post subject: Reply with quote

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 ;-)
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 3007
Location: Edge of marsh USA

PostPosted: Sun Oct 31, 2021 3:57 am    Post subject: Reply with quote

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:
Code:
$ 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
Code:
$ 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.
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sun Oct 31, 2021 12:01 pm    Post subject: Reply with quote

pietinger wrote:
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


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
Code:

CONFIG_EXPERT=y
CONFIG_DEBUG_KERNEL=y

like you suggested !

Some additional information:

Code:

 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 !
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Sun Oct 31, 2021 1:58 pm    Post subject: Reply with quote

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

Code:
-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
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sun Oct 31, 2021 2:54 pm    Post subject: Reply with quote

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

Code:
-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


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:

Code:

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


?
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Sun Oct 31, 2021 4:34 pm    Post subject: Reply with quote

Code:
 # 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.
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sun Oct 31, 2021 4:57 pm    Post subject: Reply with quote

Tony0945 wrote:
Code:
 # 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.


I've no idea why the "behaviour" on your side is so different. :-(
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
Back to top
View user's profile Send private message
martin13
n00b
n00b


Joined: 20 Oct 2021
Posts: 21

PostPosted: Sun Oct 31, 2021 5:00 pm    Post subject: Reply with quote

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

Code:
-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


You also don't have neither modules nor initramfs ?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum