From 4c49bd46708dd552d6471e24657ebcbf1c4f44bd Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Mon, 19 Oct 2015 17:14:29 +0200 Subject: flash_eth: provide option to split output file To flash a large rootfs over tftp the rootfs must be split into chunks of 64MB on the tftp server. Add the option '-c' to the update.sh script which does this automatically. Use 64MB chunks on all module types. --- .../images/files/apalis-imx6/apalis-imx6_bin/flash_eth.scr | 8 ++++---- recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.scr | 8 ++++---- .../images/files/colibri-imx6/colibri-imx6_bin/flash_eth.scr | 4 ++-- .../images/files/colibri-t30/colibri-t30_bin/flash_eth.scr | 8 ++++---- recipes/images/files/library/imx6/update.sh | 9 ++++++++- recipes/images/files/library/tegra/update.sh | 11 ++++++++++- 6 files changed, 32 insertions(+), 16 deletions(-) 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 index b68654b..56f8441 100644 --- a/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_eth.scr +++ b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_eth.scr @@ -11,8 +11,8 @@ setenv update 'run update_1; run update_uboot; run update_2; run update_3; reset setenv update_it 'run update_1; run update_uboot_it; run update_2; run update_3; reset' setenv update_1 'tftpboot ${loadaddr} mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1' setenv update_2 'tftpboot ${loadaddr} boot.vfat && run set_blkcnt && mmc dev 0 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' +#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_3 'setenv filesize 4000000; setenv filenum 10; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextnum; done' echo 'enter "run update" or "run update_it" to update the entire module' 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 index 965549a..a161d5a 100644 --- a/recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.scr +++ b/recipes/images/files/apalis-t30/apalis-t30_bin/flash_eth.scr @@ -26,10 +26,10 @@ setenv update_configblock 'run check_configblock; tftpboot ${loadaddr} configblo setenv update_1 'tftpboot ${loadaddr} mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1' setenv update_2 'tftpboot ${loadaddr} boot.vfat && run set_blkcnt && mmc dev 0 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' +#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_3 'setenv filesize 4000000; setenv filenum 10; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextnum; done' 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' 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 index e21870a..0a671bd 100644 --- a/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_eth.scr +++ b/recipes/images/files/colibri-imx6/colibri-imx6_bin/flash_eth.scr @@ -11,6 +11,6 @@ setenv update_1 'tftpboot ${loadaddr} mbr.bin && mmc dev 0 0 && mmc write ${load setenv update_2 'tftpboot ${loadaddr} 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 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' +#split -a 2 -b `expr 64 \* 1024 \* 1024` --numeric-suffixes=10 root.ext3 root.ext3- +setenv update_3 'setenv filesize 4000000; setenv filenum 10; 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-t30/colibri-t30_bin/flash_eth.scr b/recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.scr index e3e7a59..797dd4c 100644 --- a/recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.scr +++ b/recipes/images/files/colibri-t30/colibri-t30_bin/flash_eth.scr @@ -26,10 +26,10 @@ setenv update_configblock 'run check_configblock; tftpboot ${loadaddr} configblo setenv update_1 'tftpboot ${loadaddr} mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1' setenv update_2 'tftpboot ${loadaddr} boot.vfat && run set_blkcnt && mmc dev 0 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' +#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_3 'setenv filesize 4000000; setenv filenum 10; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextnum; done' 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' diff --git a/recipes/images/files/library/imx6/update.sh b/recipes/images/files/library/imx6/update.sh index 9739457..f6b832d 100755 --- a/recipes/images/files/library/imx6/update.sh +++ b/recipes/images/files/library/imx6/update.sh @@ -51,6 +51,7 @@ Usage() 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 "-c : split the resulting rootfs into chunks usable for tftp transmission" 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" @@ -65,13 +66,16 @@ Usage() MIN_PARTITION_FREE_SIZE=100 OUT_DIR="" ROOTFSPATH=rootfs +SPLIT=0 UBOOT_RECOVERY=0 # No devicetree by default KERNEL_DEVICETREE="" KERNEL_IMAGETYPE="uImage" -while getopts "dho:" Option ; do +while getopts "cdho:" Option ; do case $Option in + c) SPLIT=1 + ;; d) UBOOT_RECOVERY=1 ;; h) Usage @@ -267,6 +271,9 @@ sudo $LOCPATH/genext3fs.sh -d rootfs -b ${EXT_SIZE} ${BINARIES}/${IMAGEFILE} || #copy to $OUT_DIR sudo cp ${BINARIES}/${U_BOOT_BINARY} ${BINARIES}/${U_BOOT_BINARY_IT} ${BINARIES}/uImage ${BINARIES}/mbr.bin ${BINARIES}/boot.vfat \ ${BINARIES}/${IMAGEFILE} ${BINARIES}/flash*.img ${BINARIES}/versions.txt "$OUT_DIR" +if [ "$SPLIT" -ge 1 ] ; then +sudo split -a 2 -b `expr 64 \* 1024 \* 1024` --numeric-suffixes=10 "$OUT_DIR/root.ext3" "$OUT_DIR/root.ext3-" +fi sync Flash diff --git a/recipes/images/files/library/tegra/update.sh b/recipes/images/files/library/tegra/update.sh index 2248b22..10b11ef 100755 --- a/recipes/images/files/library/tegra/update.sh +++ b/recipes/images/files/library/tegra/update.sh @@ -52,6 +52,7 @@ Usage() echo "on the eMMC/NAND or one copied over USB into the module's RAM" echo "" echo "-b : T20: selects boot device (hsmmc/nand) (default: nand)" + echo "-c : split the resulting rootfs into chunks usable for tftp transmission" echo "-d : use USB recovery mode to copy/execute U-Boot to the module's RAM" echo "-f : flash instructions" echo "-h : prints this message" @@ -73,6 +74,7 @@ Usage() # initialise options BOOT_DEVICE=nand EMMC_PARTS="mbr.bin boot.vfat" +SPLIT=0 # no devicetree by default KERNEL_DEVICETREE="" KERNEL_IMAGETYPE="uImage" @@ -91,10 +93,12 @@ UBOOT_RECOVERY=0 MODVERSION=Add_Version_-v RAM_SIZE=Add_RAMsize_-r -while getopts "b:dfho:r:sv:" Option ; do +while getopts "b:cdfho:r:sv:" Option ; do case $Option in b) BOOT_DEVICE=$OPTARG ;; + c) SPLIT=1 + ;; d) UBOOT_RECOVERY=1 ;; f) Flash @@ -397,6 +401,11 @@ OUT_DIR=`readlink -f $OUT_DIR` cd ${BINARIES} sudo cp ${CBOOT_IMAGE} ${KERNEL_IMAGETYPE} ${EMMC_PARTS} ${IMAGEFILE}* flash*.img versions.txt "$OUT_DIR" cd .. +if [ "${IMAGEFILE}" = "root.ext3" ] ; then + if [ "$SPLIT" -ge 1 ] ; then + sudo split -a 2 -b `expr 64 \* 1024 \* 1024` --numeric-suffixes=10 "$OUT_DIR/root.ext3" "$OUT_DIR/root.ext3-" + fi +fi sync echo "Successfully copied data to target folder." echo "" -- cgit v1.2.3