diff options
-rw-r--r-- | libdiskconfig/config_mbr.c | 13 | ||||
-rw-r--r-- | libdiskconfig/diskconfig.h | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/libdiskconfig/config_mbr.c b/libdiskconfig/config_mbr.c index 4836f80..c168c78 100644 --- a/libdiskconfig/config_mbr.c +++ b/libdiskconfig/config_mbr.c @@ -31,9 +31,16 @@ static void cfg_pentry(struct pc_partition *pentry, uint8_t status, uint8_t type, uint32_t start, uint32_t len) { - /* zero out the c/h/s entries.. they are not used */ - memset(&pentry->start, 0, sizeof(struct chs)); - memset(&pentry->end, 0, sizeof(struct chs)); + if (len > 0) { + /* seems that somes BIOSens can get wedged on boot while verifying + * the mbr if these are 0 */ + memset(&pentry->start, 0xff, sizeof(struct chs)); + memset(&pentry->end, 0xff, sizeof(struct chs)); + } else { + /* zero out the c/h/s entries.. they are not used */ + memset(&pentry->start, 0, sizeof(struct chs)); + memset(&pentry->end, 0, sizeof(struct chs)); + } pentry->status = status; pentry->type = type; diff --git a/libdiskconfig/diskconfig.h b/libdiskconfig/diskconfig.h index 9ff8c4d..1e9762a 100644 --- a/libdiskconfig/diskconfig.h +++ b/libdiskconfig/diskconfig.h @@ -48,10 +48,10 @@ #define PART_ACTIVE_FLAG 0x1 struct chs { - uint8_t cylinder; uint8_t head; uint8_t sector; -}; + uint8_t cylinder; +} __attribute__((__packed__)); /* 16 byte pc partition descriptor that sits in MBR and EPBR. * Note: multi-byte entities have little-endian layout on disk */ |