Re: Cannot boot from floppy disk
David Brownlee <[email protected]> Tue, 22 Apr 2014 20:44:10 +0100
| Newsgroups | gmane.os.netbsd.ports.bebox |
|---|---|
| Message-ID | <CAGN_6pYMvYe+9FVjSXRJ1m9+-aqfD20vtA3Tff6ZOTeUb3F8yw@mail.gmail.com> |
--001a11c331b60c670d04f7a6d7c6 Content-Type: text/plain; charset=UTF-8 On 22 Apr 2014 18:58, "Frank Wille" <[email protected]> wrote: > > On Mon, 21 Apr 2014 17:31:32 +0100 > David Brownlee <[email protected]> wrote: > > > > Now I'm trying to find out how the images are made. An nbmake-bebox in > > > src/sys/arch/bebox/stand only creates "boot.elf" and the stripped > > > "boot", which is also in ELF format. Who converts that into PEF format > > > and puts it into the image? > > > > I suspect you want distrib/bebox... good hunting :) > > Right. I guess we have a problem with compiling on 64-bit architectures > (I compiled on NetBSD/amd64). > > The BeOS PEF file header is in mkbootimage/pef.h defined as: > > ---8<--- > struct FileHeader > { > unsigned long magic; > unsigned long fileTypeID; > unsigned long archID; > unsigned long versionNumber; > unsigned long dateTimeStamp; > unsigned long definVersion; > unsigned long implVersion; > unsigned long currentVersion; > unsigned short numSections; > unsigned short loadableSections; > unsigned long memoryAddress; > }; > > #define PEF_MAGIC 0x4A6F7921 /* Joy! */ > #define PEF_FILE 0x70656666 /* peff */ > #define PEF_PPC 0x70777063 /* pwpc */ > ---8<--- Bingo. That was careless of someone :) - I suspect the definition was copied from BeOS or similar. > I guess the types should be replaced by uint32_t and uint16_t to make it > work, as the file header in my boot.fs image looks like that: > > 00006400 4a 6f 79 21 00 00 00 00 70 65 66 66 00 00 00 00 |Joy!....peff....| > 00006410 70 77 70 63 00 00 00 00 00 00 00 01 00 00 00 00 |pwpc............| > > Note the empty 32-bit words between magic, fileTypeID and archID. > That cannot work... The good news is that it should be a simple fix, and that you are in the perfect place to test the result :-p --001a11c331b60c670d04f7a6d7c6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p dir=3D"ltr">On 22 Apr 2014 18:58, "Frank Wille" <<a href=3D= "mailto:[email protected]">[email protected]</a>> wrote:<br> ><br> > On Mon, 21 Apr 2014 17:31:32 +0100<br> > David Brownlee <<a href=3D"mailto:[email protected]">[email protected]</a>>= ; wrote:<br> ><br> > > > Now I'm trying to find out how the images are made. An n= bmake-bebox in<br> > > > src/sys/arch/bebox/stand only creates "boot.elf" a= nd the stripped<br> > > > "boot", which is also in ELF format. Who converts = that into PEF format<br> > > > and puts it into the image?<br> > ><br> > > I suspect you want distrib/bebox... good hunting :)<br> ><br> > Right. I guess we have a problem with compiling on 64-bit architecture= s<br> > (I compiled on NetBSD/amd64).<br> ><br> > The BeOS PEF file header is in mkbootimage/pef.h defined as:<br> ><br> > ---8<---<br> > struct FileHeader<br> > {<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long magic;<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long fileTypeID;<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long archID;<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long versionNumber;<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long dateTimeStamp;<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long definVersion;<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long implVersion;<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long currentVersion;<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned short numSections;<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned short loadableSections;<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long memoryAddress;<br> > };<br> ><br> > #define PEF_MAGIC 0x4A6F7921 =C2=A0/* Joy! */<br> > #define PEF_FILE =C2=A00x70656666 =C2=A0/* peff */<br> > #define PEF_PPC =C2=A0 0x70777063 =C2=A0/* pwpc */<br> > ---8<---</p> <p dir=3D"ltr">Bingo.=C2=A0 That was careless of someone :)=C2=A0 - I suspe= ct the definition was copied from BeOS or similar. <br></p> <p dir=3D"ltr">> I guess the types should be replaced by uint32_t and ui= nt16_t to make it<br> > work, as the file header in my boot.fs image looks like that:<br> ><br> > 00006400 =C2=A04a 6f 79 21 00 00 00 00 =C2=A070 65 66 66 00 00 00 00 = =C2=A0|Joy!....peff....|<br> > 00006410 =C2=A070 77 70 63 00 00 00 00 =C2=A000 00 00 01 00 00 00 00 = =C2=A0|pwpc............|<br> ><br> > Note the empty 32-bit words between magic, fileTypeID and archID.<br> > That cannot work...</p> <p dir=3D"ltr">The good news is that it should be a simple fix, and that yo= u are in the perfect place to test the result :-p<br></p> --001a11c331b60c670d04f7a6d7c6--