summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/blspec.c29
-rw-r--r--common/partitions.c1
-rw-r--r--common/partitions/dos.c4
-rw-r--r--common/partitions/parser.h1
4 files changed, 34 insertions, 1 deletions
diff --git a/common/blspec.c b/common/blspec.c
index 7e84ff3cec..ab18602715 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -634,6 +634,29 @@ int blspec_scan_devicename(struct blspec *blspec, const char *devname)
return blspec_scan_device(blspec, dev);
}
+static int blspec_append_root(struct blspec_entry *entry)
+{
+ const char *appendroot;
+ char *rootarg;
+
+ appendroot = blspec_entry_var_get(entry, "linux-appendroot");
+ if (!appendroot || strcmp(appendroot, "true"))
+ return 0;
+
+ rootarg = path_get_linux_rootarg(entry->rootpath);
+ if (IS_ERR(rootarg)) {
+ pr_err("Getting root argument for %s failed with: %s\n",
+ entry->rootpath, strerror(-PTR_ERR(rootarg)));
+ return PTR_ERR(rootarg);
+ }
+
+ globalvar_add_simple("linux.bootargs.dyn.blspec.appendroot", rootarg);
+
+ free(rootarg);
+
+ return 0;
+}
+
/*
* blspec_boot - boot an entry
*
@@ -683,6 +706,10 @@ int blspec_boot(struct blspec_entry *entry, int verbose, int dryrun)
globalvar_add_simple("linux.bootargs.dyn.blspec", options);
+ ret = blspec_append_root(entry);
+ if (ret)
+ goto err_out;
+
pr_info("booting %s from %s\n", blspec_entry_var_get(entry, "title"),
entry->cdev ? dev_name(entry->cdev->dev) : "none");
@@ -701,7 +728,7 @@ int blspec_boot(struct blspec_entry *entry, int verbose, int dryrun)
ret = bootm_boot(&data);
if (ret)
pr_err("Booting failed\n");
-
+err_out:
free((char *)data.oftree_file);
free((char *)data.initrd_file);
free((char *)data.os_file);
diff --git a/common/partitions.c b/common/partitions.c
index 37d9cb7edc..4f50bfeff1 100644
--- a/common/partitions.c
+++ b/common/partitions.c
@@ -64,6 +64,7 @@ static int register_one_partition(struct block_device *blk,
}
cdev->dos_partition_type = part->dos_partition_type;
+ strcpy(cdev->partuuid, part->partuuid);
free(partition_name);
diff --git a/common/partitions/dos.c b/common/partitions/dos.c
index 37addfd2ef..e0cb35627d 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 8d39452378..8ad134a9aa 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;
};