Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can i create initrd image for a new(experimental) kernel without actually installing it. (Existing tools to create initrd based on config and details from installed kernel.)

Say i compile a new kernel with experimental features turned on, i have this in another separate partition. I would like to boot into this kernel, for that will old initrd work ? if i want to create a new initrd.img for new kernel without actually installing kernel, how can i do it ?

BTW, can someone clarify about initramfs ? will it be useful for my scenario ?

share|improve this question
    
How did you create your current initrd? –  phunehehe Mar 17 '11 at 7:19
    
If you compile a kernel with a given version, and the modules in the initrd are an older version, the kernel won't load them. –  ultrasawblade Mar 17 '11 at 13:35
    
@phunehehe currently i build kernel from /usr/linux where kernel source is copied. which then installs related file directly to /boot. But i want to compile kernel in some sandbox directory and just use the kernel-image and initrd alone instead of updating other system files. –  rajaganesh87 Mar 17 '11 at 15:11
    
I don't really get it. What is preventing you from building the initrd without messing touching the kernel? –  phunehehe Mar 17 '11 at 15:16
    
@phunehehe currently i am trying build via "mkinitramfs -o initrd.img 2.6.37" but my current running kernel is not 2.6.37. I get error cannot find "/lib/modules/2.6.37" i have compiled 2.6.37 but have not installed it (omitted steps "make install" and "make modules_install"). is it not possible to boot with just vmlinuz and initrd ? should i do make install too ? –  rajaganesh87 Mar 17 '11 at 16:25
add comment

1 Answer 1

up vote 1 down vote accepted

Creating an initrd doesn't have anything to do with installing a kernel. All you do is to create a file structure for the initrd, copy the required files, write the init script and package all of that into a cpio archive. I used the instructions in the Gentoo Wiki to make my initrd. Some distributions make tools to generate initrds, and for that you will have to name your distro. For example, Arch has mkinitcpio.

initramfs is just another (newer) implementation of the initial ramdisk. I don't know for sure, but I think modern distributions all use initramfs. When you see "initrd", it may be a shorthand for "initial ramdisk", and thus it covers both initrd and initramfs.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.