adding linuxrc to initrd
How can I add linuxrc to initrd that is inside /boot folder on my pc
as give on man pages of initrd http://www.netadmintools.com/html/initrd.man.html What I understood is executable /linuxrc determines what is needed to (1) mount the normal root file-system (i.e. device type, device drivers, file system) and (2) the distribution media (e.g. CD-ROM, network, tape, ...). This can be done by asking the user, by auto-probing, or by using a hybrid approach. I want to be able to create an initrd which I can give to my friend who can start installation from it . by mounting root on cd or dvd etc |
Try this
# mkdir /tmp/init # zcat /boot/initrd.img > /tmp/initrd.img # mkdir init # mount -o loop initrd.img init Change the files u need inside the init dir .. # umount init # gzip -9 initrd.img # mv initrd.img.gz /boot/initrd.img |
Quote:
Yes Actually what I did was #gzip -dc initrd | cpio -id so I got a directory that had a lot of files which I could modify including the init script but the only problem I faced was init was executable can I get the source code of this init script which actually does a pivot_root to mount the ISO to start the installation for any distribution fedora ,debian or suse etc etc any one |
Ok am not able to get ur query properly still.
U want to edit linuxrc ? U can directly edit it since its a shell script [and not an exe]. Or can u post the list of files in ur initrd and as to which file u need the source for.. |
Quote:
|
Getting the source should be a bit easy [or i think :) ]
In google just search for - "distro linuxrc.c". If your distro is redhat linux ,the search for redhat linuxrc.c This should point to some locations where u can get the code. - zulfi |
Quote:
look here nothing is coming out http://www.google.co.in/search?q=Ope...ient=firefox-a http://www.google.co.in/search?hl=en...G=Search&meta= http://www.google.co.in/search?hl=en...G=Search&meta= In case you feel that there is something useful to be seen in these links do point out may be I missed something which I don't feel so . |
Yeah it was not found in google.
But this should work .. initrd.img of your system is created by mkinitrd command. This command comes as a part of mkinitrd package. In your Fedora PC try $ rpm -qi mkinitrd This will give your the rpm version. Download the corresponding source rpm and this should have all your source files that are used to created the initrd image. The kernel rpm runs the mkinitrd command before installing kernel to create the initrd file system. Happy tinkering ... |
And one thing you may like to know [if u dont know already]
In a fedora,redhat box if u need source for any file , check which package the file belongs to $ rpm -qif <filename> Download the corresponding source rpm and installing this rpm should give you the source code. [Default the source falls into /usr/src/redhat/SOURCES directory ] - zulfi |
Quote:
But what about the initrd that is present on the dvd or cd that comes for installation is it also created by the same command which I don't think so since I have checked both the initrd on cd and the one in boot folder the one installed has only the modules that are required for booting the system appropritately with the lini to script init that reads some where /etc/rc.S or inittab files and in case of the init on the dvd it should be different since the fstab entries are to be different for installing the system Quote:
|
Ok by now I have checked as per said I downloaded mkinitrd-6.0.9-5.src.rpm
sysvinit-2.86 src rpm and installed which gave bz2 and tar files in /usr/src/redhat/SOURCES directory that I had to manually extract there was an mkinitrd script which had functions named findnetdriver(),handlenetdev(),to me the interesting part started from line number 1209 where the script started building the filesystem vecho "Building initrd in $MNTIMAGE" this was the line after which I guess it starts making the initrd but here what I saw it took the entries from /etc/fstab which I think should not be done because when you start installation from CDROM it does not have any entries in /etc/fstab except the ones like proc etc some lines I am copy pasting line no 1249 =================================== mkdir $MNTIMAGE/dev/mapper mknod $MNTIMAGE/dev/ram0 b 1 0 mknod $MNTIMAGE/dev/ram1 b 1 1 ln -sf ram1 $MNTIMAGE/dev/ram mknod $MNTIMAGE/dev/null c 1 3 mknod $MNTIMAGE/dev/zero c 1 5 mknod $MNTIMAGE/dev/systty c 4 0 if ! echo "$(uname -m)" | grep -q "s390"; then for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 ; do mknod $MNTIMAGE/dev/tty$i c 4 $i done fi for i in 0 1 2 3 ; do mknod $MNTIMAGE/dev/ttyS$i c 4 $(($i + 64)) done mknod $MNTIMAGE/dev/tty c 5 0 mknod $MNTIMAGE/dev/console c 5 1 mknod $MNTIMAGE/dev/ptmx c 5 2 mknod $MNTIMAGE/dev/rtc c 10 135 if [ "$(uname -m)" == "ia64" ]; then mknod $MNTIMAGE/dev/efirtc c 10 136 fi ============================================= and there onwards it gives all the messages like loading drivers etc but the linuxrc part that I had been searching is missing here now what next should I try. |
All times are GMT -5. The time now is 03:16 PM. |