Make partition-table easier to work with
- Rewrite the JSON input as something more human readable: sizes with
suffixes, string names for type guids, etc.
- Generate the partition-table.img from this, also output the
postprocessed json version.
Change-Id: If86aaccde877744540ccaa9b8c908b8eb65244d7
diff --git a/partition-table.bpt b/partition-table.bpt
deleted file mode 100644
index 8fc336c..0000000
--- a/partition-table.bpt
+++ /dev/null
@@ -1,53 +0,0 @@
-{
- "settings": {
- "ab_suffixes": ["_a", "_b"],
- "partitions_offset_begin": 0,
- "disk_size": 12884901888,
- "disk_alignment": 8388608,
- "disk_guid": "85b83f23-51c4-4403-8bac-906ff5800f4e"
- },
- "partitions": [
- {
- "label": "boot",
- "offset": 8388608,
- "size": 134217728,
- "grow": false,
- "guid": "595059e1-7b18-4e71-98f8-86b0ef75fe34",
- "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
- "flags": "0x0000000000000000",
- "persist": false,
- "ignore": false,
- "ab": false,
- "ab_expanded": false,
- "position": 1
- },
- {
- "label": "misc",
- "offset": 142606336,
- "size": 1048576,
- "grow": false,
- "guid": "8d34ae73-b586-4f9a-b0e8-ec448b882071",
- "type_guid": "6b2378b0-0fbc-4aa9-a4f6-4d6e17281c47",
- "flags": "0x0000000000000000",
- "persist": false,
- "ignore": false,
- "ab": false,
- "ab_expanded": false,
- "position": 2
- },
- {
- "label": "rootfs",
- "offset": 150994944,
- "size": 12725518336,
- "grow": true,
- "guid": "70672ec3-5eee-49ff-b3b1-eb1fbd406bf5",
- "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
- "flags": "0x0000000000000000",
- "persist": false,
- "ignore": false,
- "ab": false,
- "ab_expanded": false,
- "position": 3
- }
- ]
-}
diff --git a/partition-table.json b/partition-table.json
new file mode 100644
index 0000000..9040ebc
--- /dev/null
+++ b/partition-table.json
@@ -0,0 +1,31 @@
+{
+ "settings": {
+ "disk_size": "12 GiB",
+ "disk_alignment": "8 MiB",
+ "disk_guid": "85b83f23-51c4-4403-8bac-906ff5800f4e"
+ },
+ "partitions": [
+ {
+ "label": "boot",
+ "size": "128 MiB",
+ "guid": "595059e1-7b18-4e71-98f8-86b0ef75fe34",
+ "type_guid": "brillo_boot",
+ "position": 1
+ },
+ {
+ "label": "misc",
+ "size": "1 MiB",
+ "guid": "auto",
+ "type_guid": "brillo_misc",
+ "position": 2
+ },
+ {
+ "label": "rootfs",
+ "size": "2 GiB",
+ "grow": true,
+ "guid": "70672ec3-5eee-49ff-b3b1-eb1fbd406bf5",
+ "type_guid": "brillo_system",
+ "position": 3
+ }
+ ]
+}
\ No newline at end of file
diff --git a/partition-table.mk b/partition-table.mk
index f7d912e..28f2623 100644
--- a/partition-table.mk
+++ b/partition-table.mk
@@ -4,11 +4,19 @@
include $(ROOTDIR)/build/preamble.mk
-partition-table: $(PRODUCT_OUT)/partition-table.img
+partition-table: $(PRODUCT_OUT)/partition-table.img $(PRODUCT_OUT)/partition-table.json
-$(PRODUCT_OUT)/partition-table.img: $(ROOTDIR)/build/partition-table.bpt
+$(PRODUCT_OUT)/partition-table.json: $(ROOTDIR)/build/partition-table.json
mkdir -p $(PRODUCT_OUT)
- $(ROOTDIR)/tools/bpt/bpttool make_table --input $(ROOTDIR)/build/partition-table.bpt --output_gpt $(PRODUCT_OUT)/partition-table.img
+ $(ROOTDIR)/tools/bpt/bpttool make_table \
+ --input $(ROOTDIR)/build/partition-table.json \
+ --output_json $(PRODUCT_OUT)/partition-table.json
+
+$(PRODUCT_OUT)/partition-table.img: $(ROOTDIR)/build/partition-table.json
+ mkdir -p $(PRODUCT_OUT)
+ $(ROOTDIR)/tools/bpt/bpttool make_table \
+ --input $(ROOTDIR)/build/partition-table.json \
+ --output_gpt $(PRODUCT_OUT)/partition-table.img
targets::
@echo "partition-table - builds a partition table image for the eMMC"