The Linux Kernel: Configuring the Kernel (Part 1)

make gconfig never works on ubuntu 12.04 LTS whatever I do. Has anyone tried it?
I have also asked a question Trouble using `make gconfig` in ubuntu linux in 'Unix and Linux' on StackExchange website with details of my problem. No working answers so far :(

Some kind of GTK developer's library is needed, but I am not sure which one. For example, when I use "make menuconfig", I must have libncurses5-dev installed. I would suggest some kind of package like (the name may be wrong, but as a general idea) libgtk-dev.

UPDATE:

Try installing libglade-2.0 or the whole Glade system.

make gconfig

gconfig.png
 
Last edited:


Some kind of GTK developer's library is needed, but I am not sure which one. For example, when I use "make menuconfig", I must have libncurses5-dev installed. I would suggest some kind of package like (the name may be wrong, but as a general idea) libgtk-dev.

UPDATE:

Try installing libglade-2.0 or the whole Glade system.

Updated:
Ok, I found out the problem, the default update sever mentioned in Software center wasn't responding properly. I went out to Ubuntu Sotware Center, then Edit -> Software Sources -> Ubuntu Software -> Download From, and chose another server for update. Then tried downloading required libraries and it worked.
Now the command for required libs for gconfig in Ubuntu is:
>> sudo apt-get install libgtk2.0-dev libglib2.0-dev libglade2-dev
and `make gconfig` will work fine :)
 
Last edited:
hi friends,

how to download the linux coding and how to editing or which platform we will editing the coding
 
hi friends,

how to download the linux coding and how to editing or which platform we will editing the coding

I am not sure what you are asking. Can you clarify?

You can edit code on any distro. I prefer to do my coding on Ubuntu with the Geany IDE.
 
From last week m tryng to configure Android kernel on our newc oreborad ; I have also got zImage but by using the default .config file.But when i give command "make menuconfig" it shows the below error:-

[root@swapnilLinuxHost linux-2.6.36-android]# make menuconfig
HOSTLD scripts/kconfig/mconf
scripts/kconfig/mconf.o: file not recognized: File truncated
collect2: ld returned 1 exit status
make[1]: * [scripts/kconfig/mconf] Error 1
make: * [menuconfig] Error 2
[root@swapnilLinuxHost linux-2.6.36-android]#


Please help me through this issue.Waiting for your response.

Thanks,
Anjusha P.
 
From last week m tryng to configure Android kernel on our newc oreborad ; I have also got zImage but by using the default .config file.But when i give command "make menuconfig" it shows the below error:-

[root@swapnilLinuxHost linux-2.6.36-android]# make menuconfig
HOSTLD scripts/kconfig/mconf
scripts/kconfig/mconf.o: file not recognized: File truncated
collect2: ld returned 1 exit status
make[1]: * [scripts/kconfig/mconf] Error 1
make: * [menuconfig] Error 2
[root@swapnilLinuxHost linux-2.6.36-android]#


Please help me through this issue.Waiting for your response.

Thanks,
Anjusha P.

My first suggestion is that you get the latest Android-kernel source code. Kernel 2.6.x is rather old (compared to the newest kernels). You probably should not use the default ".config" file. Configure the Android kernel as needed for your device. Also, ensure you have Ncurses installed (libncurses5-dev). If this fails, try using "make gconfig" (GTK interface that requires GTK) or "make xconfig" (Qt interface that requires Qt). Does this help?

By the way, you do not need to be Root to configure or compile the kernel.
 
Great articles! Details on what the choices actually do. However I am trying to build
a gentoo kernel for the system rescue CD. Thus I already have a .config file from cat /proc/config.gz | gzip -d > .config that should be the starting point. However when I cheat (which has sometimes worked but not this time) and copy this in to the kernel source directory and then make menuconfig then make a change and save the config (because I think the real config file is somewhere in the kernel source directory not the .config file) the kernel make dies saying the selected CPU doesn't support the x86 instruction set (despite the CPU being x86 generic). Is there a proper way to set an existing .config file as the starting point for a config that I just don't know and google can't find (I sure hope so :))? I have mostly been a FreeBSD user and frankly much prefer the edit a simple text file in 5 minutes kernel config method in BSD. When the above didn't work I started from the patched kernel sources with no config file and ran menuconfig. In another window I ran menuconfig and loaded the running config from .config.cur with the load command. I have spent most of a day so far switching between windows and trying to make one config match the other so far with limited success :). So I'm hoping there is an easier way to do this :).

Peter Van Epp
 
