imx6: Add support for Toradex Apalis family of CoMs
[openwrt/staging/chunkeey.git] / target / linux / imx6 / base-files / lib / imx6.sh
index 1bf1439523766292568d2ea529d14dde34d4855f..68caaff15fe72b33ea57a9c42eff38f654a16a87 100755 (executable)
@@ -6,6 +6,33 @@
 IMX6_BOARD_NAME=
 IMX6_MODEL=
 
+rootpartuuid() {
+       local cmdline=$(cat /proc/cmdline)
+       local bootpart=${cmdline##*root=}
+       bootpart=${bootpart%% *}
+       local uuid=${bootpart#PARTUUID=}
+       echo ${uuid%-02}
+}
+
+bootdev_from_uuid() {
+       blkid | grep "PTUUID=\"$(rootpartuuid)\"" | cut -d : -f1
+}
+
+bootpart_from_uuid() {
+       blkid | grep $(rootpartuuid)-01 | cut -d : -f1
+}
+
+rootpart_from_uuid() {
+       blkid | grep $(rootpartuuid)-02 | cut -d : -f1
+}
+
+apalis_mount_boot() {
+       mkdir -p /boot
+       [ -f /boot/uImage ] || {
+               mount -o rw,noatime $(bootpart_from_uuid) /boot > /dev/null
+       }
+}
+
 imx6_board_detect() {
        local machine
        local name
@@ -59,6 +86,15 @@ imx6_board_detect() {
                name="cubox-i"
                ;;
 
+       "Toradex Apalis iMX6Q/D Module on Ixora Carrier Board" |\
+       "Toradex Apalis iMX6Q/D Module on Ixora Carrier Board V1.1")
+               name="apalis,ixora"
+               ;;
+
+       "Toradex Apalis iMX6Q/D Module on Apalis Evaluation Board")
+               name="apalis,eval"
+               ;;
+
        "Wandboard i.MX6 Dual Lite Board")
                name="wandboard"
                ;;