LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-10-2012, 01:14 PM   #1
Lieyza
LQ Newbie
 
Registered: Jul 2012
Posts: 16

Rep: Reputation: Disabled
how to build and compile kernel 2.6.32 in ubuntu 10.04 correctly


Hi,

I'm new in this linux base system. I try to compile a kernel due to my project on PMIPv6 which needed several parameter to add on for experiment. I use Ubuntu 10.04 LTS and my kernel is linux-source-2.6.32.

This is the way how i compile and configure my kernel :-


$ apt-get update
$ apt-get install linux-source
$ cd /usr/src/
$ tar xjf linux-source-2.6.32
$ ln -s /usr/src/linux-source-2.6.32 /usr/src/linux

Configure them.

$ apt-get install qt3-apps-dev g++
$ cd /usr/src/linux-source-XX.XX.XX
$ make xconfig

Setting is needed for PMIPv6 Openairinterface :-

CONFIG_EXPERIMENTAL=y (GENERAL SETUP -> PROMPT FOR DEV AND OR INCOMPLETE DRIVERS)
CONFIG_SYSVIPC=y (GENERAL SETUP -> SYSTEM V IPC)
CONFIG_PROC_FS=y
CONFIG_NET=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> TCP/IP NETWORKING)
CONFIG_INET=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> TCP/IP NETWORKING)
CONFIG_IPV6=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> TCP/IP NETWORKING)
CONFIG_IPV6_MIP6=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IPV6 PROTOCOL)
CONFIG_XFRM=y
CONFIG_XFRM_USER=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> TRANSFORMATION USER CONFIGURATION INTERFACE)
CONFIG_XFRM_SUB_POLICY=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> TRANSFORMATION SUB POLICY SUPPORT)
CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IPV6 PROTOCOL -> IPV6: MIPV6 ROUTE OPTIMISATION MODE)
CONFIG_IPV6_TUNNEL=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IPV6 PROTOCOL -> IPV6: IPV6 IN IPV6 TUNNEL)
CONFIG_IP_ADVANCED_ROUTER=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IP: ADVANCED ROUTER)
CONFIG_IPV6_MULTIPLE_TABLES=y
CONFIG_IPV6_SUBTREES=y
CONFIG_ARPD=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IP: ARP DAEMON SUPPORT)
CONFIG_INET6_ESP=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IPV6 PROTOCOL -> IPV6 ESP TRANSFORMATION)
CONFIG_NET_KEY=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> PF_KEY SOCKETS)
CONFIG_NET_KEY_MIGRATE=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> PF_KEY SOCKETS -> PF_KEY MIGRATE)
Do not turn CONFIG_IPV6_MIP6_DEBUG on

To check my kernel
$ ./chkconf_kernel.sh /usr/src/linux-source-2.6.32

Kernel recompilation

$ cd /usr/src/linux-source-XX.XX.XX
$ make && make modules_install && make install
$ mkinitramfs -o /boot/initrd.img-XX.XX.XX XX.XX.XX
$ update-grub
$ reboot

After this step and method.. I always get KERNEL PANIC in result. Can anyone suggest me any tips? or did i do something wrong?

I did try other method too. How to install UMIP (kernel and userland) .. but still.. a kernel panic. Anyone can help me??
 
Old 07-10-2012, 10:42 PM   #2
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Jessie
Posts: 592

Rep: Reputation: 119Reputation: 119
From the manpages for mkinitramfs:
Quote:
mkinitramfs is meant for advanced usage. On your local box update-initramfs calls mkinitramfs with the relevant parameters. update-initramfs keeps sha1sum of generated initramfs.
First delete the initrd you created, then:
Try:
Code:
update-initramfs -c -k xx.xx.xx.xx.xx
 
1 members found this post helpful.
Old 07-11-2012, 01:23 AM   #3
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
See if this helps

http://tuxthink.blogspot.in/2012/05/...on-debian.html
 
1 members found this post helpful.
Old 07-13-2012, 10:11 AM   #4
Lieyza
LQ Newbie
 
Registered: Jul 2012
Posts: 16

Original Poster
Rep: Reputation: Disabled
towheedm ~ what you mean by xx.xx.xx.xx.xx?? i try to put my kernel version number which 2.6.32, but the error show "cannot find /lib/modules/2.6.32

