summaryrefslogtreecommitdiff
path: root/recipes
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2016-06-08 12:38:29 +0200
committerMax Krummenacher <max.krummenacher@toradex.com>2016-06-30 13:28:26 +0200
commit255715f4826b41fbd8790b6085fbf1bdcf1ac700 (patch)
tree5c65e6599226c793f6d8c671fabf64f09cacf56f /recipes
parent9b6246484616ce7a512d43ecad2f8a3910ecb9db (diff)
apalis-tk1: add initial flashing infrastructure
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Diffstat (limited to 'recipes')
-rw-r--r--recipes/images/files/apalis-tk1/apalis-tk1_bin/PM375_Hynix_2GB_H5TC4G63AFR_RDA_924MHz.bctbin0 -> 8192 bytes
-rw-r--r--recipes/images/files/apalis-tk1/apalis-tk1_bin/apalis-tk1.img.cfg22
-rw-r--r--recipes/images/files/apalis-tk1/apalis-tk1_bin/flash_blk.scr29
-rw-r--r--recipes/images/files/apalis-tk1/apalis-tk1_bin/flash_eth.scr30
l---------recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_blk.scr1
l---------recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_eth.scr1
l---------recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_mmc.scr1
l---------recipes/images/files/apalis-tk1/apalis-tk1_bin/mk-u-boot-scripts.sh1
l---------recipes/images/files/apalis-tk1/tegra-uboot-flasher/genext3fs.sh1
l---------recipes/images/files/apalis-tk1/update.sh1
-rwxr-xr-xrecipes/images/files/library/tegra/update.sh27
11 files changed, 109 insertions, 5 deletions
diff --git a/recipes/images/files/apalis-tk1/apalis-tk1_bin/PM375_Hynix_2GB_H5TC4G63AFR_RDA_924MHz.bct b/recipes/images/files/apalis-tk1/apalis-tk1_bin/PM375_Hynix_2GB_H5TC4G63AFR_RDA_924MHz.bct
new file mode 100644
index 0000000..556a40e
--- /dev/null
+++ b/recipes/images/files/apalis-tk1/apalis-tk1_bin/PM375_Hynix_2GB_H5TC4G63AFR_RDA_924MHz.bct
Binary files differ
diff --git a/recipes/images/files/apalis-tk1/apalis-tk1_bin/apalis-tk1.img.cfg b/recipes/images/files/apalis-tk1/apalis-tk1_bin/apalis-tk1.img.cfg
new file mode 100644
index 0000000..b9d203c
--- /dev/null
+++ b/recipes/images/files/apalis-tk1/apalis-tk1_bin/apalis-tk1.img.cfg
@@ -0,0 +1,22 @@
+# Copyright (C) 2016 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 = 0x00400001;
+Bctcopy = 1;
+Bctfile = PM375_Hynix_2GB_H5TC4G63AFR_RDA_924MHz.bct;
+BootLoader = u-boot-dtb-tegra.bin,0x80108000,0x80108000,Complete;
diff --git a/recipes/images/files/apalis-tk1/apalis-tk1_bin/flash_blk.scr b/recipes/images/files/apalis-tk1/apalis-tk1_bin/flash_blk.scr
new file mode 100644
index 0000000..994e480
--- /dev/null
+++ b/recipes/images/files/apalis-tk1/apalis-tk1_bin/flash_blk.scr
@@ -0,0 +1,29 @@
+test -n ${interface} || setenv interface mmc
+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 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 cp_file_chunk 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/root.ext3 ${filesize} ${filepos}; run set_blkcnt; mmc dev 0 0 && mmc write ${loadaddr} ${blkstart} ${blkcnt}'
+
+setenv update_uboot 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/${board_name}.img && run set_blkcnt && mmc dev 0 1 && mmc write ${loadaddr} 0x0 ${blkcnt}'
+
+setenv update_kernel 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+
+setenv update_fdt 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/${soc}-apalis-${fdt_board}.dtb && fatwrite mmc 0:1 ${loadaddr} ${soc}-apalis-${fdt_board}.dtb ${filesize}'
+
+setenv update_configblock 'run check_configblock; load ${interface} ${drive}:1 ${loadaddr} ${board_name}/configblock.bin && mmc dev 0 1 && mmc write ${loadaddr} ${conf_blk_offset} 1'
+
+setenv update_1 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/boot.vfat && run set_blkcnt && mmc dev 0 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
+#do it in chunks of 64M to fit into DDR RAM of the smallest module
+setenv update_rootfs 'setenv filesize 4000000; setenv filepos 0; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextpos; done'
+
+setenv update 'run update_uboot; run update_1; run update_2; run update_kernel; run update_fdt; run update_rootfs; reset'
+
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/apalis-tk1/apalis-tk1_bin/flash_eth.scr b/recipes/images/files/apalis-tk1/apalis-tk1_bin/flash_eth.scr
new file mode 100644
index 0000000..6f92554
--- /dev/null
+++ b/recipes/images/files/apalis-tk1/apalis-tk1_bin/flash_eth.scr
@@ -0,0 +1,30 @@
+setenv set_blkcnt 'setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200'
+#workaround U-Boot counting in hex and split did in decimal
+setenv incr_decimal 'setexpr filenum ${filenum} + 1; setexpr filenrlow ${filenum} % 0x10; test ${filenrlow} -eq "a" && setexpr filenum ${filenum} + 0x6; true'
+setenv set_nextnum 'run incr_decimal; setexpr blkstart ${blkstart} + ${blkcnt}'
+
+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 cp_file_chunk 'tftpboot ${loadaddr} ${board_name}/root.ext3-${filenum}; run set_blkcnt; mmc dev 0 0 && mmc write ${loadaddr} ${blkstart} ${blkcnt}'
+
+setenv update_uboot 'tftpboot ${loadaddr} ${board_name}/${board_name}.img && run set_blkcnt && mmc dev 0 1 && mmc write ${loadaddr} 0x0 ${blkcnt}'
+
+setenv update_kernel 'tftpboot ${loadaddr} ${board_name}/uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+
+setenv update_fdt 'tftpboot ${loadaddr} ${board_name}/${soc}-apalis-${fdt_board}.dtb && fatwrite mmc 0:1 ${loadaddr} ${soc}-apalis-${fdt_board}.dtb ${filesize}'
+
+setenv update_configblock 'run check_configblock; tftpboot ${loadaddr} ${board_name}/configblock.bin && mmc dev 0 1 && mmc write ${loadaddr} ${conf_blk_offset} 1'
+
+setenv update_1 'tftpboot ${loadaddr} ${board_name}/mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'tftpboot ${loadaddr} ${board_name}/boot.vfat && run set_blkcnt && mmc dev 0 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 2 -b `expr 64 \* 1024 \* 1024` --numeric-suffixes=10 root.ext3 root.ext3-
+setenv update_rootfs 'setenv filesize 4000000; setenv filenum 10; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextnum; done'
+
+setenv update 'run update_uboot; run update_1; run update_2; run update_kernel; run update_fdt; run update_rootfs; reset'
+
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_blk.scr b/recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_blk.scr
new file mode 120000
index 0000000..5954646
--- /dev/null
+++ b/recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_blk.scr
@@ -0,0 +1 @@
+../../library/fwd_blk.scr \ No newline at end of file
diff --git a/recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_eth.scr b/recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_eth.scr
new file mode 120000
index 0000000..decc214
--- /dev/null
+++ b/recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_eth.scr
@@ -0,0 +1 @@
+../../library/fwd_eth.scr \ No newline at end of file
diff --git a/recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_mmc.scr b/recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_mmc.scr
new file mode 120000
index 0000000..3848cfa
--- /dev/null
+++ b/recipes/images/files/apalis-tk1/apalis-tk1_bin/fwd_mmc.scr
@@ -0,0 +1 @@
+../../library/fwd_mmc.scr \ No newline at end of file
diff --git a/recipes/images/files/apalis-tk1/apalis-tk1_bin/mk-u-boot-scripts.sh b/recipes/images/files/apalis-tk1/apalis-tk1_bin/mk-u-boot-scripts.sh
new file mode 120000
index 0000000..ce71dbd
--- /dev/null
+++ b/recipes/images/files/apalis-tk1/apalis-tk1_bin/mk-u-boot-scripts.sh
@@ -0,0 +1 @@
+../../library/mk-u-boot-scripts.sh \ No newline at end of file
diff --git a/recipes/images/files/apalis-tk1/tegra-uboot-flasher/genext3fs.sh b/recipes/images/files/apalis-tk1/tegra-uboot-flasher/genext3fs.sh
new file mode 120000
index 0000000..cc716db
--- /dev/null
+++ b/recipes/images/files/apalis-tk1/tegra-uboot-flasher/genext3fs.sh
@@ -0,0 +1 @@
+../../library/genext3fs.sh \ No newline at end of file
diff --git a/recipes/images/files/apalis-tk1/update.sh b/recipes/images/files/apalis-tk1/update.sh
new file mode 120000
index 0000000..6ebea84
--- /dev/null
+++ b/recipes/images/files/apalis-tk1/update.sh
@@ -0,0 +1 @@
+../library/tegra/update.sh \ No newline at end of file
diff --git a/recipes/images/files/library/tegra/update.sh b/recipes/images/files/library/tegra/update.sh
index 6116c89..4780be6 100755
--- a/recipes/images/files/library/tegra/update.sh
+++ b/recipes/images/files/library/tegra/update.sh
@@ -139,9 +139,25 @@ if [ "$CNT" -ge 1 ] ; then
OUT_DIR="$OUT_DIR/apalis_t30"
U_BOOT_BINARY=u-boot-dtb-tegra.bin
else
- echo "can not detect module type from ./rootfs/etc/issue"
- echo "exiting"
- exit 1
+ CNT=`grep -ic "tk1" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Apalis TK1 rootfs detected"
+ MODTYPE=apalis-tk1
+ BCT=PM375_Hynix_2GB_H5TC4G63AFR_RDA_924MHz.bct
+ CBOOT_IMAGE=apalis-tk1.img
+ CBOOT_IMAGE_TARGET=tegra124
+ # assumed minimal eMMC size [in sectors of 512]
+ EMMC_SIZE=$(expr 1024 \* 7450 \* 2)
+ IMAGEFILE=root.ext3
+ KERNEL_DEVICETREE="tegra124-apalis-eval.dtb"
+ LOCPATH="tegra-uboot-flasher"
+ OUT_DIR="$OUT_DIR/apalis-tk1"
+ U_BOOT_BINARY=u-boot-dtb-tegra.bin
+ else
+ echo "can not detect module type from ./rootfs/etc/issue"
+ echo "exiting"
+ exit 1
+ fi
fi
else
CNT=`grep -ic "colibri" rootfs/etc/issue || true`
@@ -271,7 +287,7 @@ touch ${BINARIES}/versions.txt
echo "Component Versions" > ${BINARIES}/versions.txt
basename "`readlink -e ${BINARIES}/${U_BOOT_BINARY}`" >> ${BINARIES}/versions.txt
basename "`readlink -e ${BINARIES}/${KERNEL_IMAGETYPE}`" >> ${BINARIES}/versions.txt
-ROOTFSVERSION=`grep -i t[2-3]0 rootfs/etc/issue`
+ROOTFSVERSION=`egrep -i 't([2-3]0|k1)' rootfs/etc/issue`
echo "Rootfs ${ROOTFSVERSION}" >> ${BINARIES}/versions.txt
#create subdirectory for this module type
@@ -318,7 +334,7 @@ if [ "${MODTYPE}" = "colibri-t20" ] ; then
echo ""
echo "UBI image of root file system generated, copying data to target folder..."
else
- if [ "${MODTYPE}" = "apalis-t30" ] || [ "${MODTYPE}" = "colibri-t30" ] ; then
+ if [ "${MODTYPE}" = "apalis-t30" ] || [ "${MODTYPE}" = "apalis-tk1" ] || [ "${MODTYPE}" = "colibri-t30" ] ; then
# Boot partition [in sectors of 512]
BOOT_START=$(expr 4096 \* 2)
# Rootfs partition [in sectors of 512]
@@ -367,6 +383,7 @@ else
fi
fi
done
+ [ "${MODTYPE}" = "apalis-tk1" ] && ([ $COPIED = true ] || { echo "Did not find the devicetrees from KERNEL_DEVICETREE, ${KERNEL_DEVICETREE}. Aborting."; exit 1; })
fi
echo ""