|
|
@ -223,9 +223,26 @@ rootfsb_end=$(( ${rootfsb_start} + ${rootfs_part_sectors} - 1 )) |
|
|
|
data_start=$(disk_align_sectors ${rootfsb_end} ${MENDER_PARTITION_ALIGNMENT} ) |
|
|
|
data_end=$(( ${data_start} + ${data_part_sectors} - 1 )) |
|
|
|
|
|
|
|
# Create partition table. TODO: GPT support |
|
|
|
run_and_log_cmd "${PARTED} -s ${img_path} mklabel msdos" |
|
|
|
run_and_log_cmd "${PARTED} -s ${img_path} unit s mkpart primary fat32 ${boot_part_start} ${boot_part_end}" |
|
|
|
if [ -n "${MENDER_PARTITION_SCHEME}" ]; then |
|
|
|
# Force partition scheme to the one from configs |
|
|
|
partition_scheme="${MENDER_PARTITION_SCHEME}" |
|
|
|
log_info "Forcing partition scheme defined by MENDER_PARTITION_SCHEME to: ${partition_scheme}" |
|
|
|
else |
|
|
|
# By default use the partition scheme from the input image |
|
|
|
partition_scheme=$(disk_get_part_value ${disk_image} 1 SCHEME) |
|
|
|
log_info "Using input diskimage partition scheme (${partition_scheme})" |
|
|
|
fi |
|
|
|
|
|
|
|
# Create partition table. |
|
|
|
if [ "${partition_scheme}" == "gpt" ]; then |
|
|
|
log_info "Writing GPT partition table" |
|
|
|
run_and_log_cmd "${PARTED} -s ${img_path} mklabel gpt" |
|
|
|
run_and_log_cmd "${PARTED} -s ${img_path} unit s mkpart ESP fat32 ${boot_part_start} ${boot_part_end}" |
|
|
|
else |
|
|
|
log_info "Writing DOS (MBR) partition table" |
|
|
|
run_and_log_cmd "${PARTED} -s ${img_path} mklabel msdos" |
|
|
|
run_and_log_cmd "${PARTED} -s ${img_path} unit s mkpart primary fat32 ${boot_part_start} ${boot_part_end}" |
|
|
|
fi |
|
|
|
run_and_log_cmd "${PARTED} -s ${img_path} set 1 boot on" |
|
|
|
run_and_log_cmd "${PARTED} -s ${img_path} -- unit s mkpart primary ext2 ${rootfsa_start} ${rootfsa_end}" |
|
|
|
run_and_log_cmd "${PARTED} -s ${img_path} -- unit s mkpart primary ext2 ${rootfsb_start} ${rootfsb_end}" |
|
|
@ -239,9 +256,13 @@ if [ "${MENDER_COPY_BOOT_GAP}" == "y" ]; then |
|
|
|
fi |
|
|
|
|
|
|
|
# Burn Partitions |
|
|
|
log_info "Writing boot partition image" |
|
|
|
disk_write_at_offset "${boot_part}" "${img_path}" "${boot_part_start}" |
|
|
|
log_info "Writing rootfsa partition image" |
|
|
|
disk_write_at_offset "${output_dir}/rootfs.img" "${img_path}" "${rootfsa_start}" |
|
|
|
log_info "Writing rootfsb partition image" |
|
|
|
disk_write_at_offset "${output_dir}/rootfs.img" "${img_path}" "${rootfsb_start}" |
|
|
|
log_info "Writing data partition image" |
|
|
|
disk_write_at_offset "${output_dir}/data.img" "${img_path}" "${data_start}" |
|
|
|
|
|
|
|
log_info "Performing platform specific package operations (if any)" |
|
|
|