aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/imx/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/imx/base-files')
-rw-r--r--target/linux/imx/base-files/etc/board.d/02_network46
-rw-r--r--target/linux/imx/base-files/etc/inittab4
-rw-r--r--target/linux/imx/base-files/lib/imx.sh30
-rw-r--r--target/linux/imx/base-files/lib/preinit/79_move_config21
-rwxr-xr-xtarget/linux/imx/base-files/lib/upgrade/platform.sh142
5 files changed, 243 insertions, 0 deletions
diff --git a/target/linux/imx/base-files/etc/board.d/02_network b/target/linux/imx/base-files/etc/board.d/02_network
new file mode 100644
index 0000000000..1668b86008
--- /dev/null
+++ b/target/linux/imx/base-files/etc/board.d/02_network
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2013-2015 OpenWrt.org
+#
+
+. /lib/functions/uci-defaults.sh
+
+board=$(board_name)
+
+board_config_update
+
+case "$board" in
+gw,imx6dl-gw51xx |\
+gw,imx6dl-gw52xx |\
+gw,imx6dl-gw5904 |\
+gw,imx6dl-gw5907 |\
+gw,imx6dl-gw5910 |\
+gw,imx6dl-gw5912 |\
+gw,imx6dl-gw5913 |\
+gw,imx6q-gw51xx |\
+gw,imx6q-gw52xx |\
+gw,imx6q-gw5904 |\
+gw,imx6q-gw5907 |\
+gw,imx6q-gw5910 |\
+gw,imx6q-gw5912 |\
+gw,imx6q-gw5913 |\
+solidrun,cubox-i/dl |\
+solidrun,cubox-i/q )
+ ucidef_set_interface_lan 'eth0'
+ ;;
+gw,imx6dl-gw53xx |\
+gw,imx6dl-gw54xx |\
+gw,imx6dl-gw552x |\
+gw,imx6q-gw53xx |\
+gw,imx6q-gw5400-a |\
+gw,imx6q-gw54xx |\
+gw,imx6q-gw552x )
+ ucidef_set_interfaces_lan_wan 'eth0' 'eth1'
+ ;;
+wand,imx6dl-wandboard )
+ ucidef_set_interface_wan 'eth0'
+ ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/imx/base-files/etc/inittab b/target/linux/imx/base-files/etc/inittab
new file mode 100644
index 0000000000..b944a93ada
--- /dev/null
+++ b/target/linux/imx/base-files/etc/inittab
@@ -0,0 +1,4 @@
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K shutdown
+::askconsole:/usr/libexec/login.sh
+tty1::askfirst:/usr/libexec/login.sh
diff --git a/target/linux/imx/base-files/lib/imx.sh b/target/linux/imx/base-files/lib/imx.sh
new file mode 100644
index 0000000000..46d2eeb006
--- /dev/null
+++ b/target/linux/imx/base-files/lib/imx.sh
@@ -0,0 +1,30 @@
+#
+# Copyright (C) 2010-2013 OpenWrt.org
+#
+
+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
+ }
+}
diff --git a/target/linux/imx/base-files/lib/preinit/79_move_config b/target/linux/imx/base-files/lib/preinit/79_move_config
new file mode 100644
index 0000000000..6ed59320ac
--- /dev/null
+++ b/target/linux/imx/base-files/lib/preinit/79_move_config
@@ -0,0 +1,21 @@
+. /lib/imx.sh
+. /lib/functions.sh
+. /lib/upgrade/common.sh
+
+move_config() {
+ local board=$(board_name)
+
+ case "$board" in
+ toradex,apalis_imx6q-eval |\
+ toradex,apalis_imx6q-ixora |\
+ toradex,apalis_imx6q-ixora-v1.1 )
+ if [ -b $(bootpart_from_uuid) ]; then
+ apalis_mount_boot
+ [ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
+ umount /boot
+ fi
+ ;;
+ esac
+}
+
+boot_hook_add preinit_mount_root move_config
diff --git a/target/linux/imx/base-files/lib/upgrade/platform.sh b/target/linux/imx/base-files/lib/upgrade/platform.sh
new file mode 100755
index 0000000000..e18d59c771
--- /dev/null
+++ b/target/linux/imx/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,142 @@
+#
+# Copyright (C) 2010-2015 OpenWrt.org
+#
+
+. /lib/imx.sh
+
+RAMFS_COPY_BIN='blkid jffs2reset'
+
+enable_image_metadata_check() {
+ case "$(board_name)" in
+ toradex,apalis_imx6q-eval |\
+ toradex,apalis_imx6q-ixora |\
+ toradex,apalis_imx6q-ixora-v1.1 )
+ REQUIRE_IMAGE_METADATA=1
+ ;;
+ esac
+}
+enable_image_metadata_check
+
+apalis_copy_config() {
+ apalis_mount_boot
+ cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE"
+ sync
+ umount /boot
+}
+
+apalis_do_upgrade() {
+ apalis_mount_boot
+ get_image "$1" | tar Oxf - sysupgrade-apalis/kernel > /boot/uImage
+ get_image "$1" | tar Oxf - sysupgrade-apalis/root > $(rootpart_from_uuid)
+ sync
+ umount /boot
+}
+
+platform_check_image() {
+ local board=$(board_name)
+
+ case "$board" in
+ gw,imx6dl-gw51xx |\
+ gw,imx6dl-gw52xx |\
+ gw,imx6dl-gw53xx |\
+ gw,imx6dl-gw54xx |\
+ gw,imx6dl-gw551x |\
+ gw,imx6dl-gw552x |\
+ gw,imx6dl-gw553x |\
+ gw,imx6dl-gw5904 |\
+ gw,imx6dl-gw5907 |\
+ gw,imx6dl-gw5910 |\
+ gw,imx6dl-gw5912 |\
+ gw,imx6dl-gw5913 |\
+ gw,imx6q-gw51xx |\
+ gw,imx6q-gw52xx |\
+ gw,imx6q-gw53xx |\
+ gw,imx6q-gw5400-a |\
+ gw,imx6q-gw54xx |\
+ gw,imx6q-gw551x |\
+ gw,imx6q-gw552x |\
+ gw,imx6q-gw553x |\
+ gw,imx6q-gw5904 |\
+ gw,imx6q-gw5907 |\
+ gw,imx6q-gw5910 |\
+ gw,imx6q-gw5912 |\
+ gw,imx6q-gw5913 )
+ nand_do_platform_check $board $1
+ return $?;
+ ;;
+ toradex,apalis_imx6q-eval |\
+ toradex,apalis_imx6q-ixora |\
+ toradex,apalis_imx6q-ixora-v1.1 )
+ return 0
+ ;;
+ esac
+
+ echo "Sysupgrade is not yet supported on $board."
+ return 1
+}
+
+platform_do_upgrade() {
+ local board=$(board_name)
+
+ case "$board" in
+ gw,imx6dl-gw51xx |\
+ gw,imx6dl-gw52xx |\
+ gw,imx6dl-gw53xx |\
+ gw,imx6dl-gw54xx |\
+ gw,imx6dl-gw551x |\
+ gw,imx6dl-gw552x |\
+ gw,imx6dl-gw553x |\
+ gw,imx6dl-gw5904 |\
+ gw,imx6dl-gw5907 |\
+ gw,imx6dl-gw5910 |\
+ gw,imx6dl-gw5912 |\
+ gw,imx6dl-gw5913 |\
+ gw,imx6q-gw51xx |\
+ gw,imx6q-gw52xx |\
+ gw,imx6q-gw53xx |\
+ gw,imx6q-gw5400-a |\
+ gw,imx6q-gw54xx |\
+ gw,imx6q-gw551x |\
+ gw,imx6q-gw552x |\
+ gw,imx6q-gw553x |\
+ gw,imx6q-gw5904 |\
+ gw,imx6q-gw5907 |\
+ gw,imx6q-gw5910 |\
+ gw,imx6q-gw5912 |\
+ gw,imx6q-gw5913 )
+ nand_do_upgrade "$1"
+ ;;
+ toradex,apalis_imx6q-eval |\
+ toradex,apalis_imx6q-ixora |\
+ toradex,apalis_imx6q-ixora-v1.1 )
+ apalis_do_upgrade "$1"
+ ;;
+ esac
+}
+
+platform_copy_config() {
+ local board=$(board_name)
+
+ case "$board" in
+ toradex,apalis_imx6q-eval |\
+ toradex,apalis_imx6q-ixora |\
+ toradex,apalis_imx6q-ixora-v1.1 )
+ apalis_copy_config
+ ;;
+ esac
+}
+
+platform_pre_upgrade() {
+ local board=$(board_name)
+
+ case "$board" in
+ toradex,apalis_imx6q-eval |\
+ toradex,apalis_imx6q-ixora |\
+ toradex,apalis_imx6q-ixora-v1.1 )
+ [ -z "$UPGRADE_BACKUP" ] && {
+ jffs2reset -y
+ umount /overlay
+ }
+ ;;
+ esac
+}