[Skiboot] [PATCH 6/6] Mark all partitions except full PNOR and boot kernel

Timothy Pearson tpearson at raptorengineering.com
Sat Apr 27 03:01:04 AEST 2019


 firmware read only

FFS partitions don't always align on erase blocks.  Mark any paritions
not known to align on erase blocks as read only to prevent silent corruption
of adjacent partitions during erase / write from the host.

Signed-off-by: Timothy Pearson <tpearson at raptorengineering.com>
---
 core/flash.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/core/flash.c b/core/flash.c
index e775dd16..3da6d4a4 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -279,6 +279,13 @@ static struct dt_node *flash_add_dt_node(struct flash *flash, int id)
 		partition_node = dt_new_addr(partition_container_node, "partition", ffs_part_start);
 		dt_add_property_strings(partition_node, "label", name);
 		dt_add_property_cells(partition_node, "reg", ffs_part_start, ffs_part_size);
+		if (part_name_map[i].id != RESOURCE_ID_KERNEL_FW) {
+			/* Mark all partitions other than the full PNOR and the boot kernel
+			 * firmware as read only.  These two partitions are the only partitions
+			 * that are properly erase block aligned at this time.
+			 */
+			dt_add_property(partition_node, "read-only", NULL, 0);
+		}
 	}
 
 	partition_node = dt_new_addr(partition_container_node, "partition", 0);
-- 
2.11.0



More information about the Skiboot mailing list