svn commit: r263926 - head/usr.bin/mkimg
Marcel Moolenaar
marcel at FreeBSD.org
Sat Mar 29 23:46:02 UTC 2014
Author: marcel
Date: Sat Mar 29 23:46:01 2014
New Revision: 263926
URL: http://svnweb.freebsd.org/changeset/base/263926
Log:
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.
Modified:
head/usr.bin/mkimg/ebr.c
head/usr.bin/mkimg/gpt.c
head/usr.bin/mkimg/mbr.c
Modified: head/usr.bin/mkimg/ebr.c
==============================================================================
--- head/usr.bin/mkimg/ebr.c Sat Mar 29 23:25:09 2014 (r263925)
+++ head/usr.bin/mkimg/ebr.c Sat Mar 29 23:46:01 2014 (r263926)
@@ -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) },
Modified: head/usr.bin/mkimg/gpt.c
==============================================================================
--- head/usr.bin/mkimg/gpt.c Sat Mar 29 23:25:09 2014 (r263925)
+++ head/usr.bin/mkimg/gpt.c Sat Mar 29 23:46:01 2014 (r263926)
@@ -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 *boo
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));
Modified: head/usr.bin/mkimg/mbr.c
==============================================================================
--- head/usr.bin/mkimg/mbr.c Sat Mar 29 23:25:09 2014 (r263925)
+++ head/usr.bin/mkimg/mbr.c Sat Mar 29 23:46:01 2014 (r263926)
@@ -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) },
More information about the svn-src-all
mailing list