summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2015-03-28 13:59:29 +0100
committerMax Krummenacher <max.krummenacher@toradex.com>2015-05-12 10:04:34 +0200
commit495ad28eadc1733c58fb644586f8f9ce60e4a6ce (patch)
tree823c2d2ca93396be5075922c76f9a0592705d55b
parent48d95d0878b84c42a194800d904ff93908b9b785 (diff)
trdx-image-fstype: drop tarball in favour of files
Drop the burnflash.tar.bz2 tarball and put the individual files under version control. Only create minimal set for colibri-t20 for now and move it with the change to tegra-uboot-flasher.
-rw-r--r--recipes/images/files/apalis-imx6/apalis-imx6_bin/configblock.binbin0 -> 32 bytes
-rw-r--r--recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_eth.imgbin0 -> 1603 bytes
-rw-r--r--recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_eth.scr15
-rw-r--r--recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_mmc.imgbin0 -> 1609 bytes
-rw-r--r--recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_mmc.scr14
-rwxr-xr-xrecipes/images/files/apalis-imx6/apalis-imx6_bin/mk-u-boot-scripts.sh5
-rwxr-xr-xrecipes/images/files/apalis-imx6/imx_flash/genext3fs.sh80
-rwxr-xr-xrecipes/images/files/apalis-imx6/update.sh259
-rw-r--r--recipes/images/files/apalis-t30/apalis-t30_bin/apalis_t30.img.cfg22
-rw-r--r--recipes/images/files/apalis-t30/apalis-t30_bin/apalis_t30_12MHz_MT41K512M8RH-125_533MHz.bctbin0 -> 6128 bytes
-rw-r--r--recipes/images/files/apalis-t30/apalis-t30_bin/configblock.binbin0 -> 32 bytes
-rw-r--r--recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.imgbin0 -> 3434 bytes
-rw-r--r--recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.scr35
-rw-r--r--recipes/images/files/apalis-t30/apalis-t30_bin/flash_mmc.imgbin0 -> 3514 bytes
-rw-r--r--recipes/images/files/apalis-t30/apalis-t30_bin/flash_mmc.scr35
-rwxr-xr-xrecipes/images/files/apalis-t30/apalis-t30_bin/mk-u-boot-scripts.sh5
-rwxr-xr-xrecipes/images/files/apalis-t30/create_configblock.sh206
-rwxr-xr-xrecipes/images/files/apalis-t30/tegra-uboot-flasher/genext3fs.sh80
-rwxr-xr-xrecipes/images/files/apalis-t30/update.sh273
-rw-r--r--recipes/images/files/colibri-imx6/colibri-imx6_bin/configblock.binbin0 -> 32 bytes
-rw-r--r--recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_eth.imgbin0 -> 1614 bytes
-rw-r--r--recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_eth.scr15
-rw-r--r--recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_mmc.imgbin0 -> 1622 bytes
-rw-r--r--recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_mmc.scr14
-rwxr-xr-xrecipes/images/files/colibri-imx6/colibri-imx6_bin/mk-u-boot-scripts.sh5
-rwxr-xr-xrecipes/images/files/colibri-imx6/imx_flash/genext3fs.sh80
-rwxr-xr-xrecipes/images/files/colibri-imx6/update.sh259
-rw-r--r--recipes/images/files/colibri-pxa/colibri-pxa_bin/README1
-rw-r--r--recipes/images/files/colibri-t20/colibri-t20_bin/configblock_256.binbin0 -> 2048 bytes
-rw-r--r--recipes/images/files/colibri-t20/colibri-t20_bin/configblock_512.binbin0 -> 2048 bytes
-rwxr-xr-xrecipes/images/files/colibri-t20/colibri-t20_bin/mk-u-boot-scripts.sh5
-rwxr-xr-xrecipes/images/files/colibri-t20/create_configblock.sh168
-rwxr-xr-xrecipes/images/files/colibri-t20/t20_nvflash/genext3fs.sh80
-rw-r--r--recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30.img.cfg22
-rwxr-xr-xrecipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30_12MHz_NT5CC256M16CP-DI_400MHz.bctbin0 -> 6128 bytes
-rw-r--r--recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30_12MHz_NT5CC256M16CP-DI_533MHz.bctbin0 -> 6128 bytes
-rw-r--r--recipes/images/files/colibri-t30/colibri-t30_bin/configblock.binbin0 -> 32 bytes
-rw-r--r--recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.imgbin0 -> 3435 bytes
-rw-r--r--recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.scr35
-rw-r--r--recipes/images/files/colibri-t30/colibri-t30_bin/flash_mmc.imgbin0 -> 3515 bytes
-rw-r--r--recipes/images/files/colibri-t30/colibri-t30_bin/flash_mmc.scr35
-rwxr-xr-xrecipes/images/files/colibri-t30/colibri-t30_bin/mk-u-boot-scripts.sh5
-rwxr-xr-xrecipes/images/files/colibri-t30/create_configblock.sh206
-rwxr-xr-xrecipes/images/files/colibri-t30/tegra-uboot-flasher/genext3fs.sh80
-rwxr-xr-xrecipes/images/files/colibri-t30/update.sh273
-rw-r--r--recipes/images/files/colibri-vf/README4
-rw-r--r--recipes/images/files/colibri-vf/colibri-vf_bin/configblock.binbin0 -> 2048 bytes
-rw-r--r--recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.imgbin0 -> 1282 bytes
-rw-r--r--recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.scr16
-rw-r--r--recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.imgbin0 -> 1261 bytes
-rw-r--r--recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.scr16
-rwxr-xr-xrecipes/images/files/colibri-vf/colibri-vf_bin/mk-u-boot-scripts.sh7
-rwxr-xr-xrecipes/images/files/colibri-vf/create_configblock.sh193
-rwxr-xr-xrecipes/images/files/colibri-vf/format_sd.sh115
-rwxr-xr-xrecipes/images/files/colibri-vf/update.sh184
-rwxr-xr-xrecipes/images/files/colibri-vf/vf_flash/imx_uart.m32bin0 -> 27288 bytes
-rw-r--r--recipes/images/trdx-image-fstype.inc5
57 files changed, 2849 insertions, 3 deletions
diff --git a/recipes/images/files/apalis-imx6/apalis-imx6_bin/configblock.bin b/recipes/images/files/apalis-imx6/apalis-imx6_bin/configblock.bin
new file mode 100644
index 0000000..f1f39ab
--- /dev/null
+++ b/recipes/images/files/apalis-imx6/apalis-imx6_bin/configblock.bin
Binary files differ
diff --git a/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_eth.img b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_eth.img
new file mode 100644
index 0000000..d5987f5
--- /dev/null
+++ b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_eth.img
Binary files differ
diff --git a/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_eth.scr b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_eth.scr
new file mode 100644
index 0000000..9122758
--- /dev/null
+++ b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_eth.scr
@@ -0,0 +1,15 @@
+setenv set_blkcnt 'setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200'
+setenv set_nextnum 'setexpr filenum ${filenum} + 1; setexpr blkstart ${blkstart} + ${blkcnt}'
+setenv cp_file_chunk 'tftpboot ${loadaddr} root.ext3-${filenum}; run set_blkcnt; mmc dev 0 && mmc write ${loadaddr} ${blkstart} ${blkcnt}'
+setenv update_uboot 'tftpboot ${loadaddr} u-boot.imx && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 2 ${blkcnt}'
+setenv update_kernel 'tftpboot ${loadaddr} uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+setenv update_fdt 'tftpboot ${loadaddr} ${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}'
+setenv update_configblock 'tftpboot ${loadaddr} configblock.bin && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 0x500 ${blkcnt}'
+setenv update 'run update_1; run update_uboot; run update_2; run update_3; reset'
+setenv update_1 'tftpboot ${loadaddr} mbr.bin && mmc dev 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'tftpboot ${loadaddr} boot.vfat && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
+#do it in chunks of 256M to fit into DDR RAM of the smallest module
+#split root.ext3 into multiple 256M chunks before copying to TFTP folder as follows
+#split -a 1 -b `expr 256 \* 1024 \* 1024` -d root.ext3 root.ext3-
+setenv update_3 'setenv filesize 10000000; setenv filenum 0; setenv blkstart a000; while test ${filesize} -eq "10000000"; do run cp_file_chunk; run set_nextnum; done'
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_mmc.img b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_mmc.img
new file mode 100644
index 0000000..72348fd
--- /dev/null
+++ b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_mmc.img
Binary files differ
diff --git a/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_mmc.scr b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_mmc.scr
new file mode 100644
index 0000000..5d26cb8
--- /dev/null
+++ b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_mmc.scr
@@ -0,0 +1,14 @@
+test -n ${drive} || setenv drive 1
+setenv set_blkcnt 'setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200'
+setenv set_nextpos 'setexpr filepos ${filepos} + ${filesize}; setexpr blkstart ${blkstart} + ${blkcnt}'
+setenv cp_file_chunk 'fatload mmc ${drive}:1 ${loadaddr} root.ext3 ${filesize} ${filepos}; run set_blkcnt; mmc dev 0 && mmc write ${loadaddr} ${blkstart} ${blkcnt}'
+setenv update_uboot 'fatload mmc ${drive}:1 ${loadaddr} u-boot.imx && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 2 ${blkcnt}'
+setenv update_kernel 'fatload mmc ${drive}:1 ${loadaddr} uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+setenv update_fdt 'fatload mmc ${drive}:1 ${loadaddr} ${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}'
+setenv update_configblock 'fatload mmc ${drive}:1 ${loadaddr} configblock.bin && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 0x500 ${blkcnt}'
+setenv update 'run update_1; run update_uboot; run update_2; run update_3; reset'
+setenv update_1 'fatload mmc ${drive}:1 ${loadaddr} mbr.bin && mmc dev 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'fatload mmc ${drive}:1 ${loadaddr} boot.vfat && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
+#do it in chunks of 256M to fit into DDR RAM of the smallest module
+setenv update_3 'setenv filesize 10000000; setenv filepos 0; setenv blkstart a000; while test ${filesize} -eq "10000000"; do run cp_file_chunk; run set_nextpos; done'
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/apalis-imx6/apalis-imx6_bin/mk-u-boot-scripts.sh b/recipes/images/files/apalis-imx6/apalis-imx6_bin/mk-u-boot-scripts.sh
new file mode 100755
index 0000000..2a4e898
--- /dev/null
+++ b/recipes/images/files/apalis-imx6/apalis-imx6_bin/mk-u-boot-scripts.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+for f in *.scr
+do
+ mkimage -T script -C none -n 'Flash Apalis iMX6' -d $f `basename $f .scr`.img
+done
diff --git a/recipes/images/files/apalis-imx6/imx_flash/genext3fs.sh b/recipes/images/files/apalis-imx6/imx_flash/genext3fs.sh
new file mode 100755
index 0000000..3c8ecc8
--- /dev/null
+++ b/recipes/images/files/apalis-imx6/imx_flash/genext3fs.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+#creates a file containing a ext3 binary blob of the content of the ../rootfs folder
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+
+MOUNTPOINT="mnt/trdx-rootfs"
+
+Usage()
+{
+ echo "creates a file containing a ext3 binary blob. Output file name taken from command line"
+ echo "Usage: genext3fs.sh [OPTION]... dest_file_name"
+ echo "-h : Prints this message"
+ echo "-b : Sets the partition size in MBytes, default 256"
+ echo "-d : Selects the directory which contains the partition content, default ../rootfs"
+ echo ""
+}
+
+PARTITIONSIZE=256
+SRCPATH=../rootfs
+
+while getopts "b:d:h" Option ; do
+ case $Option in
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [[ "$#" -eq "1" ]] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ b) PARTITIONSIZE=$OPTARG
+ ;;
+ d) SRCPATH=$OPTARG
+ ;;
+ esac
+done
+#adjust the commandline arg for the now used options
+shift $(($OPTIND - 1))
+
+#create the file used for the loopbackdevice and format it for ext3
+#answer y to "is not a block special device"
+dd if=/dev/zero of=$@ bs=1024k count=$PARTITIONSIZE
+mkfs.ext3 -F -L arm $@
+#disable fsck checks based on mount count or time interval
+tune2fs -c 0 -i 0 $@
+
+#prepare mountpoint for the loopdevice
+sudo mkdir -p $MOUNTPOINT
+sudo umount $MOUNTPOINT &> /dev/null
+sudo rm -rf $MOUNTPOINT/*
+#mount the file as a loopdevice
+#there seems to be a race between mkfs.ext3 not yet finished and mount already trying to mount, so try until it works
+MOUNTED=0
+while [ "$MOUNTED" -eq "0" ] ; do
+ sync
+ sleep 1
+ sudo mount $@ $MOUNTPOINT/ -o loop -t ext3
+ MOUNTED=`mount | grep -c "$MOUNTPOINT"`
+done
+#extract rootfs into the file
+sudo cp -rpP $SRCPATH/* $MOUNTPOINT
+if [ "$?" -ne "0" ] ; then
+ $ECHO -e "\033[1mCopying the rootfs failed.\033[0m"
+ echo "Check for error messages from cp"
+ sudo rm $@
+ exit 1
+fi
+
+#unmount again
+sudo umount $MOUNTPOINT
+
+#if the mounting was unsuccesful all rootfs data now still is in MOUNTPOINT, and $@ contains an empty fs
+#delete $@ in that case to fail early
+sync
+FAILED=`ls $MOUNTPOINT | wc -l`
+if [ "$FAILED" -ne "0" ] ; then
+ $ECHO -e "\033[1mMounting the loopdevice $@ failed.\033[0m"
+ sudo rm $@
+ exit 1
+fi
diff --git a/recipes/images/files/apalis-imx6/update.sh b/recipes/images/files/apalis-imx6/update.sh
new file mode 100755
index 0000000..6f91728
--- /dev/null
+++ b/recipes/images/files/apalis-imx6/update.sh
@@ -0,0 +1,259 @@
+#!/bin/sh
+# Prepare files needed for flashing a Apalis/Colibri iMX6 module
+#
+# inspired by meta-fsl-arm/classes/image_types_fsl.bbclass
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+#some distros have fs tools only in root's path
+PARTED=`which parted` 2> /dev/null
+if [ -e "$PARTED" ] ; then
+ MKFSVFAT=`which mkfs.vfat`
+else
+ PARTED=`sudo which parted`
+ MKFSVFAT=`sudo which mkfs.vfat`
+fi
+
+Flash()
+{
+ echo ""
+ echo "To flash the Apalis/Colibri iMX6 module, boot the module to the U-Boot prompt and"
+ echo ""
+ echo "when using a SD-card, insert the SD-card and enter:"
+ echo "run setupdate"
+ echo ""
+ echo "when using tftp, connect Ethernet and enter:"
+ echo "tftp \$loadaddr flash_eth.img ; source \$loadaddr"
+ echo ""
+ echo "then enter to update all:"
+ echo "run update"
+ echo ""
+ echo "to update a single component enter one of:"
+ echo "run update_uboot"
+ echo "run update_kernel"
+ echo ""
+ echo ""
+ echo "If you don't have a working U-Boot anymore, connect your PC to the module's"
+ echo "USB client port, bring the module in the serial download mode and start"
+ echo "the update.sh script with the -d option. This will copy U-Boot into the"
+ echo "modules RAM and execute it."
+}
+
+Usage()
+{
+ echo ""
+ echo "Prepares and copies files for flashing the internal eMMC of a Apalis/Colibri iMX6"
+ echo ""
+ echo "Will require a running U-Boot on the target. Either one already flashed"
+ echo "on the eMMC or one copied over usb into the module's RAM"
+ echo ""
+ echo "-d : use USB connection to copy and execute U-Boot to the module's RAM"
+ echo "-h : Prints this message"
+ echo "-o directory : output directory, defaults to /media/KERNEL"
+ echo " if this is on a SD card, it should be the"
+ echo " first partition formated with VFAT"
+ echo ""
+ echo "Example \"./update.sh\" copies the requiered files to /media/KERNEL/"
+ echo "Example \"./update.sh -o /srv/tftp/\" copies the requiered files to /srv/tftp/"
+ echo ""
+ echo ""
+ Flash
+}
+
+#initialise options
+UBOOT_RECOVERY=0
+OUT_DIR="/media/KERNEL"
+MIN_PARTITION_FREE_SIZE=100
+ROOTFSPATH=rootfs
+# No devicetree by default
+KERNEL_DEVICETREE=""
+KERNEL_IMAGETYPE="uImage"
+
+while getopts "dho:" Option ; do
+ case $Option in
+ d) UBOOT_RECOVERY=1
+ ;;
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [ "$#" -eq 1 ] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ o) OUT_DIR=$OPTARG
+ ;;
+ esac
+done
+
+# autotect MODTYPE from from rootfs directory
+CNT=`grep -ic "Colibri.iMX6" rootfs/etc/issue || true`
+if [ "$CNT" -ge 1 ] ; then
+ echo "Colibri iMX6 rootfs detected"
+ MODTYPE=colibri-imx6
+ IMAGEFILE=root.ext3
+ U_BOOT_BINARY=u-boot.imx
+ KERNEL_DEVICETREE="imx6dl-colibri-eval-v3.dtb"
+ LOCPATH="imx_flash"
+ # eMMC size [in sectors of 512]
+ EMMC_SIZE=$(expr 1024 \* 3500 \* 2)
+else
+ CNT=`grep -ic "imx6" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Apalis iMX6 rootfs detected"
+ MODTYPE=apalis-imx6
+ IMAGEFILE=root.ext3
+ U_BOOT_BINARY=u-boot.imx
+ KERNEL_DEVICETREE="imx6q-apalis-eval.dtb imx6q-apalis-eval_v1_0.dtb"
+ LOCPATH="imx_flash"
+ # eMMC size [in sectors of 512]
+ EMMC_SIZE=$(expr 1024 \* 3500 \* 2)
+ else
+ echo "can not detect module type from ./rootfs/etc/issue"
+ echo "exiting"
+ exit 1
+ fi
+fi
+BINARIES=${MODTYPE}_bin
+
+#is only U-Boot to be copied to RAM?
+if [ "$UBOOT_RECOVERY" -ge 1 ] ; then
+ cd ${LOCPATH}
+ sudo ./imx_usb ../${BINARIES}/${U_BOOT_BINARY}
+ exit 1
+fi
+
+# is OUT_DIR an existing directory?
+if [ ! -d "$OUT_DIR" ] ; then
+ echo "$OUT_DIR" "does not exist, exiting"
+ exit 1
+fi
+
+#sanity check for correct untared rootfs
+DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'`
+if [ "${DEV_OWNER}x" != "rootx" ]
+then
+ $ECHO -e "rootfs/dev is not owned by root, but it should!"
+ $ECHO -e "\033[1mPlease unpack the tarball with root rights.\033[0m"
+ $ECHO -e "e.g. sudo tar xjvf Apalis_iMX6_LinuxImageV2.1_20140201.tar.bz2"
+ exit 1
+fi
+
+#sanity check for existens of U-Boot and kernel
+[ -e ${BINARIES}/${U_BOOT_BINARY} ] || { echo "${BINARIES}/${U_BOOT_BINARY} does not exist"; exit 1; }
+[ -e ${BINARIES}/uImage ] || { echo "${BINARIES}/uImage does not exist"; exit 1; }
+
+#sanity check for some programs
+MCOPY=`sudo which mcopy`
+[ "${MCOPY}x" != "x" ] || { echo >&2 "Program mcopy not available. Aborting."; exit 1; }
+sudo ${PARTED} -v >/dev/null 2>&1 || { echo >&2 "Program parted not available. Aborting."; exit 1; }
+[ "${MKFSVFAT}x" != "x" ] || { echo >&2 "Program mkfs.vfat not available. Aborting."; exit 1; }
+MKFSEXT3=`sudo which mkfs.ext3`
+[ "${MKFSEXT3}x" != "x" ] || { echo >&2 "Program mkfs.ext3 not available. Aborting."; exit 1; }
+awk -V >/dev/null 2>&1 || { echo >&2 "Program awk not available. Aborting."; exit 1; }
+dd --help >/dev/null 2>&1 || { echo >&2 "Program dd not available. Aborting."; exit 1; }
+
+#make the directory with the outputfiles writable
+sudo chown $USER: ${BINARIES}
+
+#make a file with the used versions for U-Boot, kernel and rootfs
+rm ${BINARIES}/versions.txt
+touch ${BINARIES}/versions.txt
+echo "Component Versions" > ${BINARIES}/versions.txt
+basename "`readlink -e ${BINARIES}/${U_BOOT_BINARY}`" >> ${BINARIES}/versions.txt
+basename "`readlink -e ${BINARIES}/uImage`" >> ${BINARIES}/versions.txt
+$ECHO -n "Rootfs " >> ${BINARIES}/versions.txt
+grep -i imx6 rootfs/etc/issue >> ${BINARIES}/versions.txt
+
+
+# The emmc layout used is:
+#
+# user area aka general purpose eMMC region:
+#
+# 0 -> IMAGE_ROOTFS_ALIGNMENT - reserved to bootloader (not partitioned)
+# IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE - kernel and other data
+# BOOT_SPACE -> SDIMG_SIZE - rootfs
+#
+# Default Free space = 1.3x
+# Use IMAGE_OVERHEAD_FACTOR to add more space
+# <--------->
+# 4MiB 16MiB SDIMG_ROOTFS 4MiB
+# <-----------------------> <----------> <----------------------> <------------------------------>
+# ------------------------ ------------ ------------------------ -------------------------------
+# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE | IMAGE_ROOTFS_ALIGNMENT |
+# ------------------------ ------------ ------------------------ -------------------------------
+# ^ ^ ^ ^ ^
+# | | | | |
+# 0 4096 4MiB + 16MiB 4MiB + 16Mib + SDIMG_ROOTFS 4MiB + 16MiB + SDIMG_ROOTFS + 4MiB
+#
+# with U-Boot at 1024, the U-Boot environment at 512 * 1024, the config block is at 640 * 1024
+
+
+# Boot partition [in sectors of 512]
+BOOT_START=$(expr 4096 \* 2)
+# Rootfs partition [in sectors of 512]
+ROOTFS_START=$(expr 20480 \* 2)
+# Boot partition volume id
+BOOTDD_VOLUME_ID="Boot"
+
+#make the partition size size(rootfs used + MIN_PARTITION_FREE_SIZE)
+#add about 4% to the rootfs to account for fs overhead. (/1024/985 instead of /1024/1024).
+#add 512 bytes per file to account for small files
+NUMBER_OF_FILES=`sudo find ${ROOTFSPATH} | wc -l`
+EXT_SIZE=`sudo du -DsB1 ${ROOTFSPATH} | awk -v min=$MIN_PARTITION_FREE_SIZE -v f=${NUMBER_OF_FILES} \
+ '{rootfs_size=$1+f*512;rootfs_size=int(rootfs_size/1024/985); print (rootfs_size+min) }'`
+
+echo ""
+echo "Creating MBR file and do the partitioning"
+# Initialize a sparse file
+dd if=/dev/zero of=${BINARIES}/mbr.bin bs=512 count=0 seek=${EMMC_SIZE}
+${PARTED} -s ${BINARIES}/mbr.bin mklabel msdos
+${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary fat32 ${BOOT_START} $(expr ${ROOTFS_START} - 1 )
+# the partition spans to the end of the disk, even though the fs size will be smaller
+# on the target the fs is then grown to the full size
+${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary ext2 ${ROOTFS_START} $(expr ${EMMC_SIZE} \- ${ROOTFS_START} \- 1)
+${PARTED} -s ${BINARIES}/mbr.bin unit s print
+# get the size of the VFAT partition
+BOOT_BLOCKS=$(LC_ALL=C ${PARTED} -s ${BINARIES}/mbr.bin unit b print \
+ | awk '/ 1 / { print int(substr($4, 1, length($4 -1)) / 1024) }')
+# now crop the file to only the MBR size
+IMG_SIZE=512
+truncate -s $IMG_SIZE ${BINARIES}/mbr.bin
+
+
+echo ""
+echo "Creating VFAT partion image with the kernel"
+rm -f ${BINARIES}/boot.vfat
+${MKFSVFAT} -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${BINARIES}/boot.vfat $BOOT_BLOCKS
+export MTOOLS_SKIP_CHECK=1
+mcopy -i ${BINARIES}/boot.vfat -s ${BINARIES}/uImage ::/uImage
+
+# Copy device tree file
+COPIED=false
+if test -n "${KERNEL_DEVICETREE}"; then
+ for DTS_FILE in ${KERNEL_DEVICETREE}; do
+ DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
+ if [ -e "${BINARIES}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ]; then
+ kernel_bin="`readlink ${BINARIES}/${KERNEL_IMAGETYPE}`"
+ kernel_bin_for_dtb="`readlink ${BINARIES}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb | sed "s,$DTS_BASE_NAME,${MODTYPE},g;s,\.dtb$,.bin,g"`"
+ if [ "$kernel_bin" = "$kernel_bin_for_dtb" ]; then
+ mcopy -i ${BINARIES}/boot.vfat -s ${BINARIES}/${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb ::/${DTS_BASE_NAME}.dtb
+ #copy also to out_dir
+ sudo cp ${BINARIES}/${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb "$OUT_DIR/${DTS_BASE_NAME}.dtb"
+ COPIED=true
+ fi
+ fi
+ done
+ [ $COPIED = true ] || { echo "Did not find the devicetrees from KERNEL_DEVICETREE, ${KERNEL_DEVICETREE}. Aborting."; exit 1; }
+fi
+
+echo ""
+echo "Creating rootfs partion image"
+rm -f ${BINARIES}/${IMAGEFILE}
+sudo $LOCPATH/genext3fs.sh -d rootfs -b ${EXT_SIZE} ${BINARIES}/${IMAGEFILE} || exit 1
+
+
+#copy to $OUT_DIR
+sudo cp ${BINARIES}/configblock.bin ${BINARIES}/${U_BOOT_BINARY} ${BINARIES}/uImage ${BINARIES}/mbr.bin ${BINARIES}/boot.vfat ${BINARIES}/${IMAGEFILE} ${BINARIES}/flash*.img ${BINARIES}/versions.txt "$OUT_DIR"
+sync
+
+Flash
diff --git a/recipes/images/files/apalis-t30/apalis-t30_bin/apalis_t30.img.cfg b/recipes/images/files/apalis-t30/apalis-t30_bin/apalis_t30.img.cfg
new file mode 100644
index 0000000..3e990e2
--- /dev/null
+++ b/recipes/images/files/apalis-t30/apalis-t30_bin/apalis_t30.img.cfg
@@ -0,0 +1,22 @@
+# Copyright (C) 2014 Toradex, Inc.
+#
+# This software is provided 'as-is', without any express or implied
+# warranty. In no event will the authors be held liable for any damages
+# arising from the use of this software.
+#
+# Permission is granted to anyone to use this software for any purpose,
+# including commercial applications, and to alter it and redistribute it
+# freely, subject to the following restrictions:
+#
+# 1. The origin of this software must not be misrepresented; you must not
+# claim that you wrote the original software. If you use this software
+# in a product, an acknowledgment in the product documentation would be
+# appreciated but is not required.
+# 2. Altered source versions must be plainly marked as such, and must not be
+# misrepresented as being the original software.
+# 3. This notice may not be removed or altered from any source distribution.
+
+Version = 0x00020001;
+Bctcopy = 1;
+Bctfile = apalis_t30_12MHz_MT41K512M8RH-125_533MHz.bct;
+BootLoader = u-boot-dtb-tegra.bin,0x80108000,0x80108000,Complete;
diff --git a/recipes/images/files/apalis-t30/apalis-t30_bin/apalis_t30_12MHz_MT41K512M8RH-125_533MHz.bct b/recipes/images/files/apalis-t30/apalis-t30_bin/apalis_t30_12MHz_MT41K512M8RH-125_533MHz.bct
new file mode 100644
index 0000000..423aad1
--- /dev/null
+++ b/recipes/images/files/apalis-t30/apalis-t30_bin/apalis_t30_12MHz_MT41K512M8RH-125_533MHz.bct
Binary files differ
diff --git a/recipes/images/files/apalis-t30/apalis-t30_bin/configblock.bin b/recipes/images/files/apalis-t30/apalis-t30_bin/configblock.bin
new file mode 100644
index 0000000..cba3a26
--- /dev/null
+++ b/recipes/images/files/apalis-t30/apalis-t30_bin/configblock.bin
Binary files differ
diff --git a/recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.img b/recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.img
new file mode 100644
index 0000000..0c4b63f
--- /dev/null
+++ b/recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.img
Binary files differ
diff --git a/recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.scr b/recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.scr
new file mode 100644
index 0000000..100629e
--- /dev/null
+++ b/recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.scr
@@ -0,0 +1,35 @@
+test -n ${drive} || setenv drive 1
+
+setenv check_1 'setenv conf_blk_offset 0x1fff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_2 'setenv conf_blk_offset 0xfff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_3 'setenv conf_blk_offset 0x7ff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_configblock 'setexpr toradex_oui_addr $loadaddr + 8; mmc dev 0 1; run check_1 || run check_2 || run check_3; crc32 -v $toradex_oui_addr 3 94305232'
+
+setenv migrate_1 'mmc dev 0 0; mmc read ${loadaddr} 6000 1; setenv conf_blk_offset 0x1fff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_2 'mmc dev 0 0; mmc read ${loadaddr} 8000 1; setenv conf_blk_offset 0xfff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_3 'mmc dev 0 0; mmc read ${loadaddr} 9000 1; setenv conf_blk_offset 0x7ff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_4 'mmc dev 0 0; mmc read ${loadaddr} 34000 1; setenv conf_blk_offset 0x1fff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_5 'mmc dev 0 0; mmc read ${loadaddr} 36000 1; setenv conf_blk_offset 0xfff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_6 'mmc dev 0 0; mmc read ${loadaddr} 37000 1; setenv conf_blk_offset 0x7ff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_configblock 'setexpr toradex_oui_addr $loadaddr + 8; run migrate_1; run migrate_2; run migrate_3; run migrate_4; run migrate_5; run migrate_6'
+
+setenv update_configblock 'tftpboot ${loadaddr} configblock.bin && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && run check_configblock; mmc write $loadaddr $conf_blk_offset ${blkcnt}'
+
+setenv update_uboot 'tftpboot ${loadaddr} apalis_t30.img && if setexpr blkcnt $filesize + 0x1ff; then setexpr blkcnt ${blkcnt} / 0x200; else setenv blkcnt 0x500; fi && mmc dev 0 1 && mmc write ${loadaddr} 0x0 ${blkcnt}'
+
+setenv update_kernel 'tftpboot ${loadaddr} uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+
+setenv update_fdt 'tftpboot ${loadaddr} ${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}'
+
+setenv update_1 'tftpboot ${loadaddr} mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'tftpboot ${loadaddr} boot.vfat && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && mmc dev 0 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
+setenv update_3 'tftpboot ${loadaddr} root.ext3 && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && mmc dev 0 0 && mmc write ${loadaddr} 0xa000 ${blkcnt}'
+
+setenv echo_v2.3b2 echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate_v2.3b2\" to complete update"
+setenv migrate_v2.3b2 'run migrate_configblock; run update_new'
+setenv update_v2.3b2 'run update_uboot && run echo_v2.3b2'
+
+setenv update_new 'run check_configblock || run migrate_configblock; run update_uboot; run update_1; run update_2; run update_3; reset'
+setenv update 'if test -v $ver; then run update_new; else run update_v2.3b2; fi'
+
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/apalis-t30/apalis-t30_bin/flash_mmc.img b/recipes/images/files/apalis-t30/apalis-t30_bin/flash_mmc.img
new file mode 100644
index 0000000..f406b54
--- /dev/null
+++ b/recipes/images/files/apalis-t30/apalis-t30_bin/flash_mmc.img
Binary files differ
diff --git a/recipes/images/files/apalis-t30/apalis-t30_bin/flash_mmc.scr b/recipes/images/files/apalis-t30/apalis-t30_bin/flash_mmc.scr
new file mode 100644
index 0000000..b33c594
--- /dev/null
+++ b/recipes/images/files/apalis-t30/apalis-t30_bin/flash_mmc.scr
@@ -0,0 +1,35 @@
+test -n ${drive} || setenv drive 1
+
+setenv check_1 'setenv conf_blk_offset 0x1fff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_2 'setenv conf_blk_offset 0xfff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_3 'setenv conf_blk_offset 0x7ff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_configblock 'setexpr toradex_oui_addr $loadaddr + 8; mmc dev 0 1; run check_1 || run check_2 || run check_3; crc32 -v $toradex_oui_addr 3 94305232'
+
+setenv migrate_1 'mmc dev 0 0; mmc read ${loadaddr} 6000 1; setenv conf_blk_offset 0x1fff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_2 'mmc dev 0 0; mmc read ${loadaddr} 8000 1; setenv conf_blk_offset 0xfff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_3 'mmc dev 0 0; mmc read ${loadaddr} 9000 1; setenv conf_blk_offset 0x7ff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_4 'mmc dev 0 0; mmc read ${loadaddr} 34000 1; setenv conf_blk_offset 0x1fff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_5 'mmc dev 0 0; mmc read ${loadaddr} 36000 1; setenv conf_blk_offset 0xfff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_6 'mmc dev 0 0; mmc read ${loadaddr} 37000 1; setenv conf_blk_offset 0x7ff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_configblock 'setexpr toradex_oui_addr $loadaddr + 8; run migrate_1; run migrate_2; run migrate_3; run migrate_4; run migrate_5; run migrate_6'
+
+setenv update_configblock 'load mmc ${drive}:1 ${loadaddr} configblock.bin && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && run check_configblock; mmc write $loadaddr $conf_blk_offset ${blkcnt}'
+
+setenv update_uboot 'fatload mmc ${drive}:1 ${loadaddr} apalis_t30.img && if setexpr blkcnt $filesize + 0x1ff; then setexpr blkcnt ${blkcnt} / 0x200; else setenv blkcnt 0x500; fi && mmc dev 0 1 && mmc write ${loadaddr} 0x0 ${blkcnt}'
+
+setenv update_kernel 'load mmc ${drive}:1 ${loadaddr} uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+
+setenv update_fdt 'load mmc ${drive}:1 ${loadaddr} ${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}'
+
+setenv update_1 'load mmc ${drive}:1 ${loadaddr} mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'load mmc ${drive}:1 ${loadaddr} boot.vfat && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && mmc dev 0 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
+setenv update_3 'load mmc ${drive}:1 ${loadaddr} root.ext3 && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && mmc dev 0 0 && mmc write ${loadaddr} 0xa000 ${blkcnt}'
+
+setenv echo_v2.3b2 echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate_v2.3b2\" to complete update"
+setenv migrate_v2.3b2 'run migrate_configblock; run update_new'
+setenv update_v2.3b2 'run update_uboot && run echo_v2.3b2'
+
+setenv update_new 'run check_configblock || run migrate_configblock; run update_uboot; run update_1; run update_2; run update_3; reset'
+setenv update 'if test -v $ver; then run update_new; else run update_v2.3b2; fi'
+
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/apalis-t30/apalis-t30_bin/mk-u-boot-scripts.sh b/recipes/images/files/apalis-t30/apalis-t30_bin/mk-u-boot-scripts.sh
new file mode 100755
index 0000000..2a4e898
--- /dev/null
+++ b/recipes/images/files/apalis-t30/apalis-t30_bin/mk-u-boot-scripts.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+for f in *.scr
+do
+ mkimage -T script -C none -n 'Flash Apalis iMX6' -d $f `basename $f .scr`.img
+done
diff --git a/recipes/images/files/apalis-t30/create_configblock.sh b/recipes/images/files/apalis-t30/create_configblock.sh
new file mode 100755
index 0000000..a33600a
--- /dev/null
+++ b/recipes/images/files/apalis-t30/create_configblock.sh
@@ -0,0 +1,206 @@
+#! /bin/sh
+
+Usage()
+{
+ echo "create_configblock creates a configblock binary from the info on the module sticker."
+ echo "This can be used when the configblock got lost during a failed update attempt."
+ echo "The created configblock can then be written to the module with:"
+ echo "update.sh -c"
+ echo ""
+}
+
+while getopts "h" Option ; do
+ case $Option in
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [ "$#" -eq 1 ] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ esac
+done
+
+# autotect MODTYPE from from rootfs directory
+CNT=`grep -c "T20" rootfs/etc/issue || true`
+if [ ${CNT} -ge 1 ] ; then
+ echo "Colibri T20 rootfs detected"
+ MODTYPE=colibri-t20
+ BOOT_DEVICE=nand
+else
+ CNT=`grep -c "T30" rootfs/etc/issue || true`
+ if [ ${CNT} -ge 1 ] ; then
+ CNT=`grep -c "Apalis" rootfs/etc/issue || true`
+ if [ ${CNT} -ge 1 ] ; then
+ echo "Apalis T30 rootfs detected"
+ MODTYPE=apalis-t30
+ else
+ echo "Colibri T30 rootfs detected"
+ MODTYPE=colibri-t30
+ fi
+ else
+ CNT=`grep -c "VF" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ CNT=`grep -c "VF50" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Colibri VF50 rootfs detected"
+ MODTYPE=colibri-vf50
+ else
+ echo "Colibri VF61 rootfs detected"
+ MODTYPE=colibri-vf61
+ fi
+ else
+ CNT=`grep -c "Colibri_iMX6" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Colibri iMX6 rootfs detected"
+ MODTYPE=colibri-imx6
+ else
+ CNT=`grep -ic "imx6" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Apalis iMX6 rootfs detected"
+ MODTYPE=apalis-imx6
+ else
+ echo "can not detect modulue type from ./rootfs/etc/issue"
+ echo "exiting"
+ exit 1
+ fi
+ fi
+ fi
+ fi
+fi
+
+echo "Enter the modules serial number on the modules sticker or"
+echo "use a barcode scanner to enter the content of the stickers barcode"
+
+# read a barcode and test it to be 8 or 16 numbers only 0025100102489109 0115100000000024
+# 1234567890123456 1234567890123456
+until [ "${BARCODE}x" != "x" ]
+do
+ read BARCODE
+ #remove all whitespace
+ BARCODE=`echo $BARCODE | tr -d ' '`
+ #get strlen and the number of numeric characters
+ STRLEN=`echo $BARCODE | wc -c`
+ NUMCNT=`echo $BARCODE | sed 's/[^0-9]//g' | wc -c`
+ if [ $STRLEN -ne 17 ] ; then
+ if [ $STRLEN -ne 9 ] ; then
+ echo "The serial number must be 8 numbers long (the barcode 16)"
+ BARCODE=""
+ fi
+ fi
+ if [ $NUMCNT -ne $STRLEN ] ; then
+ echo "The serial number must contain all numeric characters"
+ BARCODE=""
+ fi
+done
+DATECODE=19700101000000
+if [ $STRLEN -eq 17 ] ; then
+ SERIALNR=`echo $BARCODE | awk 'BEGIN{ FIELDWIDTHS = "8 8"} {print $2}'`
+ PRODUCTNR=`echo $BARCODE | awk 'BEGIN{ FIELDWIDTHS = "8 8"} {print $1}'`
+else
+ SERIALNR=$BARCODE
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+ case ${MODTYPE} in
+ "colibri-t20")
+ RAM_SIZE=256
+ echo "Enter the RAM size ( 256 / 512 ):"
+ read RAM_SIZE
+ echo "Enter I for IT version, nothing otherwise"
+ read IT
+ if [ $RAM_SIZE -eq 512 ] ; then
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0022"
+ else
+ PROD_ID="0021"
+ fi
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+
+ else
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0024"
+ else
+ PROD_ID="0020"
+ fi
+ PROD_ID="0020"
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_256.bin
+ fi
+ ;;
+ "colibri-t30")
+ PROD_ID="0023"
+ ;;
+ "apalis-t30")
+ PROD_ID="0025"
+ ;;
+ "colibri-vf50")
+ PROD_ID="0010"
+ ;;
+ "colibir-vf61")
+ PROD_ID="0011"
+ ;;
+ "apalis-imx6")
+ PROD_ID="0027"
+ ;;
+ "colibri-imx6")
+ RAM_SIZE=256
+ echo "Enter the RAM size ( 256 / 512 ):"
+ read RAM_SIZE
+ echo "Enter I for IT version, nothing otherwise"
+ read IT
+ if [ $RAM_SIZE -eq 512 ] ; then
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0017"
+ else
+ PROD_ID="0015"
+ fi
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+
+ else
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0016"
+ else
+ PROD_ID="0014"
+ fi
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+ fi
+ ;;
+ esac
+
+ echo "Enter the module version, e.g. V1.2 C"
+ read PRODVERSION
+ VER_MAJ=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $2}'`
+ VER_MIN=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $4}'`
+ #VARIANT: A=0, B=1 ...
+ VARIANT=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $6}'`
+ VARIANT=`printf "%d\n" "'$VARIANT"`
+ VARIANT=`expr $VARIANT - 65`
+ if [ "$VARIANT" -lt 10 ] ; then
+ VARIANT=0$VARIANT
+ fi
+ PRODUCTNR=${PROD_ID}${VER_MAJ}${VER_MIN}${VARIANT}
+fi
+
+#write the config block file
+if [ "${MODTYPE}" = "colibri-t20" ] ; then
+ PROD_ID=`echo $PRODUCTNR | awk 'BEGIN{ FIELDWIDTHS = "4 4"} {print $1}'`
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_256.bin
+ if [ ${PROD_ID} = "0021" ] ; then
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+ fi
+ if [ ${PROD_ID} = "0022" ] ; then
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+ fi
+else
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+fi
+sudo chown ${USER}: ${MODTYPE}_bin
+sudo rm -f $CONFIGBLOCK_FILE
+#file header
+awk 'function sc(c) {return (c<128?c:(c-256))} BEGIN{printf "%c%c%c%c",0,64,1,-49}' > $CONFIGBLOCK_FILE
+#mac addr / serial
+echo $SERIALNR | awk 'function sc(c) {return (c<128?c:(c-256))} {printf "%c%c%c%c%c%c%c%c%c%c%c%c",2,64,0,0, 0,20,45, sc(int($0/256/256)), sc(int($0/256)%256), sc($0%256),0,0 }' >> $CONFIGBLOCK_FILE
+#product describtion, $1 char 0/1: ??, $2 char 2/3: ProdID, $3 char 4:VerMaj, $4 char 5:VerMin, $5 char 6/7:Variant
+echo $PRODUCTNR | awk 'BEGIN{ FIELDWIDTHS = "2 2 1 1 2"} function sc(c) {return (c<128?c:(c-256))} {printf "%c%c%c%c%c%c%c%c%c%c%c%c",2,64,8,0 ,sc($3),0, sc($4),0, sc($5),0, sc($2),0 }' >> $CONFIGBLOCK_FILE
+#fill to 32 bytes
+awk 'function sc(c) {return (c<128?c:(c-256))} BEGIN{printf "%c%c%c%c",-1,-1,-1,-1}' >> $CONFIGBLOCK_FILE
+
+exit 0
diff --git a/recipes/images/files/apalis-t30/tegra-uboot-flasher/genext3fs.sh b/recipes/images/files/apalis-t30/tegra-uboot-flasher/genext3fs.sh
new file mode 100755
index 0000000..3c8ecc8
--- /dev/null
+++ b/recipes/images/files/apalis-t30/tegra-uboot-flasher/genext3fs.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+#creates a file containing a ext3 binary blob of the content of the ../rootfs folder
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+
+MOUNTPOINT="mnt/trdx-rootfs"
+
+Usage()
+{
+ echo "creates a file containing a ext3 binary blob. Output file name taken from command line"
+ echo "Usage: genext3fs.sh [OPTION]... dest_file_name"
+ echo "-h : Prints this message"
+ echo "-b : Sets the partition size in MBytes, default 256"
+ echo "-d : Selects the directory which contains the partition content, default ../rootfs"
+ echo ""
+}
+
+PARTITIONSIZE=256
+SRCPATH=../rootfs
+
+while getopts "b:d:h" Option ; do
+ case $Option in
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [[ "$#" -eq "1" ]] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ b) PARTITIONSIZE=$OPTARG
+ ;;
+ d) SRCPATH=$OPTARG
+ ;;
+ esac
+done
+#adjust the commandline arg for the now used options
+shift $(($OPTIND - 1))
+
+#create the file used for the loopbackdevice and format it for ext3
+#answer y to "is not a block special device"
+dd if=/dev/zero of=$@ bs=1024k count=$PARTITIONSIZE
+mkfs.ext3 -F -L arm $@
+#disable fsck checks based on mount count or time interval
+tune2fs -c 0 -i 0 $@
+
+#prepare mountpoint for the loopdevice
+sudo mkdir -p $MOUNTPOINT
+sudo umount $MOUNTPOINT &> /dev/null
+sudo rm -rf $MOUNTPOINT/*
+#mount the file as a loopdevice
+#there seems to be a race between mkfs.ext3 not yet finished and mount already trying to mount, so try until it works
+MOUNTED=0
+while [ "$MOUNTED" -eq "0" ] ; do
+ sync
+ sleep 1
+ sudo mount $@ $MOUNTPOINT/ -o loop -t ext3
+ MOUNTED=`mount | grep -c "$MOUNTPOINT"`
+done
+#extract rootfs into the file
+sudo cp -rpP $SRCPATH/* $MOUNTPOINT
+if [ "$?" -ne "0" ] ; then
+ $ECHO -e "\033[1mCopying the rootfs failed.\033[0m"
+ echo "Check for error messages from cp"
+ sudo rm $@
+ exit 1
+fi
+
+#unmount again
+sudo umount $MOUNTPOINT
+
+#if the mounting was unsuccesful all rootfs data now still is in MOUNTPOINT, and $@ contains an empty fs
+#delete $@ in that case to fail early
+sync
+FAILED=`ls $MOUNTPOINT | wc -l`
+if [ "$FAILED" -ne "0" ] ; then
+ $ECHO -e "\033[1mMounting the loopdevice $@ failed.\033[0m"
+ sudo rm $@
+ exit 1
+fi
diff --git a/recipes/images/files/apalis-t30/update.sh b/recipes/images/files/apalis-t30/update.sh
new file mode 100755
index 0000000..21b4ac6
--- /dev/null
+++ b/recipes/images/files/apalis-t30/update.sh
@@ -0,0 +1,273 @@
+#!/bin/sh
+# Prepare files needed for flashing a Apalis/Colibri T30 module
+#
+# inspired by meta-fsl-arm/classes/image_types_fsl.bbclass
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+#some distros have fs tools only in root's path
+PARTED=`which parted` 2> /dev/null
+if [ -e "$PARTED" ] ; then
+ MKFSVFAT=`which mkfs.vfat`
+else
+ PARTED=`sudo which parted`
+ MKFSVFAT=`sudo which mkfs.vfat`
+fi
+
+Flash()
+{
+ echo ""
+ echo "To flash the Apalis/Colibri T30 module, boot the module to the U-Boot prompt and"
+ echo ""
+ echo "when using a SD-card, insert the SD-card and enter:"
+ echo "run setupdate"
+ echo ""
+ echo "when using tftp, connect Ethernet and enter:"
+ echo "tftp \$loadaddr flash_eth.img ; source \$loadaddr"
+ echo ""
+ echo "then enter to update all:"
+ echo "run update"
+ echo ""
+ echo "to update a single component enter one of:"
+ echo "run update_uboot"
+ echo "run update_kernel"
+ echo ""
+ echo ""
+ echo "If you don't have a working U-Boot anymore, connect your PC to the module's"
+ echo "USB client port, bring the module in the serial download mode and start"
+ echo "the update.sh script with the -d option. This will copy U-Boot into the"
+ echo "modules RAM and execute it."
+}
+
+Usage()
+{
+ echo ""
+ echo "Prepares and copies files for flashing the internal eMMC of a Apalis/Colibri T30"
+ echo ""
+ echo "Will require a running U-Boot on the target. Either one already flashed"
+ echo "on the eMMC or one copied over usb into the module's RAM"
+ echo ""
+ echo "-d : use USB connection to copy and execute U-Boot to the module's RAM"
+ echo "-h : Prints this message"
+ echo "-o directory : output directory, defaults to /media/KERNEL"
+ echo " if this is on a SD card, it should be the"
+ echo " first partition formated with VFAT"
+ echo ""
+ echo "Example \"./update.sh\" copies the requiered files to /media/KERNEL/"
+ echo "Example \"./update.sh -o /srv/tftp/\" copies the requiered files to /srv/tftp/"
+ echo ""
+ echo ""
+ Flash
+}
+
+#initialise options
+UBOOT_RECOVERY=0
+OUT_DIR="/media/KERNEL"
+MIN_PARTITION_FREE_SIZE=100
+ROOTFSPATH=rootfs
+# No devicetree by default
+KERNEL_DEVICETREE=""
+KERNEL_IMAGETYPE="uImage"
+
+while getopts "dho:" Option ; do
+ case $Option in
+ d) UBOOT_RECOVERY=1
+ ;;
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [ "$#" -eq 1 ] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ o) OUT_DIR=$OPTARG
+ ;;
+ esac
+done
+
+# autotect MODTYPE from from rootfs directory
+CNT=`grep -ic "t30" rootfs/etc/issue || true`
+if [ "$CNT" -ge 1 ] ; then
+ CNT=`grep -ic "apalis" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Apalis T30 rootfs detected"
+ MODTYPE=apalis-t30
+ IMAGEFILE=root.ext3
+ U_BOOT_BINARY=u-boot-dtb-tegra.bin
+ KERNEL_DEVICETREE="tegra30-apalis-eval.dtb"
+ LOCPATH="tegra-uboot-flasher"
+ # eMMC size [in sectors of 512]
+ EMMC_SIZE=$(expr 1024 \* 3500 \* 2)
+ BCT=apalis_t30_12MHz_MT41K512M8RH-125_533MHz.bct
+ CBOOT_IMAGE=apalis_t30.img
+ else
+ echo "Colibri T30 rootfs detected"
+ MODTYPE=colibri-t30
+ IMAGEFILE=root.ext3
+ U_BOOT_BINARY=u-boot-dtb-tegra.bin
+ KERNEL_DEVICETREE="tegra30-colibri-eval-v3.dtb"
+ LOCPATH="tegra-uboot-flasher"
+ EMMC_SIZE=$(expr 1024 \* 2000 \* 2)
+ # with new kernel, boot with 400MHz, then switch between 400 & 800
+ BCT=colibri_t30_12MHz_NT5CC256M16CP-DI_400MHz.bct
+# BCT=colibri_t30_12MHz_NT5CC256M16CP-DI_533MHz.bct
+ CBOOT_IMAGE=colibri_t30.img
+ fi
+else
+ echo "can not detect module type from ./rootfs/etc/issue"
+ echo "exiting"
+ exit 1
+fi
+BINARIES=${MODTYPE}_bin
+
+#is only U-Boot to be copied to RAM?
+if [ "$UBOOT_RECOVERY" -ge 1 ] ; then
+ cd ${LOCPATH}
+ sudo ./tegrarcm --bct=../${BINARIES}/${BCT} --bootloader=../${BINARIES}/${U_BOOT_BINARY} --loadaddr=0x80108000
+ exit 1
+fi
+
+# is OUT_DIR an existing directory?
+if [ ! -d "$OUT_DIR" ] ; then
+ echo "$OUT_DIR" "does not exist, exiting"
+ exit 1
+fi
+
+#sanity check for correct untared rootfs
+DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'`
+if [ "${DEV_OWNER}x" != "rootx" ]
+then
+ $ECHO -e "rootfs/dev is not owned by root, but it should!"
+ $ECHO -e "\033[1mPlease unpack the tarball with root rights.\033[0m"
+ $ECHO -e "e.g. sudo tar xjvf Apalis_T30_LinuxImageV2.1_20140201.tar.bz2"
+ exit 1
+fi
+
+#sanity check for existens of U-Boot and kernel
+[ -e ${BINARIES}/${U_BOOT_BINARY} ] || { echo "${BINARIES}/${U_BOOT_BINARY} does not exist"; exit 1; }
+[ -e ${BINARIES}/uImage ] || { echo "${BINARIES}/uImage does not exist"; exit 1; }
+
+#sanity check for some programs
+MCOPY=`sudo which mcopy`
+[ "${MCOPY}x" != "x" ] || { echo >&2 "Program mcopy not available. Aborting."; exit 1; }
+sudo ${PARTED} -v >/dev/null 2>&1 || { echo >&2 "Program parted not available. Aborting."; exit 1; }
+[ "${MKFSVFAT}x" != "x" ] || { echo >&2 "Program mkfs.vfat not available. Aborting."; exit 1; }
+MKFSEXT3=`sudo which mkfs.ext3`
+[ "${MKFSEXT3}x" != "x" ] || { echo >&2 "Program mkfs.ext3 not available. Aborting."; exit 1; }
+awk -V >/dev/null 2>&1 || { echo >&2 "Program awk not available. Aborting."; exit 1; }
+dd --help >/dev/null 2>&1 || { echo >&2 "Program dd not available. Aborting."; exit 1; }
+tegra-uboot-flasher/cbootimage -h >/dev/null 2>&1
+[ "$?" -lt 2 ] || { echo >&2 "Program cbootimage not available. 32bit compatibility libs? Aborting."; exit 1; }
+
+#make the directory with the outputfiles writable
+sudo chown $USER: ${BINARIES}
+
+#make a file with the used versions for U-Boot, kernel and rootfs
+rm ${BINARIES}/versions.txt
+touch ${BINARIES}/versions.txt
+echo "Component Versions" > ${BINARIES}/versions.txt
+basename "`readlink -e ${BINARIES}/${U_BOOT_BINARY}`" >> ${BINARIES}/versions.txt
+basename "`readlink -e ${BINARIES}/uImage`" >> ${BINARIES}/versions.txt
+$ECHO -n "Rootfs " >> ${BINARIES}/versions.txt
+grep -i t30 rootfs/etc/issue >> ${BINARIES}/versions.txt
+
+
+# The emmc layout used is:
+#
+# boot area partition 1 aka eMMC boot sector:
+#
+# with cbootimage containing BCT and U-Boot boot loader
+#
+# user area aka general purpose eMMC region:
+#
+# 0 -> IMAGE_ROOTFS_ALIGNMENT - reserved to bootloader (not partitioned)
+# IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE - kernel and other data
+# BOOT_SPACE -> SDIMG_SIZE - rootfs
+#
+# Default Free space = 1.3x
+# Use IMAGE_OVERHEAD_FACTOR to add more space
+# <--------->
+# 4MiB 16MiB SDIMG_ROOTFS 4MiB
+# <-----------------------> <----------> <----------------------> <------------------------------>
+# ------------------------ ------------ ------------------------ -------------------------------
+# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE | IMAGE_ROOTFS_ALIGNMENT |
+# ------------------------ ------------ ------------------------ -------------------------------
+# ^ ^ ^ ^ ^
+# | | | | |
+# 0 4096 4MiB + 16MiB 4MiB + 16Mib + SDIMG_ROOTFS 4MiB + 16MiB + SDIMG_ROOTFS + 4MiB
+#
+# with the U-Boot environment at 512 * 1024, the config block is at 640 * 1024
+
+
+# generate cbootimage containing BCT and U-Boot boot loader
+cd ${BINARIES}
+sudo ../${LOCPATH}/cbootimage -s tegra30 ${CBOOT_IMAGE}.cfg ${CBOOT_IMAGE}
+cd ..
+
+
+# Boot partition [in sectors of 512]
+BOOT_START=$(expr 4096 \* 2)
+# Rootfs partition [in sectors of 512]
+ROOTFS_START=$(expr 20480 \* 2)
+# Boot partition volume id
+BOOTDD_VOLUME_ID="Boot"
+
+#make the partition size size(rootfs used + MIN_PARTITION_FREE_SIZE)
+#add about 4% to the rootfs to account for fs overhead. (/1024/985 instead of /1024/1024).
+#add 512 bytes per file to account for small files
+NUMBER_OF_FILES=`sudo find ${ROOTFSPATH} | wc -l`
+EXT_SIZE=`sudo du -DsB1 ${ROOTFSPATH} | awk -v min=$MIN_PARTITION_FREE_SIZE -v f=${NUMBER_OF_FILES} \
+ '{rootfs_size=$1+f*512;rootfs_size=int(rootfs_size/1024/985); print (rootfs_size+min) }'`
+
+echo ""
+echo "Creating MBR file and do the partitioning"
+# Initialize a sparse file
+dd if=/dev/zero of=${BINARIES}/mbr.bin bs=512 count=0 seek=${EMMC_SIZE}
+${PARTED} -s ${BINARIES}/mbr.bin mklabel msdos
+${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary fat32 ${BOOT_START} $(expr ${ROOTFS_START} - 1 )
+# the partition spans to the end of the disk, even though the fs size will be smaller
+# on the target the fs is then grown to the full size
+${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary ext2 ${ROOTFS_START} $(expr ${EMMC_SIZE} \- ${ROOTFS_START} \- 1)
+${PARTED} -s ${BINARIES}/mbr.bin unit s print
+# get the size of the VFAT partition
+BOOT_BLOCKS=$(LC_ALL=C ${PARTED} -s ${BINARIES}/mbr.bin unit b print \
+ | awk '/ 1 / { print int(substr($4, 1, length($4 -1)) / 1024) }')
+# now crop the file to only the MBR size
+IMG_SIZE=512
+truncate -s $IMG_SIZE ${BINARIES}/mbr.bin
+
+
+echo ""
+echo "Creating VFAT partion image with the kernel"
+rm -f ${BINARIES}/boot.vfat
+${MKFSVFAT} -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${BINARIES}/boot.vfat $BOOT_BLOCKS
+export MTOOLS_SKIP_CHECK=1
+mcopy -i ${BINARIES}/boot.vfat -s ${BINARIES}/uImage ::/uImage
+
+# Copy device tree file
+if test -n "${KERNEL_DEVICETREE}"; then
+ for DTS_FILE in ${KERNEL_DEVICETREE}; do
+ DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
+ if [ -e "${BINARIES}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ]; then
+ kernel_bin="`readlink ${BINARIES}/${KERNEL_IMAGETYPE}`"
+ kernel_bin_for_dtb="`readlink ${BINARIES}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb | sed "s,$DTS_BASE_NAME,${MODTYPE},g;s,\.dtb$,.bin,g"`"
+ if [ "$kernel_bin" = "$kernel_bin_for_dtb" ]; then
+ mcopy -i ${BINARIES}/boot.vfat -s ${BINARIES}/${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb ::/${DTS_BASE_NAME}.dtb
+ #copy also to out_dir
+ sudo cp ${BINARIES}/${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb "$OUT_DIR/${DTS_BASE_NAME}.dtb"
+ fi
+ fi
+ done
+fi
+
+echo ""
+echo "Creating rootfs partion image"
+rm -f ${BINARIES}/${IMAGEFILE}
+sudo $LOCPATH/genext3fs.sh -d rootfs -b ${EXT_SIZE} ${BINARIES}/${IMAGEFILE} || exit 1
+
+
+#copy to $OUT_DIR
+sudo cp ${BINARIES}/configblock.bin ${BINARIES}/${CBOOT_IMAGE} ${BINARIES}/uImage ${BINARIES}/mbr.bin ${BINARIES}/boot.vfat ${BINARIES}/${IMAGEFILE} ${BINARIES}/flash*.img ${BINARIES}/versions.txt "$OUT_DIR"
+sync
+
+Flash
diff --git a/recipes/images/files/colibri-imx6/colibri-imx6_bin/configblock.bin b/recipes/images/files/colibri-imx6/colibri-imx6_bin/configblock.bin
new file mode 100644
index 0000000..ab8f1f7
--- /dev/null
+++ b/recipes/images/files/colibri-imx6/colibri-imx6_bin/configblock.bin
Binary files differ
diff --git a/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_eth.img b/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_eth.img
new file mode 100644
index 0000000..2a2719f
--- /dev/null
+++ b/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_eth.img
Binary files differ
diff --git a/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_eth.scr b/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_eth.scr
new file mode 100644
index 0000000..6eb57fb
--- /dev/null
+++ b/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_eth.scr
@@ -0,0 +1,15 @@
+setenv set_blkcnt 'setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200'
+setenv set_nextnum 'setexpr filenum ${filenum} + 1; setexpr blkstart ${blkstart} + ${blkcnt}'
+setenv cp_file_chunk 'tftpboot ${loadaddr} root.ext3-${filenum}; run set_blkcnt; mmc dev 0 && mmc write ${loadaddr} ${blkstart} ${blkcnt}'
+setenv update_uboot 'tftpboot ${loadaddr} u-boot.imx && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 2 ${blkcnt}; patch_ddr_size'
+setenv update_kernel 'tftpboot ${loadaddr} uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+setenv update_fdt 'tftpboot ${loadaddr} ${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}'
+setenv update_configblock 'tftpboot ${loadaddr} configblock.bin && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 0x500 ${blkcnt}'
+setenv update 'run update_1; run update_uboot; run update_2; run update_3; reset'
+setenv update_1 'tftpboot ${loadaddr} mbr.bin && mmc dev 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'tftpboot ${loadaddr} boot.vfat && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
+#do it in chunks of 64M to fit into DDR RAM of the smallest module
+#split root.ext3 into multiple 64M chunks before copying to TFTP folder as follows
+#split -a 1 -b `expr 64 \* 1024 \* 1024` -d root.ext3 root.ext3-
+setenv update_3 'setenv filesize 4000000; setenv filenum 0; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextnum; done'
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_mmc.img b/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_mmc.img
new file mode 100644
index 0000000..c11c023
--- /dev/null
+++ b/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_mmc.img
Binary files differ
diff --git a/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_mmc.scr b/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_mmc.scr
new file mode 100644
index 0000000..81e0d2b
--- /dev/null
+++ b/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_mmc.scr
@@ -0,0 +1,14 @@
+test -n ${drive} || setenv drive 1
+setenv set_blkcnt 'setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200'
+setenv set_nextpos 'setexpr filepos ${filepos} + ${filesize}; setexpr blkstart ${blkstart} + ${blkcnt}'
+setenv cp_file_chunk 'fatload mmc ${drive}:1 ${loadaddr} root.ext3 ${filesize} ${filepos}; run set_blkcnt; mmc dev 0 && mmc write ${loadaddr} ${blkstart} ${blkcnt}'
+setenv update_uboot 'fatload mmc ${drive}:1 ${loadaddr} u-boot.imx && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 2 ${blkcnt}; patch_ddr_size'
+setenv update_kernel 'fatload mmc ${drive}:1 ${loadaddr} uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+setenv update_fdt 'fatload mmc ${drive}:1 ${loadaddr} ${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}'
+setenv update_configblock 'fatload mmc ${drive}:1 ${loadaddr} configblock.bin && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 0x500 ${blkcnt}'
+setenv update 'run update_1; run update_uboot; run update_2; run update_3; reset'
+setenv update_1 'fatload mmc ${drive}:1 ${loadaddr} mbr.bin && mmc dev 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'fatload mmc ${drive}:1 ${loadaddr} boot.vfat && run set_blkcnt && mmc dev 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
+#do it in chunks of 64M to fit into DDR RAM of the smallest module
+setenv update_3 'setenv filesize 4000000; setenv filepos 0; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextpos; done'
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/colibri-imx6/colibri-imx6_bin/mk-u-boot-scripts.sh b/recipes/images/files/colibri-imx6/colibri-imx6_bin/mk-u-boot-scripts.sh
new file mode 100755
index 0000000..2a4e898
--- /dev/null
+++ b/recipes/images/files/colibri-imx6/colibri-imx6_bin/mk-u-boot-scripts.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+for f in *.scr
+do
+ mkimage -T script -C none -n 'Flash Apalis iMX6' -d $f `basename $f .scr`.img
+done
diff --git a/recipes/images/files/colibri-imx6/imx_flash/genext3fs.sh b/recipes/images/files/colibri-imx6/imx_flash/genext3fs.sh
new file mode 100755
index 0000000..3c8ecc8
--- /dev/null
+++ b/recipes/images/files/colibri-imx6/imx_flash/genext3fs.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+#creates a file containing a ext3 binary blob of the content of the ../rootfs folder
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+
+MOUNTPOINT="mnt/trdx-rootfs"
+
+Usage()
+{
+ echo "creates a file containing a ext3 binary blob. Output file name taken from command line"
+ echo "Usage: genext3fs.sh [OPTION]... dest_file_name"
+ echo "-h : Prints this message"
+ echo "-b : Sets the partition size in MBytes, default 256"
+ echo "-d : Selects the directory which contains the partition content, default ../rootfs"
+ echo ""
+}
+
+PARTITIONSIZE=256
+SRCPATH=../rootfs
+
+while getopts "b:d:h" Option ; do
+ case $Option in
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [[ "$#" -eq "1" ]] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ b) PARTITIONSIZE=$OPTARG
+ ;;
+ d) SRCPATH=$OPTARG
+ ;;
+ esac
+done
+#adjust the commandline arg for the now used options
+shift $(($OPTIND - 1))
+
+#create the file used for the loopbackdevice and format it for ext3
+#answer y to "is not a block special device"
+dd if=/dev/zero of=$@ bs=1024k count=$PARTITIONSIZE
+mkfs.ext3 -F -L arm $@
+#disable fsck checks based on mount count or time interval
+tune2fs -c 0 -i 0 $@
+
+#prepare mountpoint for the loopdevice
+sudo mkdir -p $MOUNTPOINT
+sudo umount $MOUNTPOINT &> /dev/null
+sudo rm -rf $MOUNTPOINT/*
+#mount the file as a loopdevice
+#there seems to be a race between mkfs.ext3 not yet finished and mount already trying to mount, so try until it works
+MOUNTED=0
+while [ "$MOUNTED" -eq "0" ] ; do
+ sync
+ sleep 1
+ sudo mount $@ $MOUNTPOINT/ -o loop -t ext3
+ MOUNTED=`mount | grep -c "$MOUNTPOINT"`
+done
+#extract rootfs into the file
+sudo cp -rpP $SRCPATH/* $MOUNTPOINT
+if [ "$?" -ne "0" ] ; then
+ $ECHO -e "\033[1mCopying the rootfs failed.\033[0m"
+ echo "Check for error messages from cp"
+ sudo rm $@
+ exit 1
+fi
+
+#unmount again
+sudo umount $MOUNTPOINT
+
+#if the mounting was unsuccesful all rootfs data now still is in MOUNTPOINT, and $@ contains an empty fs
+#delete $@ in that case to fail early
+sync
+FAILED=`ls $MOUNTPOINT | wc -l`
+if [ "$FAILED" -ne "0" ] ; then
+ $ECHO -e "\033[1mMounting the loopdevice $@ failed.\033[0m"
+ sudo rm $@
+ exit 1
+fi
diff --git a/recipes/images/files/colibri-imx6/update.sh b/recipes/images/files/colibri-imx6/update.sh
new file mode 100755
index 0000000..6f91728
--- /dev/null
+++ b/recipes/images/files/colibri-imx6/update.sh
@@ -0,0 +1,259 @@
+#!/bin/sh
+# Prepare files needed for flashing a Apalis/Colibri iMX6 module
+#
+# inspired by meta-fsl-arm/classes/image_types_fsl.bbclass
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+#some distros have fs tools only in root's path
+PARTED=`which parted` 2> /dev/null
+if [ -e "$PARTED" ] ; then
+ MKFSVFAT=`which mkfs.vfat`
+else
+ PARTED=`sudo which parted`
+ MKFSVFAT=`sudo which mkfs.vfat`
+fi
+
+Flash()
+{
+ echo ""
+ echo "To flash the Apalis/Colibri iMX6 module, boot the module to the U-Boot prompt and"
+ echo ""
+ echo "when using a SD-card, insert the SD-card and enter:"
+ echo "run setupdate"
+ echo ""
+ echo "when using tftp, connect Ethernet and enter:"
+ echo "tftp \$loadaddr flash_eth.img ; source \$loadaddr"
+ echo ""
+ echo "then enter to update all:"
+ echo "run update"
+ echo ""
+ echo "to update a single component enter one of:"
+ echo "run update_uboot"
+ echo "run update_kernel"
+ echo ""
+ echo ""
+ echo "If you don't have a working U-Boot anymore, connect your PC to the module's"
+ echo "USB client port, bring the module in the serial download mode and start"
+ echo "the update.sh script with the -d option. This will copy U-Boot into the"
+ echo "modules RAM and execute it."
+}
+
+Usage()
+{
+ echo ""
+ echo "Prepares and copies files for flashing the internal eMMC of a Apalis/Colibri iMX6"
+ echo ""
+ echo "Will require a running U-Boot on the target. Either one already flashed"
+ echo "on the eMMC or one copied over usb into the module's RAM"
+ echo ""
+ echo "-d : use USB connection to copy and execute U-Boot to the module's RAM"
+ echo "-h : Prints this message"
+ echo "-o directory : output directory, defaults to /media/KERNEL"
+ echo " if this is on a SD card, it should be the"
+ echo " first partition formated with VFAT"
+ echo ""
+ echo "Example \"./update.sh\" copies the requiered files to /media/KERNEL/"
+ echo "Example \"./update.sh -o /srv/tftp/\" copies the requiered files to /srv/tftp/"
+ echo ""
+ echo ""
+ Flash
+}
+
+#initialise options
+UBOOT_RECOVERY=0
+OUT_DIR="/media/KERNEL"
+MIN_PARTITION_FREE_SIZE=100
+ROOTFSPATH=rootfs
+# No devicetree by default
+KERNEL_DEVICETREE=""
+KERNEL_IMAGETYPE="uImage"
+
+while getopts "dho:" Option ; do
+ case $Option in
+ d) UBOOT_RECOVERY=1
+ ;;
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [ "$#" -eq 1 ] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ o) OUT_DIR=$OPTARG
+ ;;
+ esac
+done
+
+# autotect MODTYPE from from rootfs directory
+CNT=`grep -ic "Colibri.iMX6" rootfs/etc/issue || true`
+if [ "$CNT" -ge 1 ] ; then
+ echo "Colibri iMX6 rootfs detected"
+ MODTYPE=colibri-imx6
+ IMAGEFILE=root.ext3
+ U_BOOT_BINARY=u-boot.imx
+ KERNEL_DEVICETREE="imx6dl-colibri-eval-v3.dtb"
+ LOCPATH="imx_flash"
+ # eMMC size [in sectors of 512]
+ EMMC_SIZE=$(expr 1024 \* 3500 \* 2)
+else
+ CNT=`grep -ic "imx6" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Apalis iMX6 rootfs detected"
+ MODTYPE=apalis-imx6
+ IMAGEFILE=root.ext3
+ U_BOOT_BINARY=u-boot.imx
+ KERNEL_DEVICETREE="imx6q-apalis-eval.dtb imx6q-apalis-eval_v1_0.dtb"
+ LOCPATH="imx_flash"
+ # eMMC size [in sectors of 512]
+ EMMC_SIZE=$(expr 1024 \* 3500 \* 2)
+ else
+ echo "can not detect module type from ./rootfs/etc/issue"
+ echo "exiting"
+ exit 1
+ fi
+fi
+BINARIES=${MODTYPE}_bin
+
+#is only U-Boot to be copied to RAM?
+if [ "$UBOOT_RECOVERY" -ge 1 ] ; then
+ cd ${LOCPATH}
+ sudo ./imx_usb ../${BINARIES}/${U_BOOT_BINARY}
+ exit 1
+fi
+
+# is OUT_DIR an existing directory?
+if [ ! -d "$OUT_DIR" ] ; then
+ echo "$OUT_DIR" "does not exist, exiting"
+ exit 1
+fi
+
+#sanity check for correct untared rootfs
+DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'`
+if [ "${DEV_OWNER}x" != "rootx" ]
+then
+ $ECHO -e "rootfs/dev is not owned by root, but it should!"
+ $ECHO -e "\033[1mPlease unpack the tarball with root rights.\033[0m"
+ $ECHO -e "e.g. sudo tar xjvf Apalis_iMX6_LinuxImageV2.1_20140201.tar.bz2"
+ exit 1
+fi
+
+#sanity check for existens of U-Boot and kernel
+[ -e ${BINARIES}/${U_BOOT_BINARY} ] || { echo "${BINARIES}/${U_BOOT_BINARY} does not exist"; exit 1; }
+[ -e ${BINARIES}/uImage ] || { echo "${BINARIES}/uImage does not exist"; exit 1; }
+
+#sanity check for some programs
+MCOPY=`sudo which mcopy`
+[ "${MCOPY}x" != "x" ] || { echo >&2 "Program mcopy not available. Aborting."; exit 1; }
+sudo ${PARTED} -v >/dev/null 2>&1 || { echo >&2 "Program parted not available. Aborting."; exit 1; }
+[ "${MKFSVFAT}x" != "x" ] || { echo >&2 "Program mkfs.vfat not available. Aborting."; exit 1; }
+MKFSEXT3=`sudo which mkfs.ext3`
+[ "${MKFSEXT3}x" != "x" ] || { echo >&2 "Program mkfs.ext3 not available. Aborting."; exit 1; }
+awk -V >/dev/null 2>&1 || { echo >&2 "Program awk not available. Aborting."; exit 1; }
+dd --help >/dev/null 2>&1 || { echo >&2 "Program dd not available. Aborting."; exit 1; }
+
+#make the directory with the outputfiles writable
+sudo chown $USER: ${BINARIES}
+
+#make a file with the used versions for U-Boot, kernel and rootfs
+rm ${BINARIES}/versions.txt
+touch ${BINARIES}/versions.txt
+echo "Component Versions" > ${BINARIES}/versions.txt
+basename "`readlink -e ${BINARIES}/${U_BOOT_BINARY}`" >> ${BINARIES}/versions.txt
+basename "`readlink -e ${BINARIES}/uImage`" >> ${BINARIES}/versions.txt
+$ECHO -n "Rootfs " >> ${BINARIES}/versions.txt
+grep -i imx6 rootfs/etc/issue >> ${BINARIES}/versions.txt
+
+
+# The emmc layout used is:
+#
+# user area aka general purpose eMMC region:
+#
+# 0 -> IMAGE_ROOTFS_ALIGNMENT - reserved to bootloader (not partitioned)
+# IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE - kernel and other data
+# BOOT_SPACE -> SDIMG_SIZE - rootfs
+#
+# Default Free space = 1.3x
+# Use IMAGE_OVERHEAD_FACTOR to add more space
+# <--------->
+# 4MiB 16MiB SDIMG_ROOTFS 4MiB
+# <-----------------------> <----------> <----------------------> <------------------------------>
+# ------------------------ ------------ ------------------------ -------------------------------
+# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE | IMAGE_ROOTFS_ALIGNMENT |
+# ------------------------ ------------ ------------------------ -------------------------------
+# ^ ^ ^ ^ ^
+# | | | | |
+# 0 4096 4MiB + 16MiB 4MiB + 16Mib + SDIMG_ROOTFS 4MiB + 16MiB + SDIMG_ROOTFS + 4MiB
+#
+# with U-Boot at 1024, the U-Boot environment at 512 * 1024, the config block is at 640 * 1024
+
+
+# Boot partition [in sectors of 512]
+BOOT_START=$(expr 4096 \* 2)
+# Rootfs partition [in sectors of 512]
+ROOTFS_START=$(expr 20480 \* 2)
+# Boot partition volume id
+BOOTDD_VOLUME_ID="Boot"
+
+#make the partition size size(rootfs used + MIN_PARTITION_FREE_SIZE)
+#add about 4% to the rootfs to account for fs overhead. (/1024/985 instead of /1024/1024).
+#add 512 bytes per file to account for small files
+NUMBER_OF_FILES=`sudo find ${ROOTFSPATH} | wc -l`
+EXT_SIZE=`sudo du -DsB1 ${ROOTFSPATH} | awk -v min=$MIN_PARTITION_FREE_SIZE -v f=${NUMBER_OF_FILES} \
+ '{rootfs_size=$1+f*512;rootfs_size=int(rootfs_size/1024/985); print (rootfs_size+min) }'`
+
+echo ""
+echo "Creating MBR file and do the partitioning"
+# Initialize a sparse file
+dd if=/dev/zero of=${BINARIES}/mbr.bin bs=512 count=0 seek=${EMMC_SIZE}
+${PARTED} -s ${BINARIES}/mbr.bin mklabel msdos
+${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary fat32 ${BOOT_START} $(expr ${ROOTFS_START} - 1 )
+# the partition spans to the end of the disk, even though the fs size will be smaller
+# on the target the fs is then grown to the full size
+${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary ext2 ${ROOTFS_START} $(expr ${EMMC_SIZE} \- ${ROOTFS_START} \- 1)
+${PARTED} -s ${BINARIES}/mbr.bin unit s print
+# get the size of the VFAT partition
+BOOT_BLOCKS=$(LC_ALL=C ${PARTED} -s ${BINARIES}/mbr.bin unit b print \
+ | awk '/ 1 / { print int(substr($4, 1, length($4 -1)) / 1024) }')
+# now crop the file to only the MBR size
+IMG_SIZE=512
+truncate -s $IMG_SIZE ${BINARIES}/mbr.bin
+
+
+echo ""
+echo "Creating VFAT partion image with the kernel"
+rm -f ${BINARIES}/boot.vfat
+${MKFSVFAT} -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${BINARIES}/boot.vfat $BOOT_BLOCKS
+export MTOOLS_SKIP_CHECK=1
+mcopy -i ${BINARIES}/boot.vfat -s ${BINARIES}/uImage ::/uImage
+
+# Copy device tree file
+COPIED=false
+if test -n "${KERNEL_DEVICETREE}"; then
+ for DTS_FILE in ${KERNEL_DEVICETREE}; do
+ DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
+ if [ -e "${BINARIES}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ]; then
+ kernel_bin="`readlink ${BINARIES}/${KERNEL_IMAGETYPE}`"
+ kernel_bin_for_dtb="`readlink ${BINARIES}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb | sed "s,$DTS_BASE_NAME,${MODTYPE},g;s,\.dtb$,.bin,g"`"
+ if [ "$kernel_bin" = "$kernel_bin_for_dtb" ]; then
+ mcopy -i ${BINARIES}/boot.vfat -s ${BINARIES}/${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb ::/${DTS_BASE_NAME}.dtb
+ #copy also to out_dir
+ sudo cp ${BINARIES}/${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb "$OUT_DIR/${DTS_BASE_NAME}.dtb"
+ COPIED=true
+ fi
+ fi
+ done
+ [ $COPIED = true ] || { echo "Did not find the devicetrees from KERNEL_DEVICETREE, ${KERNEL_DEVICETREE}. Aborting."; exit 1; }
+fi
+
+echo ""
+echo "Creating rootfs partion image"
+rm -f ${BINARIES}/${IMAGEFILE}
+sudo $LOCPATH/genext3fs.sh -d rootfs -b ${EXT_SIZE} ${BINARIES}/${IMAGEFILE} || exit 1
+
+
+#copy to $OUT_DIR
+sudo cp ${BINARIES}/configblock.bin ${BINARIES}/${U_BOOT_BINARY} ${BINARIES}/uImage ${BINARIES}/mbr.bin ${BINARIES}/boot.vfat ${BINARIES}/${IMAGEFILE} ${BINARIES}/flash*.img ${BINARIES}/versions.txt "$OUT_DIR"
+sync
+
+Flash
diff --git a/recipes/images/files/colibri-pxa/colibri-pxa_bin/README b/recipes/images/files/colibri-pxa/colibri-pxa_bin/README
new file mode 100644
index 0000000..2d597f4
--- /dev/null
+++ b/recipes/images/files/colibri-pxa/colibri-pxa_bin/README
@@ -0,0 +1 @@
+u-boot and kernel for pxa \ No newline at end of file
diff --git a/recipes/images/files/colibri-t20/colibri-t20_bin/configblock_256.bin b/recipes/images/files/colibri-t20/colibri-t20_bin/configblock_256.bin
new file mode 100644
index 0000000..35068f7
--- /dev/null
+++ b/recipes/images/files/colibri-t20/colibri-t20_bin/configblock_256.bin
Binary files differ
diff --git a/recipes/images/files/colibri-t20/colibri-t20_bin/configblock_512.bin b/recipes/images/files/colibri-t20/colibri-t20_bin/configblock_512.bin
new file mode 100644
index 0000000..b58dbaa
--- /dev/null
+++ b/recipes/images/files/colibri-t20/colibri-t20_bin/configblock_512.bin
Binary files differ
diff --git a/recipes/images/files/colibri-t20/colibri-t20_bin/mk-u-boot-scripts.sh b/recipes/images/files/colibri-t20/colibri-t20_bin/mk-u-boot-scripts.sh
new file mode 100755
index 0000000..2a4e898
--- /dev/null
+++ b/recipes/images/files/colibri-t20/colibri-t20_bin/mk-u-boot-scripts.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+for f in *.scr
+do
+ mkimage -T script -C none -n 'Flash Apalis iMX6' -d $f `basename $f .scr`.img
+done
diff --git a/recipes/images/files/colibri-t20/create_configblock.sh b/recipes/images/files/colibri-t20/create_configblock.sh
new file mode 100755
index 0000000..bf0bc62
--- /dev/null
+++ b/recipes/images/files/colibri-t20/create_configblock.sh
@@ -0,0 +1,168 @@
+#! /bin/sh
+
+Usage()
+{
+ echo "create_configblock creates a configblock binary from the info on the module sticker."
+ echo "This can be used when the configblock got lost during a failed update attempt."
+ echo "The created configblock can then be written to the module with:"
+ echo "update.sh -c"
+ echo ""
+}
+
+while getopts "h" Option ; do
+ case $Option in
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [[ $# -eq 1 ]] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ esac
+done
+
+# autotect MODTYPE from from rootfs directory
+CNT=`grep -c "T20" rootfs/etc/issue || true`
+if [ ${CNT} -ge 1 ] ; then
+ echo "Colibri T20 rootfs detected"
+ MODTYPE=colibri-t20
+ BOOT_DEVICE=nand
+else
+ CNT=`grep -c "T30" rootfs/etc/issue || true`
+ if [ ${CNT} -ge 1 ] ; then
+ CNT=`grep -c "Apalis" rootfs/etc/issue || true`
+ if [ ${CNT} -ge 1 ] ; then
+ echo "Apalis T30 rootfs detected"
+ MODTYPE=apalis-t30
+ else
+ echo "Colibri T30 rootfs detected"
+ MODTYPE=colibri-t30
+ fi
+ else
+ CNT=`grep -c "VF" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ CNT=`grep -c "VF50" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Colibri VF50 rootfs detected"
+ MODTYPE=colibri-vf50
+ else
+ echo "Colibri VF61 rootfs detected"
+ MODTYPE=colibri-vf61
+ fi
+ else
+ echo "can not detect modulue type from ./rootfs/etc/issue"
+ echo "exiting"
+ exit 1
+ fi
+ fi
+fi
+
+echo "Enter the modules serial number on the modules sticker or"
+echo "use a barcode scanner to enter the content of the stickers barcode"
+
+# read a barcode and test it to be 8 or 16 numbers only 0025100102489109 0115100000000024
+# 1234567890123456 1234567890123456
+until [ "${BARCODE}x" != "x" ]
+do
+ read BARCODE
+ #remove all whitespace
+ BARCODE=`echo $BARCODE | tr -d ' '`
+ #get strlen and the number of numeric characters
+ STRLEN=`echo $BARCODE | wc -c`
+ NUMCNT=`echo $BARCODE | sed 's/[^0-9]//g' | wc -c`
+ if [ $STRLEN -ne 17 ] ; then
+ if [ $STRLEN -ne 9 ] ; then
+ echo "The serial number must be 8 numbers long (the barcode 16)"
+ BARCODE=""
+ fi
+ fi
+ if [ $NUMCNT -ne $STRLEN ] ; then
+ echo "The serial number must contain all numeric characters"
+ BARCODE=""
+ fi
+done
+DATECODE=19700101000000
+if [ $STRLEN -eq 17 ] ; then
+ SERIALNR=`echo $BARCODE | awk 'BEGIN{ FIELDWIDTHS = "8 8"} {print $2}'`
+ PRODUCTNR=`echo $BARCODE | awk 'BEGIN{ FIELDWIDTHS = "8 8"} {print $1}'`
+else
+ SERIALNR=$BARCODE
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+ case ${MODTYPE} in
+ "colibri-t20")
+ RAM_SIZE=256
+ echo "Enter the RAM size ( 256 / 512 ):"
+ read RAM_SIZE
+ echo "Enter I for IT version, nothing otherwise"
+ read IT
+ if [ $RAM_SIZE -eq 512 ] ; then
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0022"
+ else
+ PROD_ID="0021"
+ fi
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+
+ else
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0024"
+ else
+ PROD_ID="0020"
+ fi
+ PROD_ID="0020"
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_256.bin
+ fi
+ ;;
+ "colibri-t30")
+ PROD_ID="0023"
+ ;;
+ "apalis-t30")
+ PROD_ID="0025"
+ ;;
+ "colibri-vf50")
+ PROD_ID="0010"
+ ;;
+ "apalis-vf61")
+ PROD_ID="0011"
+ ;;
+ esac
+
+ echo "Enter the module version, e.g. V1.2 C"
+ read PRODVERSION
+ VER_MAJ=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $2}'`
+ VER_MIN=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $4}'`
+ #VARIANT: A=0, B=1 ...
+ VARIANT=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $6}'`
+ VARIANT=`printf "%d\n" "'$VARIANT"`
+ VARIANT=`expr $VARIANT - 65`
+ if [ "$VARIANT" -lt 10 ] ; then
+ VARIANT=0$VARIANT
+ fi
+ PRODUCTNR=${PROD_ID}${VER_MAJ}${VER_MIN}${VARIANT}
+fi
+
+#write the config block file
+if [ "${MODTYPE}" = "colibri-t20" ] ; then
+ PROD_ID=`echo $PRODUCTNR | awk 'BEGIN{ FIELDWIDTHS = "4 4"} {print $1}'`
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_256.bin
+ if [ ${PROD_ID} = "0021" ] ; then
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+ fi
+ if [ ${PROD_ID} = "0022" ] ; then
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+ fi
+else
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+fi
+sudo chown ${USER}: ${MODTYPE}_bin
+sudo rm -f $CONFIGBLOCK_FILE
+#file header
+awk 'function sc(c) {return (c<128?c:(c-256))} BEGIN{printf "%c%c%c%c",0,64,1,-49}' > $CONFIGBLOCK_FILE
+#mac addr / serial
+echo $SERIALNR | awk 'function sc(c) {return (c<128?c:(c-256))} {printf "%c%c%c%c%c%c%c%c%c%c%c%c",2,64,0,0, 0,20,45, sc(int($0/256/256)), sc(int($0/256)%256), sc($0%256),0,0 }' >> $CONFIGBLOCK_FILE
+#product describtion, $1 char 0/1: ??, $2 char 2/3: ProdID, $3 char 4:VerMaj, $4 char 5:VerMin, $5 char 6/7:Variant
+echo $PRODUCTNR | awk 'BEGIN{ FIELDWIDTHS = "2 2 1 1 2"} function sc(c) {return (c<128?c:(c-256))} {printf "%c%c%c%c%c%c%c%c%c%c%c%c",2,64,8,0 ,sc($3),0, sc($4),0, sc($5),0, sc($2),0 }' >> $CONFIGBLOCK_FILE
+#fill to 32 bytes
+awk 'function sc(c) {return (c<128?c:(c-256))} BEGIN{printf "%c%c%c%c",-1,-1,-1,-1}' >> $CONFIGBLOCK_FILE
+
+exit 0
diff --git a/recipes/images/files/colibri-t20/t20_nvflash/genext3fs.sh b/recipes/images/files/colibri-t20/t20_nvflash/genext3fs.sh
new file mode 100755
index 0000000..3c8ecc8
--- /dev/null
+++ b/recipes/images/files/colibri-t20/t20_nvflash/genext3fs.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+#creates a file containing a ext3 binary blob of the content of the ../rootfs folder
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+
+MOUNTPOINT="mnt/trdx-rootfs"
+
+Usage()
+{
+ echo "creates a file containing a ext3 binary blob. Output file name taken from command line"
+ echo "Usage: genext3fs.sh [OPTION]... dest_file_name"
+ echo "-h : Prints this message"
+ echo "-b : Sets the partition size in MBytes, default 256"
+ echo "-d : Selects the directory which contains the partition content, default ../rootfs"
+ echo ""
+}
+
+PARTITIONSIZE=256
+SRCPATH=../rootfs
+
+while getopts "b:d:h" Option ; do
+ case $Option in
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [[ "$#" -eq "1" ]] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ b) PARTITIONSIZE=$OPTARG
+ ;;
+ d) SRCPATH=$OPTARG
+ ;;
+ esac
+done
+#adjust the commandline arg for the now used options
+shift $(($OPTIND - 1))
+
+#create the file used for the loopbackdevice and format it for ext3
+#answer y to "is not a block special device"
+dd if=/dev/zero of=$@ bs=1024k count=$PARTITIONSIZE
+mkfs.ext3 -F -L arm $@
+#disable fsck checks based on mount count or time interval
+tune2fs -c 0 -i 0 $@
+
+#prepare mountpoint for the loopdevice
+sudo mkdir -p $MOUNTPOINT
+sudo umount $MOUNTPOINT &> /dev/null
+sudo rm -rf $MOUNTPOINT/*
+#mount the file as a loopdevice
+#there seems to be a race between mkfs.ext3 not yet finished and mount already trying to mount, so try until it works
+MOUNTED=0
+while [ "$MOUNTED" -eq "0" ] ; do
+ sync
+ sleep 1
+ sudo mount $@ $MOUNTPOINT/ -o loop -t ext3
+ MOUNTED=`mount | grep -c "$MOUNTPOINT"`
+done
+#extract rootfs into the file
+sudo cp -rpP $SRCPATH/* $MOUNTPOINT
+if [ "$?" -ne "0" ] ; then
+ $ECHO -e "\033[1mCopying the rootfs failed.\033[0m"
+ echo "Check for error messages from cp"
+ sudo rm $@
+ exit 1
+fi
+
+#unmount again
+sudo umount $MOUNTPOINT
+
+#if the mounting was unsuccesful all rootfs data now still is in MOUNTPOINT, and $@ contains an empty fs
+#delete $@ in that case to fail early
+sync
+FAILED=`ls $MOUNTPOINT | wc -l`
+if [ "$FAILED" -ne "0" ] ; then
+ $ECHO -e "\033[1mMounting the loopdevice $@ failed.\033[0m"
+ sudo rm $@
+ exit 1
+fi
diff --git a/recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30.img.cfg b/recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30.img.cfg
new file mode 100644
index 0000000..d797a13
--- /dev/null
+++ b/recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30.img.cfg
@@ -0,0 +1,22 @@
+# Copyright (C) 2013-2014 Toradex, Inc.
+#
+# This software is provided 'as-is', without any express or implied
+# warranty. In no event will the authors be held liable for any damages
+# arising from the use of this software.
+#
+# Permission is granted to anyone to use this software for any purpose,
+# including commercial applications, and to alter it and redistribute it
+# freely, subject to the following restrictions:
+#
+# 1. The origin of this software must not be misrepresented; you must not
+# claim that you wrote the original software. If you use this software
+# in a product, an acknowledgment in the product documentation would be
+# appreciated but is not required.
+# 2. Altered source versions must be plainly marked as such, and must not be
+# misrepresented as being the original software.
+# 3. This notice may not be removed or altered from any source distribution.
+
+Version = 0x00020001;
+Bctcopy = 1;
+Bctfile = colibri_t30_12MHz_NT5CC256M16CP-DI_400MHz.bct;
+BootLoader = u-boot-dtb-tegra.bin,0x80108000,0x80108000,Complete;
diff --git a/recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30_12MHz_NT5CC256M16CP-DI_400MHz.bct b/recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30_12MHz_NT5CC256M16CP-DI_400MHz.bct
new file mode 100755
index 0000000..109f0c0
--- /dev/null
+++ b/recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30_12MHz_NT5CC256M16CP-DI_400MHz.bct
Binary files differ
diff --git a/recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30_12MHz_NT5CC256M16CP-DI_533MHz.bct b/recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30_12MHz_NT5CC256M16CP-DI_533MHz.bct
new file mode 100644
index 0000000..0349242
--- /dev/null
+++ b/recipes/images/files/colibri-t30/colibri-t30_bin/colibri_t30_12MHz_NT5CC256M16CP-DI_533MHz.bct
Binary files differ
diff --git a/recipes/images/files/colibri-t30/colibri-t30_bin/configblock.bin b/recipes/images/files/colibri-t30/colibri-t30_bin/configblock.bin
new file mode 100644
index 0000000..bd184b7
--- /dev/null
+++ b/recipes/images/files/colibri-t30/colibri-t30_bin/configblock.bin
Binary files differ
diff --git a/recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.img b/recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.img
new file mode 100644
index 0000000..0715856
--- /dev/null
+++ b/recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.img
Binary files differ
diff --git a/recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.scr b/recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.scr
new file mode 100644
index 0000000..df18194
--- /dev/null
+++ b/recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.scr
@@ -0,0 +1,35 @@
+test -n ${drive} || setenv drive 1
+
+setenv check_1 'setenv conf_blk_offset 0x1fff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_2 'setenv conf_blk_offset 0xfff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_3 'setenv conf_blk_offset 0x7ff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_configblock 'setexpr toradex_oui_addr $loadaddr + 8; mmc dev 0 1; run check_1 || run check_2 || run check_3; crc32 -v $toradex_oui_addr 3 94305232'
+
+setenv migrate_1 'mmc dev 0 0; mmc read ${loadaddr} 6000 1; setenv conf_blk_offset 0x1fff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_2 'mmc dev 0 0; mmc read ${loadaddr} 8000 1; setenv conf_blk_offset 0xfff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_3 'mmc dev 0 0; mmc read ${loadaddr} 9000 1; setenv conf_blk_offset 0x7ff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_4 'mmc dev 0 0; mmc read ${loadaddr} 34000 1; setenv conf_blk_offset 0x1fff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_5 'mmc dev 0 0; mmc read ${loadaddr} 36000 1; setenv conf_blk_offset 0xfff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_6 'mmc dev 0 0; mmc read ${loadaddr} 37000 1; setenv conf_blk_offset 0x7ff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_configblock 'setexpr toradex_oui_addr $loadaddr + 8; run migrate_1; run migrate_2; run migrate_3; run migrate_4; run migrate_5; run migrate_6'
+
+setenv update_configblock 'tftpboot ${loadaddr} configblock.bin && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && run check_configblock; mmc write $loadaddr $conf_blk_offset ${blkcnt}'
+
+setenv update_uboot 'tftpboot ${loadaddr} colibri_t30.img && if setexpr blkcnt $filesize + 0x1ff; then setexpr blkcnt ${blkcnt} / 0x200; else setenv blkcnt 0x500; fi && mmc dev 0 1 && mmc write ${loadaddr} 0x0 ${blkcnt}'
+
+setenv update_kernel 'tftpboot ${loadaddr} uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+
+setenv update_fdt 'tftpboot ${loadaddr} ${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}'
+
+setenv update_1 'tftpboot ${loadaddr} mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'tftpboot ${loadaddr} boot.vfat && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && mmc dev 0 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
+setenv update_3 'tftpboot ${loadaddr} root.ext3 && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && mmc dev 0 0 && mmc write ${loadaddr} 0xa000 ${blkcnt}'
+
+setenv echo_v2.3b1 echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate_v2.3b1\" to complete update"
+setenv migrate_v2.3b1 'run migrate_configblock; run update_new'
+setenv update_v2.3b1 'run update_uboot && run echo_v2.3b1'
+
+setenv update_new 'run check_configblock || run migrate_configblock; run update_uboot; run update_1; run update_2; run update_3; reset'
+setenv update 'if test -v $ver; then run update_new; else run update_v2.3b1; fi'
+
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/colibri-t30/colibri-t30_bin/flash_mmc.img b/recipes/images/files/colibri-t30/colibri-t30_bin/flash_mmc.img
new file mode 100644
index 0000000..191d157
--- /dev/null
+++ b/recipes/images/files/colibri-t30/colibri-t30_bin/flash_mmc.img
Binary files differ
diff --git a/recipes/images/files/colibri-t30/colibri-t30_bin/flash_mmc.scr b/recipes/images/files/colibri-t30/colibri-t30_bin/flash_mmc.scr
new file mode 100644
index 0000000..024a3b8
--- /dev/null
+++ b/recipes/images/files/colibri-t30/colibri-t30_bin/flash_mmc.scr
@@ -0,0 +1,35 @@
+test -n ${drive} || setenv drive 1
+
+setenv check_1 'setenv conf_blk_offset 0x1fff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_2 'setenv conf_blk_offset 0xfff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_3 'setenv conf_blk_offset 0x7ff; mmc read $loadaddr $conf_blk_offset 1'
+setenv check_configblock 'setexpr toradex_oui_addr $loadaddr + 8; mmc dev 0 1; run check_1 || run check_2 || run check_3; crc32 -v $toradex_oui_addr 3 94305232'
+
+setenv migrate_1 'mmc dev 0 0; mmc read ${loadaddr} 6000 1; setenv conf_blk_offset 0x1fff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_2 'mmc dev 0 0; mmc read ${loadaddr} 8000 1; setenv conf_blk_offset 0xfff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_3 'mmc dev 0 0; mmc read ${loadaddr} 9000 1; setenv conf_blk_offset 0x7ff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_4 'mmc dev 0 0; mmc read ${loadaddr} 34000 1; setenv conf_blk_offset 0x1fff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_5 'mmc dev 0 0; mmc read ${loadaddr} 36000 1; setenv conf_blk_offset 0xfff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_6 'mmc dev 0 0; mmc read ${loadaddr} 37000 1; setenv conf_blk_offset 0x7ff; crc32 -v $toradex_oui_addr 3 94305232 && mmc dev 0 1 && mmc write $loadaddr $conf_blk_offset 1'
+setenv migrate_configblock 'setexpr toradex_oui_addr $loadaddr + 8; run migrate_1; run migrate_2; run migrate_3; run migrate_4; run migrate_5; run migrate_6'
+
+setenv update_configblock 'load mmc ${drive}:1 ${loadaddr} configblock.bin && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && run check_configblock; mmc write $loadaddr $conf_blk_offset ${blkcnt}'
+
+setenv update_uboot 'fatload mmc ${drive}:1 ${loadaddr} colibri_t30.img && if setexpr blkcnt $filesize + 0x1ff; then setexpr blkcnt ${blkcnt} / 0x200; else setenv blkcnt 0x500; fi && mmc dev 0 1 && mmc write ${loadaddr} 0x0 ${blkcnt}'
+
+setenv update_kernel 'load mmc ${drive}:1 ${loadaddr} uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+
+setenv update_fdt 'load mmc ${drive}:1 ${loadaddr} ${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}'
+
+setenv update_1 'load mmc ${drive}:1 ${loadaddr} mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'load mmc ${drive}:1 ${loadaddr} boot.vfat && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && mmc dev 0 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
+setenv update_3 'load mmc ${drive}:1 ${loadaddr} root.ext3 && setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 && mmc dev 0 0 && mmc write ${loadaddr} 0xa000 ${blkcnt}'
+
+setenv echo_v2.3b1 echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate_v2.3b1\" to complete update"
+setenv migrate_v2.3b1 'run migrate_configblock; run update_new'
+setenv update_v2.3b1 'run update_uboot && run echo_v2.3b1'
+
+setenv update_new 'run check_configblock || run migrate_configblock; run update_uboot; run update_1; run update_2; run update_3; reset'
+setenv update 'if test -v $ver; then run update_new; else run update_v2.3b1; fi'
+
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/colibri-t30/colibri-t30_bin/mk-u-boot-scripts.sh b/recipes/images/files/colibri-t30/colibri-t30_bin/mk-u-boot-scripts.sh
new file mode 100755
index 0000000..2a4e898
--- /dev/null
+++ b/recipes/images/files/colibri-t30/colibri-t30_bin/mk-u-boot-scripts.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+for f in *.scr
+do
+ mkimage -T script -C none -n 'Flash Apalis iMX6' -d $f `basename $f .scr`.img
+done
diff --git a/recipes/images/files/colibri-t30/create_configblock.sh b/recipes/images/files/colibri-t30/create_configblock.sh
new file mode 100755
index 0000000..a33600a
--- /dev/null
+++ b/recipes/images/files/colibri-t30/create_configblock.sh
@@ -0,0 +1,206 @@
+#! /bin/sh
+
+Usage()
+{
+ echo "create_configblock creates a configblock binary from the info on the module sticker."
+ echo "This can be used when the configblock got lost during a failed update attempt."
+ echo "The created configblock can then be written to the module with:"
+ echo "update.sh -c"
+ echo ""
+}
+
+while getopts "h" Option ; do
+ case $Option in
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [ "$#" -eq 1 ] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ esac
+done
+
+# autotect MODTYPE from from rootfs directory
+CNT=`grep -c "T20" rootfs/etc/issue || true`
+if [ ${CNT} -ge 1 ] ; then
+ echo "Colibri T20 rootfs detected"
+ MODTYPE=colibri-t20
+ BOOT_DEVICE=nand
+else
+ CNT=`grep -c "T30" rootfs/etc/issue || true`
+ if [ ${CNT} -ge 1 ] ; then
+ CNT=`grep -c "Apalis" rootfs/etc/issue || true`
+ if [ ${CNT} -ge 1 ] ; then
+ echo "Apalis T30 rootfs detected"
+ MODTYPE=apalis-t30
+ else
+ echo "Colibri T30 rootfs detected"
+ MODTYPE=colibri-t30
+ fi
+ else
+ CNT=`grep -c "VF" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ CNT=`grep -c "VF50" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Colibri VF50 rootfs detected"
+ MODTYPE=colibri-vf50
+ else
+ echo "Colibri VF61 rootfs detected"
+ MODTYPE=colibri-vf61
+ fi
+ else
+ CNT=`grep -c "Colibri_iMX6" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Colibri iMX6 rootfs detected"
+ MODTYPE=colibri-imx6
+ else
+ CNT=`grep -ic "imx6" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Apalis iMX6 rootfs detected"
+ MODTYPE=apalis-imx6
+ else
+ echo "can not detect modulue type from ./rootfs/etc/issue"
+ echo "exiting"
+ exit 1
+ fi
+ fi
+ fi
+ fi
+fi
+
+echo "Enter the modules serial number on the modules sticker or"
+echo "use a barcode scanner to enter the content of the stickers barcode"
+
+# read a barcode and test it to be 8 or 16 numbers only 0025100102489109 0115100000000024
+# 1234567890123456 1234567890123456
+until [ "${BARCODE}x" != "x" ]
+do
+ read BARCODE
+ #remove all whitespace
+ BARCODE=`echo $BARCODE | tr -d ' '`
+ #get strlen and the number of numeric characters
+ STRLEN=`echo $BARCODE | wc -c`
+ NUMCNT=`echo $BARCODE | sed 's/[^0-9]//g' | wc -c`
+ if [ $STRLEN -ne 17 ] ; then
+ if [ $STRLEN -ne 9 ] ; then
+ echo "The serial number must be 8 numbers long (the barcode 16)"
+ BARCODE=""
+ fi
+ fi
+ if [ $NUMCNT -ne $STRLEN ] ; then
+ echo "The serial number must contain all numeric characters"
+ BARCODE=""
+ fi
+done
+DATECODE=19700101000000
+if [ $STRLEN -eq 17 ] ; then
+ SERIALNR=`echo $BARCODE | awk 'BEGIN{ FIELDWIDTHS = "8 8"} {print $2}'`
+ PRODUCTNR=`echo $BARCODE | awk 'BEGIN{ FIELDWIDTHS = "8 8"} {print $1}'`
+else
+ SERIALNR=$BARCODE
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+ case ${MODTYPE} in
+ "colibri-t20")
+ RAM_SIZE=256
+ echo "Enter the RAM size ( 256 / 512 ):"
+ read RAM_SIZE
+ echo "Enter I for IT version, nothing otherwise"
+ read IT
+ if [ $RAM_SIZE -eq 512 ] ; then
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0022"
+ else
+ PROD_ID="0021"
+ fi
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+
+ else
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0024"
+ else
+ PROD_ID="0020"
+ fi
+ PROD_ID="0020"
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_256.bin
+ fi
+ ;;
+ "colibri-t30")
+ PROD_ID="0023"
+ ;;
+ "apalis-t30")
+ PROD_ID="0025"
+ ;;
+ "colibri-vf50")
+ PROD_ID="0010"
+ ;;
+ "colibir-vf61")
+ PROD_ID="0011"
+ ;;
+ "apalis-imx6")
+ PROD_ID="0027"
+ ;;
+ "colibri-imx6")
+ RAM_SIZE=256
+ echo "Enter the RAM size ( 256 / 512 ):"
+ read RAM_SIZE
+ echo "Enter I for IT version, nothing otherwise"
+ read IT
+ if [ $RAM_SIZE -eq 512 ] ; then
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0017"
+ else
+ PROD_ID="0015"
+ fi
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+
+ else
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0016"
+ else
+ PROD_ID="0014"
+ fi
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+ fi
+ ;;
+ esac
+
+ echo "Enter the module version, e.g. V1.2 C"
+ read PRODVERSION
+ VER_MAJ=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $2}'`
+ VER_MIN=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $4}'`
+ #VARIANT: A=0, B=1 ...
+ VARIANT=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $6}'`
+ VARIANT=`printf "%d\n" "'$VARIANT"`
+ VARIANT=`expr $VARIANT - 65`
+ if [ "$VARIANT" -lt 10 ] ; then
+ VARIANT=0$VARIANT
+ fi
+ PRODUCTNR=${PROD_ID}${VER_MAJ}${VER_MIN}${VARIANT}
+fi
+
+#write the config block file
+if [ "${MODTYPE}" = "colibri-t20" ] ; then
+ PROD_ID=`echo $PRODUCTNR | awk 'BEGIN{ FIELDWIDTHS = "4 4"} {print $1}'`
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_256.bin
+ if [ ${PROD_ID} = "0021" ] ; then
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+ fi
+ if [ ${PROD_ID} = "0022" ] ; then
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+ fi
+else
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+fi
+sudo chown ${USER}: ${MODTYPE}_bin
+sudo rm -f $CONFIGBLOCK_FILE
+#file header
+awk 'function sc(c) {return (c<128?c:(c-256))} BEGIN{printf "%c%c%c%c",0,64,1,-49}' > $CONFIGBLOCK_FILE
+#mac addr / serial
+echo $SERIALNR | awk 'function sc(c) {return (c<128?c:(c-256))} {printf "%c%c%c%c%c%c%c%c%c%c%c%c",2,64,0,0, 0,20,45, sc(int($0/256/256)), sc(int($0/256)%256), sc($0%256),0,0 }' >> $CONFIGBLOCK_FILE
+#product describtion, $1 char 0/1: ??, $2 char 2/3: ProdID, $3 char 4:VerMaj, $4 char 5:VerMin, $5 char 6/7:Variant
+echo $PRODUCTNR | awk 'BEGIN{ FIELDWIDTHS = "2 2 1 1 2"} function sc(c) {return (c<128?c:(c-256))} {printf "%c%c%c%c%c%c%c%c%c%c%c%c",2,64,8,0 ,sc($3),0, sc($4),0, sc($5),0, sc($2),0 }' >> $CONFIGBLOCK_FILE
+#fill to 32 bytes
+awk 'function sc(c) {return (c<128?c:(c-256))} BEGIN{printf "%c%c%c%c",-1,-1,-1,-1}' >> $CONFIGBLOCK_FILE
+
+exit 0
diff --git a/recipes/images/files/colibri-t30/tegra-uboot-flasher/genext3fs.sh b/recipes/images/files/colibri-t30/tegra-uboot-flasher/genext3fs.sh
new file mode 100755
index 0000000..3c8ecc8
--- /dev/null
+++ b/recipes/images/files/colibri-t30/tegra-uboot-flasher/genext3fs.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+#creates a file containing a ext3 binary blob of the content of the ../rootfs folder
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+
+MOUNTPOINT="mnt/trdx-rootfs"
+
+Usage()
+{
+ echo "creates a file containing a ext3 binary blob. Output file name taken from command line"
+ echo "Usage: genext3fs.sh [OPTION]... dest_file_name"
+ echo "-h : Prints this message"
+ echo "-b : Sets the partition size in MBytes, default 256"
+ echo "-d : Selects the directory which contains the partition content, default ../rootfs"
+ echo ""
+}
+
+PARTITIONSIZE=256
+SRCPATH=../rootfs
+
+while getopts "b:d:h" Option ; do
+ case $Option in
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [[ "$#" -eq "1" ]] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ b) PARTITIONSIZE=$OPTARG
+ ;;
+ d) SRCPATH=$OPTARG
+ ;;
+ esac
+done
+#adjust the commandline arg for the now used options
+shift $(($OPTIND - 1))
+
+#create the file used for the loopbackdevice and format it for ext3
+#answer y to "is not a block special device"
+dd if=/dev/zero of=$@ bs=1024k count=$PARTITIONSIZE
+mkfs.ext3 -F -L arm $@
+#disable fsck checks based on mount count or time interval
+tune2fs -c 0 -i 0 $@
+
+#prepare mountpoint for the loopdevice
+sudo mkdir -p $MOUNTPOINT
+sudo umount $MOUNTPOINT &> /dev/null
+sudo rm -rf $MOUNTPOINT/*
+#mount the file as a loopdevice
+#there seems to be a race between mkfs.ext3 not yet finished and mount already trying to mount, so try until it works
+MOUNTED=0
+while [ "$MOUNTED" -eq "0" ] ; do
+ sync
+ sleep 1
+ sudo mount $@ $MOUNTPOINT/ -o loop -t ext3
+ MOUNTED=`mount | grep -c "$MOUNTPOINT"`
+done
+#extract rootfs into the file
+sudo cp -rpP $SRCPATH/* $MOUNTPOINT
+if [ "$?" -ne "0" ] ; then
+ $ECHO -e "\033[1mCopying the rootfs failed.\033[0m"
+ echo "Check for error messages from cp"
+ sudo rm $@
+ exit 1
+fi
+
+#unmount again
+sudo umount $MOUNTPOINT
+
+#if the mounting was unsuccesful all rootfs data now still is in MOUNTPOINT, and $@ contains an empty fs
+#delete $@ in that case to fail early
+sync
+FAILED=`ls $MOUNTPOINT | wc -l`
+if [ "$FAILED" -ne "0" ] ; then
+ $ECHO -e "\033[1mMounting the loopdevice $@ failed.\033[0m"
+ sudo rm $@
+ exit 1
+fi
diff --git a/recipes/images/files/colibri-t30/update.sh b/recipes/images/files/colibri-t30/update.sh
new file mode 100755
index 0000000..21b4ac6
--- /dev/null
+++ b/recipes/images/files/colibri-t30/update.sh
@@ -0,0 +1,273 @@
+#!/bin/sh
+# Prepare files needed for flashing a Apalis/Colibri T30 module
+#
+# inspired by meta-fsl-arm/classes/image_types_fsl.bbclass
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+#some distros have fs tools only in root's path
+PARTED=`which parted` 2> /dev/null
+if [ -e "$PARTED" ] ; then
+ MKFSVFAT=`which mkfs.vfat`
+else
+ PARTED=`sudo which parted`
+ MKFSVFAT=`sudo which mkfs.vfat`
+fi
+
+Flash()
+{
+ echo ""
+ echo "To flash the Apalis/Colibri T30 module, boot the module to the U-Boot prompt and"
+ echo ""
+ echo "when using a SD-card, insert the SD-card and enter:"
+ echo "run setupdate"
+ echo ""
+ echo "when using tftp, connect Ethernet and enter:"
+ echo "tftp \$loadaddr flash_eth.img ; source \$loadaddr"
+ echo ""
+ echo "then enter to update all:"
+ echo "run update"
+ echo ""
+ echo "to update a single component enter one of:"
+ echo "run update_uboot"
+ echo "run update_kernel"
+ echo ""
+ echo ""
+ echo "If you don't have a working U-Boot anymore, connect your PC to the module's"
+ echo "USB client port, bring the module in the serial download mode and start"
+ echo "the update.sh script with the -d option. This will copy U-Boot into the"
+ echo "modules RAM and execute it."
+}
+
+Usage()
+{
+ echo ""
+ echo "Prepares and copies files for flashing the internal eMMC of a Apalis/Colibri T30"
+ echo ""
+ echo "Will require a running U-Boot on the target. Either one already flashed"
+ echo "on the eMMC or one copied over usb into the module's RAM"
+ echo ""
+ echo "-d : use USB connection to copy and execute U-Boot to the module's RAM"
+ echo "-h : Prints this message"
+ echo "-o directory : output directory, defaults to /media/KERNEL"
+ echo " if this is on a SD card, it should be the"
+ echo " first partition formated with VFAT"
+ echo ""
+ echo "Example \"./update.sh\" copies the requiered files to /media/KERNEL/"
+ echo "Example \"./update.sh -o /srv/tftp/\" copies the requiered files to /srv/tftp/"
+ echo ""
+ echo ""
+ Flash
+}
+
+#initialise options
+UBOOT_RECOVERY=0
+OUT_DIR="/media/KERNEL"
+MIN_PARTITION_FREE_SIZE=100
+ROOTFSPATH=rootfs
+# No devicetree by default
+KERNEL_DEVICETREE=""
+KERNEL_IMAGETYPE="uImage"
+
+while getopts "dho:" Option ; do
+ case $Option in
+ d) UBOOT_RECOVERY=1
+ ;;
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [ "$#" -eq 1 ] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ o) OUT_DIR=$OPTARG
+ ;;
+ esac
+done
+
+# autotect MODTYPE from from rootfs directory
+CNT=`grep -ic "t30" rootfs/etc/issue || true`
+if [ "$CNT" -ge 1 ] ; then
+ CNT=`grep -ic "apalis" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Apalis T30 rootfs detected"
+ MODTYPE=apalis-t30
+ IMAGEFILE=root.ext3
+ U_BOOT_BINARY=u-boot-dtb-tegra.bin
+ KERNEL_DEVICETREE="tegra30-apalis-eval.dtb"
+ LOCPATH="tegra-uboot-flasher"
+ # eMMC size [in sectors of 512]
+ EMMC_SIZE=$(expr 1024 \* 3500 \* 2)
+ BCT=apalis_t30_12MHz_MT41K512M8RH-125_533MHz.bct
+ CBOOT_IMAGE=apalis_t30.img
+ else
+ echo "Colibri T30 rootfs detected"
+ MODTYPE=colibri-t30
+ IMAGEFILE=root.ext3
+ U_BOOT_BINARY=u-boot-dtb-tegra.bin
+ KERNEL_DEVICETREE="tegra30-colibri-eval-v3.dtb"
+ LOCPATH="tegra-uboot-flasher"
+ EMMC_SIZE=$(expr 1024 \* 2000 \* 2)
+ # with new kernel, boot with 400MHz, then switch between 400 & 800
+ BCT=colibri_t30_12MHz_NT5CC256M16CP-DI_400MHz.bct
+# BCT=colibri_t30_12MHz_NT5CC256M16CP-DI_533MHz.bct
+ CBOOT_IMAGE=colibri_t30.img
+ fi
+else
+ echo "can not detect module type from ./rootfs/etc/issue"
+ echo "exiting"
+ exit 1
+fi
+BINARIES=${MODTYPE}_bin
+
+#is only U-Boot to be copied to RAM?
+if [ "$UBOOT_RECOVERY" -ge 1 ] ; then
+ cd ${LOCPATH}
+ sudo ./tegrarcm --bct=../${BINARIES}/${BCT} --bootloader=../${BINARIES}/${U_BOOT_BINARY} --loadaddr=0x80108000
+ exit 1
+fi
+
+# is OUT_DIR an existing directory?
+if [ ! -d "$OUT_DIR" ] ; then
+ echo "$OUT_DIR" "does not exist, exiting"
+ exit 1
+fi
+
+#sanity check for correct untared rootfs
+DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'`
+if [ "${DEV_OWNER}x" != "rootx" ]
+then
+ $ECHO -e "rootfs/dev is not owned by root, but it should!"
+ $ECHO -e "\033[1mPlease unpack the tarball with root rights.\033[0m"
+ $ECHO -e "e.g. sudo tar xjvf Apalis_T30_LinuxImageV2.1_20140201.tar.bz2"
+ exit 1
+fi
+
+#sanity check for existens of U-Boot and kernel
+[ -e ${BINARIES}/${U_BOOT_BINARY} ] || { echo "${BINARIES}/${U_BOOT_BINARY} does not exist"; exit 1; }
+[ -e ${BINARIES}/uImage ] || { echo "${BINARIES}/uImage does not exist"; exit 1; }
+
+#sanity check for some programs
+MCOPY=`sudo which mcopy`
+[ "${MCOPY}x" != "x" ] || { echo >&2 "Program mcopy not available. Aborting."; exit 1; }
+sudo ${PARTED} -v >/dev/null 2>&1 || { echo >&2 "Program parted not available. Aborting."; exit 1; }
+[ "${MKFSVFAT}x" != "x" ] || { echo >&2 "Program mkfs.vfat not available. Aborting."; exit 1; }
+MKFSEXT3=`sudo which mkfs.ext3`
+[ "${MKFSEXT3}x" != "x" ] || { echo >&2 "Program mkfs.ext3 not available. Aborting."; exit 1; }
+awk -V >/dev/null 2>&1 || { echo >&2 "Program awk not available. Aborting."; exit 1; }
+dd --help >/dev/null 2>&1 || { echo >&2 "Program dd not available. Aborting."; exit 1; }
+tegra-uboot-flasher/cbootimage -h >/dev/null 2>&1
+[ "$?" -lt 2 ] || { echo >&2 "Program cbootimage not available. 32bit compatibility libs? Aborting."; exit 1; }
+
+#make the directory with the outputfiles writable
+sudo chown $USER: ${BINARIES}
+
+#make a file with the used versions for U-Boot, kernel and rootfs
+rm ${BINARIES}/versions.txt
+touch ${BINARIES}/versions.txt
+echo "Component Versions" > ${BINARIES}/versions.txt
+basename "`readlink -e ${BINARIES}/${U_BOOT_BINARY}`" >> ${BINARIES}/versions.txt
+basename "`readlink -e ${BINARIES}/uImage`" >> ${BINARIES}/versions.txt
+$ECHO -n "Rootfs " >> ${BINARIES}/versions.txt
+grep -i t30 rootfs/etc/issue >> ${BINARIES}/versions.txt
+
+
+# The emmc layout used is:
+#
+# boot area partition 1 aka eMMC boot sector:
+#
+# with cbootimage containing BCT and U-Boot boot loader
+#
+# user area aka general purpose eMMC region:
+#
+# 0 -> IMAGE_ROOTFS_ALIGNMENT - reserved to bootloader (not partitioned)
+# IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE - kernel and other data
+# BOOT_SPACE -> SDIMG_SIZE - rootfs
+#
+# Default Free space = 1.3x
+# Use IMAGE_OVERHEAD_FACTOR to add more space
+# <--------->
+# 4MiB 16MiB SDIMG_ROOTFS 4MiB
+# <-----------------------> <----------> <----------------------> <------------------------------>
+# ------------------------ ------------ ------------------------ -------------------------------
+# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE | IMAGE_ROOTFS_ALIGNMENT |
+# ------------------------ ------------ ------------------------ -------------------------------
+# ^ ^ ^ ^ ^
+# | | | | |
+# 0 4096 4MiB + 16MiB 4MiB + 16Mib + SDIMG_ROOTFS 4MiB + 16MiB + SDIMG_ROOTFS + 4MiB
+#
+# with the U-Boot environment at 512 * 1024, the config block is at 640 * 1024
+
+
+# generate cbootimage containing BCT and U-Boot boot loader
+cd ${BINARIES}
+sudo ../${LOCPATH}/cbootimage -s tegra30 ${CBOOT_IMAGE}.cfg ${CBOOT_IMAGE}
+cd ..
+
+
+# Boot partition [in sectors of 512]
+BOOT_START=$(expr 4096 \* 2)
+# Rootfs partition [in sectors of 512]
+ROOTFS_START=$(expr 20480 \* 2)
+# Boot partition volume id
+BOOTDD_VOLUME_ID="Boot"
+
+#make the partition size size(rootfs used + MIN_PARTITION_FREE_SIZE)
+#add about 4% to the rootfs to account for fs overhead. (/1024/985 instead of /1024/1024).
+#add 512 bytes per file to account for small files
+NUMBER_OF_FILES=`sudo find ${ROOTFSPATH} | wc -l`
+EXT_SIZE=`sudo du -DsB1 ${ROOTFSPATH} | awk -v min=$MIN_PARTITION_FREE_SIZE -v f=${NUMBER_OF_FILES} \
+ '{rootfs_size=$1+f*512;rootfs_size=int(rootfs_size/1024/985); print (rootfs_size+min) }'`
+
+echo ""
+echo "Creating MBR file and do the partitioning"
+# Initialize a sparse file
+dd if=/dev/zero of=${BINARIES}/mbr.bin bs=512 count=0 seek=${EMMC_SIZE}
+${PARTED} -s ${BINARIES}/mbr.bin mklabel msdos
+${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary fat32 ${BOOT_START} $(expr ${ROOTFS_START} - 1 )
+# the partition spans to the end of the disk, even though the fs size will be smaller
+# on the target the fs is then grown to the full size
+${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary ext2 ${ROOTFS_START} $(expr ${EMMC_SIZE} \- ${ROOTFS_START} \- 1)
+${PARTED} -s ${BINARIES}/mbr.bin unit s print
+# get the size of the VFAT partition
+BOOT_BLOCKS=$(LC_ALL=C ${PARTED} -s ${BINARIES}/mbr.bin unit b print \
+ | awk '/ 1 / { print int(substr($4, 1, length($4 -1)) / 1024) }')
+# now crop the file to only the MBR size
+IMG_SIZE=512
+truncate -s $IMG_SIZE ${BINARIES}/mbr.bin
+
+
+echo ""
+echo "Creating VFAT partion image with the kernel"
+rm -f ${BINARIES}/boot.vfat
+${MKFSVFAT} -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${BINARIES}/boot.vfat $BOOT_BLOCKS
+export MTOOLS_SKIP_CHECK=1
+mcopy -i ${BINARIES}/boot.vfat -s ${BINARIES}/uImage ::/uImage
+
+# Copy device tree file
+if test -n "${KERNEL_DEVICETREE}"; then
+ for DTS_FILE in ${KERNEL_DEVICETREE}; do
+ DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
+ if [ -e "${BINARIES}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ]; then
+ kernel_bin="`readlink ${BINARIES}/${KERNEL_IMAGETYPE}`"
+ kernel_bin_for_dtb="`readlink ${BINARIES}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb | sed "s,$DTS_BASE_NAME,${MODTYPE},g;s,\.dtb$,.bin,g"`"
+ if [ "$kernel_bin" = "$kernel_bin_for_dtb" ]; then
+ mcopy -i ${BINARIES}/boot.vfat -s ${BINARIES}/${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb ::/${DTS_BASE_NAME}.dtb
+ #copy also to out_dir
+ sudo cp ${BINARIES}/${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb "$OUT_DIR/${DTS_BASE_NAME}.dtb"
+ fi
+ fi
+ done
+fi
+
+echo ""
+echo "Creating rootfs partion image"
+rm -f ${BINARIES}/${IMAGEFILE}
+sudo $LOCPATH/genext3fs.sh -d rootfs -b ${EXT_SIZE} ${BINARIES}/${IMAGEFILE} || exit 1
+
+
+#copy to $OUT_DIR
+sudo cp ${BINARIES}/configblock.bin ${BINARIES}/${CBOOT_IMAGE} ${BINARIES}/uImage ${BINARIES}/mbr.bin ${BINARIES}/boot.vfat ${BINARIES}/${IMAGEFILE} ${BINARIES}/flash*.img ${BINARIES}/versions.txt "$OUT_DIR"
+sync
+
+Flash
diff --git a/recipes/images/files/colibri-vf/README b/recipes/images/files/colibri-vf/README
new file mode 100644
index 0000000..d350ef7
--- /dev/null
+++ b/recipes/images/files/colibri-vf/README
@@ -0,0 +1,4 @@
+Toradex Linux BSP
+
+Use the update.sh script to update your module. Also check the Release Notes
+located in the same directory of the BSP release tarball.
diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/configblock.bin b/recipes/images/files/colibri-vf/colibri-vf_bin/configblock.bin
new file mode 100644
index 0000000..9998f4b
--- /dev/null
+++ b/recipes/images/files/colibri-vf/colibri-vf_bin/configblock.bin
Binary files differ
diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.img b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.img
new file mode 100644
index 0000000..d5f4b9e
--- /dev/null
+++ b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.img
Binary files differ
diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.scr b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.scr
new file mode 100644
index 0000000..bef0405
--- /dev/null
+++ b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.scr
@@ -0,0 +1,16 @@
+setenv create_bcb 'nand erase.part vf-bcb && writebcb 0x20000 0x20000'
+setenv update_configblock 'mw.l ${loadaddr} 0xffffffff 0x200 && tftpboot ${loadaddr} configblock.bin && nand write ${loadaddr} 0x800 0x800'
+
+setenv update_uboot 'tftpboot ${loadaddr} u-boot-nand.imx && nand erase.part u-boot && nand erase.part u-boot-env && nand write ${loadaddr} u-boot'
+setenv update_rootfs 'tftpboot ${loadaddr} ubifs.img && nand erase.part ubi && ubi part ubi && ubi createvol rootfs && ubi write ${loadaddr} rootfs ${filesize}'
+
+setenv echo_v2.1b3 echo "successfully updated U-Boot, power-cycle and enter \"tftpboot flash_eth.img ${loadaddr}\; source ${loadaddr}\; run migrate_v2.1b3\" to complete update"
+setenv migrate_v2.1b3 'nand read ${loadaddr} 0x40000 0x800 && nand erase.chip && writebcb 0x20000 0x20000 && nand write ${loadaddr} 0x800 0x800 && run update_new'
+setenv update_v2.1b3 'run update_uboot; run echo_v2.1b3'
+
+setenv mtdparts 'mtdparts=fsl_nfc:128k(vf-bcb)ro,1408k(u-boot)ro,512k(u-boot-env),-(ubi)'
+
+setenv update_new 'run update_uboot; run update_rootfs; reset'
+setenv update 'if test -v $ver; then run update_new; else run update_v2.1b3; fi'
+
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.img b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.img
new file mode 100644
index 0000000..98ace63
--- /dev/null
+++ b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.img
Binary files differ
diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.scr b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.scr
new file mode 100644
index 0000000..dcf1c15
--- /dev/null
+++ b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.scr
@@ -0,0 +1,16 @@
+setenv create_bcb 'nand erase.part vf-bcb && writebcb 0x20000 0x20000'
+setenv update_configblock 'mw.l ${loadaddr} 0xffffffff 0x200 && fatload mmc 0:1 ${loadaddr} configblock.bin && nand write ${loadaddr} 0x800 0x800'
+
+setenv update_uboot 'fatload mmc 0:1 ${loadaddr} u-boot-nand.imx && nand erase.part u-boot && nand erase.part u-boot-env && nand write ${loadaddr} u-boot'
+setenv update_rootfs 'fatload mmc 0:1 ${loadaddr} ubifs.img && nand erase.part ubi && ubi part ubi && ubi createvol rootfs && ubi write ${loadaddr} rootfs ${filesize}'
+
+setenv echo_v2.1b3 echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate_v2.1b3\" to complete update"
+setenv migrate_v2.1b3 'nand read ${loadaddr} 0x40000 0x800 && nand erase.chip && writebcb 0x20000 0x20000 && nand write ${loadaddr} 0x800 0x800 && run update_new'
+setenv update_v2.1b3 'run update_uboot; run echo_v2.1b3'
+
+setenv mtdparts 'mtdparts=fsl_nfc:128k(vf-bcb)ro,1408k(u-boot)ro,512k(u-boot-env),-(ubi)'
+
+setenv update_new 'run update_uboot; run update_rootfs; reset'
+setenv update 'if test -v $ver; then run update_new; else run update_v2.1b3; fi'
+
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/mk-u-boot-scripts.sh b/recipes/images/files/colibri-vf/colibri-vf_bin/mk-u-boot-scripts.sh
new file mode 100755
index 0000000..3c10ac4
--- /dev/null
+++ b/recipes/images/files/colibri-vf/colibri-vf_bin/mk-u-boot-scripts.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+for f in *.scr
+do
+ mkimage -T script -C none -n 'Flash Colibri VF' -d $f `basename $f .scr`.img
+done
+#mkimage -T script -C none -n 'Flash Colibri VF with data from SD card' -d flash_mmc.scr flash_mmc.img
+#mkimage -T script -C none -n 'Flash Colibri VF with u-boot from SD card' -d flash_mmc_u-boot.scr flash_mmc_u-boot.img
diff --git a/recipes/images/files/colibri-vf/create_configblock.sh b/recipes/images/files/colibri-vf/create_configblock.sh
new file mode 100755
index 0000000..759a9dc
--- /dev/null
+++ b/recipes/images/files/colibri-vf/create_configblock.sh
@@ -0,0 +1,193 @@
+#! /bin/sh
+
+Usage()
+{
+ echo "create_configblock creates a configblock binary from the info on the module sticker."
+ echo "This can be used when the configblock got lost during a failed update attempt."
+ echo ""
+ echo "The created config-block will be copied to the choosen output directory when running"
+ echo "the update.sh command. In order to write the config block, the boot configuration block"
+ echo "need to be recreated first:"
+ echo "run create_bcb"
+ echo "run update_configblock"
+ echo ""
+}
+
+while getopts "h" Option ; do
+ case $Option in
+ h) Usage
+ # Exit if only usage (-h) was specfied.
+ if [[ $# -eq 1 ]] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ esac
+done
+
+# autotect MODTYPE from from rootfs directory
+CNT=`grep -c "T20" rootfs/etc/issue || true`
+if [ ${CNT} -ge 1 ] ; then
+ echo "Colibri T20 rootfs detected"
+ MODTYPE=colibri-t20
+ BOOT_DEVICE=nand
+else
+ CNT=`grep -c "T30" rootfs/etc/issue || true`
+ if [ ${CNT} -ge 1 ] ; then
+ CNT=`grep -c "Apalis" rootfs/etc/issue || true`
+ if [ ${CNT} -ge 1 ] ; then
+ echo "Apalis T30 rootfs detected"
+ MODTYPE=apalis-t30
+ else
+ echo "Colibri T30 rootfs detected"
+ MODTYPE=colibri-t30
+ fi
+ else
+ CNT=`grep -c "VF" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Colibri VF rootfs detected"
+
+ MODTYPE=colibri-vf
+ else
+ echo "can not detect modulue type from ./rootfs/etc/issue"
+ echo "exiting"
+ exit 1
+ fi
+ fi
+fi
+
+echo "Enter the modules serial number on the modules sticker or"
+echo "use a barcode scanner to enter the content of the stickers barcode"
+
+# read a barcode and test it to be 8 or 16 numbers only 0025100102489109 0115100000000024
+# 1234567890123456 1234567890123456
+until [ "${BARCODE}x" != "x" ]
+do
+ read BARCODE
+ #remove all whitespace
+ BARCODE=`echo $BARCODE | tr -d ' '`
+ #get strlen and the number of numeric characters
+ STRLEN=`echo $BARCODE | wc -c`
+ NUMCNT=`echo $BARCODE | sed 's/[^0-9]//g' | wc -c`
+ if [ $STRLEN -ne 17 ] ; then
+ if [ $STRLEN -ne 9 ] ; then
+ echo "The serial number must be 8 numbers long (the barcode 16)"
+ BARCODE=""
+ fi
+ fi
+ if [ $NUMCNT -ne $STRLEN ] ; then
+ echo "The serial number must contain all numeric characters"
+ BARCODE=""
+ fi
+done
+DATECODE=19700101000000
+if [ $STRLEN -eq 17 ] ; then
+ SERIALNR=`echo $BARCODE | awk 'BEGIN{ FIELDWIDTHS = "8 8"} {print $2}'`
+ PRODUCTNR=`echo $BARCODE | awk 'BEGIN{ FIELDWIDTHS = "8 8"} {print $1}'`
+else
+ SERIALNR=$BARCODE
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
+ case ${MODTYPE} in
+ "colibri-t20")
+ RAM_SIZE=256
+ echo "Enter the RAM size ( 256 / 512 ):"
+ read RAM_SIZE
+ echo "Enter I for IT version, nothing otherwise"
+ read IT
+ if [ $RAM_SIZE -eq 512 ] ; then
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0022"
+ else
+ PROD_ID="0021"
+ fi
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+
+ else
+ if [ "$IT"x = "I" ] ; then
+ PROD_ID="0024"
+ else
+ PROD_ID="0020"
+ fi
+ PROD_ID="0020"
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_256.bin
+ fi
+ ;;
+ "colibri-t30")
+ PROD_ID="0023"
+ ;;
+ "apalis-t30")
+ PROD_ID="0025"
+ ;;
+ "colibri-vf")
+ echo "Enter 50 for a Colibri VF50 or 61 for a Colibri VF61"
+ VF_TYPE=""
+ until [ "${VF_TYPE}x" != "x" ]
+ do
+ read VF_TYPE
+ #remove all whitespace
+ VF_TYPE=`echo $VF_TYPE | tr -d ' '`
+ #get strlen and the number of numeric characters
+ if [ "${VF_TYPE}" != "61" ] ; then
+ if [ "${VF_TYPE}" != "50" ] ; then
+ echo "Only 50 or 61 valid, try again"
+ VF_TYPE=""
+ fi
+ fi
+ done
+
+ echo "Enter I for IT version, nothing otherwise"
+ read IT
+
+ if [ "$VF_TYPE" = "50" ] ; then
+ if [ "$IT" = "I" ] ; then
+ PROD_ID="0013"
+ else
+ PROD_ID="0010"
+ fi
+ elif [ "$VF_TYPE" = "61" ] ; then
+ if [ "$IT" = "I" ] ; then
+ PROD_ID="0012"
+ else
+ PROD_ID="0011"
+ fi
+ fi
+ ;;
+ esac
+
+ echo "Enter the module version, e.g. V1.2 C"
+ read PRODVERSION
+ VER_MAJ=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $2}'`
+ VER_MIN=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $4}'`
+ #VARIANT: A=0, B=1 ...
+ VARIANT=`echo $PRODVERSION | awk 'BEGIN{ FIELDWIDTHS = "1 1 1 1 1 1"} {print $6}'`
+ VARIANT=`printf "%d\n" "'$VARIANT"`
+ VARIANT=`expr $VARIANT - 65`
+ if [ "$VARIANT" -lt 10 ] ; then
+ VARIANT=0$VARIANT
+ fi
+ PRODUCTNR=${PROD_ID}${VER_MAJ}${VER_MIN}${VARIANT}
+fi
+
+#write the config block file
+if [ "${MODTYPE}" = "colibri-t20" ] ; then
+ PROD_ID=`echo $PRODUCTNR | awk 'BEGIN{ FIELDWIDTHS = "4 4"} {print $1}'`
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_256.bin
+ if [ ${PROD_ID} = "0021" ] ; then
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+ fi
+ if [ ${PROD_ID} = "0022" ] ; then
+ CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock_512.bin
+ fi
+fi
+sudo chown ${USER}: `dirname $CONFIGBLOCK_FILE`
+sudo rm -f $CONFIGBLOCK_FILE
+#file header
+awk 'function sc(c) {return (c<128?c:(c-256))} BEGIN{printf "%c%c%c%c",0,64,1,-49}' > $CONFIGBLOCK_FILE
+#mac addr / serial
+echo $SERIALNR | awk 'function sc(c) {return (c<128?c:(c-256))} {printf "%c%c%c%c%c%c%c%c%c%c%c%c",2,64,0,0, 0,20,45, sc(int($0/256/256)), sc(int($0/256)%256), sc($0%256),0,0 }' >> $CONFIGBLOCK_FILE
+#product describtion, $1 char 0/1: ??, $2 char 2/3: ProdID, $3 char 4:VerMaj, $4 char 5:VerMin, $5 char 6/7:Variant
+echo $PRODUCTNR | awk 'BEGIN{ FIELDWIDTHS = "2 2 1 1 2"} function sc(c) {return (c<128?c:(c-256))} {printf "%c%c%c%c%c%c%c%c%c%c%c%c",2,64,8,0 ,sc($3),0, sc($4),0, sc($5),0, sc($2),0 }' >> $CONFIGBLOCK_FILE
+#fill to 32 bytes
+awk 'function sc(c) {return (c<128?c:(c-256))} BEGIN{printf "%c%c%c%c",-1,-1,-1,-1}' >> $CONFIGBLOCK_FILE
+
+exit 0
diff --git a/recipes/images/files/colibri-vf/format_sd.sh b/recipes/images/files/colibri-vf/format_sd.sh
new file mode 100755
index 0000000..a1e2e86
--- /dev/null
+++ b/recipes/images/files/colibri-vf/format_sd.sh
@@ -0,0 +1,115 @@
+#! /bin/sh
+# Format a SD card to be used for flashing a Colibri VFxx module
+# Then calls update.sh to add needed files
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+
+Usage()
+{
+ echo ""
+ echo "Formats and fills a SD card with files for flashing the internal NAND of a"
+ echo "Colibri VFxx. Optionally creates a rootfs partition to allow booting and taking"
+ echo "kernel and rootfs from SD card."
+ echo "ALL DATA ON THE DEVICE GIVEN WITH -d WILL BE DELETED!!"
+ echo
+ echo "Requires a running U-Boot on the target. Either one already flashed on the NAND"
+ echo "or strapping the board to boot from SD card and booting U-Boot from the card"
+ echo "(only possible on older samples without blown boot fuses)."
+ echo ""
+ echo "-h : Prints this message"
+ echo ""
+ echo "-d FILE : device file of the SD card"
+ echo "-f : additionally copy the rootfs into the second partition"
+ echo "-s : optimise file system for 128MB NAND, increases usable space"
+ echo " on VF50 module a little, but on VF61 uses also only 128MB"
+ echo ""
+ echo "Example \"./format_sd.sh -d /dev/mmcblk0\" prepares the SD card /dev/mmcblk0"
+ echo ""
+}
+
+#initialise options
+DEV="/dev/null"
+CFGBLOCK_ONLY=0
+DEBUG_ONLY=0
+KERNEL_ONLY=0
+UBOOT_ONLY=0
+CP_ROOTFS=0
+
+while getopts "hd:fs" Option ; do
+ case $Option in
+ h) Usage
+ # Exit if only usage (-h) was specified.
+ if [[ $# -eq 1 ]] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ d) DEV=$OPTARG
+ ;;
+ f) CP_ROOTFS=1
+ ;;
+ s) UPDATE_OPTS="-s"
+ esac
+done
+
+DEVNAME=`basename $DEV`
+DEVNAMESTART=`echo $DEVNAME | cut -c 1-3`
+
+# sanity checks to try and not touch one of the users hard drives or other issues
+if [ ! -b $DEV ] ; then
+ echo $DEV "is not a block device, "
+ echo "please specify the device file representing your SD card"
+ exit 1
+fi
+if [ "$DEVNAMESTART" = "sda" ] ; then
+ echo $DEV "seems to be your primary hard disk,"
+ echo "please specify the device file representing your SD card"
+ exit 1
+fi
+if [ ! -d /sys/block/$DEVNAME ] ; then
+ echo "/sys/block/$DEVNAME"
+ echo $DEV "seems to not be a disk, please specify the device file"
+ echo "representing your SD card (without any trailing number)"
+ exit 1
+fi
+IS_USB_MMC=`ls -l /sys/block/$DEVNAME | grep -c "usb\|mmc"`
+if [ $IS_USB_MMC -eq 0 ] ; then
+ echo $DEV "seems not to be connected over USB or MMC, please specify the device file"
+ echo "representing your SD card (without any trailing number)"
+ exit 1
+fi
+
+if [ "$DEVNAMESTART" = "mmc" ] ; then
+ PART_PREFIX="p"
+else
+ PART_PREFIX=""
+fi
+# make sure the partitions are unmounted
+sudo umount ${DEV}${PART_PREFIX}?
+
+# partition and format the vfat partition
+sudo parted -s $DEV mklabel msdos mkpart primary fat32 1MB 512MB mkpart primary ext3 512MB 100%
+sudo umount ${DEV}${PART_PREFIX}1
+sudo mkfs.vfat -n KERNEL ${DEV}${PART_PREFIX}1
+
+# dd U-Boot onto the SD card
+sudo dd if=colibri-vf_bin/u-boot.imx of=${DEV} bs=512 seek=2
+
+sudo mkdir -p mntpoint1
+sudo mount -t vfat ${DEV}${PART_PREFIX}1 mntpoint1 -o umask=0
+
+# now copy U-Boot, kernel and ubi-img to the KERNEL partition
+DEST=`readlink -e mntpoint1`
+./update.sh -o "$DEST" $UPDATE_OPTS
+
+#copy the rootfs
+if [ "$CP_ROOTFS" -eq 1 ] ; then
+ sudo umount ${DEV}${PART_PREFIX}2
+ sudo mkfs.ext3 -L RFS ${DEV}${PART_PREFIX}2 && sync
+ sudo mkdir -p mntpoint2
+ sudo mount -t ext3 ${DEV}${PART_PREFIX}2 mntpoint2
+ sudo cp -pPr rootfs/* mntpoint2/
+fi
+
+sudo umount ${DEV}${PART_PREFIX}?
diff --git a/recipes/images/files/colibri-vf/update.sh b/recipes/images/files/colibri-vf/update.sh
new file mode 100755
index 0000000..014c475
--- /dev/null
+++ b/recipes/images/files/colibri-vf/update.sh
@@ -0,0 +1,184 @@
+#! /bin/sh
+# Prepare files needed for flashing a Colbiri VFxx module
+# and copy them into a convenient location for use from a running U-Boot
+
+set -e
+
+# sometimes we need the binary echo, not the shell builtin
+ECHO=`which echo`
+
+Flash()
+{
+ echo "To flash the Colibri VFxx module a running U-Boot is required. Boot the"
+ echo "module to the U-Boot prompt and"
+ echo ""
+ echo "insert the SD card and enter:"
+ echo "# run setupdate"
+ echo ""
+ echo "to update all components enter:"
+ echo "# run update"
+ echo ""
+ echo "to update a single component enter one of:"
+ echo "# run update_uboot"
+ echo "# run update_rootfs"
+ echo ""
+ echo ""
+ echo "If you don't have a working U-Boot any more, connect your PC to the module's"
+ echo "UART, bring the module in the serial download mode and start the update.sh"
+ echo "script with the -d option. This will copy U-Boot into the module's RAM and"
+ echo "and execute it. Also bridge RTS/CTS when using the evaluation boards USB to"
+ echo "UART converter."
+ echo ""
+ echo "\"./update.sh -n -d /dev/ttyUSB0\""
+ echo ""
+ echo "Next, recreate the Boot Configuration Block and the Toradex Config Block"
+ echo ""
+ echo "# run create_bcb"
+ echo "# run update_configblock"
+}
+
+Usage()
+{
+ echo ""
+ echo "Prepares and copies files for flashing the internal NAND of a Colibri VFxx"
+ echo ""
+ echo "The recommended way is to copy the files on a SD card. The script format_sd.sh"
+ echo "may be used to format the SD card."
+ echo ""
+ echo "Will require a running U-Boot on the target. Either one already flashed"
+ echo "on the NAND or download using serial downloader (argument -d)."
+ echo ""
+ echo "-d uart_dev : use UART connection to copy and execute U-Boot from module's RAM"
+ echo "-f : flash instructions"
+ echo "-h : Prints this message"
+ echo "-n : Disable hardware flow control (bridge RTS/CTS!)"
+ echo "-o directory : output directory"
+ echo "-s : optimise file system for 128MB NAND, increases usable space"
+ echo " on VF50 module a little, but on VF61 uses also only 128MB"
+ echo ""
+ echo "Examples:"
+ echo "\"./update.sh -o /media/KERNEL/\" copies the required files to SD card"
+ echo ""
+ echo "*** For detailed recovery/update procedures, refer to the Release Notes ***"
+ echo ""
+}
+
+#initialise options
+UBOOT_RECOVERY=0
+NORTSCTS=0
+OUT_DIR=""
+# NAND parameters
+PAGE=2KiB
+BLOCK=124KiB
+MAXLEB=8112
+
+while getopts "d:fnho:s" Option ; do
+ case $Option in
+ d) UBOOT_RECOVERY=1
+ UARTDEV=$OPTARG
+ ;;
+ n) NORTSCTS=1
+ ;;
+ h) Usage
+ # Exit if only usage (-h) was specified.
+ if [[ $# -eq 1 ]] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ f) Flash
+ exit 0
+ ;;
+ o) OUT_DIR=$OPTARG
+ ;;
+ s) MAXLEB=982
+ ;;
+ esac
+done
+
+if [[ "$OUT_DIR" = "" && "$UBOOT_RECOVERY" = "0" ]] ; then
+ Usage
+ exit 0
+fi
+
+# auto detect MODTYPE from rootfs directory
+if [ -f rootfs/etc/issue ] ; then
+ CNT=`grep -c "VF" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Colibri VF rootfs detected"
+ MODTYPE=colibri-vf
+ IMAGEFILE=ubifs.img
+
+ LOCPATH="vf_flash"
+ fi
+fi
+
+if [ -e $MODTYPE ] ; then
+ echo "can not detect module type from ./rootfs/etc/issue"
+ echo "exiting"
+ exit 1
+fi
+BINARIES=${MODTYPE}_bin
+
+#is only U-Boot to be copied to RAM?
+if [ "$UBOOT_RECOVERY" -eq 1 ] ; then
+ LOADEROPTS=""
+ if [ ${NORTSCTS} = 1 ]; then
+ LOADEROPTS="--no-rtscts"
+ fi
+
+ echo "Put the module in recovery mode and press [ENTER]..."
+ read RESULT
+ sudo ${LOCPATH}/imx_uart ${LOADEROPTS} ${UARTDEV} ${LOCPATH}/vybrid_usb_work.conf ${BINARIES}/u-boot.imx
+ exit 0
+fi
+
+# is OUT_DIR an existing directory?
+if [ ! -d "$OUT_DIR" ] ; then
+ echo "$OUT_DIR" "does not exist, exiting"
+ exit 1
+fi
+
+#sanity check for correct untared rootfs
+DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'`
+if [ "${DEV_OWNER}x" != "rootx" ]
+then
+ $ECHO -e "rootfs/dev is not owned by root, but it should!"
+ $ECHO -e "\033[1mPlease unpack the tarball with root rights.\033[0m"
+ $ECHO -e "e.g. sudo tar xjvf Colibri_VF_LinuxImageV2.3_20140804.tar.bz2"
+ exit 1
+fi
+
+#sanity check, can we execute mkfs.ubifs, e.g. see the help text?
+CNT=`sudo $LOCPATH/mkfs.ubifs -h | grep -c space-fixup`
+if [ "$CNT" -eq 0 ] ; then
+ echo "The program mkfs.ubifs can not be executed or does not provide --space-fixup"
+ echo "option."
+ echo "Are you on a 64bit Linux host without installed 32bit execution environment?"
+ $ECHO -e "\033[1mPlease install e.g. ia32-libs on 64-bit Ubuntu\033[0m"
+ $ECHO -e "\033[1mMaybe others are needed e.g. liblzo2:i386 on 64-bit Ubuntu\033[0m"
+ exit 1
+fi
+
+# Prepare full flashing
+#build ${IMAGEFILE} if it does not exist
+sudo $LOCPATH/mkfs.ubifs -c ${MAXLEB} -e ${BLOCK} -m ${PAGE} -o ${BINARIES}/${IMAGEFILE} -r rootfs/ -v
+
+echo ""
+echo "UBI image of root file system generated, coping data to target folder..."
+
+#make a file with the used versions for U-Boot, kernel and rootfs
+sudo touch ${BINARIES}/versions.txt
+sudo chmod ugo+w ${BINARIES}/versions.txt
+echo "Component Versions" > ${BINARIES}/versions.txt
+basename "`readlink -e ${BINARIES}/u-boot.imx`" >> ${BINARIES}/versions.txt
+$ECHO -n "Rootfs " >> ${BINARIES}/versions.txt
+grep VF rootfs/etc/issue >> ${BINARIES}/versions.txt
+
+#copy to $OUT_DIR
+sudo cp ${BINARIES}/configblock.bin ${BINARIES}/u-boot-nand.imx ${BINARIES}/ubifs.img ${BINARIES}/flash*.img ${BINARIES}/versions.txt "$OUT_DIR"
+sync
+echo "Successfully copied data to target folder."
+echo ""
+
+Flash
diff --git a/recipes/images/files/colibri-vf/vf_flash/imx_uart.m32 b/recipes/images/files/colibri-vf/vf_flash/imx_uart.m32
new file mode 100755
index 0000000..6251202
--- /dev/null
+++ b/recipes/images/files/colibri-vf/vf_flash/imx_uart.m32
Binary files differ
diff --git a/recipes/images/trdx-image-fstype.inc b/recipes/images/trdx-image-fstype.inc
index f6153bc..6a6b0a9 100644
--- a/recipes/images/trdx-image-fstype.inc
+++ b/recipes/images/trdx-image-fstype.inc
@@ -1,6 +1,6 @@
#create the deployment directory-tree
-BURNFLASH := "${THISDIR}/files/${MACHINE}/burnflash.tar.bz2"
+BURNFLASH := "${THISDIR}/files/${MACHINE}"
IMAGE_ROOTFS = "${WORKDIR}/${IMAGE_NAME}${PV}/rootfs"
U_BOOT_EXT = "bin"
@@ -74,8 +74,7 @@ imagedeploy_kernel_vf() {
fakeroot do_imagedeploy() {
cd ${WORKDIR}
- tar -xf ${BURNFLASH}
- cp -pPr burnflash/* ${IMAGE_NAME}${PV}/
+ cp -pPr ${BURNFLASH}/* ${IMAGE_NAME}${PV}/
imagedeploy_kernel