summaryrefslogtreecommitdiffstats
path: root/common/partitions
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-06-17 12:40:04 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-06-18 09:01:01 +0200
commitbc31d85c6e23d724664e76bcfc3b2eda778012a3 (patch)
tree7555fa7f2093c7777635f576941c4a59bd7038db /common/partitions
parentacc930f1e9c482dc826bb63a6b9d36463a280210 (diff)
downloadbarebox-bc31d85c6e23d724664e76bcfc3b2eda778012a3.tar.gz
cdev: Add partuuid string to struct cdev
This adds the partuuid string to struct cdev in order to have this available for constructing a suitable Linux root=PARTUUID= option for booting Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/partitions')
-rw-r--r--common/partitions/dos.c4
-rw-r--r--common/partitions/parser.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/common/partitions/dos.c b/common/partitions/dos.c
index 37addfd..e0cb356 100644
--- a/common/partitions/dos.c
+++ b/common/partitions/dos.c
@@ -185,6 +185,7 @@ static void dos_partition(void *buf, struct block_device *blk,
uint8_t *buffer = buf;
int i;
struct disk_signature_priv *dsp;
+ uint32_t signature = get_unaligned_le32(buf + 0x1b8);
table = (struct partition_entry *)&buffer[446];
@@ -202,6 +203,9 @@ static void dos_partition(void *buf, struct block_device *blk,
pd->parts[n].first_sec = pentry.first_sec;
pd->parts[n].size = pentry.size;
pd->parts[n].dos_partition_type = pentry.dos_partition_type;
+ if (signature)
+ sprintf(pd->parts[n].partuuid, "%08x-%02d",
+ signature, i + 1);
pd->used_entries++;
/*
* Partitions of type 0x05 and 0x0f (and some more)
diff --git a/common/partitions/parser.h b/common/partitions/parser.h
index 8d39452..8ad134a 100644
--- a/common/partitions/parser.h
+++ b/common/partitions/parser.h
@@ -17,6 +17,7 @@
struct partition {
char name[MAX_PARTITION_NAME];
u8 dos_partition_type;
+ char partuuid[MAX_PARTUUID_STR];
uint64_t first_sec;
uint64_t size;
};