1Upstream-Status: Pending
2
3diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh
4index 2a32d26ffc..a8cc76d440 100644
5--- a/obmc-init.sh
6+++ b/obmc-init.sh
7@@ -287,6 +287,14 @@ then
8 	fi
9 fi
10
11+# Ensure that we clean our rwfs on version change
12+if mount $rwdev $rwdir -t $rwfst -o $rwopts; then
13+	if ! cmp "$rwdir"/os-release /etc/os-release 2>/dev/null; then
14+		echo "RWFS from older BMC version, cleaning"
15+		touch $trigger
16+	fi
17+	umount "$rwdir"
18+fi
19 if grep -w clean-rwfs-filesystem $optfile
20 then
21 	echo "Cleaning of read-write overlay filesystem requested."
22@@ -411,6 +419,9 @@ HERE
23 	debug_takeover "$msg"
24 fi
25
26+# Keep track of the last version to use this rwfs
27+cp /etc/os-release "$rwdir"/os-release
28+
29 # Empty workdir; do not remove workdir itself for it will fail to recreate it if
30 # RWFS is full
31 if [ -d $work ]
32