aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/imx6/base-files/lib
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/imx6/base-files/lib')
-rwxr-xr-xtarget/linux/imx6/base-files/lib/imx6.sh36
-rw-r--r--target/linux/imx6/base-files/lib/preinit/79_move_config20
-rwxr-xr-xtarget/linux/imx6/base-files/lib/upgrade/platform.sh47
3 files changed, 103 insertions, 0 deletions
diff --git a/target/linux/imx6/base-files/lib/imx6.sh b/target/linux/imx6/base-files/lib/imx6.sh
index 1bf1439523..68caaff15f 100755
--- a/target/linux/imx6/base-files/lib/imx6.sh
+++ b/target/linux/imx6/base-files/lib/imx6.sh
@@ -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"
;;
diff --git a/target/linux/imx6/base-files/lib/preinit/79_move_config b/target/linux/imx6/base-files/lib/preinit/79_move_config
new file mode 100644
index 0000000000..6b66fbd42d
--- /dev/null
+++ b/target/linux/imx6/base-files/lib/preinit/79_move_config
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. /lib/imx6.sh
+. /lib/functions.sh
+
+move_config() {
+ local board=$(board_name)
+
+ case "$board" in
+ apalis*)
+ if [ -b $(bootpart_from_uuid) ]; then
+ apalis_mount_boot
+ [ -f /boot/sysupgrade.tgz ] && mv -f /boot/sysupgrade.tgz /
+ umount /boot
+ fi
+ ;;
+ esac
+}
+
+boot_hook_add preinit_mount_root move_config
diff --git a/target/linux/imx6/base-files/lib/upgrade/platform.sh b/target/linux/imx6/base-files/lib/upgrade/platform.sh
index ab52291109..2d76b6b4af 100755
--- a/target/linux/imx6/base-files/lib/upgrade/platform.sh
+++ b/target/linux/imx6/base-files/lib/upgrade/platform.sh
@@ -2,10 +2,44 @@
# Copyright (C) 2010-2015 OpenWrt.org
#
+. /lib/imx6.sh
+
+RAMFS_COPY_BIN='blkid'
+
+enable_image_metadata_check() {
+ case "$(board_name)" in
+ apalis*)
+ REQUIRE_IMAGE_METADATA=1
+ ;;
+ esac
+}
+enable_image_metadata_check
+
+apalis_copy_config() {
+ apalis_mount_boot
+ cp -af "$CONF_TAR" /boot/
+ sync
+ umount /boot
+}
+
+apalis_do_upgrade() {
+ local board_name=$(board_name)
+ board_name=${board_name/,/_}
+
+ apalis_mount_boot
+ get_image "$1" | tar Oxf - sysupgrade-${board_name}/kernel > /boot/uImage
+ get_image "$1" | tar Oxf - sysupgrade-${board_name}/root > $(rootpart_from_uuid)
+ sync
+ umount /boot
+}
+
platform_check_image() {
local board=$(board_name)
case "$board" in
+ apalis*)
+ return 0
+ ;;
*gw5*)
nand_do_platform_check $board $1
return $?;
@@ -20,8 +54,21 @@ platform_do_upgrade() {
local board=$(board_name)
case "$board" in
+ apalis*)
+ apalis_do_upgrade "$1"
+ ;;
*gw5*)
nand_do_upgrade "$1"
;;
esac
}
+
+platform_copy_config() {
+ local board=$(board_name)
+
+ case "$board" in
+ apalis*)
+ apalis_copy_config
+ ;;
+ esac
+}