lkml.org 
[lkml]   [2002]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRE: Multiple kernels OOPS at boot on Fujitsu pt510 ( AMD DX100 CPU ) - ksymoops output attached
On Fri, 1 Mar 2002, Torrey Hoffman wrote:

> Richard B. Johnson [mailto:root@chaos.analogic.com] wrote:
>
> [... snipped: using 2.4.1 because... ]
>
> > Later versions, including the current 2.4.18 fail, to mount an initrd.
>
> I have successfully used ext2-formatted initrd's with a variety of recent
> kernels between 2.4.16 and 2.4.18. The only problem I've ever had is that
> when _building_ an initrd, kernels between 2.4.10 and 2.4.18-pre-something
> had a bug in the ramdisk driver. This has been fixed in later kernels,
> and there is also a workaround for it.
>
> > Once somebody makes a kernel they has both a working loop device and
> > a working initial RAM Disk, I will use that kernel. In the meantime,
>
> My workstation is running a 2.4.18-pre? which successfully mounts CDROM
> ISO images on loopback and successfully creates and boots initrd's.
>
> Are you sure this is not something specific to your setup or config?
>
> Torrey Hoffman

I have gone this far; I can include SCSI in the initial build so
I can boot and mount a root file-system.

This is on 2.4.17. Once I am up, I can build an ext2 file-system ramdisk-
image. I can mount it though the loop device and I can read/write to
it the ram disk and the loop device together work.

However, I should be able to do:
mke2fs -Fq /dev/ram0 1440
# This works ...
mount /dev/ram0 /mnt
# This fails to mount the loop-back device. If I do:
mount -o loop -t ext2 /dev/ram0 /mnt. That works.

Given that, when the kernel uncompresses initrd, and attempts to
mount the root file-system, it doesn't mount it through the loop
device. Instead, in tries to mount it directly. This is probably
what fails. Something has been broken for quite some time and
nobody else seems concerned.

If I boot 2.4.1, I can do:
mke2fs -Fq /dev/ram0 1440
mount /dev/ram0 /mnt

This all works fine.

Attached is my 'ram-disk' tester. If it works on your version
of kernel, please let me know what version it is. This makes
a bootable floppy which loads a tiny program that pretends that
it's init. It doesn't touch your hard disks or anything like
that. It is useful to make such a bootable floppy to verify that
some CPU that you might want to purchase, will boot Linux. This
is what the script was originally used for.


Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).

