From 9c61fd1e86c38bd2011130122ddefea2b3a41afd Mon Sep 17 00:00:00 2001 From: Troy Kisky <troy.kisky@boundarydevices.com> Date: Thu, 1 Aug 2019 11:30:52 -0700 Subject: [PATCH] boundary: bootscript: add image-gzwrite.txt/split-for-gzwrite.sh Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> --- board/boundary/bootscripts/image-gzwrite.txt | 51 +++++++++++++++++++ .../boundary/bootscripts/split-for-gzwrite.sh | 24 +++++++++ 2 files changed, 75 insertions(+) create mode 100644 board/boundary/bootscripts/image-gzwrite.txt create mode 100644 board/boundary/bootscripts/split-for-gzwrite.sh diff --git a/board/boundary/bootscripts/image-gzwrite.txt b/board/boundary/bootscripts/image-gzwrite.txt new file mode 100644 index 00000000000..5aeecdd08ec --- /dev/null +++ b/board/boundary/bootscripts/image-gzwrite.txt @@ -0,0 +1,51 @@ +setenv stdout serial,vga + +if itest.s "x" == "x${imagefile}" ; then + imagefile=ubuntu.img.gz +fi +if itest.s "x" == "x${gzdest}" ; then + echo "Please set gzdest. ie. setenv gzdest 'mmc 1';" + exit; +fi + +a_base=0x10000000 +if itest.s x51 == "x${imx_cpu}" ; then + a_base=0x90000000 +elif itest.s x53 == "x${imx_cpu}"; then + a_base=0x70000000 +elif itest.s x6SX == "x${imx_cpu}" || itest.s x6ULL == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then + a_base=0x80000000 +elif itest.s x8MQ == "x${imx_cpu}" || itest.s x8MM == "x${imx_cpu}"; then + a_base=0x40000000 +fi +setexpr a_gz ${a_base} + 0x00080000 + +echo "Trying to load ${imagefile} (about 5...10 minutes)" + +setexpr i 0; +setexpr offset 0; +while test $i -le 99 +do + if load ${devtype} ${devnum} ${a_gz} ${imagefile}.$i ; then + echo "Extracting file ${imagefile}.$i to eMMC" + gzwrite ${gzdest} ${a_gz} 0x${filesize} 0x100000 0x${offset}00000 ; + else + if itest $i -eq 0 ; then + echo "image file not found or its too big to fit in the memory"; + echo "expected file name : ${imagefile}.$i"; + echo "exiting..." + exit + fi + echo "Done." + echo "Please remove the SD card, then reset board..." + exit; + fi + setexpr i $i + 1; + setexpr rem $i % 0x10; + if itest 0x$rem -eq 0x0a ; then + #this is to show a decimal number when really hex is output + setexpr i $i + 6; + fi; + # add 512M, units of offset is M + setexpr offset $offset + 0x200 +done diff --git a/board/boundary/bootscripts/split-for-gzwrite.sh b/board/boundary/bootscripts/split-for-gzwrite.sh new file mode 100644 index 00000000000..5caeb6353ec --- /dev/null +++ b/board/boundary/bootscripts/split-for-gzwrite.sh @@ -0,0 +1,24 @@ +#!/bin/bash +let i=0 +let offset=0 +if [ -z "$1" ] ; then + echo specify file to split + exit +fi + +zcat $1 >t.tmp +while [ 1 ] +do + dd if=t.tmp ibs=1M count=512 skip=$offset | gzip >$1.$i + let size=`zcat $1.$i | wc -c` + echo file $1.$i size is $size + if [ $size -lt 536870912 ] ; then + echo last is $size + break; + fi + + let i=$i+1 + let offset=$offset+512 +done +rm t.tmp + -- GitLab