LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-15-2024, 12:40 PM   #1
SlackWar
Member
 
Registered: Jul 2014
Location: Europe
Distribution: Slackware
Posts: 72

Rep: Reputation: Disabled
Swollen kernel


Some time ago I made a mistake during kernel configuration, and now I can't find the option I switched — unfortunately, I deleted the older config, so I can't do direct comparison.

The problem is: somehow I added BSS to the kernel file, which actually shouldn't be there:

„Note that the BSS segment is not stored in the kernel image because it can be synthesized at boot time by filling a block of memory with zeros.”

Have a look what size reports for two kernels I built:

Code:
root@machine/usr/src/linux-4.19.304.old/arch/x86/boot# size bzImage 
size: bzImage: warning: ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .bss
   text    data     bss     dec     hex filename
7971136       0 15236288        23207424        1621e00 bzImage

root@machine/usr/src/linux-6.1.72/arch/x86/boot# size bzImage 
   text    data     bss     dec     hex filename
5979840       0       0 5979840  5b3ec0 bzImage
Yes, that first kernel is about 2 MB bigger than it used to be (note that warning printed during sizing).

Anyone has an idea, which actually option should be switched off to get back to „normal” size? Of course from the thousand options available to search none is clearly described „add_BSS” or similar way. No „BSS” term anywhere in the config file.
 
Old 01-15-2024, 01:41 PM   #2
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,939

Rep: Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568
Maybe CONFIG_INITRAMFS_SOURCE? Did you embed an initramfs in your kernel?
 
Old 01-15-2024, 01:47 PM   #3
SlackWar
Member
 
Registered: Jul 2014
Location: Europe
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: Disabled
It is empty: CONFIG_INITRAMFS_SOURCE=""
 
Old 01-15-2024, 01:50 PM   #4
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,939

Rep: Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568Reputation: 1568
Then you probably didn't embed firmware either? CONFIG_EXTRA_FIRMWARE ?
 
Old 01-15-2024, 02:00 PM   #5
SlackWar
Member
 
Registered: Jul 2014
Location: Europe
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: Disabled
It's also empty: CONFIG_EXTRA_FIRMWARE=""
 
Old 01-15-2024, 02:56 PM   #6
SlackWar
Member
 
Registered: Jul 2014
Location: Europe
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: Disabled
I also compared vmlinux in both cases:

Code:
root@machine/usr/src/linux-6.1.72# size vmlinux 
   text    data     bss     dec     hex filename
11129708        4302096 2605088 18036892        113389c vmlinux

root@machine/usr/src/linux-4.19.304# size vmlinux 
   text    data     bss     dec     hex filename
9020463 2461744 2723840 14206047         d8c45f vmlinux
So it seems some kind of mysterious „data” has been glued to my 4.x kernel build — but no idea how and when I did that. How to get rid of this?
 
Old 01-15-2024, 03:23 PM   #7
lazardo
Member
 
Registered: Feb 2010
Location: SD Bay Area
Posts: 276

Rep: Reputation: Disabled
Quote:
Originally Posted by SlackWar View Post
Some time ago I made a mistake during kernel configuration, and now I can't find the option I switched — unfortunately, I deleted the older config, so I can't do direct comparison.
This might help.
Code:
$ /usr/src/linux/scripts/extract-ikconfig /usr/src/linux/arch/x86/boot/bzImage | head
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 6.1.70 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=110200
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23700
 
Old 01-15-2024, 03:37 PM   #8
SlackWar
Member
 
Registered: Jul 2014
Location: Europe
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: Disabled
But I've got no problem with 6.1.x line; the problem is with 4.19.x compiled on x64 (no such issue on 32-bit machine).
Yes, in my 6.1.x configuration I have these initial lines looking exactly as yours.

I suspect it may be some kind of bug in 4.19.x line, not my mistake — introduced somewhere around 4.19.282. I'm unable to find any option, that could make the bzip2-compressed kernel file by 2 MB bigger on x64.
 
Old 01-16-2024, 12:32 AM   #9
henca
Senior Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 1,017

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
Instead of guessing, why not simply boot the two kernels and save their contents of /proc/config.gz for comparision?

regards Henrik
 
1 members found this post helpful.
Old 01-16-2024, 05:12 AM   #10
SlackWar
Member
 
Registered: Jul 2014
Location: Europe
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: Disabled
I don't use /proc/config.gz actually, but of course I do have my own configuration files for both kernels — there are too many differences among them to make any clear conclusion.

I was hoping anyone could know the origin of that „bss” that appeared in the kernel just out of the blue.
 
Old 01-16-2024, 11:51 AM   #11
rkomar
Member
 
Registered: Mar 2022
Location: Sudbury, ON, Canada
Distribution: Slackware
Posts: 34

Rep: Reputation: 14
The BSS is always part of the kernel, it is where zero-initialized or non-initialized static variables go. The segment is shared by all of the kernel code (outside of modules, I presume), so it's hard to guess what is making it large just based on the config file. You might get more information looking at the map file for the kernel and seeing what is in the BSS segment.

I vaguely recall that the BSS doesn't take up much space in the file, rather the segment is created and filled with zeroes when the kernel is loaded. If so, it wouldn't be making the compressed kernel file any larger.

Edit: oops, I should have re-read the first post before replying. I don't think this added any useful information.

Last edited by rkomar; 01-16-2024 at 11:54 AM.
 
Old 01-16-2024, 11:58 AM   #12
SlackWar
Member
 
Registered: Jul 2014
Location: Europe
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: Disabled
I'm afraid it added not, unfortunately.
I'm still searching the config to find out, what's wrong there.
 
Old 01-16-2024, 12:33 PM   #13
rkomar
Member
 
Registered: Mar 2022
Location: Sudbury, ON, Canada
Distribution: Slackware
Posts: 34

Rep: Reputation: 14
You mention that the 4.19 kernel is 2MB larger, which is the difference in the size between the text segments (i.e. where the kernel instructions are stored). Maybe this has nothing to do with the bss or data segments. Perhaps more of the code is built directly into the kernel rather than as modules?
 
Old 01-16-2024, 12:38 PM   #14
SlackWar
Member
 
Registered: Jul 2014
Location: Europe
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: Disabled
You may want to examine more closely my posts in this thread; I suggest take a closer look at the first post again (and the post #6).
 
Old 01-16-2024, 12:59 PM   #15
rkomar
Member
 
Registered: Mar 2022
Location: Sudbury, ON, Canada
Distribution: Slackware
Posts: 34

Rep: Reputation: 14
I did look at them closely. Perhaps you are being fooled by the bad tabulation of the output in post #6. The numbers don't line up with the column headers. The 6.1.72 kernel has a larger data section than the 4.19.304 kernel in vmlinux.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to upgrade the Debian 3 kernel 2.4.18 to kernel 2.6 or bigmem- kernel chandu.bezawada Debian 6 11-12-2010 09:33 AM
LXer: Howto: build Linux kernel module against installed kernel w/o full kernel source tree LXer Syndicated Linux News 0 09-03-2006 08:21 PM
Update kernel from kernel-enterprise-2.4.9-e.3 to kernel-enterprise-2.4.9-e.8 imsajjadali Red Hat 0 01-24-2004 12:41 AM
Update kernel from kernel-enterprise-2.4.9-e.3 to kernel-enterprise-2.4.9-e.8 imsajjadali Linux - Software 4 01-17-2004 12:38 PM
A new kernel is out! A new kernel is out! A new kernel is out! Aussie Linux - General 9 11-29-2002 08:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration