Pass info about HW model to kernel
The idea here is to decouple "one-time configuration" which is supposed
to happen exactly once during product manufacturing, such as MAC
addresses or, in this case, the information about the HW model, from
user-accessible configuration.
This way, we can have a universal image which applies for all CzechLight
devices that happen to use the Clearfog Base as a controller, regardless
on whether it's a (future) production 1U ROADM line card, or the legacy
CL-ROADMv2 box.
It is expected that during the initial flashing of the system to the
eMMC, the flashing script will store this into U-Boot's environment. The
OS image (a rootfs) will contain systemd unit files for all possible
combinations of CzechLight models along with a
ConditionKernelCommandLine=... stanza to control which of the unit files
to actually start.
Change-Id: I3c1b5d6627538e590b6925cae945e2bbd1a96e34
diff --git a/board/czechlight/clearfog/boot.scr.txt b/board/czechlight/clearfog/boot.scr.txt
index a2332e3..a2b0580 100644
--- a/board/czechlight/clearfog/boot.scr.txt
+++ b/board/czechlight/clearfog/boot.scr.txt
@@ -1,5 +1,5 @@
setenv fdtfile armada-388-clearfog-base.dtb
-setenv bootargs root=/dev/mmcblk0p1
+setenv bootargs root=/dev/mmcblk0p1 czechlight=${czechlight}
load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}/${fdtfile}
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${prefix}/zImage
bootz ${kernel_addr_r} - ${fdt_addr_r}
diff --git a/board/czechlight/common/overlay/usr/lib/systemd/system/czechlight-roadm-v2.service b/board/czechlight/common/overlay/usr/lib/systemd/system/czechlight-roadm-v2.service
index 09645dc..c41b229 100644
--- a/board/czechlight/common/overlay/usr/lib/systemd/system/czechlight-roadm-v2.service
+++ b/board/czechlight/common/overlay/usr/lib/systemd/system/czechlight-roadm-v2.service
@@ -4,6 +4,7 @@
Requires=sysrepod.service
PartOf=sysrepod.service
StartLimitIntervalSec=0
+ConditionKernelCommandLine=czechlight=CL-ROADMv2
[Service]
Type=simple
diff --git a/board/czechlight/common/overlay/usr/lib/systemd/system/multi-user.target.wants/czechlight-roadm-v2.service b/board/czechlight/common/overlay/usr/lib/systemd/system/multi-user.target.wants/czechlight-roadm-v2.service
new file mode 120000
index 0000000..f923550
--- /dev/null
+++ b/board/czechlight/common/overlay/usr/lib/systemd/system/multi-user.target.wants/czechlight-roadm-v2.service
@@ -0,0 +1 @@
+../czechlight-roadm-v2.service
\ No newline at end of file