Fix build on FreeBSD 7 where:
1. DOSPTYP_FAT32 is not defined in <sys/diskmbr.h> 2. uuid_enc_le() does not exist in libc.
This commit is contained in:
parent
6f51bc45db
commit
9e4108268e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=263926
@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$");
|
||||
#include "mkimg.h"
|
||||
#include "scheme.h"
|
||||
|
||||
#ifndef DOSPTYP_FAT32
|
||||
#define DOSPTYP_FAT32 0x0b
|
||||
#endif
|
||||
|
||||
static struct mkimg_alias ebr_aliases[] = {
|
||||
{ ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) },
|
||||
{ ALIAS_FREEBSD, ALIAS_INT2TYPE(DOSPTYP_386BSD) },
|
||||
|
@ -128,6 +128,21 @@ crc32(const void *buf, size_t sz)
|
||||
return (crc ^ ~0U);
|
||||
}
|
||||
|
||||
static void
|
||||
gpt_uuid_enc(void *buf, const uuid_t *uuid)
|
||||
{
|
||||
uint8_t *p = buf;
|
||||
int i;
|
||||
|
||||
le32enc(p, uuid->time_low);
|
||||
le16enc(p + 4, uuid->time_mid);
|
||||
le16enc(p + 6, uuid->time_hi_and_version);
|
||||
p[8] = uuid->clock_seq_hi_and_reserved;
|
||||
p[9] = uuid->clock_seq_low;
|
||||
for (i = 0; i < _UUID_NODE_LEN; i++)
|
||||
p[10 + i] = uuid->node[i];
|
||||
}
|
||||
|
||||
static u_int
|
||||
gpt_tblsz(void)
|
||||
{
|
||||
@ -207,9 +222,9 @@ gpt_mktbl(u_int tblsz)
|
||||
|
||||
STAILQ_FOREACH(part, &partlist, link) {
|
||||
ent = tbl + part->index;
|
||||
uuid_enc_le(&ent->ent_type, ALIAS_TYPE2PTR(part->type));
|
||||
gpt_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type));
|
||||
uuidgen(&uuid, 1);
|
||||
uuid_enc_le(&ent->ent_uuid, &uuid);
|
||||
gpt_uuid_enc(&ent->ent_uuid, &uuid);
|
||||
le64enc(&ent->ent_lba_start, part->block);
|
||||
le64enc(&ent->ent_lba_end, part->block + part->size - 1);
|
||||
if (part->label != NULL) {
|
||||
@ -278,7 +293,7 @@ gpt_write(int fd, lba_t imgsz, void *bootcode)
|
||||
le64enc(&hdr->hdr_lba_start, 2 + tblsz);
|
||||
le64enc(&hdr->hdr_lba_end, imgsz - tblsz - 2);
|
||||
uuidgen(&uuid, 1);
|
||||
uuid_enc_le(&hdr->hdr_uuid, &uuid);
|
||||
gpt_uuid_enc(&hdr->hdr_uuid, &uuid);
|
||||
le32enc(&hdr->hdr_entries, nparts);
|
||||
le32enc(&hdr->hdr_entsz, sizeof(struct gpt_ent));
|
||||
crc = crc32(tbl, nparts * sizeof(struct gpt_ent));
|
||||
|
@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$");
|
||||
#include "mkimg.h"
|
||||
#include "scheme.h"
|
||||
|
||||
#ifndef DOSPTYP_FAT32
|
||||
#define DOSPTYP_FAT32 0x0b
|
||||
#endif
|
||||
|
||||
static struct mkimg_alias mbr_aliases[] = {
|
||||
{ ALIAS_EBR, ALIAS_INT2TYPE(DOSPTYP_EXT) },
|
||||
{ ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) },
|
||||
|
Loading…
Reference in New Issue
Block a user