Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: Problem booting Samsung 164UX ("Ruffian") MB - SOLUTION!
  1998-10-11 17:15 Problem booting Samsung 164UX ("Ruffian") MB Andreas Haumer
@ 1998-10-11 19:28 ` Andreas Haumer
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Haumer @ 1998-10-11 19:28 UTC (permalink / raw)
  To: axp-list

Hi guys!

I found the solution to my problem with booting the 164UX from
the hard-disk partition!  :-))

I debugged the boot sectors from MSDOS floppy-disks and the MSDOS
boot partition at my UX ("od" is your friend... :-) and found some
strange differences. I then took a closer look at the sources of 
mkdosfs, and guess what I found:

[...]
struct msdos_boot_sector
{
  unsigned char boot_jump[3];	/* Boot strap short or near jump */
  char system_id[8];		/* Name - can be used to special case
				   partition manager volumes */
  unsigned char sector_size[2];	/* bytes per logical sector */
  unsigned char cluster_size;	/* sectors/cluster */
  unsigned short reserved;	/* reserved sectors */
  unsigned char fats;		/* number of FATs */
  unsigned char dir_entries[2];	/* root directory entries */
  unsigned char sectors[2];	/* number of sectors */
  unsigned char media;		/* media code (unused) */
  unsigned short fat_length;	/* sectors/FAT */
  unsigned short secs_track;	/* sectors per track */
  unsigned short heads;		/* number of heads */

  unsigned long hidden;		/* hidden sectors (unused) */
  unsigned long total_sect;	/* number of sectors (if sectors == 0) */
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  unsigned char drive_number;	/* BIOS drive number */
  unsigned char RESERVED;	/* Unused */
  unsigned char ext_boot_sign;	/* 0x29 if fields below exist (DOS
3.3+) */
  unsigned char volume_id[4];	/* Volume ID number */
  char volume_label[11];	/* Volume label */
  char fs_type[8];		/* Typically FAT12 or FAT16 */
  unsigned char boot_code[448];	/* Boot code (or message) */
  unsigned short boot_sign;	/* 0xAA55 */
};
[...]

Obviously, the author of this software never thought it would ever
be used on hardware where unsigned long > 4 bytes... :-))

I temporarily changed the "unsigned long" lines to "unsigned int",
and now the UX boots fine from a partition created with my modified
"mkdosfs"

That's the way free software works: don't whine, do it yourself... :-)

Many thanks to everyone! I'll see if I can clean up my patches to
mkdosfs and submit them to the author of that software, so that it
can be included in upcoming distributions.

- andreas

-- 
 Andreas Haumer         | email: andreas@xss.co.at | PGP key available
 *x Software + Systeme  | phone: +43.1.6001508     | on request.
 Buchengasse 67/8       |        +43.664.3004449   |   
 A-1100 Vienna, Austria |   fax: +43.1.6001507     | AH327-RIPE


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem booting Samsung 164UX ("Ruffian") MB - SOLUTION!
@ 1998-10-11 19:36 Greg Lindahl
  1998-10-11 19:59 ` Michal Jaegermann
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Lindahl @ 1998-10-11 19:36 UTC (permalink / raw)
  To: axp-list

>   unsigned long hidden;		/* hidden sectors (unused) */
>   unsigned long total_sect;	/* number of sectors (if sectors == 0) */
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some days I wonder how anything ever runs on the Alpha! Thanks for
finding this bug. This hopefully solves all the weirdness everyone
sees for partitioning disks on Alphas.

-- g


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem booting Samsung 164UX ("Ruffian") MB - SOLUTION!
  1998-10-11 19:36 Problem booting Samsung 164UX ("Ruffian") MB - SOLUTION! Greg Lindahl
@ 1998-10-11 19:59 ` Michal Jaegermann
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Jaegermann @ 1998-10-11 19:59 UTC (permalink / raw)
  To: axp-list

Greg Lindahl wrote:
> 
> >   unsigned long hidden;		/* hidden sectors (unused) */
> >   unsigned long total_sect;	/* number of sectors (if sectors == 0) */
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Some days I wonder how anything ever runs on the Alpha!

There is quite a bit of software around written a bit cleaner. :-)
In many cases these cleanup jobs started many years before the first
Alphas showed on a horizon (I know, as I have some personal
contributions into that :-).

Most likely the qouted code is derived from some MS-DOS documentation.
On 16-bit machine if you will declare the above as 'unsigned int'
you will get sizeof 2 and you will come out short (pun intended :-).
A trailing 'unsigned short boot_sign' at the structure end is also not
guaranteed to give you always 16-bits so a signature may end up
in a wrong place even if you have chances of survival on a "little
endian" machine.  What is more - without '__atribute__((packed))' you
do not have a shadow of guarantee that a layout of the whole
structure is without holes (C Standard says so and "packed" is GNU-ism)
so you may screw all this up anyway.  Linux kernel headers are quite
a bit more careful.

A code with hidden layout assumptions like quoted is a major portability
PITA.  Big sigh!

I knew that there was a good reason not to use "mkdosfs" on Alpha
(and not a real need as well :-).

  Michal


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-10-11 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-10-11 19:36 Problem booting Samsung 164UX ("Ruffian") MB - SOLUTION! Greg Lindahl
1998-10-11 19:59 ` Michal Jaegermann
  -- strict thread matches above, loose matches on Subject: below --
1998-10-11 17:15 Problem booting Samsung 164UX ("Ruffian") MB Andreas Haumer
1998-10-11 19:28 ` Problem booting Samsung 164UX ("Ruffian") MB - SOLUTION! Andreas Haumer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox