summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_blk.scr10
-rw-r--r--recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_eth.scr10
l---------recipes/images/files/colibri-imx7/colibri-imx7_bin/fwd_blk.scr1
l---------recipes/images/files/colibri-imx7/colibri-imx7_bin/fwd_eth.scr1
l---------recipes/images/files/colibri-imx7/colibri-imx7_bin/mk-u-boot-scripts.sh1
-rwxr-xr-xrecipes/images/files/colibri-imx7/update.sh181
-rw-r--r--recipes/images/trdx-extra.inc9
-rw-r--r--recipes/images/trdx-image-fstype.inc29
8 files changed, 239 insertions, 3 deletions
diff --git a/recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_blk.scr b/recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_blk.scr
new file mode 100644
index 0000000..eb6509c
--- /dev/null
+++ b/recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_blk.scr
@@ -0,0 +1,10 @@
+setenv create_bcb 'nand erase.part mx7-bcb && writebcb 0x20000 0x20000'
+setenv update_configblock 'fatload ${interface} 0:1 ${loadaddr} ${board_name}/configblock.bin && nand write ${loadaddr} 0x800 ${filesize}'
+
+setenv prepare_rootfs 'ubi part ubi && ubi check rootfs || ubi create rootfs'
+setenv update_uboot 'fatload ${interface} 0:1 ${loadaddr} ${board_name}/u-boot-nand.imx && nand erase.part u-boot && nand erase.part u-boot-env && nand write ${loadaddr} u-boot'
+setenv update_rootfs 'fatload ${interface} 0:1 ${loadaddr} ${board_name}/ubifs.img && run prepare_rootfs && ubi write ${loadaddr} rootfs ${filesize}'
+
+setenv update 'mtdparts default; run update_uboot; run update_rootfs; reset'
+
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_eth.scr b/recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_eth.scr
new file mode 100644
index 0000000..4f81a85
--- /dev/null
+++ b/recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_eth.scr
@@ -0,0 +1,10 @@
+setenv create_bcb 'nand erase.part mx7-bcb && writebcb 0x20000 0x20000'
+setenv update_configblock 'tftpboot ${loadaddr} ${board_name}/configblock.bin && nand write ${loadaddr} 0x800 ${filesize}'
+
+setenv prepare_rootfs 'ubi part ubi && ubi check rootfs || ubi create rootfs'
+setenv update_uboot 'tftpboot ${loadaddr} ${board_name}/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} ${board_name}/ubifs.img && run prepare_rootfs && ubi write ${loadaddr} rootfs ${filesize}'
+
+setenv update 'mtdparts default; run update_uboot; run update_rootfs; reset'
+
+echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/colibri-imx7/colibri-imx7_bin/fwd_blk.scr b/recipes/images/files/colibri-imx7/colibri-imx7_bin/fwd_blk.scr
new file mode 120000
index 0000000..5954646
--- /dev/null
+++ b/recipes/images/files/colibri-imx7/colibri-imx7_bin/fwd_blk.scr
@@ -0,0 +1 @@
+../../library/fwd_blk.scr \ No newline at end of file
diff --git a/recipes/images/files/colibri-imx7/colibri-imx7_bin/fwd_eth.scr b/recipes/images/files/colibri-imx7/colibri-imx7_bin/fwd_eth.scr
new file mode 120000
index 0000000..decc214
--- /dev/null
+++ b/recipes/images/files/colibri-imx7/colibri-imx7_bin/fwd_eth.scr
@@ -0,0 +1 @@
+../../library/fwd_eth.scr \ No newline at end of file
diff --git a/recipes/images/files/colibri-imx7/colibri-imx7_bin/mk-u-boot-scripts.sh b/recipes/images/files/colibri-imx7/colibri-imx7_bin/mk-u-boot-scripts.sh
new file mode 120000
index 0000000..ce71dbd
--- /dev/null
+++ b/recipes/images/files/colibri-imx7/colibri-imx7_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/colibri-imx7/update.sh b/recipes/images/files/colibri-imx7/update.sh
new file mode 100755
index 0000000..205d437
--- /dev/null
+++ b/recipes/images/files/colibri-imx7/update.sh
@@ -0,0 +1,181 @@
+#! /bin/sh
+# Prepare files needed for flashing a Colibri iMX7 module and
+# copy them to a convenient location for using 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 iMX7 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_rootfs'"
+ 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 into 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 "execute it."
+ echo ""
+ echo "Then use the following command to get U-Boot running:"
+ echo "'./update.sh -n -d /dev/ttyUSB0'"
+ echo ""
+ echo "Next, recreate the Boot Configuration Block and the Toradex Config Block:"
+ echo "'run setupdate'"
+ echo "'run update_uboot'"
+ echo "'run create_bcb'"
+ echo "'cfgblock create'"
+}
+
+Usage()
+{
+ echo ""
+ echo "Prepares and copies files for flashing internal NAND of Colibri iMX7"
+ echo ""
+ echo "The recommended way is to copy the files on a SD card or USB flash drive."
+ echo "The script format_sd.sh may be used to format the SD card."
+ echo ""
+ echo "The flash step requires a running U-Boot on the target. Either one already"
+ echo "flashed on the NAND or downloaded using serial downloader (argument -d)."
+ echo ""
+ echo "-d : use a USB connection to copy/execute U-Boot to/from module's RAM"
+ echo "-f : flash instructions"
+ echo "-h : prints this message"
+ echo "-o directory : output directory"
+ echo ""
+ echo "Example \"./update.sh -o /media/KERNEL/\" copies the required files to SD card"
+ echo ""
+ echo "*** For detailed recovery/update procedures, refer to the following website: ***"
+ echo "http://developer.toradex.com/knowledge-base/flashing-linux-on-vybrid-modules"
+ echo ""
+}
+
+# initialise options
+UBOOT_RECOVERY=0
+OUT_DIR=""
+# NAND parameters
+PAGE=2KiB
+BLOCK=124KiB
+MAXLEB=8112
+
+while getopts "d:fhno:s" Option ; do
+ case $Option in
+ d) UBOOT_RECOVERY=1
+ UARTDEV=$OPTARG
+ ;;
+ f) Flash
+ exit 0
+ ;;
+ h) Usage
+ # Exit if only usage (-h) was specified.
+ if [ "$#" -eq 1 ] ; then
+ exit 10
+ fi
+ exit 0
+ ;;
+ o) OUT_DIR=$OPTARG
+ ;;
+ esac
+done
+
+if [ "$OUT_DIR" = "" ] && [ "$UBOOT_RECOVERY" = "0" ] ; then
+ Usage
+ exit 0
+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
+
+# auto detect MODTYPE from rootfs directory
+if [ -f rootfs/etc/issue ] ; then
+ CNT=`grep -c "MX7" rootfs/etc/issue || true`
+ if [ "$CNT" -ge 1 ] ; then
+ echo "Colibri iMX7 rootfs detected"
+ MODTYPE=colibri-imx7
+ IMAGEFILE=ubifs.img
+ LOCPATH="imx_flash"
+ OUT_DIR="$OUT_DIR/colibri_imx7"
+ 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
+ echo "Put the module in recovery mode and press [ENTER]..."
+ read RESULT
+ sudo ${LOCPATH}/imx_usb ${BINARIES}/u-boot.imx
+ exit 0
+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_iMX7_LinuxImageV2.6_20160101.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 --space-fixup -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 MX7 rootfs/etc/issue >> ${BINARIES}/versions.txt
+
+#create subdirectory for this module type
+sudo mkdir -p "$OUT_DIR"
+
+#copy to $OUT_DIR
+sudo cp ${BINARIES}/u-boot-nand.imx ${BINARIES}/ubifs.img ${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"
+#cleanup intermediate files
+sudo rm ${BINARIES}/ubifs.img ${BINARIES}/versions.txt
+sync
+
+echo "Successfully copied data to target folder."
+echo ""
+
+Flash
diff --git a/recipes/images/trdx-extra.inc b/recipes/images/trdx-extra.inc
index a5ba13a..3322fb5 100644
--- a/recipes/images/trdx-extra.inc
+++ b/recipes/images/trdx-extra.inc
@@ -89,6 +89,15 @@ IMAGE_INSTALL_append_colibri-vf = " \
usb-suspend-resume \
"
+IMAGE_INSTALL_append_mx7 = " \
+ ptpd \
+ iproute2 \
+ canutils \
+ mtd-utils-ubifs \
+ kernel-modules \
+ imx-kobs \
+"
+
IMAGE_INSTALL += " \
max9526-i2c \
crda \
diff --git a/recipes/images/trdx-image-fstype.inc b/recipes/images/trdx-image-fstype.inc
index e138835..c7b49fe 100644
--- a/recipes/images/trdx-image-fstype.inc
+++ b/recipes/images/trdx-image-fstype.inc
@@ -5,6 +5,7 @@ IMAGE_ROOTFS = "${WORKDIR}/${IMAGE_NAME}${PV}/rootfs"
U_BOOT_EXT = "bin"
U_BOOT_EXT_mx6 = "imx"
+U_BOOT_EXT_mx7 = "imx"
U_BOOT_EXT_vf = "imx"
U_BOOT_SYMLINK = "u-boot-${MACHINE}.${U_BOOT_EXT}"
U_BOOT_SYMLINK_tegra = "u-boot-dtb-tegra-${MACHINE}.${U_BOOT_EXT}"
@@ -13,6 +14,7 @@ U_BOOT_BINARY_tegra = "u-boot-dtb-tegra.${U_BOOT_EXT}"
#we need some native tools for deployment
DEPENDS_append_mx6 = " imx-loader-native"
+DEPENDS_append_mx7 = " mtd-utils-native imx-loader-native"
#FIXME: 32-bit tegrarcm built on F20 does not run on 64-bit F20 even with properly installed 32-bit libs!
DEPENDS_append_tegra = " cbootimage-native tegrarcm-native"
DEPENDS_append_tegra2 = " mtd-utils-native"
@@ -37,6 +39,22 @@ imagedeploytools_append_mx6() {
cp ${STAGING_ETCDIR_NATIVE}/imx-loader.d/mx6_usb_work.conf ${IMAGE_ROOT}/
}
+imagedeploytools_append_mx7() {
+ IMAGE_ROOT="${IMAGE_ROOTFS}/../imx_flash/"
+ rm -f ${IMAGE_ROOT}/mkfs.ubifs ${IMAGE_ROOT}/imx_usb
+ mkdir -p ${IMAGE_ROOT}
+
+ # add the mkfs.ubifs binary
+ cp ${STAGING_DIR_NATIVE}/usr/sbin/mkfs.ubifs ${IMAGE_ROOT}/
+ ${BUILD_STRIP} ${IMAGE_ROOT}/mkfs.ubifs
+
+ # add imx-loader and its configuration files
+ cp ${STAGING_BINDIR_NATIVE}/imx_usb ${IMAGE_ROOT}/
+ ${BUILD_STRIP} ${IMAGE_ROOT}/imx_usb*
+ cp ${STAGING_ETCDIR_NATIVE}/imx-loader.d/imx_usb.conf ${IMAGE_ROOT}/
+ cp ${STAGING_ETCDIR_NATIVE}/imx-loader.d/mx7_usb_work.conf ${IMAGE_ROOT}/
+}
+
imagedeploytools_append_tegra() {
IMAGE_ROOT="${IMAGE_ROOTFS}/../tegra-uboot-flasher/"
mkdir -p ${IMAGE_ROOT}
@@ -71,10 +89,15 @@ imagedeploytools_append_vf() {
imagedeploy_kernel() {
# put kernel, device-tree into the bin directories, remove the kernel/dtb from the rootfs/boot
- rm -f ${IMAGE_ROOTFS}/boot/uImage* ${IMAGE_ROOTFS}/boot/*.dtb
- cp -pP ${DEPLOY_DIR_IMAGE}/uImage* ${IMAGE_ROOTFS}/../${MACHINE}_bin/
+ rm -f ${IMAGE_ROOTFS}/boot/${KERNEL_IMAGETYPE}* ${IMAGE_ROOTFS}/boot/*.dtb
+ cp -pP ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}* ${IMAGE_ROOTFS}/../${MACHINE}_bin/
ls ${DEPLOY_DIR_IMAGE}/*.dtb 2> /dev/null && cp -pP ${DEPLOY_DIR_IMAGE}/*.dtb ${IMAGE_ROOTFS}/../${MACHINE}_bin/
- mv ${IMAGE_ROOTFS}/../${MACHINE}_bin/uImage-${MACHINE}.bin ${IMAGE_ROOTFS}/../${MACHINE}_bin/uImage
+ mv ${IMAGE_ROOTFS}/../${MACHINE}_bin/${KERNEL_IMAGETYPE}-${MACHINE}.bin ${IMAGE_ROOTFS}/../${MACHINE}_bin/${KERNEL_IMAGETYPE}
+}
+
+imagedeploy_kernel_mx7() {
+ # Do nothing, we use the kernel from /boot inside root fs
+ :
}
imagedeploy_kernel_tegra2() {