Sample Header Ad - 728x90

How to populate /dev directory when building my own initrd?

12 votes
2 answers
16551 views
I am trying to learn stuff about initrd. I have followed this tutorial to build my own initrd from scratch, and I installed busybox on it. Then I made an .iso from it with isolinux, so I could test it in virtualbox. It works great! I have the basic commands from busybox, so I wanted to mount a filesystem. But the /dev directory is almost empty (no sda), except for some files I created while following the tutorial. I learned about udev and I think this is what I need. However I am not sure how to go on this. Should I just grab the latest source code from udev, compile it and add it to my initrd? And then call /bin/udev or something like that in my init script? Or is there an other/better way to populate the /dev directory? **Edit:** Some additional info and updates on what I have done already. - I test everything in virtual box. I just installed ubuntu minimal in virtual box, made an .iso from my initrd, and then boot from the iso in virtualbox. - I used the vmlinuz and /lib/modules that were present on a debian-businesscard.iso and copied those over to my initrd which I created by following the tutorial I linked earlier. - Kernel has CONFIG_DEVTMPFS=y - Some devices show up in /dev, like tty0-tty63 and some others, but no sda/hda. - Ran lspci -k in my currently running OS and in a virtual box to check which modules are in use. SATA Controller says it uses ahci as module. - When I execute modprobe -v ahci it complains a lot about "unknown symbol: ata_some_stuff", but after that it returns something like SCSI Subsystem initialized, ATA-6: VBOX HARDDISK and Direct-Access ATA VBOX HARDDISK. However, still no harddrive devices found in /dev. My current /init/ script is as follows: #!/bin/ash mount -t devtmpfs none /dev mount -t proc /proc /proc mount -t sysfs none /sys modprobe -v ahci echo "Hello world" exec /bin/ash --login Does anyone has any idea what I am doing wrong and what I should be doing instead?
Asked by Carlito (578 rep)
Oct 23, 2012, 08:31 PM
Last activity: May 10, 2023, 08:25 AM