[Résolu] Compilation Kernel de 182Mo

Comme demander, je continue la résolution de mon problème ici.
Le sujet avais commencer ici forum.debian-fr.org/viewtopic.ph … c&start=75

[quote=“mattotop”]182 Mo, ça fait beaucoup tout de même: chez moi, ils sont plus proches de 18Mo.
Tu es sûr de ne pas avoir fait d’erreur de conversion ?

Sinon, pour ton patch, est ce que patch-o-matic-ng t’installe les patch dans /usr/src/kernel-patches ?
Parceque dans ce cas la, tu peux compiler proprement avec make-kpkg --added-patches patch1,patch2 …

Sinon, un exemple d’utilisation de patch-o-matic-ng plutot debian propre:
debian-administration.org/articles/518[/quote]

Merci pour ton lien, mais le patch o-matic-ng ne contient plus le match iptables ip_random.
J’ai écrit au créateur du patch, mais apparemment il ne répond pas.

Mon problème n’est pas l’intégration du patch au sources (c’est fait), mais la compilation qui dur presque 50 minutes avec un Opteron 165 (donc dual-core) et me sort un deb de 182Mo

Voilà le contenu de mon /usr/src/

total 210252 lrwxrwxrwx 1 root src 19 2007-04-24 16:10 linux -> linux-source-2.6.20 drwxr-xr-x 19 root root 4096 2007-04-11 12:45 linux-headers-2.6.17-11 drwxr-xr-x 4 root root 4096 2007-04-11 12:45 linux-headers-2.6.17-11-generic drwxr-xr-x 20 root root 4096 2007-04-17 02:21 linux-headers-2.6.20-15 drwxr-xr-x 4 root root 4096 2007-04-17 02:21 linux-headers-2.6.20-15-generic -rw-r--r-- 1 root src 167341210 2007-04-25 14:38 linux-image-2.6.20_fugitif.1.0_amd64.deb lrwxrwxrwx 1 root src 40 2007-02-12 06:26 linux-OLDVERSION.1176597338 -> /usr/src/linux-headers-2.6.17-11-generic drwxr-xr-x 22 root root 4096 2007-04-25 14:54 linux-source-2.6.20 -rw-r--r-- 1 root root 47703988 2007-04-15 09:48 linux-source-2.6.20.tar.bz2 drwxr-xr-x 2 root src 4096 2007-04-24 15:48 modules drwxr-xr-x 7 root root 4096 2007-02-16 00:08 rpm

Comme tu peu voir, le .deb est énorme. J’essai de compiler le linux-source-2.6.20.

Edit: apparemment c’est /lib/modules qui prend 635Mo une fois dépaqueter.

J’ai comparer le deb du kernel original au mien, et il me manque le /lib/modules/2.6.20/initrd.
A la place, j’ai un lien sources qui pointe vers /usr/src/linux-source-2.6.20/…/modules
Autrement le kernel contient le même nombres de fichiers que l’officiel.

Se serais pas mon kpkg qui est mal configurer ? Pourquoi le initrd n’est pas créer ?

Comment compile tu le module décris toutes les étapes une par une et exactement ce que tu fait :wink:

J’ai suivis le howto qui est ici pour la compilation
forum.debian-fr.org/viewtopic.ph … sc&start=0

Et avant de lancer la compilation, j’applique mon patch qui copie le fichier ipt_random.h dans [quote]/usr/src/linux/include/linux/netfilter_ipv4/ipt_random.h[/quote] et le fichier ipt_random.c dans [quote] /usr/src/linux/net/ipv4/netfilter/ipt_random.c[/quote]

Il me sort une erreur (vu que c’est un vieux patch de 2004) sur des fichiers de config.
J’ai donc ajouter le reste à la main, et modifier [quote]/usr/src/linux/include/linux/netfilter_ipv4/Kbuild [/quote]
Ceci afin qu’il prenne en compte mon patch lors de la compilation :
Voilà l’ajout =>

Idem pour [quote]/usr/src/linux/net/ipv4/netfilter/kconfig[/quote] ou j’ajoute

[quote]config IP_NF_MATCH_RANDOM
tristate "random match support"
depends on IP_NF_IPTABLES
help
This option adds a random match which allow you to match packets
randomly following a given probability.

       To compile it as a module, choose M here.  If unsure, say N.[/quote]

