LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   compiling kernel without initrd support (https://www.linuxquestions.org/questions/debian-26/compiling-kernel-without-initrd-support-457689/)

kushalkoolwal 06-28-2006 04:22 PM

Quote:

Originally Posted by nx5000
Code:

cd /tmp && zcat /boot/initrd.img-2.6.16-2-686 | cpio -idv
Do this as non root user, as usual ;)


For the differences, google is your friend ;)
And always think about looking in the kernel documentation:

vi /usr/src/linux/Documentation/filesystems/ramfs-rootfs-initramfs.txt
vi /usr/src/linux/Documentation/filesystems/cramfs.txt

Thanks nx5000. Based on what I understood from this thread is that initrd is required only if I do not have essential modules to boot the filesystem built into the kernel. Now the surprising thing is I extracted the contents of my initd image and here is the output of the modules folder inside it.
Code:

root@debian:/tmp/initrdmount# ls
bin  conf  etc  init  lib  modules  sbin  scripts
root@debian:/tmp/initrdmount# ls -al modules/
total 8
drwxr-xr-x 2 root root 4096 2006-06-28 14:17 .
drwxr-xr-x 9 root root 4096 2006-06-28 14:17 ..

Now the modules folder is empty. I always thought that initrd contains essential modules to boot the fiesystem incase if those modules are not compiled into the kernel? Then why there is nothing inside my modules directory.

Also when I found that the modules directory is empty, I tried booting the same kernel without inird i.e. I just removed the line
initd /boot/initrd.img-2.6.15-1
from the menu.lst file.

And to my surprise I got a kernel panic error. Why is that so? how can I find out what is my kernel using from initrd image in order to boot the system normally. And also why the modules folder is empty inside my initrd image's extracted contents.

I am really confused at this point. Any clearification will be highly appreciated.

Thanks.....

nx5000 06-29-2006 04:13 AM

You are right.
Have you checked in :
/tmp/initrdmount/lib/modules/2.6.15-1

?

By uncompressing as you did, you will maybe realise that some modules which are loaded are maybe not needed or that file are not even used. So you can tweak your initrd so that your machine will boot faster (not much but still..)

Always keep a copy of your old initrd (and remember the name also)!!

kushalkoolwal 06-29-2006 04:18 PM

Quote:

Originally Posted by nx5000
You are right.
Have you checked in :
/tmp/initrdmount/lib/modules/2.6.15-1

?

By uncompressing as you did, you will maybe realise that some modules which are loaded are maybe not needed or that file are not even used. So you can tweak your initrd so that your machine will boot faster (not much but still..)

Always keep a copy of your old initrd (and remember the name also)!!

Awesome dude, You are simply the best. Yes I was able to find tons of modules in the location which you specified. Here is the output:

Code:

root@debian:/tmp/initrdmount/lib/modules/2.6.15-1/kernel/drivers# ls ide/
ide-cd.ko  ide-core.ko  ide-disk.ko  ide-generic.ko  pci
root@debian:/tmp/initrdmount/lib/modules/2.6.15-1/kernel/drivers# ls ide/pci/
aec62xx.ko  cs5520.ko    hpt366.ko        piix.ko        sis5513.ko
alim15x3.ko  cs5530.ko    ns87415.ko      rz1000.ko      slc90e66.ko
amd74xx.ko  cy82c693.ko  opti621.ko      sc1200.ko      triflex.ko
atiixp.ko    generic.ko  pdc202xx_new.ko  serverworks.ko  trm290.ko
cmd64x.ko    hpt34x.ko    pdc202xx_old.ko  siimage.ko      via82cxxx.ko
root@debian:/tmp/initrdmount/lib/modules/2.6.15-1/kernel/drivers#

So as you suggested, I should just remove(delete) the modules which I know I don;t require? Also does the creation of an initrd image is idependent of the Kernel Configuration. For example, suppose if I configure my kernel with some additonal options and remove some options and recompile it and then again make an initrd image, will this initrd image be the same as the previous one above?

Also, I encountered a new kind of initrd image on one of my other system and I don;t know how to extract it. Basically this is what I get after giving the command that you had suggested:
Code:

debian:/# file -z /boot/initrd.img-2.6.16
/boot/initrd.img-2.6.16: Linux Compressed ROM File System data, little endian size 4489216 version #2 sorted_dirs CRC 0xda8be000, edition 0, 2445 blocks, 289 files
debian:/#

How do I decompress and extract the contents of this one just like I did for my previous one above?

THanks once again for being such a wonderful guide.

kushalkoolwal 07-01-2006 10:30 PM

anyone????
:confused:

dracae 07-02-2006 10:25 AM

cpio -i < /boot/initrd.img-2.6.16

kushalkoolwal 07-03-2006 06:15 PM

Yes I was able to find tons of modules in the location which you specified. Here is the output:
Code:

root@debian:/tmp/initrdmount/lib/modules/2.6.15-1/kernel/drivers# ls ide/
ide-cd.ko  ide-core.ko  ide-disk.ko  ide-generic.ko  pci
root@debian:/tmp/initrdmount/lib/modules/2.6.15-1/kernel/drivers# ls ide/pci/
aec62xx.ko  cs5520.ko    hpt366.ko        piix.ko        sis5513.ko
alim15x3.ko  cs5530.ko    ns87415.ko      rz1000.ko      slc90e66.ko
amd74xx.ko  cy82c693.ko  opti621.ko      sc1200.ko      triflex.ko
atiixp.ko    generic.ko  pdc202xx_new.ko  serverworks.ko  trm290.ko
cmd64x.ko    hpt34x.ko    pdc202xx_old.ko  siimage.ko      via82cxxx.ko
root@debian:/tmp/initrdmount/lib/modules/2.6.15-1/kernel/drivers#

So as you suggested, I should just remove(delete) the modules which I know I don;t require? Also does the creation of an initrd image is idependent of the Kernel Configuration. For example, suppose if I configure my kernel with some additonal options and remove some options and recompile it and then again make an initrd image, will this initrd image be the same as the previous one above?

THanks once again.

nx5000 07-03-2006 08:26 PM

This is a mkinitrd question, which I don't know so much (no need here) so I can't help.vi /usr/sbin/mkinitrd.. 1500 lines of pain

I would say that mkinitrd looks into /lib/modules/<kernel_to_install/ and puts some basic tools + guess of list of modules to load (for HDD..) + list of user supplied modules.

I'm surprised that you have by default all these useless modules. Have you activated these options in .config ?

What you could so is use a postinst_script to clean it up whatever the kernel does. You have to reference your script in /etc/kernel-pkg.conf. This file is read when building debian kernels and you can easilly customize the installation there. Like extract the cpio, remove unwanted, rearchive again. Also add a line to do a copy of the old one in case (like kernel-package does : initrd.old)

edit:
Code:

man mkinitrd.conf
http://wiki.archlinux.org/index.php/Initrd

jschiwal 07-03-2006 08:47 PM

If your initrd is a compressed cpio archive and you mount it anyway, it will look empty, when in reality it is not. I will see the same thing for my SuSE's initrd file. The decompressed initrd file (a copy) will mount using the ramfs filesystem and look empty.

Instead try:
mkdir /tmp/initrd-dir
cd /tmp/initrd-dir
zcat /boot/initrd >initrd
cpio -ivd <initrd
rm initrd

Now you have access to the contents.


All times are GMT -5. The time now is 05:37 AM.