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-23-2006 05:02 PM

compiling kernel without initrd support
 
Hi,

I have been using Debian etch since quite some time and I know that by default the Debian kernel uses the initrd method to boot off. Now I would like to re-compile my existing kernel(2.6.15) without the inital ramdisk support.

Is it possible to do so? If yes then where in the kernel configuration do I have to disable it.?

ALso, what are the disadvantages of disabling initrd?

Thanks

BobNutfield 06-23-2006 05:12 PM

Hi

When you recompile your kernel, I believe the option is in general setup and looks like this in the configuration file:

Quote:

CONFIG_INITRAMFS_SOURCE=
Just unselect it. I have recompiled a number of kernels in Slackware (2.6.X) and have never used an initrd to boot. Worked just fine. I believe an initrd is only required if you have some modules which will not load at boot time without it.

Hope this helps

Bob

kushalkoolwal 06-23-2006 07:49 PM

Quote:

Originally Posted by BobNutfield
Hi

When you recompile your kernel, I believe the option is in general setup and looks like this in the configuration file:



Just unselect it. I have recompiled a number of kernels in Slackware (2.6.X) and have never used an initrd to boot. Worked just fine. I believe an initrd is only required if you have some modules which will not load at boot time without it.

Hope this helps

Bob

Thanks for replying dude. Well is there any way beforehand by which I can know if my kernel will work or not w/o initrd. In short, which are those modules which require initrd? can you give some light on this?

Thanks

syg00 06-23-2006 08:06 PM

Unless you have some *really* oddball hardware not supported natively in the kernel, there should be *NO* requirement for initrd in a hand configured kernel build.
And even if you do manage to screw it up, go back and fix it - make sure you don't overwrite your known good kernel image.

Some (most nowadays ??) distros use initrd to cover all eventualities - not a concern if you build for your own hardware.

Phiebie 06-24-2006 09:51 AM

Quote:

Originally Posted by syg00
Unless you have some *really* oddball hardware not supported natively in the kernel, there should be *NO* requirement for initrd in a hand configured kernel build.

Yes and no. There are quite a lot of people who want to keep the kernel as small and lean as possible. These tend to even compile the filesystem(s) as modules! Well it's quite obvious that the new kernel, without an initrd, will not start: he can't read the partition where the module is, that he has to load to read the partition:)
But besides that I'm not aware of any other real need to make an initrd.

utanja 06-24-2006 12:31 PM

i have been using without initrd for years without any problems....only remember you must include in the kernel everything you need to boot the filesystem....everything else can be modules...:)

kushalkoolwal 06-24-2006 03:05 PM

Quote:

Originally Posted by utanja
i have been using without initrd for years without any problems....only remember you must include in the kernel everything you need to boot the filesystem....everything else can be modules...:)

And what are the things that you need to boot the filesystem. Can you please post your kernel config(without the initrd enabled) so that I will have an idea what things to compile in. Or if you are not able to post it and then can you just list the critical things which needs to be compiled in.

JackieBrown 06-24-2006 03:32 PM

make sure when compiling your kernel to compile your filesystem into the kernel and not as a module if you don't want a initrd

jschiwal 06-24-2006 03:37 PM

Depending on whether your initrd file is a ramfs image or a compressed cpio archive, you could either mount it, or copy it to your home directory and extract the contents. Then explore the contents to see which modules are present. You could then compile these features into the kernel, and then reexamine the contents of your new initrd.

Is there an init or linuxrc script? Does it do anything that needs to be moved to a script in /etc?

HappyTux 06-25-2006 08:44 PM

You may want to read this article.

http://newbiedoc.sourceforge.net/system/kernel-pkg.html

kushalkoolwal 06-25-2006 09:11 PM

Quote:

Originally Posted by jschiwal
Depending on whether your initrd file is a ramfs image or a compressed cpio archive, you could either mount it, or copy it to your home directory and extract the contents. Then explore the contents to see which modules are present. You could then compile these features into the kernel, and then reexamine the contents of your new initrd.

Is there an init or linuxrc script? Does it do anything that needs to be moved to a script in /etc?

How do I know if it is a cpio archive or a ramfs? I am using Debian etch kernel 2.6.15. Generally my initrd image is named like initrd.img-2.6.15-1 under /boot directory.

Thanks

Col._Panic 06-26-2006 05:47 AM

I build my kernels from kernel.org, all without initrd support. I make sure my .config has the following options set -

Code:

# Block devices
#
CONFIG_BLK_DEV_FD=m
# CONFIG_BLK_CPQ_DA is not set
# CONFIG_BLK_CPQ_CISS_DA is not set
# CONFIG_BLK_DEV_DAC960 is not set
# CONFIG_BLK_DEV_UMEM is not set
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_CRYPTOLOOP=m
CONFIG_BLK_DEV_NBD=m
# CONFIG_BLK_DEV_SX8 is not set
# CONFIG_BLK_DEV_UB is not set
# CONFIG_BLK_DEV_RAM is not set (RAMdisk support)
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_CDROM_PKTCDVD=m
CONFIG_CDROM_PKTCDVD_BUFFERS=8
# CONFIG_CDROM_PKTCDVD_WCACHE is not set
# CONFIG_ATA_OVER_ETH is not set

