[haiku-development] Re: Haiku booting up with floppy image on respi2 qemu

  • From: Han Pengfei <pengphei@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 9 Aug 2018 23:57:21 +0800

Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> 于2018年8月9日周四 下午11:47写道:

On Thu, Aug 09, 2018 at 11:09:03PM +0800, Han Pengfei wrote:
So, either the tar filesystem does not recognize the image (wrong
address?
wrong verson of mkimage? file was not loaded in memory by u-boot as
expected?), or there is a bug in the code somewhere.


while after some tracing debug, I found this:

0x809941b8 Partition::_Mount check for file_system: TAR Filesystem
tarfs: open partition success
skip_gzip_header check magic failed buffer[0]=0xac, buffer[1]=0x8b
tarfs: inflating failed: bad data!
skip_gzip_header check magic failed buffer[0]=0xac, buffer[1]=0xd1
tarfs: inflating failed: bad data!
tarfs: _Inflate partition failed

it seems that the `skip_gzip_header()` checking the magic header failed,
the code as below:

    // check magic and skip method

    if (buffer[0] != 0x1f || buffer[1] != 0x8b) {

        TRACE(("%s check magic failed buffer[0]=0x%02x,
buffer[1]=0x%02x\n", __func__, buffer[0], buffer[1]));

              return false;

    }
So, the header does not match, we get ac 8b or ac d1 instead of 1f 8b.

Can you check your mkimage file? Does it indeed start with ac 8b? Are
you sure it is loaded to RAM at the right address? (IIRC the u-boot
script is suppsed to do this?)


After some more details debuging:

the floppy binary hex in qtcreator as below:

[image: flopy_binary_in_qtcreator.png]

and I have traced the zstream

        zStream.avail_in = bytesRead;

        zStream.next_in = (Bytef*)in;


        TRACE(("tarfs: %02x %02x %02x %02x %02x %02x %02x %02x \n",
in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7], in[8]));


while the debug contents:
-->tarfs: 00 8b 08 00 cd 61 6c 5b

and the correct contents should be the line 5 at figure previous:
1f 8b 08 00 cd 61 6c 5b 00 03 ec 5c 6b 90 1c d5

it seems that we overlayed the 0x1f with 0x00 , or a random byte, aka 0xAC .

-- Han Pengfei





--
Adrien.



-- 
淡泊明志,宁静致远。

PNG image

Other related posts: