From ed0e2836138849c3d66efb7462a505d5cd3e348e Mon Sep 17 00:00:00 2001
From: guowenxu <guowenxue@gmail.com>
Date: Sat, 20 Nov 2021 20:52:48 +0800
Subject: [PATCH] update images build shell script

---
 bsp/images/build.sh |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/bsp/images/build.sh b/bsp/images/build.sh
index 5a37c98..76377d6 100755
--- a/bsp/images/build.sh
+++ b/bsp/images/build.sh
@@ -37,13 +37,14 @@
     IMAGE_SIZE=2048
 fi
 
-# 1 sector - for i.MX6 or i.MX7
-UBOOT_OFSET=1
+#i.MX6/i.MX7 read uboot from mmc start on sector #2
+UBOOT_OFSET=2
+MMC_SECSIZE=512
 
-# BootRom(U-boot) Size 10MB:  20480 Sectors * 512B
+# U-boot space Size 10MB
 UBOOT_SIZE=10
 
-# vfat boot partition size
+# vfat boot partition 100MB
 BOOT_SIZE=100
 
 
@@ -101,16 +102,13 @@
 
 function generate_image()
 {
-    # system image block count by block=512k
-    BLOCK_CNT=`expr 2 \* ${IMAGE_SIZE}`
-
     # FAT32 boot partition start/end address in MB
     BOOT_START=${UBOOT_SIZE}
     BOOT_END=`expr ${BOOT_START} + ${BOOT_SIZE}`
 
     msg_banner " <${STAGE}> Generate system image "
 
-    dd if=/dev/zero of=${IMAGE_NAME} bs=512k count=${BLOCK_CNT}  && sync
+    dd if=/dev/zero of=${IMAGE_NAME} bs=1024k count=${IMAGE_SIZE}  && sync
     chmod a+x ${IMAGE_NAME}
 
     msg_banner " <${STAGE}> Partition system image "
@@ -139,7 +137,7 @@
 function install_sysimg()
 {
     msg_banner " <${STAGE}> Install u-boot image"
-    sudo dd if=${IMG_UBOOT} of=${IMAGE_NAME} bs=1k seek=${UBOOT_OFSET} conv=notrunc,sync
+    sudo dd if=${IMG_UBOOT} of=${IMAGE_NAME} bs=${MMC_SECSIZE} seek=${UBOOT_OFSET} conv=notrunc,sync
 
     msg_banner " <${STAGE}> Install linux kernel image"
 

--
Gitblit v1.9.1