LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Create an initrd (http://www.linuxquestions.org/questions/linux-software-2/create-an-initrd-673052/)

hoshangi 09-29-2008 06:27 AM

Create an initrd
 
hi


i want to create a initial Ramdisk i dont know how but i think i must create an initrd to load my kernel on my board flash when i create the initrd the dd command it's my problem when i use it as following :

dd if=/dev/zero of=initrd bs=4096

then no thing apeare.it stops here and no thing to be done,

if you have an experience about the kernel Ramdisk and how to load it on at91rm9200dk board please help me

keefaz 09-29-2008 06:40 AM

You need to tell to dd how much blocks you want to copy with count= option

Now usually the initrd are not image file made with dd, but rather an image made with cpio program
Are you sure you don't have a script that makes all the initrd procedure for you ?
like mkinitrd or mkramfs or a command with similar name

Which Linux distribution are you using ?

pinniped 09-29-2008 07:02 AM

An initramfs image will take up less space than initrd; create the directory structure, let's say it's in a directory called '/stuff'. According to the documentation in the Linux source directory you'd do something like:

cd /stuff
find . | cpio -o -H newc | gzip > ../myinitrd.img

Note: the documentation states that the 'cpio' documentation gives bad advice on how to generate the image, so don't follow any cpio docs on how to create the initramfs image.

The trick now is in the booting; for a genuine initrd, you need to pass the kernel "init=blah" to tell the kernel what to use for init (for example: init=/bin/sh), but for an initramfs you need "rdinit=blah".

But - if you really want an initrd:
dd if=/dev/zero of=myinitrd bs=512 count=40000
mke2fs myinitrd
mount myinitrd /mnt -o loop

and so on ... and after copying files into the image:
gzip myinitrd


All times are GMT -5. The time now is 01:30 PM.