Re: INITRD - linuxrc does not find executables???

Richard B. Johnson (root@chaos.analogic.com)
Sun, 15 Aug 1999 21:43:17 -0400 (EDT)


On Sun, 15 Aug 1999, Gita Menta wrote:

> I am trying to use initrd. I have copied a few executables like ls,
> mount etc. to the bin directory in the initrd - disk. Upon booting
> although linuxrc gets executed it does not find the executables.
>
> I have tried setting path variable in linuxrc too. Has anyone seen
> this problem and what is the solution?
>

Are your executables statically linked? Unless you provide the libraries
in /lib, you are not going to get them to execute. Also have you either
set a path in linuxrc or provided the complete pathname for your
executables?

Here is my script that I use to make a RAM disk to boot when I need my
SCSI disk for the root file-system. The SCSI stuff is modular.

#!/bin/bash
#
# This installs the kernel on a system that requires an initial
# RAM Disk and with an initial SCSI driver.
#

export VER=$1
IMAGE=/tmp/RamImage-${VER}
RAMDISK=/tmp/Ramdisk
DISKSIZE=1500
SYS=/usr/src/linux-${VER}/arch/i386/boot/bzImage
MAP=/usr/src/linux-${VER}/System.map
if [ "$1" = "" ] ;
then
echo "Usage:"
echo "make_ramdisk <version>"
exit 1
fi
if [ ! -f ${SYS} ] ;
then
echo "File not found, ${SYS}"
exit 1
fi
if [ ! -f ${MAP} ] ;
then
echo "File not found, ${MAP}"
exit 1
fi
umount ${RAMDISK} 2>/dev/null
mkdir ${RAMDISK} 2>/dev/null
dd if=/dev/zero of=${IMAGE} bs=1k count=${DISKSIZE}
mke2fs -Fq ${IMAGE} ${DISKSIZE}
mount -o loop ${IMAGE} ${RAMDISK}
rmdir ${RAMDISK}/lost+found
mkdir ${RAMDISK}/dev
mkdir ${RAMDISK}/etc
mkdir ${RAMDISK}/lib
mkdir ${RAMDISK}/bin
mknod ${RAMDISK}/dev/null c 1 3
mknod ${RAMDISK}/dev/ram1 b 1 1
mknod ${RAMDISK}/dev/tty0 c 4 0
mknod ${RAMDISK}/dev/tty1 c 4 1
mknod ${RAMDISK}/dev/tty2 c 4 2
mknod ${RAMDISK}/dev/tty3 c 4 3
mknod ${RAMDISK}/dev/tty4 c 4 4
ln -s /dev/tty0 ${RAMDISK}/dev/systty
ln -s /dev/tty0 ${RAMDISK}/dev/console
ln -s /dev/ram1 ${RAMDISK}/dev/ram
cp /bin/ash.static ${RAMDISK}/bin/sh
cp /sbin/insmod.static ${RAMDISK}/bin/insmod
cp /lib/modules/${VER}/scsi/BusLogic.o ${RAMDISK}/lib
cp /lib/modules/${VER}/scsi/scsi_mod.o ${RAMDISK}/lib
cp /lib/modules/${VER}/scsi/sd_mod.o ${RAMDISK}/lib
echo "#!/bin/sh" >${RAMDISK}/linuxrc
echo "insmod /lib/scsi_mod.o" >>${RAMDISK}/linuxrc
echo "insmod /lib/BusLogic.o" >>${RAMDISK}/linuxrc
echo "insmod /lib/sd_mod.o" >>${RAMDISK}/linuxrc
chmod +x ${RAMDISK}/linuxrc
umount ${RAMDISK}
rmdir ${RAMDISK}
gzip < ${IMAGE} >/boot/initrd-${VER}
rm ${IMAGE}
cp ${SYS} /boot/vmlinuz-${VER}
cp ${MAP} /boot/System.map-${VER}
rm -rf /boot/System.map
ln -s /boot/System.map-${VER} /boot/System.map
psupdate
#
echo >/boot/message
echo " Booting Linux version ${VER}" >>/boot/message
echo " Hit tab key to see alternatives" >>/boot/message
echo " This machine will self-destruct in 15 seconds" >>/boot/message
echo >>/boot/message
#
lilo -C - <<EOF
#
# In-line Lilo boot-configuration script.
#
boot = /dev/sda
message = /boot/message
compact
delay = 15 # optional, for systems that boot very quickly
vga = normal # force sane state

image = /boot/vmlinuz-${VER}
root = current
label = new
initrd = /boot/initrd-${VER}

image = /boot/vmlinuz-${VER}
root = current
label = test
initrd = /boot/initrd-test

image = /vmlinuz
root = current
label = linux

image = /vmlinuz
root = /dev/sdc3
label = maint

image = /vmlinuz
root = /dev/sdb1
label = maint-su
append="init=/bin/bash"

image = /vmlinuz.old
root = current
label = linux_old

other = /dev/sda1
table = /dev/sda
label = dos

EOF

Cheers,
Dick Johnson
**** FILE SYSTEM WAS MODIFIED ****
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/