# ATA/ATAPI/MFM/RLL support
#
CONFIG_IDE=y (a must if you use IDE HDs)
CONFIG_BLK_DEV_IDE=y

#
# Please see Documentation/ide.txt for help/info on IDE drives
#
# CONFIG_BLK_DEV_IDE_SATA is not set (most SATA uses SCSI now, see below)
# CONFIG_BLK_DEV_HD_IDE is not set
CONFIG_BLK_DEV_IDEDISK=y
# CONFIG_IDEDISK_MULTI_MODE is not set
CONFIG_BLK_DEV_IDECD=m
# CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_BLK_DEV_IDESCSI is not set
# CONFIG_IDE_TASK_IOCTL is not set

#
# IDE chipset support/bugfixes
#
# CONFIG_IDE_GENERIC is not set
# CONFIG_BLK_DEV_CMD640 is not set
# CONFIG_BLK_DEV_IDEPNP is not set
CONFIG_BLK_DEV_IDEPCI=y
CONFIG_IDEPCI_SHARE_IRQ=y
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_BLK_DEV_GENERIC is not set
# CONFIG_BLK_DEV_OPTI621 is not set
# CONFIG_BLK_DEV_RZ1000 is not set
CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
CONFIG_IDEDMA_PCI_AUTO=y
# CONFIG_IDEDMA_ONLYDISK is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_BLK_DEV_ALI15X3 is not set
CONFIG_BLK_DEV_AMD74XX=y (my mobo chipset)
# CONFIG_BLK_DEV_ATIIXP is not set
# CONFIG_BLK_DEV_CMD64X is not set
# CONFIG_BLK_DEV_TRIFLEX is not set
# CONFIG_BLK_DEV_CY82C693 is not set
# CONFIG_BLK_DEV_CS5520 is not set
# CONFIG_BLK_DEV_CS5530 is not set
# CONFIG_BLK_DEV_CS5535 is not set
# CONFIG_BLK_DEV_HPT34X is not set
# CONFIG_BLK_DEV_HPT366 is not set
# CONFIG_BLK_DEV_SC1200 is not set
# CONFIG_BLK_DEV_PIIX is not set
# CONFIG_BLK_DEV_IT821X is not set
# CONFIG_BLK_DEV_NS87415 is not set
# CONFIG_BLK_DEV_PDC202XX_OLD is not set
# CONFIG_BLK_DEV_PDC202XX_NEW is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIIMAGE is not set
# CONFIG_BLK_DEV_SIS5513 is not set
# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_ARM is not set
CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_IVB is not set
CONFIG_IDEDMA_AUTO=y
# CONFIG_BLK_DEV_HD is not set

#
# SCSI device support
#
# CONFIG_RAID_ATTRS is not set
CONFIG_SCSI=y (I boot off SATA)
CONFIG_SCSI_PROC_FS=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y (because I use SATA HDs)
# CONFIG_CHR_DEV_ST is not set
# CONFIG_CHR_DEV_OSST is not set
# CONFIG_BLK_DEV_SR is not set
CONFIG_CHR_DEV_SG=m
# CONFIG_CHR_DEV_SCH is not set