Great articles! Details on what the choices actually do. However I am trying to build
a gentoo kernel for the system rescue CD. Thus I already have a .config file from cat /proc/config.gz | gzip -d > .config that should be the starting point. However when I cheat (which has sometimes worked but not this time) and copy this in to the kernel source directory and then make menuconfig then make a change and save the config (because I think the real config file is somewhere in the kernel source directory not the .config file) the kernel make dies saying the selected CPU doesn't support the x86 instruction set (despite the CPU being x86 generic). Is there a proper way to set an existing .config file as the starting point for a config that I just don't know and google can't find (I sure hope so :))? I have mostly been a FreeBSD user and frankly much prefer the edit a simple text file in 5 minutes kernel config method in BSD. When the above didn't work I started from the patched kernel sources with no config file and ran menuconfig. In another window I ran menuconfig and loaded the running config from .config.cur with the load command. I have spent most of a day so far switching between windows and trying to make one config match the other so far with limited success :). So I'm hoping there is an easier way to do this :).

Peter Van Epp

If you copy the configuration from one kernel (/proc/config.gz | gzip -d > .config) and then place/paste it into the main directory of the kernel src, then that is the config-file that is used. If the kernel src is a different version than the origin of the copied config, then you need to "update" the config file. To do this, run "make oldconfig" in a terminal. Then, you will be ask some questions. Your config file will be updated for the new kernel features. Next, perform any configurations using one of the "make *config" commands like "make gconfig" or your favorite interface. Editing the config file using a text editor will not enable dependencies. Using a configuration interface will manage dependencies. Also, make sure that you have all of the needed compilers and libraries installed on your system.

So, the Gentoo system (where you got the ".config"), your computer, and your active Linux OS performing the compiling are all x86-systems, right? When you say "x86" are you refering to x86 in general, x86-64, or x86-32? (I ask this because some people say "x86" meaning "x86-32 & x86-64", while some people mean "x86-32")

Summary:

/proc/config.gz | gzip -d > .config
# place ".config" with kernel src
make oldconfig
make gconfig || make xconfig || make menuconfig || <OR YOUR PREFERRED INTERFACE>
 
"So, the Gentoo system (where you got the ".config"), your computer, and your active Linux OS performing the compiling are all x86-systems, right? When you say "x86" are you refering to x86 in general, x86-64, or x86-32? (I ask this because some people say "x86" meaning "x86-32 & x86-64", while some people mean "x86-32")"

Yes the system I'm trying this on is an AMD Athlon 64 booted from a System Rescue CD iso.

(chroot) sysresccd linux # uname -a
Linux sysresccd 3.10.53-std431-amd64 #2 SMP Fri Aug 15 21:36:03 UTC 2014 x86_64 AMD Phenom(tm) 9950 Quad-Core Processor AuthenticAMD GNU/Linux

(chroot) sysresccd linux # pwd
/usr/src/linux

tar xfp linux-3.10.tar.xz
cd linux-3.10
xzcat ../std-sources-3.10-01-stable-3.10.53.patch.xz | patch -p1
xzcat ../std-sources-3.10-02-fc18.patch.xz | patch -p1
xzcat ../std-sources-3.10-03-aufs.patch.xz | patch -p1
xzcat ../std-sources-3.10-04-reiser4.patch.xz | patch -p1
(chroot) sysresccd linux # ls -a
. crypto include lib README tools
.. Documentation init .mailmap REPORTING-BUGS usr
arch drivers ipc MAINTAINERS samples virt
block firmware Kbuild Makefile scripts
COPYING fs Kconfig mm security
CREDITS .gitignore kernel net sound
cat /proc/config.gz | gzip -d > .config
make menuconfig
General setup
Initramfs source file(s)
/var/tmp/genkernel/initramfs-3.10.53-std431-amd64.cpio

to

""
and save

(chroot) sysresccd linux # make
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
#
# configuration written to .config
#
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_32.h
SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_32_ia32.h
SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_64_x32.h
SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_64.h
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
WRAP arch/x86/include/generated/asm/clkdev.h
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
CC kernel/bounds.s
kernel/bounds.c:1: error: CPU you selected does not support x86-64 instruction set
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2

menuconfig:

> Processor type and features
Processor family (Generic-x86-64) --->

I'm coming to think there is something wrong in the patches as 1) I have successfully configed a kernel this way before and 2) a config from scratch (no .config in
the source directory run menuconfig and adjust to match that in the running .config file) does the same thing (and I think that is how I got a successful config in the past). At least I now know that putting a .config from a running kernel in to the .config should work, which is a great help, since everything I've seen says don't edit the .config file and I wasn't sure that wasn't what was causing the problem. Thanks for the reply!
I'll continue beating on this and report back when I figure out what I'm doing wrong. I should have a backup of a previous successful build to start from.

Peter Van Epp
 
