initrd for custom kernel

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

initrd for custom kernel

Post by piranha »

How do you compile an initrd for a custom kernel?

I don't want to install it, I just want to compile it to a specific directory. the kernel is located in a specific directory as well.
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

Compile initrd? Isn't that some sort of ramdisk image... ? :?
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

Um....yeah....I used the word "compile" because I was tired and I couldn't think of another word.....sorry.....

create an initrd..... help?
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Post by jnc100 »

Well I guess you could

Code: Select all

dd if=/dev/zero of=initrd bs=1k count=initrd_size
mk(filesystem of choice)fs initrd
mount -t filesystem -o loop,rw initrd /mnt
cd /mnt
cp all_my_files .
cd /
umount /mnt
and even gzip it if you're feeling clever
But that's just off the top of my head so I've probably forgotten something...

Regards,
John.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

I'm not sure I get what you mean... will you be mounting this "ramdisk" image via your kernel? You'll have to write support code for that..

As for "creating" the actual image... Create it like any other disk image, You can use the dd command and then setup a vnode/loopback device to create a file system (FFS/Ext2.. or FAT if you must..)

http://www.osdev.org/wiki/Loopback_Device

Have fun :wink:

(Dang.. jnc100 replied first... :lol:)
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

thanks guys!!!!!!
:P
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Post Reply