summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2015-07-14 13:40:03 +0200
committerMax Krummenacher <max.oss.09@gmail.com>2015-10-12 15:15:41 +0200
commitfcb29c42d1ad3cfb76752d83642a482e3871504a (patch)
treeea07ce13a726a32855a60c9318e6d9724aa9fdcd
parentbf43da14800e1d2f6837acab8fcb362709d2d150 (diff)
update.sh: cleanup eMMC layout comments
The eMMC layout comments are confusing and in some regards outdated. Clean it up. While at it move the calculation of the rootfs file system size to the rootfs creation to not confuse the rootfs file system size with the size of the rootfs partition.
-rwxr-xr-xrecipes/images/files/library/imx6/update.sh37
-rwxr-xr-xrecipes/images/files/library/tegra/update.sh47
2 files changed, 40 insertions, 44 deletions
diff --git a/recipes/images/files/library/imx6/update.sh b/recipes/images/files/library/imx6/update.sh
index 773e812..96c1ddb 100755
--- a/recipes/images/files/library/imx6/update.sh
+++ b/recipes/images/files/library/imx6/update.sh
@@ -99,7 +99,7 @@ if [ "$CNT" -ge 1 ] ; then
U_BOOT_BINARY_IT=u-boot.imx
KERNEL_DEVICETREE="imx6dl-colibri-eval-v3.dtb imx6dl-colibri-cam-eval-v3.dtb"
LOCPATH="imx_flash"
- # eMMC size [in sectors of 512]
+ # assumed minimal eMMC size [in sectors of 512]
EMMC_SIZE=$(expr 1024 \* 3500 \* 2)
else
CNT=`grep -ic "imx6" rootfs/etc/issue || true`
@@ -111,7 +111,7 @@ else
U_BOOT_BINARY_IT=u-boot-it.imx
KERNEL_DEVICETREE="imx6q-apalis-eval.dtb imx6q-apalis-eval_v1_0.dtb"
LOCPATH="imx_flash"
- # eMMC size [in sectors of 512]
+ # assumed minimal eMMC size [in sectors of 512]
EMMC_SIZE=$(expr 1024 \* 3500 \* 2)
else
echo "can not detect module type from ./rootfs/etc/issue"
@@ -182,17 +182,14 @@ grep -i imx6 rootfs/etc/issue >> ${BINARIES}/versions.txt
# IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE - kernel and other data
# BOOT_SPACE -> SDIMG_SIZE - rootfs
#
-# Default Free space = 1.3x
-# Use IMAGE_OVERHEAD_FACTOR to add more space
-# <--------->
-# 4MiB 16MiB SDIMG_ROOTFS 4MiB
-# <-----------------------> <----------> <----------------------> <------------------------------>
-# ------------------------ ------------ ------------------------ -------------------------------
-# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE | IMAGE_ROOTFS_ALIGNMENT |
-# ------------------------ ------------ ------------------------ -------------------------------
-# ^ ^ ^ ^ ^
-# | | | | |
-# 0 4096 4MiB + 16MiB 4MiB + 16Mib + SDIMG_ROOTFS 4MiB + 16MiB + SDIMG_ROOTFS + 4MiB
+# 4MiB 16MiB SDIMG_ROOTFS
+# <-----------------------> <----------> <---------------------->
+# ------------------------ ------------ ------------------------
+# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE |
+# ------------------------ ------------ ------------------------
+# ^ ^ ^
+# | | |
+# 0 4MiB 4MiB + 16MiB EMMC_SIZE
#
# with U-Boot at 1024, the U-Boot environment at 512 * 1024, the config block is at 640 * 1024
@@ -204,13 +201,6 @@ ROOTFS_START=$(expr 20480 \* 2)
# Boot partition volume id
BOOTDD_VOLUME_ID="boot"
-#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
-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) }'`
-
echo ""
echo "Creating MBR file and do the partitioning"
# Initialize a sparse file
@@ -257,6 +247,13 @@ fi
echo ""
echo "Creating rootfs partion 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/genext3fs.sh -d rootfs -b ${EXT_SIZE} ${BINARIES}/${IMAGEFILE} || exit 1
diff --git a/recipes/images/files/library/tegra/update.sh b/recipes/images/files/library/tegra/update.sh
index 552f728..8b7ed94 100755
--- a/recipes/images/files/library/tegra/update.sh
+++ b/recipes/images/files/library/tegra/update.sh
@@ -132,7 +132,7 @@ if [ "$CNT" -ge 1 ] ; then
U_BOOT_BINARY=u-boot-dtb-tegra.bin
KERNEL_DEVICETREE="tegra30-apalis-eval.dtb"
LOCPATH="tegra-uboot-flasher"
- # eMMC size [in sectors of 512]
+ # assumed minimal eMMC size [in sectors of 512]
EMMC_SIZE=$(expr 1024 \* 7450 \* 2)
BCT=apalis_t30_12MHz_MT41K512M8RH-125_533MHz.bct
CBOOT_IMAGE=apalis_t30.img
@@ -280,29 +280,27 @@ grep -i t[2-3]0 rootfs/etc/issue >> ${BINARIES}/versions.txt
# The emmc layout used is:
#
-# boot area partition 1 aka eMMC boot sector:
-#
+# boot area partition 1 aka primary eMMC boot sector:
# with cbootimage containing BCT and U-Boot boot loader
+# and the configblock at the end of that boot area partition
+#
+# boot area partition 2 aka secondary eMMC boot sector:
+# with the U-Boot environment at the end of that boot area partition
#
# user area aka general purpose eMMC region:
#
-# 0 -> IMAGE_ROOTFS_ALIGNMENT - reserved to bootloader (not partitioned)
+# 0 -> IMAGE_ROOTFS_ALIGNMENT - reserved ((not partitioned)
# IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE - kernel and other data
# BOOT_SPACE -> SDIMG_SIZE - rootfs
#
-# Default Free space = 1.3x
-# Use IMAGE_OVERHEAD_FACTOR to add more space
-# <--------->
-# 4MiB 16MiB SDIMG_ROOTFS 4MiB
-# <-----------------------> <----------> <----------------------> <------------------------------>
-# ------------------------ ------------ ------------------------ -------------------------------
-# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE | IMAGE_ROOTFS_ALIGNMENT |
-# ------------------------ ------------ ------------------------ -------------------------------
-# ^ ^ ^ ^ ^
-# | | | | |
-# 0 4096 4MiB + 16MiB 4MiB + 16Mib + SDIMG_ROOTFS 4MiB + 16MiB + SDIMG_ROOTFS + 4MiB
-#
-# with the U-Boot environment at 512 * 1024, the config block is at 640 * 1024
+# 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}
@@ -329,13 +327,6 @@ else
# Boot partition volume id
BOOTDD_VOLUME_ID="boot"
- #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
- 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) }'`
-
echo ""
echo "Creating MBR file and do the partitioning"
# Initialize a sparse file
@@ -381,6 +372,14 @@ else
echo ""
echo "Creating rootfs partion 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}
sudo $LOCPATH/genext3fs.sh -d rootfs -b ${EXT_SIZE} ${BINARIES}/${IMAGEFILE} || exit 1
fi