Make rockpi image boot from wherever it is installed
Use boot scripts for detecting, and a systemd service for mounting /boot
Change-Id: I70ee352d8d773f92c11564f3a8ddd25800d2bba2
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/frc971/rockpi/contents/boot/boot.script b/frc971/rockpi/contents/boot/boot.script
new file mode 100644
index 0000000..26732b6
--- /dev/null
+++ b/frc971/rockpi/contents/boot/boot.script
@@ -0,0 +1,6 @@
+if test ${devnum} -eq 1;
+then
+ sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} sdcard_extlinux.conf
+else
+ sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} emmc_extlinux.conf
+fi
diff --git a/frc971/rockpi/contents/etc/systemd/system/mount-boot.service b/frc971/rockpi/contents/etc/systemd/system/mount-boot.service
new file mode 100644
index 0000000..45e5783
--- /dev/null
+++ b/frc971/rockpi/contents/etc/systemd/system/mount-boot.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Mount /boot
+DefaultDependencies=no
+Before=local-fs.target
+Before=shutdown.target
+After=-.mount
+BindsTo=-.mount
+
+[Service]
+Type=oneshot
+ExecStart=/bin/bash -c "mount $(cat /proc/cmdline | sed 's/.*\(mmcblk.p\).*/\/dev\/\11/') /boot"
+TimeoutSec=0
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target