<snip>
#
# SCSI low-level drivers
#
# CONFIG_ISCSI_TCP is not set
# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
# CONFIG_SCSI_3W_9XXX is not set
# CONFIG_SCSI_ACARD is not set
# CONFIG_SCSI_AACRAID is not set
# CONFIG_SCSI_AIC7XXX is not set
# CONFIG_SCSI_AIC7XXX_OLD is not set
# CONFIG_SCSI_AIC79XX is not set
# CONFIG_SCSI_DPT_I2O is not set
# CONFIG_SCSI_ADVANSYS is not set
# CONFIG_MEGARAID_NEWGEN is not set
# CONFIG_MEGARAID_LEGACY is not set
# CONFIG_MEGARAID_SAS is not set
CONFIG_SCSI_SATA=y
# CONFIG_SCSI_SATA_AHCI is not set
# CONFIG_SCSI_SATA_SVW is not set
# CONFIG_SCSI_ATA_PIIX is not set
# CONFIG_SCSI_SATA_MV is not set
# CONFIG_SCSI_SATA_NV is not set
# CONFIG_SCSI_PDC_ADMA is not set
# CONFIG_SCSI_SATA_QSTOR is not set
# CONFIG_SCSI_SATA_PROMISE is not set
# CONFIG_SCSI_SATA_SX4 is not set
CONFIG_SCSI_SATA_SIL=y (my SATA controller)
# CONFIG_SCSI_SATA_SIL24 is not set
# CONFIG_SCSI_SATA_SIS is not set
# CONFIG_SCSI_SATA_ULI is not set
# CONFIG_SCSI_SATA_VIA is not set
# CONFIG_SCSI_SATA_VITESSE is not set
# CONFIG_SCSI_BUSLOGIC is not set
# CONFIG_SCSI_DMX3191D is not set
# CONFIG_SCSI_EATA is not set
# CONFIG_SCSI_EATA_PIO is not set
# CONFIG_SCSI_FUTURE_DOMAIN is not set
# CONFIG_SCSI_GDTH is not set
# CONFIG_SCSI_IPS is not set
# CONFIG_SCSI_INITIO is not set
# CONFIG_SCSI_INIA100 is not set
# CONFIG_SCSI_SYM53C8XX_2 is not set
# CONFIG_SCSI_IPR is not set
# CONFIG_SCSI_QLOGIC_FC is not set
# CONFIG_SCSI_QLOGIC_1280 is not set
CONFIG_SCSI_QLA2XXX=y
# CONFIG_SCSI_QLA21XX is not set
# CONFIG_SCSI_QLA22XX is not set
# CONFIG_SCSI_QLA2300 is not set
# CONFIG_SCSI_QLA2322 is not set
# CONFIG_SCSI_QLA6312 is not set
# CONFIG_SCSI_QLA24XX is not set
# CONFIG_SCSI_LPFC is not set
# CONFIG_SCSI_DC395x is not set
# CONFIG_SCSI_DC390T is not set
# CONFIG_SCSI_NSP32 is not set
# CONFIG_SCSI_DEBUG is not set
<snip>
# File systems
#
CONFIG_EXT2_FS=m
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT2_FS_SECURITY=y
# CONFIG_EXT2_FS_XIP is not set
CONFIG_EXT3_FS=m
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
CONFIG_JBD=m
# CONFIG_JBD_DEBUG is not set
CONFIG_FS_MBCACHE=m
CONFIG_REISERFS_FS=y (I boot off Reiser)
# CONFIG_REISERFS_CHECK is not set
# CONFIG_REISERFS_PROC_INFO is not set
# CONFIG_REISERFS_FS_XATTR is not set
# CONFIG_JFS_FS is not set
CONFIG_FS_POSIX_ACL=y
CONFIG_XFS_FS=m
CONFIG_XFS_QUOTA=y
CONFIG_XFS_SECURITY=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_RT=y
# CONFIG_MINIX_FS is not set
# CONFIG_ROMFS_FS is not set
CONFIG_INOTIFY=y
CONFIG_QUOTA=y
CONFIG_QFMT_V1=m
CONFIG_QFMT_V2=m
CONFIG_QUOTACTL=y
CONFIG_DNOTIFY=y
CONFIG_AUTOFS_FS=m
CONFIG_AUTOFS4_FS=m
# CONFIG_FUSE_FS is not set

# Miscellaneous filesystems
#
# CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set
# CONFIG_CRAMFS is not set (used by some RAMdisk images)
# CONFIG_VXFS_FS is not set
# CONFIG_HPFS_FS is not set
# CONFIG_QNX4FS_FS is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set

Basically, you just need to make sure your mobo chipset driver, boot drive disk type and controller, and root filesystem are all compiled in to the kernel. As for the RAMdisk options, I don't think it matters, but I leave them out for the sake of completeness.

This should also work for kernels built from Debian-patched sources, but I'm not 100% sure. I've been using the kernel.org method since 2.6.12 without any problems. Recommended are also the 'ck' performance patches from http://members.optusnet.com.au/ckolivas/kernel/ if you don't already know of them.

nx5000 06-26-2006 09:51 AM

Quote:

Originally Posted by kushalkoolwal
How do I know if it is a cpio archive or a ramfs? I am using Debian etch kernel 2.6.15. Generally my initrd image is named like initrd.img-2.6.15-1 under /boot directory.

Thanks

With the powerfull file command:

Code:

file -z /boot/initrd.img-2.6.15-1

kushalkoolwal 06-27-2006 04:23 PM

Quote:

Originally Posted by nx5000
With the powerfull file command:

Code:

file -z /boot/initrd.img-2.6.15-1

here is the output of the above command:
Code:

root@debian:~# file -z /boot/initrd.img-2.6.15-1
/boot/initrd.img-2.6.15-1: ASCII cpio archive (SVR4 with no CRC) (gzip compressed data, from Unix, last modified: Wed May 10 17:54:40 2006, max compression)
root@debian:~#

What is the difference between cpio and rmafs initrd image? Also how can I access the contents of my cpio initrd as suggested in the previous posts.

Many thanks

nx5000 06-28-2006 06:40 AM

Quote:

Also how can I access the contents of my cpio initrd as suggested in the previous posts.
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


All times are GMT -5. The time now is 01:10 AM.