summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2016-06-06 11:27:54 -0700
committerMax Krummenacher <max.krummenacher@toradex.com>2016-06-30 13:19:25 +0200
commit379eebf6059721ef36fd7db4851652b086cd1b76 (patch)
tree214b3dcc40e32106dc5ebf4d293af09c4194e7ef
parent76980cf65b0b6fe38ef71265c980c6cf48982fa6 (diff)
update.sh: imx7: write kernel and dt into static UBI volumes
Write kernel and device tree into seperate UBI Volumes. This allows to use a lot less UBI/UBIFS support in U-Boot, which should lower the risk of hitting bugs in this area. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r--recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_blk.scr12
-rw-r--r--recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_eth.scr12
-rwxr-xr-xrecipes/images/files/colibri-imx7/update.sh16
3 files changed, 33 insertions, 7 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
index 996b0d4..0403305 100644
--- a/recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_blk.scr
+++ b/recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_blk.scr
@@ -1,10 +1,16 @@
setenv create_bcb 'nand erase.part mx7-bcb && writebcb 80000 200000'
setenv update_configblock 'fatload ${interface} 0:1 ${loadaddr} ${board_name}/configblock.bin && nand write ${loadaddr} 0x800 ${filesize} && nand write ${loadaddr} 0x20800 ${filesize}'
-setenv prepare_rootfs 'ubi part ubi && ubi check rootfs || ubi create rootfs'
+# Migrate to UBI volume based boot schema
+setenv prepare_kernel_dtb 'ubi create kernel 0x800000 static && ubi create dtb 0x20000 static'
+setenv prepare_rootfs 'ubi create rootfs 0 dynamic'
+setenv prepare_ubi 'ubi part ubi && if ubi check rootfs; then if ubi check kernel; then else ubi remove rootfs && run prepare_kernel_dtb && run prepare_rootfs; fi; else run prepare_kernel_dtb && run prepare_rootfs; fi'
+
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 && writeboot ${loadaddr} 80000 200000 $filesize'
-setenv update_rootfs 'fatload ${interface} 0:1 ${loadaddr} ${board_name}/ubifs.img && run prepare_rootfs && ubi write ${loadaddr} rootfs ${filesize}'
+setenv update_kernel 'fatload ${interface} 0:1 ${loadaddr} ${board_name}/zImage && ubi write ${loadaddr} kernel ${filesize}'
+setenv update_dtb 'fatload ${interface} 0:1 ${loadaddr} ${board_name}/${soc}-colibri-${fdt_board}.dtb && ubi write ${loadaddr} dtb ${filesize}'
+setenv update_rootfs 'fatload ${interface} 0:1 ${loadaddr} ${board_name}/ubifs.img && ubi write ${loadaddr} rootfs ${filesize}'
-setenv update 'mtdparts default; run update_uboot; run update_rootfs; reset'
+setenv update 'mtdparts default; run update_uboot; run prepare_ubi && run update_kernel && run update_dtb && 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
index 1a24aa5..93d9be2 100644
--- a/recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_eth.scr
+++ b/recipes/images/files/colibri-imx7/colibri-imx7_bin/flash_eth.scr
@@ -1,10 +1,16 @@
setenv create_bcb 'nand erase.part mx7-bcb && writebcb 80000 200000'
setenv update_configblock 'tftpboot ${loadaddr} ${board_name}/configblock.bin && nand write ${loadaddr} 0x800 ${filesize} && nand write ${loadaddr} 0x20800 ${filesize}'
-setenv prepare_rootfs 'ubi part ubi && ubi check rootfs || ubi create rootfs'
+# Migrate to UBI volume based boot schema
+setenv prepare_kernel_dtb 'ubi create kernel 0x800000 static && ubi create dtb 0x20000 static'
+setenv prepare_rootfs 'ubi create rootfs 0 dynamic'
+setenv prepare_ubi 'ubi part ubi && if ubi check rootfs; then if ubi check kernel; then else ubi remove rootfs && run prepare_kernel_dtb && run prepare_rootfs; fi; else run prepare_kernel_dtb && run prepare_rootfs; fi'
+
setenv update_uboot 'tftpboot ${loadaddr} ${board_name}/u-boot-nand.imx && nand erase.part u-boot && nand erase.part u-boot-env && writeboot ${loadaddr} 80000 200000 $filesize'
-setenv update_rootfs 'tftpboot ${loadaddr} ${board_name}/ubifs.img && run prepare_rootfs && ubi write ${loadaddr} rootfs ${filesize}'
+setenv update_kernel 'tftpboot ${loadaddr} ${board_name}/zImage && ubi write ${loadaddr} kernel ${filesize}'
+setenv update_dtb 'tftpboot ${loadaddr} ${board_name}/${soc}-colibri-${fdt_board}.dtb && ubi write ${loadaddr} dtb ${filesize}'
+setenv update_rootfs 'tftpboot ${loadaddr} ${board_name}/ubifs.img && ubi write ${loadaddr} rootfs ${filesize}'
-setenv update 'mtdparts default; run update_uboot; run update_rootfs; reset'
+setenv update 'mtdparts default; run update_uboot; run prepare_ubi && run update_kernel && run update_dtb && run update_rootfs; reset'
echo 'enter "run update" to update the entire module'
diff --git a/recipes/images/files/colibri-imx7/update.sh b/recipes/images/files/colibri-imx7/update.sh
index 07b04bd..f998b78 100755
--- a/recipes/images/files/colibri-imx7/update.sh
+++ b/recipes/images/files/colibri-imx7/update.sh
@@ -66,6 +66,8 @@ OUT_DIR=""
PAGE=2KiB
BLOCK=124KiB
MAXLEB=8112
+KERNEL_DEVICETREE="imx7s-colibri-eval-v3.dtb imx7d-colibri-eval-v3.dtb"
+KERNEL_IMAGETYPE="zImage"
while getopts "dfhno:s" Option ; do
case $Option in
@@ -162,8 +164,20 @@ echo "Rootfs ${ROOTFSVERSION}" >> ${BINARIES}/versions.txt
#create subdirectory for this module type
sudo mkdir -p "$OUT_DIR"
+# Copy device tree file
+COPIED=false
+if test -n "${KERNEL_DEVICETREE}"; then
+ for DTB_FILE in ${KERNEL_DEVICETREE}; do
+ if [ -e "${BINARIES}/${KERNEL_IMAGETYPE}-${DTB_FILE}" ]; then
+ sudo cp ${BINARIES}/${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_FILE} "$OUT_DIR/${DTB_FILE}"
+ COPIED=true
+ fi
+ done
+ [ $COPIED = true ] || { echo "Did not find the devicetrees from KERNEL_DEVICETREE, ${KERNEL_DEVICETREE}. Aborting."; exit 1; }
+fi
+
#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}/u-boot-nand.imx ${BINARIES}/zImage ${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