home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / hpfslin9.zip / setboot / boot-manager.h next >
C/C++ Source or Header  |  1993-10-23  |  3KB  |  100 lines

  1. /* Boot manager, just enough to get by */
  2.  
  3. /* sector 0 */
  4.  
  5. /* The boot block is a FAT boot block.  I think it's a completely
  6.    standard FAT boot block for a size-0 filesystem. */
  7.  
  8. struct bootmgr_boot_block
  9. {
  10.   unsigned char jmp[3];
  11.   unsigned char oem_id[8];        /* "APJ&WN" */
  12.   unsigned char bytes_per_sector[2];    /* 512 */
  13.   unsigned char sectors_per_cluster;
  14.   unsigned char n_reserved_sectors[2];
  15.   unsigned char n_fats;
  16.   unsigned char n_rootdir_entries[2];
  17.   unsigned char n_sectors_s[2];        /* 32 */
  18.   unsigned char media_byte;
  19.   unsigned short sectors_per_fat;
  20.   unsigned short sectors_per_track;
  21.   unsigned short heads_per_cyl;
  22.   unsigned int n_hidden_sectors;    /* 32 */
  23.   unsigned int n_sectors_l;
  24.   unsigned char drive_number;        /* 80h -- in this case it's true */
  25.   unsigned char mbz;
  26.   unsigned char sig_29h;        /* 29h */
  27.   unsigned char vol_serno[4];
  28.   unsigned char vol_label[11];
  29.   unsigned char sig_fat[8];        /* "FAT     " */
  30.   unsigned char pad[448];
  31.   unsigned short magic;            /* aa55 */
  32. };
  33.  
  34. /* sector 1 */
  35.  
  36. /* This looks like transient data.  SETBOOT probably only writes sector 1. */
  37.  
  38. struct boot_manager_transient
  39. {
  40.   unsigned unk1, unk2;            /* Misc numbers, probably timeouts
  41.                        and so on */
  42.   unsigned short zero1;
  43.   unsigned char boot_device;        /* /IBD:X goes here */
  44.   unsigned char zero2;
  45.   unsigned zero3[14];
  46.   unsigned char boot_tag[8];        /* /IBA:name goes here */
  47.   unsigned zero4;
  48.   unsigned char current_selection[8];    /* OS last booted.  This line is
  49.                        highlighted in the initial menu. */
  50.   unsigned zero5[74];
  51. };
  52.  
  53. /* sector 3 */
  54.  
  55. /* Menu info for all primary partitions on all disks.
  56.    This is probably only written by FDISK.
  57.    The first four entries are disk 80h, the next four are 81h, and so on. */
  58.  
  59. struct boot_manager_menu
  60. {
  61.   struct partition_data {
  62.     unsigned disk_number : 7;        /* 0 = 80h, 1 = 81h, etc */
  63.     unsigned startable : 1;        /* set on boot manager partition */
  64.     unsigned numbers : 24;        /* cylinder numbers or something */
  65.     unsigned bootable : 1;        /* 0 = ignore, 1 = bootable */
  66.     unsigned zeroflags : 7;
  67.     unsigned char tag[8];        /* OS name, trailing spaces */
  68.     unsigned char zero2[3];
  69.   } partition_data[32];
  70. };
  71.  
  72. /* The data for a logical partition is out in the logical partition itself.
  73.    The partition boot sector has the standard logical partition
  74.    table at the end, and the Bootable flag and OS tag are at 0x18a
  75.    in the unused part of the block. */
  76.  
  77. struct partition_boot_sector
  78. {
  79.   unsigned char skip1[394];
  80.   unsigned char bootable;        /* 01 = bootable */
  81.   unsigned char tag[8];            /* OS name, trailing spaces */
  82.   unsigned char skip2[43];
  83.   struct {
  84.     unsigned char xxx0 : 7;
  85.     unsigned char active : 1;        /* boot indicator */
  86.     unsigned char xxx1[3];
  87.     unsigned char system_indicator;    /* 5 = extended, 1 = dos, etc */
  88.     unsigned char xxx2[3];
  89.     unsigned sector_number __attribute__ ((packed));
  90.     unsigned char xxx3[4];
  91.   } partition[4];
  92.   unsigned short magic;
  93. };
  94.  
  95. /*
  96.    Local Variables:
  97.    comment-column: 40
  98.    End:
  99. */
  100.