Sans celà je n’ai pas mon patch qui apparait dans le make menuconfig.

Après je lance la compilation qui dure 45 minutes environ. Tout se passe bien sauf que mon image fait 182Mo.
J’ai jeter un oeil dans le deb compiler et mon patch est bien compiler (ipt_random.ko)

J’ai aussi essayer de compiler un noyau de kernel.org et idem. Il fait la même taille à quelques Mo près.

J’ai essayer d’autres tuto pour la compilation et rien à faire. Toujours cette taille énorme.
J’ai les neurones en feu.

J’ai comparer mon deb a l’original pour voir se qui cloche, et dans /lib/modules je n’ai pas de initrd et le dossier /lib/modules/kernel est énorme.

Voilà la différence entre mon dossier /lib/modules/ original : (celui que j’utilise actuellement)

[quote]root@localhost:/lib/modules/2.6.20-15-generic# ls -l
total 1548
lrwxrwxrwx 1 root root 40 2007-04-17 02:21 build -> /usr/src/linux-headers-2.6.20-15-generic
drwxr-xr-x 2 root root 4096 2007-04-15 22:15 initrd
drwxr-xr-x 11 root root 4096 2007-04-15 01:48 kernel
-rw-r–r-- 1 root root 337327 2007-04-15 22:15 modules.alias
-rw-r–r-- 1 root root 69 2007-04-15 22:15 modules.ccwmap
-rw-r–r-- 1 root root 330959 2007-04-15 22:15 modules.dep
-rw-r–r-- 1 root root 813 2007-04-15 22:15 modules.ieee1394map
-rw-r–r-- 1 root root 788 2007-04-15 22:15 modules.inputmap
-rw-r–r-- 1 root root 7209 2007-04-15 22:15 modules.isapnpmap
-rw-r–r-- 1 root root 74 2007-04-15 22:15 modules.ofmap
-rw-r–r-- 1 root root 259904 2007-04-15 22:15 modules.pcimap
-rw-r–r-- 1 root root 1093 2007-04-15 22:15 modules.seriomap
-rw-r–r-- 1 root root 146117 2007-04-15 22:15 modules.symbols
-rw-r–r-- 1 root root 443096 2007-04-15 22:15 modules.usbmap[/quote]

Et le mien après compilation :

[quote]total 1588
lrwxrwxrwx 1 root root 28 2007-04-26 22:59 build -> /usr/src/linux-source-2.6.20
drwxr-xr-x 11 root root 4096 2007-04-26 23:02 kernel
-rw-r–r-- 1 root root 337327 2007-04-26 23:03 modules.alias
-rw-r–r-- 1 root root 69 2007-04-26 23:03 modules.ccwmap
-rw-r–r-- 1 root root 375924 2007-04-26 23:03 modules.dep
-rw-r–r-- 1 root root 813 2007-04-26 23:03 modules.ieee1394map
-rw-r–r-- 1 root root 788 2007-04-26 23:03 modules.inputmap
-rw-r–r-- 1 root root 7209 2007-04-26 23:03 modules.isapnpmap
-rw-r–r-- 1 root root 74 2007-04-26 23:03 modules.ofmap
-rw-r–r-- 1 root root 259904 2007-04-26 23:03 modules.pcimap
-rw-r–r-- 1 root root 1093 2007-04-26 23:03 modules.seriomap
-rw-r–r-- 1 root root 146117 2007-04-26 23:03 modules.symbols
-rw-r–r-- 1 root root 443096 2007-04-26 23:03 modules.usbmap
lrwxrwxrwx 1 root root 28 2007-04-26 22:59 source -> /usr/src/linux-source-2.6.20[/quote]

Il manque bien [quote]drwxr-xr-x 2 root root 4096 2007-04-15 22:15 initrd[/quote]

Pourtant je l’ai inclus dans la compilation [quote]fakeroot make-kpkg --append-to-version “fugihz1000” --initrd kernel_image modules_image kernel_headers[/quote]
Je comprend pas.

Edit: ah oui, j’ai aussi essayer de compiler sans rien ajouter (pas de patch ip_random) avec le kernel 2.6.20 telecharger via apt-get et idem.
J’ai pourtant pris le fichier de .config original.

Bon, apparement c’est mon initrd qui n’est pas créer. Quelqu’un qui compile soit même son noyau pourrai me dire à quoi correspond l’option [quote]# Hardcode partition to resume from so it doesn’t have to be specified

on the command line. The command line will override this setting.

RESUME=/dev/hdc5[/quote] dans le fichier /etc/mkinitrd/mkinitrd.conf ?

Car /dev/hdc5 correspond à ma partition swap, et non au point de montage /

Et les options dans /etc/kernel-img.conf sont t-il bon ?

[quote]do_symlinks = yes
relative_links = yes
do_bootloader = no
do_bootfloppy = no
do_initrd = yes
link_in_boot = no
postinst_hook = /sbin/update-grub
postrm_hook = /sbin/update-grub[/quote]

[quote=“fugitif”]Bon, apparement c’est mon initrd qui n’est pas créer. Quelqu’un qui compile soit même son noyau pourrai me dire à quoi correspond l’option [quote]# Hardcode partition to resume from so it doesn’t have to be specified

on the command line. The command line will override this setting.

RESUME=/dev/hdc5[/quote] dans le fichier /etc/mkinitrd/mkinitrd.conf ?

Car /dev/hdc5 correspond à ma partition swap, et non au point de montage /
[/quote]Nan, ça, c’est correct: ça précise la partition de swap ou doit s’enregistrer l’image mêmoire quand tu fais un “suspend to disk” (mise en veille profonde)[quote=“fugitif”]
Et les options dans /etc/kernel-img.conf sont t-il bon ?

[quote]do_symlinks = yes
relative_links = yes
do_bootloader = no
do_bootfloppy = no
do_initrd = yes
link_in_boot = no
postinst_hook = /sbin/update-grub
postrm_hook = /sbin/update-grub[/quote][/quote]Ca aussi c’est bon.
Résumons nous. Tu as deux problêmes:

  • ta compil te donne un .deb de 182Mo, sans initrd.
  • la config activant le patch disparait quand tu refais un make menuconfig

pour le premier problême, il est AMA à résoudre à part, en redéployant les sources 2.6.20 d’origine et en repartant d’un .config standard, sans patcher.

Ensuite, avant de patcher, regardes si l’extension n’est pas déjà intègrée à iptables et si ça ne marche pas sans patch.

[quote=“mattotop”]
Nan, ça, c’est correct: ça précise la partition de swap ou doit s’enregistrer l’image mêmoire quand tu fais un “suspend to disk” (mise en veille profonde)[/quote]
Et l’option ROOT=probe est bonne aussi ? Car en fesant une recherche google, j’ai vu que certain mettait la partition de montage à la place de probe.
ROOT=/dev/hdX

[quote]Ca aussi c’est bon.
Résumons nous. Tu as deux problêmes:

  • ta compil te donne un .deb de 182Mo, sans initrd.
  • la config activant le patch disparait quand tu refais un make [/quote]

Non, les options du patch qui disparait, c’est réparer. Je n’appliquait pas bien le patch au départ.
Le seul problème c’est que la compilation donne 182,5Mo, alors qu’elle devrais être dans les 18-20Mo.

[quote]
pour le premier problême, il est AMA à résoudre à part, en redéployant les sources 2.6.20 d’origine et en repartant d’un .config standard, sans patcher.[/quote]
AMA ? Ca veut dire quoi ?
J’ai déjà essayer de compiler un kernel sans modif, et sans aucun patch, et avec le fichier de .config que j’utilise actuellement.
Idem avec un kernel qui viens de kernel.org tout d’origine.
J’ai aussi essayer sans signer ma version --append-to-version où --revision

[quote]
Ensuite, avant de patcher, regardes si l’extension n’est pas déjà intègrée à iptables et si ça ne marche pas sans patch.[/quote]
Elle n’y est pas, sinon le module serais dans /lib/modules/2.6.20-15-generic/kernel/net/ipv4/netfilter/ipt_random
Le kernel 2.6.20.15-generic est celui que j’utilise en ce moment.

J’ai déjà fait plus de 10 compilations sans réussir à avoir un .deb du kernel d’une bonne taille.
J’avais déjà se problème avec un kernel 2.4.17 d’origine.
Le initrd n’est pas créer, mais si je fait un mkinitrd -o /home/fugitif/test il est bien créer.

J’ai aussi essayer une autre technique de compilation (celle ci wiki.ubuntu.com/KernelCustomBuild) et idem. Je croyait que la compilation méthode Debian était des plus simple. :question:

D’ailleur, comment est créer le initrd avec cette méthode Debian ? Avec mkinitrd -o /destination/img.initrd ou avec mkcramfs ?

Ne peut t-on pas enregistrer le log de compilation afin de voir pourquoi le initrd n’est pas créer ?

Avec une commande du style [quote]fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers >>/home/fugitif/compil.txt[/quote]

AMA a mon avis
AMHA a mon humble avis

Apparemment chez toi c’est le gros bordel pour recompiler son kernel. Et comme tu veux rajouter un patch en plus ça fait n’importe quoi. Je te propose de reprendre mon tutos et de faire une recompilation de kernel toute simple et ensuite lorsque toutes les erreurs seront résolus et que tu auras ton image correctement on passera à la mise en place du patch.

Va voir sur ashgenesis.debian-fr.net

[quote=“Ashgenesis”]AMA a mon avis
AMHA a mon humble avis

Apparemment chez toi c’est le gros bordel pour recompiler son kernel. Et comme tu veux rajouter un patch en plus ça fait n’importe quoi. Je te propose de reprendre mon tutos et de faire une recompilation de kernel toute simple et ensuite lorsque toutes les erreurs seront résolus et que tu auras ton image correctement on passera à la mise en place du patch.

Va voir sur ashgenesis.debian-fr.net[/quote]
Que j’applique le patch où non ca ne change rien. Je l’ai déjà dit. Le patch n’a rien à voir avec cette compilation de 182Mo.

Hier j’ai tester ceci => Attention c’est long

[quote]

       HOWTO install an (initrd) linux 2.6 kernel
                 on Debian woody

                    $Revision: 1.1 $

               [Marc.Herbert@free.fr](mailto:Marc.Herbert@free.fr)

Motivation

You may find this document useful if:

  • you want to test the latest linux 2.6 kernels
  • you want to keep your debian woody (“stable”) box as intact as
    possible, i.e., you want to test only linux 2.6 and not all the latest
    stuff from Debian.

You may find it even more useful if:

  • you prefer booting from a RAM-disk instead of from your hard disk
    (the “initrd-way”). See initrd(4) for more information.

Need fresh modutils and module-init-tools

The mechanism for dynamically loading kernel modules has been
rewritten between 2.4 and 2.6. As a consequence, the former "modutils"
tools (insmod, modprobe,…) are not compatible with 2.6 You need the
new “module-init-tools” instead.

Issue: these new and incompatible tools have the same filenames as
their 2.4 siblings (insmod, modprobe,…). As often, installing from
source updated packages on your stable debian distribution does the
trick here. The recent debian packages “modutils” and
module-init-tools" do some automatic kernel version detection before
invoking the right version of modprobe, insmod, etc.

First you’ll need some basic tools to compile and generate
the debian packages:

apt-get install gcc debhelper fakeroot …

Then edit your /etc/apt/sources/list file, so that the sources of
packages come from the “testing” or even “unstable” version of
debian. For instance:

deb-src ftp://ftp.yourmirror.org/pub/debian unstable main non-free contrib

Then fetch recent sources:
$ apt-get source modutils module-init-tools

Recent modutils sources need a small hack to compile on woody:

    dh_installman extra/modules*.5 extra/update-modules*.8 *.8 *.5
    sh -e debian/fixmanpages
  •   dh_installinit --no-start --update-rcd-params="start 20 S ."
    
  •   dh_installinit --update-rcd-params="start 20 S ."
      dh_strip
      dh_link bin/lsmod sbin/lsmod
    

Build the .deb packages:
$ cd module-init-* && fakeroot dpkg-buildpackage -d

$ cd …; cd modutils-* && fakeroot dpkg-buildpackage -d

And install them:
$ dpkg -i modutil*.deb
$ dpkg -i module-init-tools*.deb

You’re done.

Please note that Documentation/Changes gives a lengthy list of other
kernel-related utilities mandatory upgrades before using 2.6. However,
upgrading only modprobe & co was enough for me.

make config

From the (outdated) Documentation/initrd.txt:

“Second, the kernel has to be compiled with RAM disk support and with
support for the initial RAM disk enabled.”

When the kernel boots, it needs to mount the initial ramdisk as its
root partition, and to read from it. As a consequence, the following
features need to be compiled built-in (not as modules)

CONFIG_BLK_DEV_RAM=y (section “Block Devices”)
CONFIG_BLK_DEV_INITRD=y