111,111,111 * 111,111,111 = 12,345,678,987,654,321
#!/bin/sh
#
#
export VER=$1
RAMDISK_IMAGE=/tmp/RamImage-${VER}
RAMDISK=/tmp/Ramdisk
TMPC=/tmp/Temp.c
TMPF=/tmp/TmpExe
DISKSIZE=2048
SYS=/usr/src/linux-${VER}/arch/i386/boot/bzImage
if [ "$1" = "" ] ;
then
echo "Usage:"
echo "test_ramdisk <version>"
exit 1
fi
if [ ! -f ${SYS} ] ;
then
echo "File not found, ${SYS}"
exit 1
fi
if ! dd if=/dev/fd0 of=/dev/null bs=1k count=1 2>/dev/null ;
then
echo "Floppy drive error!"
echo "Maybe no diskette in the drive?"
exit 1
fi
#
# Make a little program called modprobe. This just returns 0.
#
echo "int main(){">${TMPC}
echo "return 0;}">>${TMPC}
gcc -O2 -o modprobe ${TMPC} -static
strip modprobe
rm ${TMPC}
#
# Make a little program called init. This just prints a moving message and
# waits forever.
#
echo "#include <stdio.h>">${TMPC}
echo "main(){">>${TMPC}
echo "int r, c;">>${TMPC}
echo "for(;;){">>${TMPC}
echo "r=rand()%25;c=rand()%68;printf(\"\033[%d;%dH Working! \", r, c);">>${TMPC}
echo "fflush(stdout);usleep(500000);">>${TMPC}
echo "printf(\"\033[%d;%dH \",r,c);fflush(stdout);">>${TMPC}
echo "}}">>${TMPC}
gcc -O2 -o init ${TMPC} -static
strip init
rm ${TMPC}
#
# Make a RAM Disk file and mount it using the loop device.
# Remove the lost+found directory to save space.
#
umount ${RAMDISK} 2>/dev/null
rm -rf ${RAMDISK} 2>/dev/null
mkdir ${RAMDISK} 2>/dev/null
dd if=/dev/zero of=${RAMDISK_IMAGE} bs=1k count=${DISKSIZE}
/sbin/mke2fs -Fq ${RAMDISK_IMAGE} ${DISKSIZE}
mount -o loop -t ext2 ${RAMDISK_IMAGE} ${RAMDISK}
rmdir ${RAMDISK}/lost+found
#
# Make the required directories in the RAM Disk.
#
mkdir -m 777 ${RAMDISK}/dev
mkdir -m 777 ${RAMDISK}/etc
mkdir -m 777 ${RAMDISK}/lib
mkdir -m 777 ${RAMDISK}/usr
mkdir -m 777 ${RAMDISK}/usr/local
mkdir -m 777 ${RAMDISK}/bin
mkdir -m 777 ${RAMDISK}/sbin
mkdir -m 777 ${RAMDISK}/tmp
mkdir -m 777 ${RAMDISK}/proc
#
# Make the required devices.
#
mknod ${RAMDISK}/dev/null c 1 3
mknod ${RAMDISK}/dev/ram0 b 1 0
mknod ${RAMDISK}/dev/ram1 b 1 1
mknod ${RAMDISK}/dev/mem c 1 1
mknod ${RAMDISK}/dev/ttyS0 c 4 64
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
mknod ${RAMDISK}/dev/tty c 5 0
mknod ${RAMDISK}/dev/ttyp0 c 3 0
mknod ${RAMDISK}/dev/ttyp1 c 3 1
mknod ${RAMDISK}/dev/ttyp2 c 3 2
mknod ${RAMDISK}/dev/ttyp3 c 3 3
mknod ${RAMDISK}/dev/ttyp4 c 3 4
mknod ${RAMDISK}/dev/ttyp5 c 3 5
mknod ${RAMDISK}/dev/ptyp0 c 2 0
mknod ${RAMDISK}/dev/ptyp1 c 2 1
mknod ${RAMDISK}/dev/ptyp2 c 2 2
mknod ${RAMDISK}/dev/ptyp3 c 2 3
mknod ${RAMDISK}/dev/ptyp4 c 2 4
mknod ${RAMDISK}/dev/ptyp5 c 2 5
mknod ${RAMDISK}/dev/zero c 1 5
#
# Set some compatibility links.
#
ln -s /dev/tty0 ${RAMDISK}/dev/systty
ln -s /dev/tty0 ${RAMDISK}/dev/console
ln -s /dev/ram1 ${RAMDISK}/dev/ram
ln -s /lib ${RAMDISK}/usr/lib
ln -s /lib ${RAMDISK}/usr/local/lib
#
#
# Copy the files and libraries. All of the files are stripped
# to save space.
#
cp modprobe ${RAMDISK}/sbin/modprobe
cp init ${RAMDISK}/sbin/init
#
#
# Unmount the RAM Disk. Remove its mount-point but save the file itself.
#
sync
df ${RAMDISK}
umount ${RAMDISK}
rmdir ${RAMDISK}
sync
#
# Make an ext2 file-system on a floppy and mount it. Remove the
# lost+found directory to save space.
#
umount /mnt 2>/dev/null
/sbin/mke2fs -q /dev/fd0
mount -t ext2 /dev/fd0 /mnt
rmdir /mnt/lost+found
#
# Compress the RAM Disk image into a file on the mounted file-system.
# Remove the original RAM Disk image, then copy the required boot
# files to the mounted file-system also.
#
gzip < ${RAMDISK_IMAGE} >/mnt/initrd-${VER}
rm ${RAMDISK_IMAGE}
cp ${SYS} /mnt/vmlinuz-${VER}
cp /boot/boot.b /mnt/boot.b
#
# Now execute lilo to install the boot-loader onto the mounted file-
# system. Lilo allows its configuration to be taken from standard input.
#
/sbin/lilo -C - <<EOF
#
# Lilo boot-configuration script.
#
boot = /dev/fd0
map = /mnt/map
backup = /dev/null
compact
vga = normal # force sane state
install = /mnt/boot.b
image = /mnt/vmlinuz-${VER}
initrd = /mnt/initrd-${VER}
root = /dev/ram0
label = Test-RAMDISK
EOF
#
# Show the results and unmount the file-system.
#
df /dev/fd0
umount /dev/fd0
#
\
 
 \ /
  Last update: 2005-03-22 13:24    [W:0.038 / U:21.180 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site