bsat ~ i cannot follow the link you give because at this step "cp /usr/share/doc/kernel-package/examples/etc/kernel/postinst.d/initramfs /etc/kernel/postinst.d/" i got error because there is no kernel folder found in my /usr/share/doc

:-( i still cant compile my kernel without kernel panic

When i try to compile with "sudo make oldconfig" it's ok. but when i change the configuration "sudo make xconfig" like about, the result will be KERNEL PANIC

Anyone can help me??????
 
Old 07-13-2012, 07:51 PM   #5
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Jessie
Posts: 592

Rep: Reputation: 119Reputation: 119
It's the kernel version. More specifically, the base version plus CONGIG_LOCALVERSION. That is if the base version is 2.6.32 and to add the string -mykenel to CONFIG_LOCALVERSION, the kernel version would be 2.6.32-mykernel.

The kernel panic usually indicates a problem with mounting the root device. Are you using RAID? What filesystem are you using? Look closely at these config items.
 
1 members found this post helpful.
Old 07-14-2012, 12:41 AM   #6
Lieyza
LQ Newbie
 
Registered: Jul 2012
Posts: 16

Original Poster
Rep: Reputation: Disabled
I think i dont really understand what u mean. I dont used RAID. My system is 32bit. I'm really a beginner.. really new in this ubuntu and kernel. Can u explain to me like i'm very new :-(
I really need a clue or help on this matter coz i still pacing the same problem.

Plus. I did read How to: Compile Linux kernel 2.6 at the net. There is a configuration on /boot/grub/menu.lst. I search for that file but it dont exist in my system. Is that the problem?
 
Old 07-14-2012, 02:33 AM   #7
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
You can try installing the packages

linux-base
linus-source-<version>

and then see if you get the files under /usr/share/doc
 
1 members found this post helpful.
Old 07-14-2012, 02:37 AM   #8
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Jessie
Posts: 592

Rep: Reputation: 119Reputation: 119
Quote:
Originally Posted by Lieyza View Post
Plus. I did read How to: Compile Linux kernel 2.6 at the net. There is a configuration on /boot/grub/menu.lst. I search for that file but it dont exist in my system. Is that the problem?
Ubuntu 10.04 uses GRUB2. The file /boot/grub/menu.lst is not used by GRUB2 so it will not exist on your system.

Quote:
Originally Posted by Lieyza View Post
I'm really a beginner.. really new in this ubuntu and kernel. Can u explain to me like i'm very new :-(
Under these conditions, I'd say to just use the kernel provided by 10.04, but you stated in your first post that this was for a project. I guess you really don't have a choice then, you must build a custom kernel.

You said you're building kernel version 2.6.32, is this the same kernel version that you're running on 10.04.

What does:
Code:
uname -r
return?

Also, in your first post you have:
Code:
./chkconf_kernel.sh /usr/src/linux-source-2.6.32
What exactly does this script do? Does it simple check the config items listed in your first post?
 
1 members found this post helpful.
Old 07-19-2012, 04:03 AM   #9
Lieyza
LQ Newbie
 
Registered: Jul 2012
Posts: 16

Original Poster
Rep: Reputation: Disabled
bsat ~ thank you for reply. I follow your instruction

Quote:
You can try installing the packages
linux-base
and then see if you get the files under /usr/share/doc
but i get this :
Quote:
root@utmmimos:~# sudo apt-get install linux-base
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package linux-base
root@utmmimos:~#
When i used
Quote:
linus-source-<version>
I get
Quote:
root@utmmimos:~# sudo apt-get install linux-source-2.6.32
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-source-2.6.32 is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-2.6.32-21 linux-headers-2.6.32-21-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@utmmimos:~#
and what file should be in there?? still there is no menu.1st file in there :-(


towheedm ~ thank yo again n again because u try to reply n give me some hint and solution. I do really appreciate!

erm.. so if ubuntu 10.04 used grub2, how the setting to replace menu.1st file?

this is the result for uname -r. Why ?

Quote:
root@utmmimos:~# sudo uname -r
2.6.32-21-generic
root@utmmimos:~#
ooo.. ok.. this
Quote:
./chkconf_kernel.sh /usr/src/linux-source-2.6.32
is to check whether my kernel configuration is fullfill this PMIPv6 project or not. i think it did not give any result to be kernel panic. rite?

i still try to configure my kernel as needed in my PMIPv6 test-bed project. Still facing the kernel panic problem. WIll update to u if any :-S

thank you for anyone that who reply me
 
Old 07-19-2012, 06:36 AM   #10
Lieyza
LQ Newbie
 
Registered: Jul 2012
Posts: 16

Original Poster
Rep: Reputation: Disabled
when i execute

[QUOTE]sudo make module[/QUOTE it show

Quote:
root@utmmimos:/usr/src/linux-source-2.6.32# sudo make modules
CHK include/linux/version.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-x86
CALL scripts/checksyscalls.sh
Building modules, stage 2.
MODPOST 2782 modules
WARNING: modpost: Found 14 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
root@utmmimos:/usr/src/linux-source-2.6.32#
is this warning are my problem? how to fix it??
 
Old 07-19-2012, 11:43 AM   #11
Lieyza
LQ Newbie
 
Registered: Jul 2012
Posts: 16

Original Poster
Rep: Reputation: Disabled
when i recompile my kernel.. i execute

sudo make
sudo make modules_install

and sudo make install i got this
Quote:
root@utmmimos:/usr/src/linux-source-2.6.32# sudo make install
sh /usr/src/linux-source-2.6.32/arch/x86/boot/install.sh 2.6.32.59+drm33.24 arch/x86/boot/bzImage \
System.map "/boot"
root@utmmimos:/usr/src/linux-source-2.6.32#
is this error??
 
Old 07-20-2012, 01:44 AM   #12
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
No that is not an error.

Quote:
bsat ~ i cannot follow the link you give because at this step "cp /usr/share/doc/kernel-package/examples/etc/kernel/postinst.d/initramfs /etc/kernel/postinst.d/" i got error because there is no kernel folder found in my /usr/share/doc
You can skip this step and try the rest, it might work.
 
1 members found this post helpful.
Old 07-22-2012, 01:32 AM   #13
Lieyza
LQ Newbie
 
Registered: Jul 2012
Posts: 16

Original Poster
Rep: Reputation: Disabled
bsat~ Thank you for reply me and give me suggestion. I think i had found out my problem that i face lately. erm.... finally. Thank you again :-)

Just to inform for now.. that i think i had already solve the kernel panic problem. I think the problem is that the depmod common. Thank you to Atreyu for giving me a right command so i can execute with a right output.

After this, i should write the right execute command to create the initrd image

Thank you again for those who already reply and give me suggestion. Thank you

The right way to create an initrd image :

sudo mkinitramfs -o /boot/initrd.img-2.6.32.59+drm33.24 2.6.32.59+drm33.24
the 2.6.32.59+drm33.24 is the file name you get after you do the step of
sudo make install
the final output at your terminal should be like this (example)
INSTALL ubuntu/rfkill/pbe5.ko
INSTALL ubuntu/rtl8192se/r8192se_pci.ko
DEPMOD 2.6.32.59+drm33.24
so you need to use the DEPMOD number to create your initrd image. Good luck to others

I hope i already success build my configration kernel Thank you to atreyu again and again.
 
Old 07-22-2012, 01:52 AM   #14
Lieyza
LQ Newbie
 
Registered: Jul 2012
Posts: 16

Original Poster
Rep: Reputation: Disabled
towheedm ~ thank you for always helping me to find my right track to solve my problem :-)
 
Old 07-22-2012, 02:42 AM   #15
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Jessie
Posts: 592

Rep: Reputation: 119Reputation: 119
The section mismatches are because of an incorrectly configured kernel. Let's start from scratch, one step at a time. There is no need to create a symlink (/usr/src/linux) to your kernel tree. I don't know what your PMIPv6 test-bed project is, I'm hoping it's something being run on the system you're building the kernel with. If your PMIPv6 test-bed project is an embedded system, the following procedure may not necessarily work as you may have to cross-compile the kernel. I'm going to assume that your PMIPv6 test-bed project will be run on the host machine.

You have your kernel tree in /usr/src/linux-source-2.6.32. Make this your PWD:
Code:
cd /usr/src/linux-source-2.6.32
Now let's start with a clean tree by removing any previously generated files, including the kernel config and any backup files:
Code:
make mrproper
Since you are running the same version of the kernel to be built, you will already have a properly configured kernel configuration file. This file is /boot/config-2.6.32-21-generic. Let's use this as a base configuration file. Copy it to your kernel source tree:
Code:
cp /boot/config-2.6.32-21-generic /usr/src/linux-source-2.6.32/.config
Now that we have a kernel configuration file in the source directory, let's apply the custom configuration item:
Code:
make xconfig
Now apply your custom config items:
Code:
CONFIG_EXPERIMENTAL=y (GENERAL SETUP -> PROMPT FOR DEV AND OR INCOMPLETE DRIVERS)
CONFIG_SYSVIPC=y (GENERAL SETUP -> SYSTEM V IPC)
CONFIG_PROC_FS=y
CONFIG_NET=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> TCP/IP NETWORKING)
CONFIG_INET=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> TCP/IP NETWORKING)
CONFIG_IPV6=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> TCP/IP NETWORKING)
CONFIG_IPV6_MIP6=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IPV6 PROTOCOL)
CONFIG_XFRM=y
CONFIG_XFRM_USER=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> TRANSFORMATION USER CONFIGURATION INTERFACE)
CONFIG_XFRM_SUB_POLICY=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> TRANSFORMATION SUB POLICY SUPPORT)
CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IPV6 PROTOCOL -> IPV6: MIPV6 ROUTE OPTIMISATION MODE)
CONFIG_IPV6_TUNNEL=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IPV6 PROTOCOL -> IPV6: IPV6 IN IPV6 TUNNEL)
CONFIG_IP_ADVANCED_ROUTER=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IP: ADVANCED ROUTER)
CONFIG_IPV6_MULTIPLE_TABLES=y
CONFIG_IPV6_SUBTREES=y
CONFIG_ARPD=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IP: ARP DAEMON SUPPORT)
CONFIG_INET6_ESP=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> IPV6 PROTOCOL -> IPV6 ESP TRANSFORMATION)
CONFIG_NET_KEY=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> PF_KEY SOCKETS)
CONFIG_NET_KEY_MIGRATE=y (NETWORKING SUPPORT -> NETWORKING OPTIONS -> PF_KEY SOCKETS -> PF_KEY MIGRATE)
Do not turn CONFIG_IPV6_MIP6_DEBUG on
Keep in mind that some configuration item may require you to enable/disable other configuration items. You can check the dependencies in the lower-right pane of the configuration window.