CONFIG_ROMFS_FS=y (section “Filesystems”)

An alternative to the “ROMFS” filesystem above could be “CRAMFS”
(short for “Compressed ROM”) used by default by the debian mkinitrd
script, but… the initrd+CRAMFS combination is not supported by
linux, unless you use a kernel source with debian patches. Moreover, it
seemed to me that the mere presence of the CRAMFS code in the vanilla
linux kernel prevented a ROMFS initrd image to boot!? I suggest
avoiding built-in CRAMFS code for the moment, unless you are a
hardcore debian fan (compiling it as module is OK).

CONFIG_CRAMFS=m (section “Miscellaneous filesystems”)

mkinitrd

After having installed your brand new 2.6 and its modules, you need to
create the initrd image.

apt-get install initrd-tools genromfs

If you use ROMFS instead of CRAMFS (see above), you must edit
/etc/mkinitrd/mkinitrd.conf:

@@ -18,4 +18,4 @@
UMASK=022

Command to generate the initrd image.

-MKIMAGE=‘mkcramfs %s %s > /dev/null’
+MKIMAGE=‘genromfs -d %s -f %s’

The mkinitrd machinery tries hard, when building the initrd image, to
guess what are the modules to preload from the ram disk, in
order to be able to access the real (hard drive) root partition. But
unfortunately, it may sometimes fail. This is hard to blame, since we
are mixing software from various provenances.

If you find that your 2.6 kernel boots from the RAM disk, but has
later problems to mount the root partition of your hard drive,
then tweaking the RAM disk may help. Thanks to the file
/etc/mkinitrd/modules (see mkinitrd(8)), you can force the kernel to
load some modules from the RAM disk (e.g., “sd_mod”) before trying to
mount the real root partition. Check also mkinitrd.conf(5)

If things still go wrong, you can insert “set -x” and other debugging
stuff into the two scripts that the kernel launches after initrd
boot and before mounting the real root:

/usr/share/initrd-tools/linuxrc
/usr/share/initrd-tools/init

LILO

As stated in Documentation/initrd.txt, do not forget to add an initrd
line in /etc/lilo.conf

initrd=/boot/initrd-my2.6

DO NOT append=“root=/dev/ram0 init=/linuxrc rw” to boot arguments,
contrary to stated in Documentation/initrd.txt, which seems outdated
wrt this.

What did you break?

OK, your debian woody machine is now running a linux 2.6 kernel and is
almost intact, expect… you cannot create initrd images compatible
with 2.4 kernels anymore, because mkinitrd blindly stores
/sbin/modprobe etc. in the RAM disk, i.e., 2.6-modules utilities!

Again, if needed, you can solve this issue by upgrading initrd-tools
to a recent version that takes 2.4/2.6 differences into account. The
good side-effect is that the new version of the mkinitrd script will
probably be more clever when guessing the modules needed to mount the
real root. The nasty side-effect is that you may get some bugs…

As usual, type:
$ apt-get source initrd-tools
$ fakeroot dpkg-buildpackage

dpkg -i initrd-tools*.deb

It seems you can safely ignore the failure of the configure step.

kernel-package

When everything above is working OK, then you can use the "make-kpkg"
tool to automate some parts and create a debian package with your 2.6
kernels, its modules, etc. It seems the (old) woody version of
make-kpkg is able to manage (new) 2.6 kernels without problem.[/quote]

Mais c’est toujours pareil.

Peut t’on compiler un kernel sur un live CD ?

J’ai trouver quelqu’un sur le forum US et une personne sur le forum Ubuntu-fr qui ont exactement le même problème que moi.
Ca viendrait peut être d’une option de gcc qui ajoute des options de débogage. Vu que mon noyau compiler est de taille normal, mais c’est les modules qui sont énorme.

Quelqu’un sait -il comment désactiver cette option de gcc? Apparement c’est gcc -g

Sinon je viens d’installer Vmware server pour me créer une image virtuel d’une distrib 64bits. (Surement la dernière Debian). Afin de compiler sur quelque chose de propre.

Bon j’ai trouver mon problème. C’était une option dans le menuconfig Compile the kernel with debug info était cocher :open_mouth:
Là mon image .deb fait 19,2Mo :smiley:

Merci à vous.

Merci à toi d’avoir donné la réponse rajoute un petit résolu dans ton titre :wink: