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

Gilles Espinasse g.esp at free.fr
Tue Jun 10 00:26:19 PDT 2008


----- Original Message ----- 
From: "H. Peter Anvin" <hpa at zytor.com>
To: "Gilles Espinasse" <g.esp at free.fr>
Cc: <klibc at zytor.com>
Sent: Monday, June 09, 2008 12:55 AM
Subject: Re: [klibc] Unable to cat raw /dev/fd0 more than one time


...
>
> Well, for one thing you're command here is somewhat daft; you have a
> redundant "cat", and "zcat -d" (which is a tautology).  This is probably
> the source of your problem: "cat" won't know that the floppy is done, so
> it won't close the file.
>
> zcat < /dev/fd0 | cpio -i
>
> ... would be better.
>
> -hpa
>
Well, the curious cat | zcat was because of 2 reasons
First a comment on debian-installer/rootskel/src-bootfloppy say
 /* Fork off cat because klibc zcat refuses to
  * read devices directly, and because we want to
  * see stderr from cat when reading the floppy. */

Secondly
zcat /dev/fd0 fail with this error message /dev/fd0 is not a directory or
regular file - ignored

Your are true zcat </dev/fd0 work and is simplier.

But that does not change the overall result, it still often fail reading
/dev/fd0 the second time.
There is just a bit more block error messages from
zcat < dev/fd0 than with
cat /dev/fd0

In fact the problem could be simplied to

echo "Insert the root-1.img floppy and press Enter"
read ANSWER
echo -n "Loading root-1 initramfs ... "
if ! cat /dev/fd0 >/tmp/floppy.gz; then
 exiterror "Failed"
else
 echo "Done root-1"
fi
echo "Insert the root-2.img floppy and press Enter"
read ANSWER
echo -n "Loading root-2 initramfs ... "
if ! cat /dev/fd0 >/tmp/floppy.gz; then
 exiterror "Failed"
else
 echo "Done root-2"
fi

I need to be slow enought changing the floppies to make it work.
I don't have yet the exact receipt.
After 'Done root-1' is printed, ejecting root-1, waiting 30s, putting root-2
could work.
That's a good new.
I could ask to eject the floppy, uncompress floppy.gz before asking to put
root-2.

I have tested too replacing cat /dev/fd0 with dd if=/dev/fd0
of=/tmp/floppy.gz
It failed with exact same error messages than cat /dev/fd0
There is another problem with dd.
Even if second read to /dev/fd0 fail, dd report no error and "Done root-2"
is always displayed.
When cat is used and failed, 'Failed' is reported.


Gilles



More information about the klibc mailing list