Installed system MSVS3.0 with kernel version 2.4. It is necessary to configure ramdisk (initrd) so that when a hard disk is detected, a certain script is executed.

On newer systems, the situation is very simple. First, there is a ramdisk type initramfs, which is configured through a convenient config-file, and secondly there is a demon udev.

On the same system, device-manager - hotplug, and then, I'm not sure that it starts at the time of system boot. And ramdisk is an initrd that is configured via the linuxrc file. Its contents are:

#!/bin/nash echo "Loading dm-mod.o module" insmod /lib/dm-mod.o echo "Loading scsi_mod.o module" insmod /lib/scsi_mod.o echo "Loading sd_mod.o module" insmod /lib/sd_mod.o echo "Loading cdrom.o module" insmod /lib/cdrom.o echo "Loading sr_mod.o module" insmod /lib/sr_mod.o echo "Loading sg.o module" insmod /lib/sg.o echo "Loading usbcore.o module" insmod /lib/usbcore.o echo "Loading usb-storage.o module" insmod /lib/usb-storage.o sleep 5 echo "Loading jbd.o module" insmod /lib/jbd.o echo "Loading ext3.o module" insmod /lib/ext3.o echo Mounting /proc filesystem mount -t proc /proc /proc echo Creating block devices mkdevices /dev echo Creating root device mkrootdev /dev/root echo 0x0100 > /proc/sys/kernel/real-root-dev echo Mounting root filesystem mount -o acl,nosecdel,secrm --ro -t ext3 /dev/root /sysroot pivot_root /sysroot /sysroot/initrd umount /initrd/proc 

I have not very deep knowledge of Linux-systems, and, frankly, I do not quite understand where the line is here, which is responsible for determining the connected devices. Plus, the system is too old to find good information on these issues.

The contents of the loader config file (LILO is installed there):

 prompt timeout=100 default=MCBC boot=/dev/hda map=/boot/map install=bmp restricted password=Qq123456 bitmap=/boot/mcbc.bmp lba32 image=/boot/vmlinuz-2.4.32-vniins42 label=MCBC initrd=/boot/initrd-2.4.32-vniins42.img read-only root=/dev/hda2 append="acpi=on" 

If this information is useful, then I need to create a virtual device through the device-mapper, which is the "mappit" root-partition.

Tell me, what exactly do I need to do so that when the system starts, my script is executed?

  • Is this a continuation of the same series of questions ? - aleksandr barakin
  • @alexanderbarakin: D tasks change every time, and I fall into a stupor. It is not so important to make a virtual device, how much to execute the script when detecting a real block device. By the way, on fresh systems I did it all (the reason is described in the question). Here I don’t even understand at what moment the prepared root system becomes the current one - AccumPlus
  • after executing the pivot_root command built into nash . - aleksandr barakin
  • one
    you, as I understand it, have no “appearances” and no. After all, you immediately need to mount as a “final” root partition what your module provides. - aleksandr barakin
  • one
    apparently, you need to replace all commands, starting with the mkrootdev call, and ending with the mount call, with your own commands, which eventually mount your file system to /sysroot . and then (starting with pivot_root ) let everything remain as it is. // I only find it difficult to give recommendations about echo 0x0100 > /proc/sys/kernel/real-root-dev - I don’t know what this command is for. perhaps it should be left too. - aleksandr barakin

0