How to configure Linux kernel source tree hierarchy - Linux
This is a discussion on How to configure Linux kernel source tree hierarchy - Linux ; Hello, I have read some books on Linux kernel programming but did not
get myself more familiar with kernel programming under the help of
those books. I still do not know exactly how to have a Linux kernel
source tree ...
-
How to configure Linux kernel source tree hierarchy
Hello, I have read some books on Linux kernel programming but did not
get myself more familiar with kernel programming under the help of
those books. I still do not know exactly how to have a Linux kernel
source tree hierarchy on my machine and do not know how to write the
very first "hello world" kernel program. I know C and how to program C
code in UNIX and Linux environment. I even searched for the related
keywords "Linux kernel source tree" on the web and Usenet, but did not
get much useful help. Could you please help a new beginner of Linux
kernel hacker and give some short but complete C code examples on:
1. How to configure Linux kernel source tree hierarchy (to set up the
development environment);
2. How to introduce my code into the kernel source (contribute myself
to Linux development and improve my C programming techniques).
Sincerely,
lovecreatesbea...@gmail.com
-
Re: How to configure Linux kernel source tree hierarchy
lovecreatesbea...@gmail.com wrote:
> I still do not know exactly how to have a Linux kernel
> source tree hierarchy on my machine
The way to do this depends on your Linux distribution. You didn't
specify which one you use so it's impossible to answer in detail.
> and do not know how to write the
> very first "hello world" kernel program.
See: http://tldp.org/LDP/lkmpg/2.6/html/c119.html
--
Markku Kolkka
markku.kolkka@iki.fi
-
Re: How to configure Linux kernel source tree hierarchy
Markku Kolkka wrote:
> lovecreatesbea...@gmail.com wrote:
>
> > I still do not know exactly how to have a Linux kernel
> > source tree hierarchy on my machine
>
> The way to do this depends on your Linux distribution. You didn't
> specify which one you use so it's impossible to answer in detail.
Thank you. I installed debian-31r1a that was downloaded from
debian.org. The kernelversion is 2.4.
> > and do not know how to write the
> > very first "hello world" kernel program.
>
> See: http://tldp.org/LDP/lkmpg/2.6/html/c119.html
Thanks for directing me to this link, I can not compile the example. Is
it because of the lack of the kernel source tree?
-
Re: How to configure Linux kernel source tree hierarchy
lovecreatesbea...@gmail.com wrote:
> Markku Kolkka wrote:
> > lovecreatesbea...@gmail.com wrote:
> >
> > > I still do not know exactly how to have a Linux kernel
> > > source tree hierarchy on my machine
> >
> > The way to do this depends on your Linux distribution. You didn't
> > specify which one you use so it's impossible to answer in detail.
>
> Thank you. I installed debian-31r1a that was downloaded from
> debian.org. The kernelversion is 2.4.
1. Untar the kernel tarball or go to the linux kernel tree if you have
already done that
2. make menuconfig. ( Set your hardware drivers/filesystems)
3. make menuconfig/oldconfig/xconfig
4. make dep (only for linux 2.4 , for 2.6 skip this step)
5. make bzImage
6. make modules
7. make modules_install
8. Install this generated bzImage in grub (bootloader)
>
> > > and do not know how to write the
> > > very first "hello world" kernel program.
> >
> > See: http://tldp.org/LDP/lkmpg/2.6/html/c119.html
>
> Thanks for directing me to this link, I can not compile the example. Is
> it because of the lack of the kernel source tree?
-
Re: How to configure Linux kernel source tree hierarchy
miline wrote:
> lovecreatesbea...@gmail.com wrote:
>
> > Markku Kolkka wrote:
> > > lovecreatesbea...@gmail.com wrote:
> > >
> > > > I still do not know exactly how to have a Linux kernel
> > > > source tree hierarchy on my machine
> > >
> > > The way to do this depends on your Linux distribution. You didn't
> > > specify which one you use so it's impossible to answer in detail.
> >
> > Thank you. I installed debian-31r1a that was downloaded from
> > debian.org. The kernelversion is 2.4.
Do I need to create and enter /usr/src/linux before untar the kernel
zipped file that was downloaded from kernel.org, e.g.
linux-2.6.16.tar.gz.
I downloaded the newest kernel source, and is it correct for me to
configure a 2.6.x kernel source tree on kernel 2.4 Debian Linux
machine?
> 1. Untar the kernel tarball or go to the linux kernel tree if you have
> already done that
> 2. make menuconfig. ( Set your hardware drivers/filesystems)
There were errors after I did this. I created /usr/src/linux and
unpacked the kernel source package there.
Is configuring the kernel source tree is similar to upgrading the
kernel? About half year ago, I had done a kernel upgrade from 2.4 to
2.6 on another machine. I remember that I also can not run this
command, I just used make config at that time. Following is a full log
of that upgrade on my machine.
$ kernelversion
2.4
$ cd linux-2.6.16/linux-2.6.16/
$ make config
$ make
$ su root 'make moudules_install'
$ su root 'cp linux-2.6.16/linux-2.6.16/arch/i386/boot/bzImage
/boot/vmlinuz-2.6.16-386'
$
$ su root 'mkinitrd -o /boot/initrd.img-2.6.16 2.6.16'
Alter boot entries in Grub record typically /boot/grub/menu.lst, add
following section at the bottom part of the file
#jhl, kernel 2.6
title kernel.org, kernel 2.6.16-386
root (hd0,0)
kernel /boot/vmlinuz-2.6.16-386 root=/dev/sda1 ro
initrd /boot/initrd.img-2.6.16 2.6.16
savedefault
boot
$ su root -c 'shutdown -r 10'
$ kernelversion
2.6
$
> 3. make menuconfig/oldconfig/xconfig
> 4. make dep (only for linux 2.4 , for 2.6 skip this step)
> 5. make bzImage
> 6. make modules
> 7. make modules_install
> 8. Install this generated bzImage in grub (bootloader)
-
Re: How to configure Linux kernel source tree hierarchy
lovecreatesbea...@gmail.com wrote:
> miline wrote:
> > lovecreatesbea...@gmail.com wrote:
> >
> > > Markku Kolkka wrote:
> > > > lovecreatesbea...@gmail.com wrote:
> > > >
> > > > > I still do not know exactly how to have a Linux kernel
> > > > > source tree hierarchy on my machine
> > > >
> > > > The way to do this depends on your Linux distribution. You didn't
> > > > specify which one you use so it's impossible to answer in detail.
> > >
> > > Thank you. I installed debian-31r1a that was downloaded from
> > > debian.org. The kernelversion is 2.4.
>
> Do I need to create and enter /usr/src/linux before untar the kernel
> zipped file that was downloaded from kernel.org, e.g.
> linux-2.6.16.tar.gz.
No, no need to go in /usr/src/linux/ .... actually when you install
source rpm (SRPM) of kernel in redhat linux it installs the source
there (/usr/src/linux).
>
> I downloaded the newest kernel source, and is it correct for me to
> configure a 2.6.x kernel source tree on kernel 2.4 Debian Linux
> machine?
yes, you can configure and install 2.6 kernel on 2.4 distribution. Just
have to worry about the modules.
>
> > 1. Untar the kernel tarball or go to the linux kernel tree if you have
> > already done that
> > 2. make menuconfig. ( Set your hardware drivers/filesystems)
>
> There were errors after I did this. I created /usr/src/linux and
> unpacked the kernel source package there.
What errors?
>
> Is configuring the kernel source tree is similar to upgrading the
> kernel?
Upgrading is configuring, building and installing
unlike configuring is only configuring.
> About half year ago, I had done a kernel upgrade from 2.4 to
> 2.6 on another machine. I remember that I also can not run this
> command, I just used make config at that time. Following is a full log
> of that upgrade on my machine.
>
> $ kernelversion
> 2.4
> $ cd linux-2.6.16/linux-2.6.16/
> $ make config
> $ make
Which architecture do you have?
make config is as good as make menuconfig.
> $ su root 'make moudules_install'
> $ su root 'cp linux-2.6.16/linux-2.6.16/arch/i386/boot/bzImage
> /boot/vmlinuz-2.6.16-386'
This is installing kernel image.
> $
>
> $ su root 'mkinitrd -o /boot/initrd.img-2.6.16 2.6.16'
Creating initial ramdisk image.
>
> Alter boot entries in Grub record typically /boot/grub/menu.lst, add
> following section at the bottom part of the file
>
> #jhl, kernel 2.6
> title kernel.org, kernel 2.6.16-386
> root (hd0,0)
> kernel /boot/vmlinuz-2.6.16-386 root=/dev/sda1 ro
> initrd /boot/initrd.img-2.6.16 2.6.16
> savedefault
> boot
>
> $ su root -c 'shutdown -r 10'
> $ kernelversion
> 2.6
> $
>
> > 3. make menuconfig/oldconfig/xconfig
> > 4. make dep (only for linux 2.4 , for 2.6 skip this step)
> > 5. make bzImage
> > 6. make modules
> > 7. make modules_install
> > 8. Install this generated bzImage in grub (bootloader)
-
Re: How to configure Linux kernel source tree hierarchy
miline wrote:
> lovecreatesbea...@gmail.com wrote:
> > miline wrote:
> > > 1. Untar the kernel tarball or go to the linux kernel tree if you have
> > > already done that
> > > 2. make menuconfig. ( Set your hardware drivers/filesystems)
> > There were errors after I did this. I created /usr/src/linux and
> > unpacked the kernel source package there.
> What errors?
Thank you for the kind help.
There are many errors for make menuconfig[1], following are some of
them. Perhaps I did not install one library for the text style menu,
and got those error message. I can invoke the $ base-config on Debian
Linux, it's a text style menu application. Last time, when I did the
kernel upgrade from 2.4 to 2.6 on Debian, I also can not execute $ make
menuconfig. I executed $ make config to achieve that upgrade. (But now
I even get errors on $ make config[2]!)
[1] error message from $ make menuconfig
---quoting---
debian-jhl:/usr/src/linux# make menuconfig
....
In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:31:20: curses.h: No such file or
directory
In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:128: error: syntax error before
"use_colors"
....
scripts/kconfig/lxdialog/checklist.c:288: error: `KEY_LEFT' undeclared
(first use in this function)
scripts/kconfig/lxdialog/checklist.c:289: error: `KEY_RIGHT' undeclared
(first use in this function)
make[2]: *** [scripts/kconfig/lxdialog/checklist.o] Error 1
make[1]: *** [menuconfig] Error 2
make: *** [menuconfig] Error 2
---quoting ends---
[2] error message from $ make config
---quoting---
include/asm/processor.h: In function `cpuid':
include/asm/processor.h:152: internal compiler error: Segmentation
fault
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
For Debian GNU/Linux specific bug reporting instructions, see
.
make[2]: *** [fs/nfs/read.o] Error 1
make[1]: *** [fs/nfs] Error 2
make: *** [fs] Error 2
---quoting ends---
> > $ kernelversion
> > 2.4
> > $ cd linux-2.6.16/linux-2.6.16/
> > $ make config
> > $ make
> Which architecture do you have?
I use the Intel Pentium 4 CPU. Do I answer the question?
debian-31r1a-i386
debian-jhl:/usr/src/linux# arch
i686
debian-jhl:/usr/src/linux#
-
Re: How to configure Linux kernel source tree hierarchy
lovecreatesbea...@gmail.com wrote:
> miline wrote:
> > lovecreatesbea...@gmail.com wrote:
> > > miline wrote:
>
> > > > 1. Untar the kernel tarball or go to the linux kernel tree if you have
> > > > already done that
> > > > 2. make menuconfig. ( Set your hardware drivers/filesystems)
> > > There were errors after I did this. I created /usr/src/linux and
> > > unpacked the kernel source package there.
> > What errors?
>
> Thank you for the kind help.
>
> There are many errors for make menuconfig[1], following are some of
> them. Perhaps I did not install one library for the text style menu,
> and got those error message. I can invoke the $ base-config on Debian
> Linux, it's a text style menu application. Last time, when I did the
> kernel upgrade from 2.4 to 2.6 on Debian, I also can not execute $ make
> menuconfig. I executed $ make config to achieve that upgrade. (But now
> I even get errors on $ make config[2]!)
>
Try "make xconfig"
> [1] error message from $ make menuconfig
> ---quoting---
> debian-jhl:/usr/src/linux# make menuconfig
> ...
> In file included from scripts/kconfig/lxdialog/checklist.c:24:
> scripts/kconfig/lxdialog/dialog.h:31:20: curses.h: No such file or
> directory
> In file included from scripts/kconfig/lxdialog/checklist.c:24:
> scripts/kconfig/lxdialog/dialog.h:128: error: syntax error before
> "use_colors"
> ...
> scripts/kconfig/lxdialog/checklist.c:288: error: `KEY_LEFT' undeclared
> (first use in this function)
> scripts/kconfig/lxdialog/checklist.c:289: error: `KEY_RIGHT' undeclared
> (first use in this function)
> make[2]: *** [scripts/kconfig/lxdialog/checklist.o] Error 1
> make[1]: *** [menuconfig] Error 2
> make: *** [menuconfig] Error 2
> ---quoting ends---
>
> [2] error message from $ make config
> ---quoting---
> include/asm/processor.h: In function `cpuid':
> include/asm/processor.h:152: internal compiler error: Segmentation
> fault
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See for instructions.
> For Debian GNU/Linux specific bug reporting instructions, see
> .
> make[2]: *** [fs/nfs/read.o] Error 1
> make[1]: *** [fs/nfs] Error 2
> make: *** [fs] Error 2
> ---quoting ends---
It seems your gcc has some problem. Try upgrading it or post this
problem to GCC list.
>
> > > $ kernelversion
> > > 2.4
> > > $ cd linux-2.6.16/linux-2.6.16/
> > > $ make config
> > > $ make
> > Which architecture do you have?
>
> I use the Intel Pentium 4 CPU. Do I answer the question?
>
> debian-31r1a-i386
>
> debian-jhl:/usr/src/linux# arch
> i686
> debian-jhl:/usr/src/linux#
-
Re: How to configure Linux kernel source tree hierarchy
Try make xconfig
miline wrote:
> lovecreatesbea...@gmail.com wrote:
>
> > miline wrote:
> > > lovecreatesbea...@gmail.com wrote:
> > > > miline wrote:
> >
> > > > > 1. Untar the kernel tarball or go to the linux kernel tree if you have
> > > > > already done that
> > > > > 2. make menuconfig. ( Set your hardware drivers/filesystems)
> > > > There were errors after I did this. I created /usr/src/linux and
> > > > unpacked the kernel source package there.
> > > What errors?
> >
> > Thank you for the kind help.
> >
> > There are many errors for make menuconfig[1], following are some of
> > them. Perhaps I did not install one library for the text style menu,
> > and got those error message. I can invoke the $ base-config on Debian
> > Linux, it's a text style menu application. Last time, when I did the
> > kernel upgrade from 2.4 to 2.6 on Debian, I also can not execute $ make
> > menuconfig. I executed $ make config to achieve that upgrade. (But now
> > I even get errors on $ make config[2]!)
> >
> Try "make xconfig"
> > [1] error message from $ make menuconfig
> > ---quoting---
> > debian-jhl:/usr/src/linux# make menuconfig
> > ...
> > In file included from scripts/kconfig/lxdialog/checklist.c:24:
> > scripts/kconfig/lxdialog/dialog.h:31:20: curses.h: No such file or
> > directory
> > In file included from scripts/kconfig/lxdialog/checklist.c:24:
> > scripts/kconfig/lxdialog/dialog.h:128: error: syntax error before
> > "use_colors"
> > ...
> > scripts/kconfig/lxdialog/checklist.c:288: error: `KEY_LEFT' undeclared
> > (first use in this function)
> > scripts/kconfig/lxdialog/checklist.c:289: error: `KEY_RIGHT' undeclared
> > (first use in this function)
> > make[2]: *** [scripts/kconfig/lxdialog/checklist.o] Error 1
> > make[1]: *** [menuconfig] Error 2
> > make: *** [menuconfig] Error 2
> > ---quoting ends---
> >
> > [2] error message from $ make config
> > ---quoting---
> > include/asm/processor.h: In function `cpuid':
> > include/asm/processor.h:152: internal compiler error: Segmentation
> > fault
> > Please submit a full bug report,
> > with preprocessed source if appropriate.
> > See for instructions.
> > For Debian GNU/Linux specific bug reporting instructions, see
> > .
> > make[2]: *** [fs/nfs/read.o] Error 1
> > make[1]: *** [fs/nfs] Error 2
> > make: *** [fs] Error 2
> > ---quoting ends---
>
> It seems your gcc has some problem. Try upgrading it or post this
> problem to GCC list.
> >
> > > > $ kernelversion
> > > > 2.4
> > > > $ cd linux-2.6.16/linux-2.6.16/
> > > > $ make config
> > > > $ make
> > > Which architecture do you have?
> >
> > I use the Intel Pentium 4 CPU. Do I answer the question?
> >
> > debian-31r1a-i386
> >
> > debian-jhl:/usr/src/linux# arch
> > i686
> > debian-jhl:/usr/src/linux#
-
Re: How to configure Linux kernel source tree hierarchy
On 2006-09-19, Bill Marcum wrote:
> You might need a gcc newer than 3.3 to build the most recent kernels.
Then again, it might work anyway ...
$ cat /proc/version
Linux version 2.6.17.13 (kimoto@mopsa) (gcc version 3.3.6 (Debian 1:3.3.6-13))
#2 PREEMPT Mon Sep 18 01:56:59 EDT 2006
--
Paul Kimoto
This message was originally posted on Usenet in plain text. Any images,
hyperlinks, or the like shown here have been added without my consent,
and may be a violation of international copyright law.