[klibc] Unable to cat raw /dev/fd0 more than one time

Gilles Espinasse g.esp at free.fr
Sun Jun 8 10:50:17 PDT 2008


Trying to be not long, on x86 I have 3 floppies images boot, root-1, root-2

Booting from boot image with no problem, I try reading root-1 and root-2
image in raw format.

Reading root-1 and root-2 is made from boot init script, using klibc-1.5.9
or klibc-1.5.10 with debian insmod patch, and a vanilia linux-2.6.24.7

root-1 and 2 images are smaller than 1440 kB and are made the same way with
 cd $(FLOPPY_ROOT_DIR) && find . | cpio -o -H newc | gzip -9 > \
        /$(INSTALLER_DIR)/images/$(SNAME)-$(VERSION)-root-1.img
...
 cd $(FLOPPY_ROOT_DIR) && find . | cpio -o -H newc | gzip -9 > \
       /$(INSTALLER_DIR)/images/$(SNAME)-$(VERSION)-root-2.img

Problem happen reading from a classical floppy (not tested usb).
/dev/fd0 node is created  with mknod reading before /sys/block/fd0/dev
information
Tested on 2 differents machines, one PII and one 486 laptop, they behave the
same

When init run those actions are made
echo "Insert the root-1.img floppy and press Enter"
read ANSWER
mount -t tmpfs tmpfs /initramfs
echo -n "Loading root-1 initramfs ... "
cd /initramfs && cat /dev/fd0 | zcat -d | cpio -i
echo "Insert the root-2.img floppy and press Enter"
read ANSWER
echo -n "Loading root-2 initramfs ... "
cd /initramfs && cat /dev/fd0 | zcat -d | cpio -i


Reading is fine for root-1
Loading root-1 initramfs ...
zcat: stdin: decompression OK, trailing garbage ignored

But when reading root-2, with same instruction, it always fail _unless_ the
floppy is not changed.
Error message is
"Loading root-2 initramfs ... floppy0: disk absent or changed during
operation
end_request: I/O error, dev fd0, sector 0
buffer I/O error on device fd0, logical block 0
floppy0: disk absent or changed during operation
end_request: I/O error, dev fd0, sector 8
buffer I/O error on device fd0, logical block 1
floppy0: disk absent or changed during operation
end_request: I/O error, dev fd0, sector 16
buffer I/O error on device fd0, logical block 2
floppy0: disk absent or changed during operation
end_request: I/O error, dev fd0, sector 24
buffer I/O error on device fd0, logical block 3
floppy0: disk absent or changed during operation
end_request: I/O error, dev fd0, sector 0
buffer I/O error on device fd0, logical block 0
/dev/fd0: invalid lenght

zcat: stdin: unexpected end of file
cpio: premature end of file"

If I do _not_ change the floppy when asked for root-2, reading same floppy
work (but this my problem with wrong files)
Anytime root-1 is replaced, next cat /dev/fd0 will next fail with any
content on floppy.

Under glibc-2.7 using same kernel, that work.
"floppy0: disk absent or changed during operation" message come from 2.6.24
floppy module code.

Gilles





More information about the klibc mailing list