I would also recommend that you set a value for CONFIG_LOCALVERSION to help differentiate between this and your other 2.6.32 kernel. This is under General Setup > Local Version - append to kernel release:. For example, you can set this to -PMIPv6. After building the kernel, you kernel version will be 2.6.32-PMIPv6.

Build each target separately so you can correct any errors before going on to the next target.

Build the kernel:
Code:
make -s
Using the -s option here causes a silent build. This prevents make from echoing the build commands, which in turn makes it easier to catch any error messages. This is MY personal preference and may not be yours or anyone else.

Once the kernel is built successfully, build the modules:
Code:
make modules
If the modules are built without any section mismatches, install them together with the kernel:
Code:
make modules_install install
This will install the modules under /lib/modules/2.6.32-PMIPv6 and create the /boot/vmlinuz-2.6.32-PMIPv6 together with the /boot/System-map-2.6.32-PMIPv6 and /boot/config-2.6.32-PMIPv6 files.

If you need to build any drivers for your new kernel, then you will also need to create the headers:
Code:
make headers_install
If you install the headers this way, DO NOT clean the kernel tree. You will lose the headers.

An alternative is to install the headers to /usr/src/linux-headers-2.6.32-PMIPv6 by setting INSTALL_HDR_PATH to /usr/src.

Hope this helps a bit.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
can't compile kernel using previoulsy build initramfs_data.cpio.gz mcha Linux - Kernel 2 11-04-2010 01:45 PM
Why do I have to build the kernel to compile a driver??? RichardUK Programming 5 07-05-2009 01:47 PM
Where can I find the build log for a kernel compile? Thaidog Linux - Software 4 11-26-2008 09:49 PM
compile and build linux from kernel in win xp pradeep2002gs Linux - Newbie 3 11-09-2008 12:36 PM
I have to build , load and compile a FAT fs module into the kernel.wat should i do? ramya272 Linux - Newbie 2 02-06-2004 10:46 AM


All times are GMT -5. The time now is 08:44 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration