1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-07 04:58:57 +00:00

arm-autonomy/xenguest-manager: keep user defined partition order

If xenguest image does not define some partitions,
e.g second partition definition is skipped but 1st and 3rd are present,
xenguest-manager will create second partition(with small 2MB size),
to keep user defined partition order.

Change-Id: I8ff19fd9f25eb47ac37f80bec849387f6802aba3
Issue-Id: SCM-1515
Signed-off-by: Kamil Dziezyk <kamil.dziezyk@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Kamil Dziezyk
2020-11-20 12:44:03 +01:00
committed by Jon Mason
parent 5331993f8c
commit aa35796c80
@@ -248,12 +248,32 @@ function xenguest_disk_init()
# with a : separated list defining the partition:
# DISK_PART3="4:ext4:disk.tgz" means that partition 3 should be 4G formated
# with ext4 and initialized with the content of disk.tgz
for part in $(seq 1 4); do
eval partdesc="\${DISK_PART${part}:-0}"
# Keep user defined partition order,
# even if previous partitions are not defined.
# Create 2MB partitions in this case
lastpart="0"
for partidx in $(seq 1 4); do
local _part="DISK_PART${partidx}"
if [ -n "${!_part:=}" ]; then
lastpart="${partidx}"
fi
done
if [ "${lastpart}" -eq "0" ]; then
# Nothing to be added here
# No partition definition found
return
fi
for part in $(seq 1 "${lastpart}"); do
eval partdesc="\${DISK_PART${part}:=}"
size=$(echo ${partdesc} | sed -e "s/\(.*\):.*:.*/\1/")
fstype=$(echo ${partdesc} | sed -e "s/.*:\(.*\):.*/\1/")
content=$(echo ${partdesc} | sed -e "s/.*:.*:\(.*\)/\1/")
local _part="DISK_PART${part}"
[ -n "${!_part:=}" ] || size="2M"
size=$(check_size "${size}")
if [ -n "${size}" ] && [ "${size}" != "0M" ]; then
# size has appended M or G suffix, let's extract just the value