summaryrefslogtreecommitdiff
path: root/recipes-images/images/files/library
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2019-04-23 11:32:58 +0200
committerMax Krummenacher <max.krummenacher@toradex.com>2019-04-23 11:35:44 +0200
commit45677492bbb2bec8215e421c4db22ac9cf9eacaf (patch)
tree6282322f554b110ce2a029bd461cd2de4d235b85 /recipes-images/images/files/library
parent9a09de4a689897937eb5ca2655c1b15b39b1adaf (diff)
images: drop the legacy update procedure
Use the Toradex Easy Installer instead. If you included tdx-image-fstype.inc in your image recipes you will have to remove that include. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Diffstat (limited to 'recipes-images/images/files/library')
-rwxr-xr-xrecipes-images/images/files/library/create_configblock.sh181
-rw-r--r--recipes-images/images/files/library/fwd_blk.scr10
-rw-r--r--recipes-images/images/files/library/fwd_eth.scr6
-rw-r--r--recipes-images/images/files/library/fwd_mmc.scr3
-rwxr-xr-xrecipes-images/images/files/library/genext3fs.sh80
-rwxr-xr-xrecipes-images/images/files/library/genext4fs.sh80
-rw-r--r--recipes-images/images/files/library/imx6/flash_blk.scr47
-rw-r--r--recipes-images/images/files/library/imx6/flash_eth.scr45
-rwxr-xr-xrecipes-images/images/files/library/imx6/update.sh310
-rwxr-xr-xrecipes-images/images/files/library/mk-u-boot-scripts.sh5
-rwxr-xr-xrecipes-images/images/files/library/tegra/update.sh477
11 files changed, 0 insertions, 1244 deletions
diff --git a/recipes-images/images/files/library/create_configblock.sh b/recipes-images/images/files/library/create_configblock.sh
deleted file mode 100755
index 63e9951..0000000
--- a/recipes-images/images/files/library/create_configblock.sh
+++ /dev/null
@@ -1,181 +0,0 @@
-#! /bin/sh
-
-# exit on error
-set -e
-
-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."
- echo ""
- echo "In order to write the config block enter on the U-Boot commandline:"
- echo "run update"
- echo "run update_configblock"
- echo ""
- echo "For Colibri VF modules the boot configuration block needs to be recreated first:"
- echo "run update"
- 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
-
-#sanity check for some programs
-AWKTEST=`echo 12345678abcdefgh | awk 'BEGIN{ FIELDWIDTHS = "8 8"} {print $2}'` || true
-[ "${AWKTEST}x" = "abcdefghx" ] || { echo >&2 "Program gawk not available. Aborting."; exit 1; }
-
-# autotect MODTYPE from from rootfs directory
-CNT=`grep -c "VF" rootfs/etc/issue || true`
-if [ "$CNT" -ge 1 ] ; then
- echo "Colibri VF rootfs detected"
- MODTYPE=colibri-vf
-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
-
-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
- case ${MODTYPE} in
- "apalis-imx6")
- RAM_SIZE=1024
- echo "Enter the RAM size ( 512 / 1024 / 2048 ):"
- read RAM_SIZE
- case ${RAM_SIZE} in
- "512")
- PROD_ID="0029"
- ;;
- "1024")
- PROD_ID="0027"
- ;;
- "2048")
- PROD_ID="0028"
- ;;
- esac
- ;;
- "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 = "Ix" ] ; then
- PROD_ID="0017"
- else
- PROD_ID="0015"
- fi
- else
- if [ "$IT"x = "Ix" ] ; then
- PROD_ID="0016"
- else
- PROD_ID="0014"
- fi
- fi
- ;;
- "colibri-vf")
- VF_TYPE=50
- echo "Enter the Module Type (50 for a Colibri VF50 or 61 for a Colibri VF61)"
- read VF_TYPE
-
- echo "Enter I for IT version, nothing otherwise"
- read IT
- if [ "$VF_TYPE" = "50" ] ; then
- if [ "$IT"x = "Ix" ] ; then
- PROD_ID="0013"
- else
- PROD_ID="0010"
- fi
- elif [ "$VF_TYPE" = "61" ] ; then
- if [ "$IT"x = "I"x ] ; 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
-CONFIGBLOCK_FILE=${MODTYPE}_bin/configblock.bin
-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/images/files/library/fwd_blk.scr b/recipes-images/images/files/library/fwd_blk.scr
deleted file mode 100644
index 0c961dd..0000000
--- a/recipes-images/images/files/library/fwd_blk.scr
+++ /dev/null
@@ -1,10 +0,0 @@
-#the update.sh script renames this. fwd_blk.scr -> ../flash_blk.img
-test -n ${interface} || setenv interface mmc
-test -n ${drive} || setenv drive 1
-test -z "${board_name}" && test "${soc}" = "vf500" && setenv board_name colibri_vf
-test -z "${board_name}" && test "${soc}" = "vf610" && setenv board_name colibri_vf
-test "${board_name}" = "colibri_imx7" && setenv drive 0
-test "${board_name}" = "colibri_vf" && setenv drive 0
-
-test -n ${board_name} || echo "board_name env not set!" && exit
-fatload ${interface} ${drive}:1 ${loadaddr} ${board_name}/flash_blk.img && source ${loadaddr}
diff --git a/recipes-images/images/files/library/fwd_eth.scr b/recipes-images/images/files/library/fwd_eth.scr
deleted file mode 100644
index d7ea35c..0000000
--- a/recipes-images/images/files/library/fwd_eth.scr
+++ /dev/null
@@ -1,6 +0,0 @@
-#the update.sh script renames this. fwd_eth.scr -> ../flash_eth.img
-test -z "${board_name}" && test "${soc}" = "vf500" && setenv board_name colibri_vf
-test -z "${board_name}" && test "${soc}" = "vf610" && setenv board_name colibri_vf
-
-test -n ${board_name} || echo "board_name env not set!" && exit
-tftpboot ${loadaddr} "${board_name}/flash_eth.img" && source ${loadaddr}
diff --git a/recipes-images/images/files/library/fwd_mmc.scr b/recipes-images/images/files/library/fwd_mmc.scr
deleted file mode 100644
index 4c8f666..0000000
--- a/recipes-images/images/files/library/fwd_mmc.scr
+++ /dev/null
@@ -1,3 +0,0 @@
-#the update.sh script renames this. fwd_mmc.scr -> ../flash_mmc.img
-#flash_mmc has been renamed to flash_blk, ensure compatibilty when updating from older versions
-fatload mmc ${drive}:1 ${loadaddr} flash_blk.img && source ${loadaddr}
diff --git a/recipes-images/images/files/library/genext3fs.sh b/recipes-images/images/files/library/genext3fs.sh
deleted file mode 100755
index 25f7a85..0000000
--- a/recipes-images/images/files/library/genext3fs.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/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/tdx-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 rootfs $@
-#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 -a $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/images/files/library/genext4fs.sh b/recipes-images/images/files/library/genext4fs.sh
deleted file mode 100755
index 9ce6735..0000000
--- a/recipes-images/images/files/library/genext4fs.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/sh
-#creates a file containing a ext4 binary blob of the content of the ../rootfs folder
-
-# sometimes we need the binary echo, not the shell builtin
-ECHO=`which echo`
-
-MOUNTPOINT="mnt/tdx-rootfs"
-
-Usage()
-{
- echo "creates a file containing a ext4 binary blob. Output file name taken from command line"
- echo "Usage: genext4fs.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 ext4
-#answer y to "is not a block special device"
-dd if=/dev/zero of=$@ bs=1024k count=$PARTITIONSIZE
-mkfs.ext4 -F -L rootfs $@
-#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.ext4 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 ext4
- MOUNTED=`mount | grep -c "$MOUNTPOINT"`
-done
-#extract rootfs into the file
-sudo cp -a $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/images/files/library/imx6/flash_blk.scr b/recipes-images/images/files/library/imx6/flash_blk.scr
deleted file mode 100644
index 12d89cf..0000000
--- a/recipes-images/images/files/library/imx6/flash_blk.scr
+++ /dev/null
@@ -1,47 +0,0 @@
-test -n ${interface} || setenv interface mmc
-test -n ${drive} || setenv drive 1
-setenv uboot_hwpart 1
-
-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 filenrlow1 ${filenum} % 0x100; setexpr filenrlow2 ${filenrlow1} % 0x10; test ${filenrlow1} -eq "9a" && test ${filenrlow2} -ne "9" && setexpr filenum ${filenum} + 0x66; test ${filenrlow1} -ne "9a" && test ${filenrlow2} -eq "a" && setexpr filenum ${filenum} + 0x6; true'
-setenv set_nextnum 'run incr_decimal; setexpr blkstart ${blkstart} + ${blkcnt}'
-
-setenv check_configblock 'setexpr toradex_oui_addr ${fdt_addr_r} + 8; mw.l ${kernel_addr_r} 0x002d1400; mmc dev 0 1; for off in 7ff fff 1fff 3fff 7fff ffff 1ffff; do mmc read ${fdt_addr_r} ${off} 1 && setenv conf_blk_offset $off; done; cmp.b ${kernel_addr_r} ${toradex_oui_addr} 3'
-
-setenv migrate_configblock 'run check_configblock; mmc dev 0 0 && mmc read ${fdt_addr_r} 0x500 1 && cmp.b ${kernel_addr_r} ${toradex_oui_addr} 3 && mmc dev 0 1 && mmc write ${fdt_addr_r} ${conf_blk_offset} 1'
-
-setenv migrate_uboot_old 'setenv uboot_hwpart 0; run update_spl && run update_uboot_bin; setenv uboot_hwpart 1'
-setenv migrate_uboot 'run update_spl && run update_uboot_bin && mmc bootbus 0 2 1 2 && mmc partconf 0 1 1 0'
-
-setenv cp_file_chunk 'load ${interface} ${drive}:1 ${fdt_addr_r} ${board_name}/root.ext4-${filenum} || setenv filesize 0; run set_blkcnt; mmc dev 0 0 && mmc write ${fdt_addr_r} ${blkstart} ${blkcnt}'
-
-setenv update_spl 'load ${interface} ${drive}:1 ${fdt_addr_r} ${board_name}/SPL && run set_blkcnt && mmc dev 0 ${uboot_hwpart} && mmc write ${fdt_addr_r} 2 ${blkcnt}'
-setenv update_uboot_bin 'load ${interface} ${drive}:1 ${fdt_addr_r} ${board_name}/u-boot.img && run set_blkcnt && mmc dev 0 ${uboot_hwpart} && mmc write ${fdt_addr_r} 8a ${blkcnt}'
-setenv update_uboot 'run update_uboot_bin && updt_fuse && mmc bootbus 0 2 0 1 && mmc partconf 0 1 1 0 && mmc rst-function 0 1'
-
-setenv update_kernel 'load ${interface} ${drive}:1 ${fdt_addr_r} ${board_name}/zImage && fatwrite mmc 0:1 ${fdt_addr_r} zImage ${filesize}'
-
-setenv update_fdt 'load ${interface} ${drive}:1 ${fdt_addr_r} ${board_name}/${fdt_file} && fatwrite mmc 0:1 ${fdt_addr_r} ${fdt_file} ${filesize}'
-
-setenv update_configblock 'run check_configblock; load ${interface} ${drive}:1 ${fdt_addr_r} ${board_name}/configblock.bin && mmc dev 0 1 && mmc write ${fdt_addr_r} ${conf_blk_offset} 1'
-
-setenv update_1 'load ${interface} ${drive}:1 ${fdt_addr_r} ${board_name}/mbr.bin && mmc dev 0 0 && mmc write ${fdt_addr_r} 0x0 0x1'
-setenv update_2 'load ${interface} ${drive}:1 ${fdt_addr_r} ${board_name}/boot.vfat && run set_blkcnt && mmc dev 0 0 && mmc write ${fdt_addr_r} 0x2000 ${blkcnt}'
-#do it in chunks of 64M to fit into DDR RAM of the smallest module
-setenv update_3 'setenv filesize 4000000; setenv filenum 100; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextnum; done; true'
-
-setenv echo_migrate echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate\" to complete update"
-setenv migrate 'run migrate_configblock; run update_latest; reset'
-setenv update_v2.4b1 'run check_configblock || run migrate_configblock; run migrate_uboot_old && run echo_migrate'
-setenv update_v2.5b3 'run check_configblock || run migrate_configblock; run migrate_uboot && run echo_migrate'
-
-# Not migrated to SPL if no U-Boot Image Magic Number at 69k into the eMMC
-setenv update_to_spl 'mmc dev 0 1; mmc read $fdt_addr_r 8a 1; itest.l *12000000 -ne 56190527 && run update_spl'
-setenv update_latest 'run update_to_spl; run update_uboot; run update_1; run update_2; run update_kernel; run update_fdt; run update_3'
-# 'updt_fuse' not available in V2.5 Beta 3 and earlier, migration needed
-setenv update_new 'updt_fuse -n && run update_latest && reset; run update_v2.5b3'
-# 'mmc bootbus' not available in in V2.4 Beta 1 and earlier, migration needed
-setenv update 'mmc bootbus 0 2 0 1 && run update_new && exit; run update_v2.4b1'
-
-echo 'enter "run update" to update the entire module'
diff --git a/recipes-images/images/files/library/imx6/flash_eth.scr b/recipes-images/images/files/library/imx6/flash_eth.scr
deleted file mode 100644
index ee91523..0000000
--- a/recipes-images/images/files/library/imx6/flash_eth.scr
+++ /dev/null
@@ -1,45 +0,0 @@
-setenv uboot_hwpart 1
-
-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 filenrlow1 ${filenum} % 0x100; setexpr filenrlow2 ${filenrlow1} % 0x10; test ${filenrlow1} -eq "9a" && test ${filenrlow2} -ne "9" && setexpr filenum ${filenum} + 0x66; test ${filenrlow1} -ne "9a" && test ${filenrlow2} -eq "a" && setexpr filenum ${filenum} + 0x6; true'
-setenv set_nextnum 'run incr_decimal; setexpr blkstart ${blkstart} + ${blkcnt}'
-
-setenv check_configblock 'setexpr toradex_oui_addr ${fdt_addr_r} + 8; mw.l ${kernel_addr_r} 0x002d1400; mmc dev 0 1; for off in 7ff fff 1fff 3fff 7fff ffff 1ffff; do mmc read ${fdt_addr_r} ${off} 1 && setenv conf_blk_offset $off; done; cmp.b ${kernel_addr_r} ${toradex_oui_addr} 3'
-
-setenv migrate_configblock 'run check_configblock; mmc dev 0 0 && mmc read ${fdt_addr_r} 0x500 1 && cmp.b ${kernel_addr_r} ${toradex_oui_addr} 3 && mmc dev 0 1 && mmc write ${fdt_addr_r} ${conf_blk_offset} 1'
-
-setenv migrate_uboot_old 'setenv uboot_hwpart 0; run update_spl && run update_uboot_bin; setenv uboot_hwpart 1'
-setenv migrate_uboot 'run update_spl && run update_uboot_bin && mmc bootbus 0 2 1 2 && mmc partconf 0 1 1 0'
-
-setenv cp_file_chunk 'tftpboot ${fdt_addr_r} ${board_name}/root.ext4-${filenum} || setenv filesize 0; run set_blkcnt; mmc dev 0 0 && mmc write ${fdt_addr_r} ${blkstart} ${blkcnt}'
-
-setenv update_spl 'tftpboot ${fdt_addr_r} ${board_name}/SPL && run set_blkcnt && mmc dev 0 ${uboot_hwpart} && mmc write ${fdt_addr_r} 2 ${blkcnt}'
-setenv update_uboot_bin 'tftpboot ${fdt_addr_r} ${board_name}/u-boot.img && run set_blkcnt && mmc dev 0 ${uboot_hwpart} && mmc write ${fdt_addr_r} 8a ${blkcnt}'
-setenv update_uboot 'run update_uboot_bin && updt_fuse && mmc bootbus 0 2 0 1 && mmc partconf 0 1 1 0 && mmc rst-function 0 1'
-
-setenv update_kernel 'tftpboot ${fdt_addr_r} ${board_name}/zImage && fatwrite mmc 0:1 ${fdt_addr_r} zImage ${filesize}'
-
-setenv update_fdt 'tftpboot ${fdt_addr_r} ${board_name}/${fdt_file} && fatwrite mmc 0:1 ${fdt_addr_r} ${fdt_file} ${filesize}'
-
-setenv update_configblock 'run check_configblock; tftpboot ${fdt_addr_r} ${board_name}/configblock.bin && mmc dev 0 1 && mmc write ${fdt_addr_r} ${conf_blk_offset} 1'
-
-setenv update_1 'tftpboot ${fdt_addr_r} ${board_name}/mbr.bin && mmc dev 0 0 && mmc write ${fdt_addr_r} 0x0 0x1'
-setenv update_2 'tftpboot ${fdt_addr_r} ${board_name}/boot.vfat && run set_blkcnt && mmc dev 0 0 && mmc write ${fdt_addr_r} 0x2000 ${blkcnt}'
-#do it in chunks of 64M to fit into DDR RAM of the smallest module
-setenv update_3 'setenv filesize 4000000; setenv filenum 100; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextnum; done; true'
-
-setenv echo_migrate echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate\" to complete update"
-setenv migrate 'run migrate_configblock; run update_latest; reset'
-setenv update_v2.4b1 'run check_configblock || run migrate_configblock; run migrate_uboot_old && run echo_migrate'
-setenv update_v2.5b3 'run check_configblock || run migrate_configblock; run migrate_uboot && run echo_migrate'
-
-# Not migrated to SPL if no U-Boot Image Magic Number at 69k into the eMMC
-setenv update_to_spl 'mmc dev 0 1; mmc read $fdt_addr_r 8a 1; itest.l *12000000 -ne 56190527 && run update_spl'
-setenv update_latest 'run update_to_spl; run update_uboot; run update_1; run update_2; run update_kernel; run update_fdt; run update_3'
-# 'updt_fuse' not available in V2.5 Beta 3 and earlier, migration needed
-setenv update_new 'updt_fuse -n && run update_latest && reset; run update_v2.5b3'
-# 'mmc bootbus' not available in in V2.4 Beta 1 and earlier, migration needed
-setenv update 'mmc bootbus 0 2 0 1 && run update_new && exit; run update_v2.4b1'
-
-echo 'enter "run update" to update the entire module'
diff --git a/recipes-images/images/files/library/imx6/update.sh b/recipes-images/images/files/library/imx6/update.sh
deleted file mode 100755
index dc5e0dd..0000000
--- a/recipes-images/images/files/library/imx6/update.sh
+++ /dev/null
@@ -1,310 +0,0 @@
-#!/bin/sh
-# Prepare files needed for flashing a Apalis/Colibri iMX6 module
-#
-# inspired by meta-fsl-arm/classes/image_types_fsl.bbclass
-
-# exit on error
-set -e
-
-Flash()
-{
- echo "To flash the Apalis/Colibri iMX6 module a running U-Boot is required. Boot the"
- echo "module to the U-Boot prompt and"
- echo ""
- echo "insert the SD card, USB flash drive or when using TFTP connect Ethernet only"
- echo "and enter:"
- echo "'run setupdate'"
- echo ""
- echo "then 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_kernel'"
- echo "'run update_fdt'"
- echo "'run update_rootfs'"
- echo ""
- echo "If you don't have a working U-Boot anymore, connect your PC to the module's USB"
- echo "client port, bring the module in the serial download mode and start the"
- echo "update.sh script with the -d option. This will copy U-Boot into the modules RAM"
- echo "and execute it."
-}
-
-Usage()
-{
- echo ""
- echo "Prepares and copies files for flashing internal eMMC of Apalis/Colibri iMX6"
- echo ""
- echo "Will require a running U-Boot on the target. Either one already flashed on the"
- echo "eMMC or one copied over USB into the module's RAM"
- echo ""
- echo "-d : use USB connection to copy/execute U-Boot to/from module's RAM"
- echo "-f : flash instructions"
- echo "-h : prints this message"
- echo "-m : module type: 0: autodetect from ./rootfs/etc/issues (default)"
- echo " 1: Apalis iMX6"
- echo " 2: Colibri iMX6"
- echo "-o directory : output directory"
- echo ""
- echo "Example \"./update.sh -o /srv/tftp/\" copies the required files to /srv/tftp/"
- echo ""
- echo "*** For detailed recovery/update procedures, refer to the following website: ***"
- echo "http://developer.toradex.com/knowledge-base/flashing-linux-on-imx6-modules"
- echo ""
-}
-
-# initialise options
-KERNEL_IMAGETYPE="zImage"
-MIN_PARTITION_FREE_SIZE=100
-MODTYPE_DETECT=0
-OUT_DIR=""
-ROOTFSPATH=rootfs
-SPLIT=1
-UBOOT_RECOVERY=0
-U_BOOT_BINARY=u-boot.img
-SPL_BINARY=SPL
-
-while getopts "dfhm:o:" Option ; do
- case $Option in
- d) UBOOT_RECOVERY=1
- ;;
- f) Flash
- exit 0
- ;;
- h) Usage
- exit 0
- ;;
- m) MODTYPE_DETECT=$OPTARG
- ;;
- o) OUT_DIR=$OPTARG
- ;;
- esac
-done
-
-if [ "$OUT_DIR" = "" ] && [ "$UBOOT_RECOVERY" = "0" ] ; then
- Usage
- exit 1
-fi
-
-# is OUT_DIR an existing directory?
-if [ ! -d "$OUT_DIR" ] && [ "$UBOOT_RECOVERY" = "0" ] ; then
- echo "$OUT_DIR" "does not exist, exiting"
- exit 1
-fi
-
-case $MODTYPE_DETECT in
- 0) # auto detect MODTYPE from rootfs directory
- if [ -f rootfs/etc/issue ] ; then
- CNT=`grep -ic "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
- fi
- fi
- fi
- if [ -e $MODTYPE ] ; then
- echo "can not detect module type from ./rootfs/etc/issue"
- echo "please specify the module type with the -m parameter"
- echo "see help: '$ ./update.sh -h'"
- echo "exiting"
- exit 1
- fi
- ;;
- 1) MODTYPE=apalis-imx6
- echo "Apalis iMX6 rootfs specified"
- ;;
- 2) MODTYPE=colibri-imx6
- echo "Colibri iMX6 rootfs specified"
- ;;
- *) echo "-m paramter specifies an unknown value"
- exit 1
- ;;
-esac
-
-case "$MODTYPE" in
- "apalis-imx6")
- # assumed minimal eMMC size [in sectors of 512]
- EMMC_SIZE=$(expr 1024 \* 3500 \* 2)
- IMAGEFILE=root.ext4
- KERNEL_DEVICETREE="%kernel_device_trees%"
- LOCPATH="`pwd`/imx_flash"
- OUT_DIR="$OUT_DIR/apalis_imx6"
- ;;
- "colibri-imx6")
- # assumed minimal eMMC size [in sectors of 512]
- EMMC_SIZE=$(expr 1024 \* 3500 \* 2)
- IMAGEFILE=root.ext4
- KERNEL_DEVICETREE="%kernel_device_trees%"
- LOCPATH="`pwd`/imx_flash"
- OUT_DIR="$OUT_DIR/colibri_imx6"
- ;;
- *) echo "script internal error, unknown module type set"
- exit 1
- ;;
-esac
-
-BINARIES=${MODTYPE}_bin
-
-#is only U-Boot to be copied to RAM?
-if [ "$UBOOT_RECOVERY" -ge 1 ] ; then
- cd ${BINARIES}
- # do a load chain of first loading SPL then u-boot.img
- sudo ${LOCPATH}/imx_usb
- exit
-fi
-
-#sanity check for awk programs
-AWKTEST=`echo 100000000 | awk -v min=100 -v f=10000 '{rootfs_size=$1+f*512;rootfs_size=int(rootfs_size/1024/985); print (rootfs_size+min) }'` || true
-[ "${AWKTEST}x" = "204x" ] || { echo >&2 "Program awk not available. Aborting."; exit 1; }
-
-#sanity check for correct untared rootfs
-DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'`
-if [ "${DEV_OWNER}x" != "rootx" ]
-then
- printf "rootfs/dev is not owned by root, but it should!\n"
- printf "\033[1mPlease unpack the tarball with root rights.\033[0m\n"
- printf "e.g. sudo tar xjvf Apalis_iMX6_LinuxImageV2.6_20160331.tar.bz2\n"
- exit 1
-fi
-
-#sanity check for existence of U-Boot and kernel
-[ -e ${BINARIES}/${U_BOOT_BINARY} ] || { echo "${BINARIES}/${U_BOOT_BINARY} does not exist"; exit 1; }
-[ -e ${BINARIES}/${SPL_BINARY} ] || { echo "${BINARIES}/${SPL_BINARY} does not exist"; exit 1; }
-[ -e ${BINARIES}/${KERNEL_IMAGETYPE} ] || { echo "${BINARIES}/${KERNEL_IMAGETYPE} does not exist"; exit 1; }
-
-#Sanity check for some programs. Some distros have fs tools only in root's path
-MCOPY=`command -v mcopy` || { echo >&2 "Program mcopy not available. Aborting."; exit 1; }
-PARTED=`command -v parted` || PARTED=`sudo -s command -v parted` || { echo >&2 "Program parted not available. Aborting."; exit 1; }
-MKFSVFAT=`command -v mkfs.fat` || MKFSVFAT=`sudo -s command -v mkfs.fat` || { echo >&2 "Program mkfs.fat not available. Aborting."; exit 1; }
-MKFSEXT4=`command -v mkfs.ext4` || MKFSEXT4=`sudo -s command -v mkfs.ext4` || { echo >&2 "Program mkfs.ext4 not available. Aborting."; exit 1; }
-dd --help >/dev/null 2>&1 || { echo >&2 "Program dd not available. Aborting."; exit 1; }
-
-#Install trap to write a sensible message in case any of the commands below
-#exit premature...
-trap '{ printf "\033[31mScript aborted unexpectedly...\033[0m\n"; }' EXIT
-
-#make the directory with the outputfiles writable
-sudo chown $USER: ${BINARIES}
-
-#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_BINARY}`" >> ${BINARIES}/versions.txt
-basename "`readlink -e ${BINARIES}/${SPL_BINARY}`" >> ${BINARIES}/versions.txt
-basename "`readlink -e ${BINARIES}/${KERNEL_IMAGETYPE}`" >> ${BINARIES}/versions.txt
-ROOTFSVERSION=`grep -i imx6 rootfs/etc/issue || echo "Version Unknown"`
-echo "Rootfs ${ROOTFSVERSION}" >> ${BINARIES}/versions.txt
-
-#create subdirectory for this module type
-sudo mkdir -p "$OUT_DIR"
-
-# The eMMC layout used is:
-#
-# boot area partition 1 aka primary eMMC boot sector:
-# with U-Boot boot loader and the U-Boot environment before the configblock at
-# the end of that boot area partition
-#
-# boot area partition 2 aka secondary eMMC boot sector:
-# reserved
-#
-# user area aka general purpose eMMC region:
-#
-# 0 -> IMAGE_ROOTFS_ALIGNMENT - reserved (not partitioned)
-# IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE - kernel and other data
-# BOOT_SPACE -> SDIMG_SIZE - rootfs
-#
-# 4MiB 16MiB SDIMG_ROOTFS
-# <-----------------------> <----------> <---------------------->
-# ------------------------ ------------ ------------------------
-# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE |
-# ------------------------ ------------ ------------------------
-# ^ ^ ^ ^
-# | | | |
-# 0 4MiB 4MiB + 16MiB EMMC_SIZE
-
-
-# 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"
-
-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 ext4 ${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 partition 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}/${KERNEL_IMAGETYPE} ::/${KERNEL_IMAGETYPE}
-
-# Copy device tree file
-COPIED=false
-if test -n "${KERNEL_DEVICETREE}"; then
- for DTB_FILE in ${KERNEL_DEVICETREE}; do
- if [ -e "${BINARIES}/${DTB_FILE}" ]; then
- mcopy -i ${BINARIES}/boot.vfat -s ${BINARIES}/${DTB_FILE} ::/${DTB_FILE}
- #copy also to out_dir
- sudo cp ${BINARIES}/${DTB_FILE} "$OUT_DIR/"
- COPIED=true
- fi
- done
- [ $COPIED = true ] || { echo "Did not find the devicetrees from KERNEL_DEVICETREE, ${KERNEL_DEVICETREE}. Aborting."; exit 1; }
-fi
-
-echo ""
-echo "Creating rootfs partition image"
-#make the filesystem 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
-#(resize it later on target to fill the size of the partition it lives in)
-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) }'`
-rm -f ${BINARIES}/${IMAGEFILE}
-sudo $LOCPATH/genext4fs.sh -d rootfs -b ${EXT_SIZE} ${BINARIES}/${IMAGEFILE} || exit 1
-
-
-#copy to $OUT_DIR
-sudo cp ${BINARIES}/${U_BOOT_BINARY} ${BINARIES}/${SPL_BINARY} ${BINARIES}/${KERNEL_IMAGETYPE} ${BINARIES}/mbr.bin \
- ${BINARIES}/boot.vfat ${BINARIES}/flash*.img ${BINARIES}/versions.txt "$OUT_DIR"
-sudo cp ${BINARIES}/fwd_blk.img "$OUT_DIR/../flash_blk.img"
-sudo cp ${BINARIES}/fwd_eth.img "$OUT_DIR/../flash_eth.img"
-sudo cp ${BINARIES}/fwd_mmc.img "$OUT_DIR/../flash_mmc.img"
-
-if [ "$SPLIT" -ge 1 ] ; then
-sudo split -a 3 -b `expr 64 \* 1024 \* 1024` --numeric-suffixes=100 ${BINARIES}/${IMAGEFILE} "$OUT_DIR/root.ext4-"
-fi
-
-#cleanup intermediate files
-sudo rm ${BINARIES}/mbr.bin ${BINARIES}/boot.vfat ${BINARIES}/${IMAGEFILE} ${BINARIES}/versions.txt
-sync
-
-#Remove trap and report success!
-trap - EXIT
-printf "\033[32mSuccessfully copied data to target folder.\033[0m\n\n"
-
-Flash
diff --git a/recipes-images/images/files/library/mk-u-boot-scripts.sh b/recipes-images/images/files/library/mk-u-boot-scripts.sh
deleted file mode 100755
index dda47d5..0000000
--- a/recipes-images/images/files/library/mk-u-boot-scripts.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-for f in *.scr
-do
- mkimage -T script -C none -n 'Flash Apalis/Colibri module' -d $f `basename $f .scr`.img
-done
diff --git a/recipes-images/images/files/library/tegra/update.sh b/recipes-images/images/files/library/tegra/update.sh
deleted file mode 100755
index cb55dfc..0000000
--- a/recipes-images/images/files/library/tegra/update.sh
+++ /dev/null
@@ -1,477 +0,0 @@
-#!/bin/sh
-# Prepare files needed for flashing an Apalis/Colibri T20/T30/TK1 module and
-# copy them to a convenient location for using from a running U-Boot
-
-# exit on error
-set -e
-
-Flash()
-{
- echo "To flash the Apalis/Colibri T20/T30/TK1 module a running U-Boot is required. Boot"
- echo "the module to the U-Boot prompt and"
- echo ""
- echo "insert the SD card, USB flash drive or when using TFTP connect Ethernet only"
- echo "and enter:"
- echo "'run setupdate'"
- echo ""
- echo "then to update all components enter:"
- echo "'run update'"
- echo ""
- echo "Alternatively, to update U-Boot enter:"
- echo "'run update_uboot'"
- echo "to update a component stored in UBI enter:"
- echo "'run prepare_ubi' (for Colibri T20)"
- echo "followed by one of:"
- echo "'run update_kernel'"
- echo "'run update_fdt' (for device tree enabled kernels)"
- echo "'run update_rootfs'"
- echo ""
- echo ""
- echo "If you don't have a working U-Boot anymore, connect your PC to the module's USB"
- echo "client port, bring the module into the recovery mode and start the update.sh"
- echo "script with the -d option. This will copy U-Boot into the module's RAM and"
- echo "execute it."
-}
-
-Usage()
-{
- echo ""
- echo "Prepares and copies files for flashing internal eMMC/NAND of Apalis T30/TK1 and"
- echo "Colibri T20/T30"
- echo ""
- echo "Will require a running U-Boot on the target. Either one already flashed on the"
- echo "eMMC/NAND or one copied over USB into the module's RAM"
- echo ""
- echo "-b : T20: selects boot device (hsmmc/nand) (default: nand)"
- echo "-d : use USB recovery mode to copy/execute U-Boot to/from module's RAM"
- echo "-f : flash instructions"
- echo "-h : prints this message"
- echo "-m : module type: 0: autodetect from ./rootfs/etc/issues (default)"
- echo " 1: Apalis T30"
- echo " 2: Apalis TK1"
- echo " 3: Colibri T20"
- echo " 4: Colibri T30"
- echo "-o directory : output directory"
- echo "-r : T20 recovery mode: select RAM size (256 | 512)"
- echo "-s : T20: optimise file system for V1.1 or 256MB V1.2 modules,"
- echo " increases usable space a little, but limits 512MB V1.2 modules"
- echo " to 512MB usable NAND space"
- echo "-v : T20 recovery mode: select Colibri version (V1_1 | V1_2)"
- echo ""
- echo "Example \"./update.sh -o /srv/tftp/\" copies the required files to /srv/tftp/"
- echo ""
- echo "*** For detailed recovery/update procedures, refer to the following website: ***"
- echo "http://developer.toradex.com/knowledge-base/flashing-linux-on-tegra-modules"
- echo ""
-}
-
-# initialise options
-BOOT_DEVICE=nand
-EMMC_PARTS="mbr.bin boot.vfat"
-# no devicetree by default
-KERNEL_DEVICETREE=""
-KERNEL_IMAGETYPE="zImage"
-MIN_PARTITION_FREE_SIZE=300
-MODTYPE_DETECT=0
-
-# NAND parameters
-BLOCK="248KiB 504KiB"
-MAXLEB=4084
-PAGE="4KiB"
-
-OUT_DIR=""
-ROOTFSPATH=rootfs
-SPLIT=1
-UBOOT_RECOVERY=0
-
-# don't provide working defaults which may lead to wrong HW/SW combination
-MODVERSION=Add_Version_-v
-RAM_SIZE=Add_RAMsize_-r
-
-while getopts "b:dfhm:o:r:sv:" Option ; do
- case $Option in
- b) BOOT_DEVICE=$OPTARG
- ;;
- d) UBOOT_RECOVERY=1
- ;;
- f) Flash
- exit 0
- ;;
- h) Usage
- exit 0
- ;;
- m) MODTYPE_DETECT=$OPTARG
- ;;
- o) OUT_DIR=$OPTARG
- ;;
- r) RAM_SIZE=$OPTARG
- ;;
- s) MAXLEB=2042
- ;;
- v) if [ "${OPTARG}" = "V1_1" ] ; then MODVERSION=v11; fi
- if [ "${OPTARG}" = "V1_2" ] ; then MODVERSION=v12; fi
- ;;
- esac
-done
-
-if [ "$OUT_DIR" = "" ] && [ "$UBOOT_RECOVERY" = "0" ] ; then
- Usage
- exit 1
-fi
-
-# is OUT_DIR an existing directory?
-if [ ! -d "$OUT_DIR" ] && [ "$UBOOT_RECOVERY" = "0" ] ; then
- echo "$OUT_DIR" "does not exist, exiting"
- exit 1
-fi
-
-case $MODTYPE_DETECT in
- 0) # auto detect MODTYPE from rootfs directory
- if [ -f rootfs/etc/issue ] ; then
- CNT=`grep -ic "apalis" rootfs/etc/issue || true`
- if [ "$CNT" -ge 1 ] ; then
- CNT=`grep -ic "t30" rootfs/etc/issue || true`
- if [ "$CNT" -ge 1 ] ; then
- echo "Apalis T30 rootfs detected"
- MODTYPE=apalis-t30
- else
- CNT=`grep -ic "tk1" rootfs/etc/issue || true`
- if [ "$CNT" -ge 1 ] ; then
- echo "Apalis TK1 rootfs detected"
- MODTYPE=apalis-tk1
-
- CNT=`grep -ic "mainline" rootfs/etc/issue || true`
- if [ "$CNT" -ge 1 ] ; then
- echo "Mainline variant"
- MODTYPE=apalis-tk1-mainline
- fi
- fi
-
- fi
- else
- CNT=`grep -ic "colibri" rootfs/etc/issue || true`
- if [ "$CNT" -ge 1 ] ; then
- CNT=`grep -ic "t20" rootfs/etc/issue || true`
- if [ "$CNT" -ge 1 ] ; then
- echo "Colibri T20 rootfs detected"
- MODTYPE=colibri-t20
- else
- CNT=`grep -ic "t30" rootfs/etc/issue || true`
- if [ "$CNT" -ge 1 ] ; then
- echo "Colibri T30 rootfs detected"
- MODTYPE=colibri-t30
- fi
- fi
- fi
- fi
- fi
- if [ -e $MODTYPE ] ; then
- echo "can not detect module type from ./rootfs/etc/issue"
- echo "please specify the module type with the -m parameter"
- echo "see help: '$ ./update.sh -h'"
- echo "exiting"
- exit 1
- fi
- ;;
- 1) MODTYPE=apalis-t30
- echo "Apalis T30 rootfs specified"
- ;;
- 2) MODTYPE=apalis-tk1
- echo "Apalis TK1 rootfs specified"
- ;;
- 3) MODTYPE=colibri-t20
- echo "Colibri T20 rootfs specified"
- ;;
- 4) MODTYPE=colibri-t30
- echo "Colibri T30 rootfs specified"
- ;;
- *) echo "-m paramter specifies an unknown value"
- exit 1
- ;;
-esac
-
-case "$MODTYPE" in
- "apalis-t30")
- # note: requires changing apalis-t30_bin/apalis_t30.img.cfg as well
-# BCT=apalis_t30_12MHz_MT41K512M8RH-125_533MHz.bct
- BCT=Apalis_T30_2GB_800Mhz.bct
- CBOOT_IMAGE=apalis_t30.img
- CBOOT_IMAGE_TARGET=tegra30
- # assumed minimal eMMC size [in sectors of 512]
- EMMC_SIZE=$(expr 1024 \* 7450 \* 2)
- IMAGEFILE=root.ext3
- KERNEL_DEVICETREE="%kernel_device_trees%"
- LOCPATH="tegra-uboot-flasher"
- OUT_DIR="$OUT_DIR/apalis_t30"
- U_BOOT_BINARY=u-boot-dtb-tegra.bin
- ;;
- "apalis-tk1" | "apalis-tk1-mainline")
- 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 \* 15020 \* 2)
- IMAGEFILE=root.ext4
- KERNEL_DEVICETREE="%kernel_device_trees%"
- LOCPATH="tegra-uboot-flasher"
- OUT_DIR="$OUT_DIR/apalis-tk1"
- U_BOOT_BINARY=u-boot-dtb-tegra.bin
- ;;
- "colibri-t20")
- BCT=colibri_t20-${RAM_SIZE}-${MODVERSION}-${BOOT_DEVICE}.bct
- CBOOT_IMAGE="colibri_t20-256-v11-nand.img colibri_t20-256-v12-nand.img colibri_t20-512-v11-nand.img colibri_t20-512-v12-nand.img"
- CBOOT_IMAGE_TARGET=tegra20
- EMMC_PARTS=""
- IMAGEFILE=ubifs
- KERNEL_DEVICETREE="%kernel_device_trees%"
- KERNEL_IMAGETYPE="zImage"
- LOCPATH="tegra-uboot-flasher"
- OUT_DIR="$OUT_DIR/colibri_t20"
- U_BOOT_BINARY=u-boot-dtb-tegra.bin
- ;;
- "colibri-t30")
- # with new kernel, boot with 400MHz, then switch between 400 & 800
- # note: requires changing colibri-t30_bin/colibri_t30.img.cfg as well
- BCT=colibri_t30_12MHz_NT5CC256M16CP-DI_400MHz.bct
-# BCT=colibri_t30_12MHz_NT5CC256M16CP-DI_533MHz.bct
- CBOOT_IMAGE=colibri_t30.img
- CBOOT_IMAGE_TARGET=tegra30
- EMMC_SIZE=$(expr 1024 \* 3640 \* 2)
- IMAGEFILE=root.ext3
- KERNEL_DEVICETREE="%kernel_device_trees%"
- LOCPATH="tegra-uboot-flasher"
- OUT_DIR="$OUT_DIR/colibri_t30"
- U_BOOT_BINARY=u-boot-dtb-tegra.bin
- ;;
- *) echo "script internal error, unknown module type set"
- exit 1
- ;;
-esac
-
-BINARIES=${MODTYPE}_bin
-
-#is only U-Boot to be copied to RAM?
-if [ "$UBOOT_RECOVERY" -eq 1 ] ; then
- if [ "${MODTYPE}" = "colibri-t20" ] ; then
- #some sanity test, we really need RAM_SIZE and MODVERSION set
- echo ""
- SANITY_CHECK=1
- if [ "256" != ${RAM_SIZE} ] && [ "512" != ${RAM_SIZE} ]; then
- printf "\033[1mplease specify your RAM size with the -r parameter\033[0m\n"
- SANITY_CHECK=0
- fi
-
- if [ "v11" != ${MODVERSION} ] && [ "v12" != ${MODVERSION} ]; then
- printf "\033[1mplease specify your module version with the -v parameter\033[0m\n"
- SANITY_CHECK=0
- fi
-
- if [ ${SANITY_CHECK} -eq 0 ] ; then
- Usage
- exit 1
- fi
- fi
-
- cd ${LOCPATH}
- sudo ./tegrarcm --bct=../${BINARIES}/${BCT} --bootloader=../${BINARIES}/${U_BOOT_BINARY} --loadaddr=0x80108000 --usb-timeout=5000
- exit
-fi
-
-#sanity check for awk programs
-AWKTEST=`echo 100000000 | awk -v min=100 -v f=10000 '{rootfs_size=$1+f*512;rootfs_size=int(rootfs_size/1024/985); print (rootfs_size+min) }'` || true
-[ "${AWKTEST}x" = "204x" ] || { echo >&2 "Program awk not available. Aborting."; exit 1; }
-
-#sanity check for correct untared rootfs
-DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'`
-if [ "${DEV_OWNER}x" != "rootx" ]
-then
- printf "rootfs/dev is not owned by root, but it should!\n"
- printf "\033[1mPlease unpack the tarball with root rights.\033[0m\n"
- printf "e.g. sudo tar xjvf Apalis_T30_LinuxImageV2.6Beta1_20160331.tar.bz2\n"
- exit 1
-fi
-
-#sanity check for existence of U-Boot and kernel
-[ -e ${BINARIES}/${U_BOOT_BINARY} ] || { echo "${BINARIES}/${U_BOOT_BINARY} does not exist"; exit 1; }
-[ -e ${BINARIES}/${KERNEL_IMAGETYPE} ] || { echo "${BINARIES}/${KERNEL_IMAGETYPE} does not exist"; exit 1; }
-
-#Sanity check for some programs. Some distros have fs tools only in root's path
-MCOPY=`command -v mcopy` || { echo >&2 "Program mcopy not available. Aborting."; exit 1; }
-PARTED=`command -v parted` || PARTED=`sudo -s command -v parted` || { echo >&2 "Program parted not available. Aborting."; exit 1; }
-MKFSVFAT=`command -v mkfs.fat` || MKFSVFAT=`sudo -s command -v mkfs.fat` || { echo >&2 "Program mkfs.fat not available. Aborting."; exit 1; }
-MKFSEXT3=`command -v mkfs.ext3` || MKFSEXT3=`sudo -s command -v mkfs.ext3` || { echo >&2 "Program mkfs.ext3 not available. Aborting."; exit 1; }
-MKFSEXT4=`command -v mkfs.ext4` || MKFSEXT4=`sudo -s command -v mkfs.ext4` || { echo >&2 "Program mkfs.ext4 not available. Aborting."; exit 1; }
-dd --help >/dev/null 2>&1 || { echo >&2 "Program dd not available. Aborting."; exit 1; }
-
-CBOOT_CNT=`tegra-uboot-flasher/cbootimage -h | grep -c outputimage || true`
-[ "$CBOOT_CNT" -gt 0 ] || { echo >&2 "Program cbootimage not available. 32bit compatibility libs? Aborting."; exit 1; }
-
-if [ "${MODTYPE}" = "colibri-t20" ] ; then
- #sanity check, can we execute mkfs.ubifs, e.g. see the help text?
- CNT=`sudo $LOCPATH/mkfs.ubifs -h | grep -c space-fixup || true`
- 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 64-bit Linux host without installed 32-bit execution environment?"
- printf "\033[1mPlease install e.g. ia32-libs on 64-bit Ubuntu\033[0m\n"
- printf "\033[1mMaybe others are needed e.g. liblzo2:i386 on 64-bit Ubuntu\033[0m\n"
- exit 1
- fi
-fi
-
-#Install trap to write a sensible message in case any of the commands below
-#exit premature...
-trap '{ printf "\033[31mScript aborted unexpectedly...\033[0m\n"; }' EXIT
-
-#make the directory with the outputfiles writable
-sudo chown $USER: ${BINARIES}
-
-#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_BINARY}`" >> ${BINARIES}/versions.txt
-basename "`readlink -e ${BINARIES}/${KERNEL_IMAGETYPE}`" >> ${BINARIES}/versions.txt
-ROOTFSVERSION=`egrep -i 't([2-3]0|k1)' rootfs/etc/issue || echo "Version Unknown"`
-echo "Rootfs ${ROOTFSVERSION}" >> ${BINARIES}/versions.txt
-
-#create subdirectory for this module type
-sudo mkdir -p "$OUT_DIR"
-
-# The eMMC layout used is:
-#
-# boot area partition 1 aka primary eMMC boot sector:
-# with cbootimage containing BCT and U-Boot boot loader and the U-Boot
-# environment before the configblock at the end of that boot area partition
-#
-# boot area partition 2 aka secondary eMMC boot sector:
-# reserved
-#
-# user area aka general purpose eMMC region:
-#
-# 0 -> IMAGE_ROOTFS_ALIGNMENT - reserved (not partitioned)
-# IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE - kernel and other data
-# BOOT_SPACE -> SDIMG_SIZE - rootfs
-#
-# 4MiB 16MiB SDIMG_ROOTFS
-# <-----------------------> <----------> <---------------------->
-# ------------------------ ------------ ------------------------
-# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE |
-# ------------------------ ------------ ------------------------
-# ^ ^ ^ ^
-# | | | |
-# 0 4MiB 4MiB + 16MiB EMMC_SIZE
-
-# generate cbootimage(s) containing BCT(s) and U-Boot boot loader
-cd ${BINARIES}
-for cbootimage in ${CBOOT_IMAGE}; do
- sudo ../${LOCPATH}/cbootimage -s ${CBOOT_IMAGE_TARGET} ${cbootimage}.cfg ${cbootimage}
-done
-cd ..
-
-if [ "${MODTYPE}" = "colibri-t20" ] ; then
- # Prepare full flashing
- #build ${IMAGEFILE} if it does not exist
- for blocksize in ${BLOCK}; do
- sudo $LOCPATH/mkfs.ubifs --space-fixup -c ${MAXLEB} -e ${blocksize} -m ${PAGE} -o ${BINARIES}/${IMAGEFILE}_${blocksize}.img -r rootfs/ -v
- done
-
- echo ""
- echo "UBI image of root file system generated, copying data to target folder..."
-else
- if [ "${MODTYPE}" = "apalis-t30" ] || [ "${MODTYPE}" = "apalis-tk1" ] || [ "${MODTYPE}" = "apalis-tk1-mainline" ] || [ "${MODTYPE}" = "colibri-t30" ] ; then
- # 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"
-
- 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
- if [ "${IMAGEFILE}" = "root.ext3" ] ; then
- ${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary ext3 ${ROOTFS_START} $(expr ${EMMC_SIZE} \- ${ROOTFS_START} \- 1)
- else
- ${PARTED} -a none -s ${BINARIES}/mbr.bin unit s mkpart primary ext4 ${ROOTFS_START} $(expr ${EMMC_SIZE} \- ${ROOTFS_START} \- 1)
- fi
- ${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 partition 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}/${KERNEL_IMAGETYPE} ::/${KERNEL_IMAGETYPE}
-
- # Copy device tree file
- COPIED=false
- if test -n "${KERNEL_DEVICETREE}"; then
- for DTB_FILE in ${KERNEL_DEVICETREE}; do
- if [ -e "${BINARIES}/${DTB_FILE}" ]; then
- mcopy -i ${BINARIES}/boot.vfat -s ${BINARIES}/${DTB_FILE} ::/${DTB_FILE}
- #copy also to out_dir
- sudo cp ${BINARIES}/${DTB_FILE} "$OUT_DIR/"
- COPIED=true
- fi
- done
- ([ "${MODTYPE}" = "apalis-tk1" ] || [ "${MODTYPE}" = "apalis-tk1-mainline" ]) && ([ $COPIED = true ] || { echo "Did not find the devicetrees from KERNEL_DEVICETREE, ${KERNEL_DEVICETREE}. Aborting."; exit 1; })
- fi
-
- echo ""
- echo "Creating rootfs partition image"
- #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
- #(resize it later on target to fill the size of the partition it lives in)
- 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) }'`
-
- rm -f ${BINARIES}/${IMAGEFILE}
- if [ "${IMAGEFILE}" = "root.ext3" ] ; then
- sudo $LOCPATH/genext3fs.sh -d rootfs -b ${EXT_SIZE} ${BINARIES}/${IMAGEFILE} || exit 1
- else
- sudo $LOCPATH/genext4fs.sh -d rootfs -b ${EXT_SIZE} ${BINARIES}/${IMAGEFILE} || exit 1
- fi
- fi
-fi
-
-#copy to $OUT_DIR
-OUT_DIR=`readlink -f $OUT_DIR`
-cd ${BINARIES}
-sudo cp ${CBOOT_IMAGE} ${KERNEL_IMAGETYPE} ${EMMC_PARTS} flash*.img versions.txt "$OUT_DIR"
-sudo cp fwd_blk.img "$OUT_DIR/../flash_blk.img"
-sudo cp fwd_eth.img "$OUT_DIR/../flash_eth.img"
-sudo cp fwd_mmc.img "$OUT_DIR/../flash_mmc.img"
-
-if [ "${IMAGEFILE}" = "root.ext3" ] || [ "${IMAGEFILE}" = "root.ext4" ] ; then
- if [ "$SPLIT" -ge 1 ] ; then
- sudo split -a 3 -b `expr 64 \* 1024 \* 1024` --numeric-suffixes=100 ${IMAGEFILE} "${OUT_DIR}/${IMAGEFILE}-"
- fi
-else
- sudo cp ${IMAGEFILE}* "$OUT_DIR"
-fi
-
-#cleanup intermediate files
-sudo rm ${CBOOT_IMAGE} ${EMMC_PARTS} ${IMAGEFILE}* versions.txt
-cd ..
-sync
-
-#Remove trap and report success!
-trap - EXIT
-printf "\033[32mSuccessfully copied data to target folder.\033[0m\n\n"
-
-Flash