Looks to be an error in the rescue CD tool chain. I have a stock gentoo system that I built (and painfully configured to be identical to a rescuecd kernel) some time ago on another disk. Swapped it in to the machine and verified that the kernel still built correctly. Copied that running source in to the rescue CD system did a make clean and make and it dies in the same way indicating the problem is in the rescue CD system rather than the configuration I expect. Unfortunately the rescue CD forum site is having problems right now but when it comes back up I will inquire there (as well as poke at the problem here more) as to what the problem might be. As someone new to linux kernel configuration I think that somehow (I admit to not knowing how exactly :)) documenting that replacing a .config file with one from a working kernel should work would be useful. In all my searching with google for configuration hints, that information doesn't come up anywhere (except here!). Since it only seemed to work sometimes for me I thought that meant it wasn't a supported config option. Again thanks for the confirmation that replacing the .config file should work, if it doesn't sometime in the future I'll poke at it as a potential bug.

Peter Van Epp
 
@vanepp , why are you using "chroot"? You could copy the Gentoo kernel's config file to a regular Linux system running on the same hardware and then build the kernel from there. I doubt a rescue distro will have all of the needed compiling tools to build the kernel.

Is it necessary to apply the patches? I wonder if the patches are changing the target architecture. Somewhere, th build-toolchain is getting conflicting information if you are getting "kernel/bounds.c:1: error: CPU you selected does not support x86-64 instruction set". I see that "uname -a" reports a 64-bit system. The problem may lie in the chroot or the fact that the system is a rescue CD.
 
The chroot is needed to use the gentoo emerge process to add new packages to an extracted (uncompressed) copy of the iso image so I was trying it on the kernel. The same thing happens if I use a simple boot and mount a partition
on /usr/src to contain the kernel sources. The rescue CD system is supposed to be able to build a custom kernel, I even managed to do it once some time ago but nothing I'm trying now works. It may be something has gone wrong in the build environment, for instance I see one complaint is that the C compiler doesn't have stackoverflow protection built in and that kernel option is selected (unfortunately unselecting it doesn't help :)) which suggests that the C compiler that they are using to build is not the same as the one on the CD (perhaps anyway). The kernel patches are needed for file system mods that apparantly aren't (perhaps only yet) in the mainline kernels. To build a kernel on the gentoo system would I not need to have it running the same kernel version as the rescue CD ? I'd assume (perhaps incorrectly) that it would use the libraries from the build system which would be different from the target system and that would cause issues. For instance the gentoo system is kernel 3.12.21 which was the current gentoo kernel when it was built and the rescue CD is using one of the long term stable kernels one of the 3.10 kernels I think, as well I expect C compiler versions will be different. In any case I'll try building the kernel source on the gentoo system and moving it across and see what happens, it can't hurt anything and I'm pretty much dead in the water until the rescue CD forum web site gets fixed and I can ask the folks there what I'm doing wrong :). I've already found some errors is the build documentation from version skew (a change from bz2 to xz compression which was easy to fix) so its possible there is a needed step missing in the documentation. Thanks for all the help I'm slowly learning things that I didn't know before that should help in future.

Peter Van Epp
 
The compression most kernels use is "gz" (gzip). Only use something else if you have a particular need to do so (like embedded system, system support, distro standard, etc.).

The library versions are not important as long as they are new enough. However, the libraries must be the same architechture as the target system, unless you are cross-compiling.

The C-compiler you are describing seems to be non-standard. Is it the "GNU Compiler" (gcc) or something else? If your C-compiler lacks overflow-protection, I wonder what effects that will have on your kernel.
 
Yes it is gcc although they may have recompiled it to reduce size because they want to be able to fit the entire system on a CD and to be able to work in relatively low memory systems. If so I will be advocating putting stack protection back in :) as that seems a poor tradeoff to me. Unfortunately the forum web site is still down and I haven't so far been able to find a working contact email address to report it, so I can't yet ask the folks who are likely to know what the problem is. I did try your suggestion of building the kernel on the stock gentoo system and that indeed seemed to work fine, the patched kernel source with the .config file from the same kerneled system made just fine with no errors. I guess my problems in the past may have been when trying to change versions. I can now do a make modules and make modules install ion the gentoo system and then copy the results over to the CD system (and likely restore the gentoo system from backup since I expect it will be unhappy with a CD / ramdrive kernel :)) to at least get kernel source to see if lm-sensors will be happier when installed. There was no complaint about the compiler lacking overflow protection so I imagine the standard gentoo system compiler has it enabled. I'm doing all of this on the same machine (I have hot swap disk trays on all my machines so switching operating systems is as easy as a shutdown and swap a disk) so the architecture is identical. Again thanks for all the help, it is pointing me at good questions to ask when the forums come back up as well as educating me!

Peter Van Epp
 
The first line of the article gives the index to the series (of articles). And the last line in a link to the next article.
 
nice one. tried all config types, I like the xconfig, seems easier.:)
 

Staff online

Members online


Latest posts

Top