--- /dev/null
+#!/bin/sh
+
+# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# script for flashing SD card using dd for ARTIK
+# the layout is:
+# * boot.img -> 1st partition
+# * modules.img -> 2nd partition
+# * rootfs.img -> 3rd partition
+# * systemd-data.img -> 5th partition
+# * user.img -> 6th partition
+#
+# script always checks for block device availability
+# files are taken from CWD
+# there are no checks if files exist, dd should fail
+#
+# SD card should be prepared using script mk_sdboot available at:
+# https://github.com/tizen-artik/sdboot
+#
+# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
+
+TESTLAB_SCRIPTS="$(CDPATH='' cd -- "$(dirname -- "$0")"/.. && pwd -P)"
+
+. "${TESTLAB_SCRIPTS}/common.sh"
+
+test -n "${1}" || die "Too few arguments!"
+
+sdd="sudo dd bs=1M"
+test -b "${1}1" || die "No ${1}1"
+$sdd if=boot.img "of=${1}1"
+test -b "${1}2" || die "No ${1}2"
+$sdd if=modules.img "of=${1}2"
+test -b "${1}3" || die "No ${1}3"
+$sdd if=rootfs.img "of=${1}3"
+test -b "${1}5" || die "No ${1}5"
+$sdd if=system-data.img "of=${1}5"
+test -b "${1}6" || die "No ${1}6"
+$sdd if=user.img "of=${1}6"
+sync
"${IMAGE_MOUNTPOINT}/usr/lib/systemd/system/deviced.service"
}
+replace_params() {
+ test -n "${TESTLAB_SCRIPTS}" || die "Missing env: testlab_scripts!"
+ IMAGE_MOUNTPOINT="$1"
+ ARTIK_MODEL="$2"
+ test -n "${IMAGE_MOUNTPOINT}" || die "Missing argument: image_mountpoint!"
+ test -n "${ARTIK_MODEL}" || die "Missing argument: artik_model!"
+ sudo cp "${TESTLAB_SCRIPTS}/prepare/params_${ARTIK_MODEL}" "${IMAGE_MOUNTPOINT}/params.bin"
+}
+
unpack_image() {
test $# -ge 2 || die "Too few arguments!"
eval DESTINATION=\$$#