HACK: Use a read-only rootfs (almost)
This is supposed to be supported by upstream systemd *and* buildroot by
now, so let's see what breaks. I expect that sysrepo & netopeer won't
like this because of repository paths and what not. It also won't be
possible to change the system's timezone, passwords, network
configuration etc, which is something that we will have to fix before
this works "for real".
Originally I wanted to go and use something like RAUC this week, but it
isn't really trivial. This hack at least works on the CL-ROADMv2. It's
ugly.
Change-Id: I52510509370c2605787a3c33e78884c936ec1717
diff --git a/board/czechlight/common/overlay/root/doit-CL-ROADM-v2.sh b/board/czechlight/common/overlay/root/doit-CL-ROADM-v2.sh
index 1c48f2d..9baa4a9 100755
--- a/board/czechlight/common/overlay/root/doit-CL-ROADM-v2.sh
+++ b/board/czechlight/common/overlay/root/doit-CL-ROADM-v2.sh
@@ -3,17 +3,31 @@
set -eux -o pipefail
shopt -s failglob
+mount / -o remount,rw
+mv /etc/sysrepo /etc/sysrepo.orig
+mkdir /etc/sysrepo
+chmod 000 /etc/sysrepo
+mke2fs -t ext4 -F -F -q /dev/sda2
+echo '/dev/sda2 /etc/sysrepo ext4 defaults 0 0' >> /etc/fstab
+mount -a
+mv /etc/sysrepo.orig/* /etc/sysrepo/
+rmdir /etc/sysrepo.orig
+
+# some of these need r/w rootfs due to SSH keys
for DIR in /etc/yang-setup/*; do
${DIR}/install-yang.sh
done
+mount / -o remount,ro
+
sysrepoctl --install --search-dir /usr/share/cla-sysrepo/yang --yang /usr/share/cla-sysrepo/yang/czechlight-roadm-v2.yang
sysrepocfg --datastore=startup --import=/usr/share/cla-sysrepo/yang/czechlight-roadm-v2.startup.xml czechlight-roadm-v2
-systemctl enable czechlight-roadm-v2
systemctl start czechlight-roadm-v2
-
-systemctl enable netopeer2-server
systemctl start netopeer2-server
+mount / -o remount,rw
+systemctl enable czechlight-roadm-v2
+systemctl enable netopeer2-server
echo 'cla-sysrepod --properties-log-level=5 --sr-bridge-log-level=5 --sysrepo-log-level=3 --driver=CL-ROADMv2 --port=/dev/ttyUSB0' >> ~/.ash_history
+mount / -o remount,ro
diff --git a/board/czechlight/epia_geode/genimage.cfg b/board/czechlight/epia_geode/genimage.cfg
index a84794f..d346949 100644
--- a/board/czechlight/epia_geode/genimage.cfg
+++ b/board/czechlight/epia_geode/genimage.cfg
@@ -17,4 +17,8 @@
partition-type = 0x83
image = "rootfs.ext4"
}
+ partition sysrepo {
+ partition-type = 0x83
+ size = 32M
+ }
}