@@ -50,8 +50,12 @@ MAX_IMG_SIZE_MB=2048
5050
5151FS_TYPE=${FS_TYPE:- " ext4" }
5252
53- # In order to support memory hotplug, image must be aligned to 128M
54- MEM_BOUNDARY=128
53+ # In order to support memory hotplug, image must be aligned to memory section(size in MB) according to different architecture.
54+ ARCH=$( arch)
55+ case " $ARCH " in
56+ aarch64) MEM_BOUNDARY_MB=1024 ;;
57+ * ) MEM_BOUNDARY_MB=128 ;;
58+ esac
5559
5660# Maximum no of attempts to create a root disk before giving up
5761MAX_ATTEMPTS=5
@@ -139,20 +143,21 @@ OK "Agent installed"
139143ROOTFS_SIZE=$( du -B 1MB -s " ${ROOTFS} " | awk ' {print $1}' )
140144BLOCK_SIZE=${BLOCK_SIZE:- 4096}
141145OLD_IMG_SIZE=0
146+ ORIG_MEM_BOUNDARY_MB=${MEM_BOUNDARY_MB}
142147
143148align_memory ()
144149{
145- remaining=$(( $IMG_SIZE % $MEM_BOUNDARY ))
150+ remaining=$(( $IMG_SIZE % $MEM_BOUNDARY_MB ))
146151 if [ " $remaining " != " 0" ]; then
147- warning " image size '$IMG_SIZE ' is not aligned to memory boundary '$MEM_BOUNDARY ', aligning it"
148- IMG_SIZE=$(( $IMG_SIZE + $MEM_BOUNDARY - $remaining ))
152+ warning " image size '$IMG_SIZE ' is not aligned to memory boundary '$MEM_BOUNDARY_MB ', aligning it"
153+ IMG_SIZE=$(( $IMG_SIZE + $MEM_BOUNDARY_MB - $remaining ))
149154 fi
150155}
151156
152157# Calculate image size based on the rootfs
153158calculate_img_size ()
154159{
155- IMG_SIZE=${IMG_SIZE:- $MEM_BOUNDARY }
160+ IMG_SIZE=${IMG_SIZE:- $MEM_BOUNDARY_MB }
156161 align_memory
157162 if [ -n " $ROOT_FREE_SPACE " ] && [ " $IMG_SIZE " -gt " $ROOTFS_SIZE " ]; then
158163 info " Ensure that root partition has at least ${ROOT_FREE_SPACE} MB of free space"
@@ -258,8 +263,8 @@ create_rootfs_disk()
258263 # if the available disk space is less than rootfs size, repeat the process
259264 # of disk creation by adding 5% in the inital assumed value $ROOTFS_SIZE
260265 if [ $ROOTFS_SIZE -gt $AVAIL_DISK ]; then
261- # Increase the size but remain aligned to 128
262- MEM_BOUNDARY =$(( $MEM_BOUNDARY + 128 ))
266+ # Increase the size but remain aligned to the original MEM_BOUNDARY_MB, which is stored in $ORIG_MEM_BOUNDARY_MB
267+ MEM_BOUNDARY_MB =$(( $MEM_BOUNDARY_MB + $ORIG_MEM_BOUNDARY_MB ))
263268 OLD_IMG_SIZE=${IMG_SIZE}
264269 unset IMG_SIZE
265270 unmount
0 commit comments