From 330636aa8d5e22f33e4d32adfa135331b5204223 Mon Sep 17 00:00:00 2001 From: Ole Petter Date: Thu, 16 Jan 2020 12:47:53 +0100 Subject: [PATCH 1/6] [spelling] Fix Changelog: None Signed-off-by: Ole Petter --- modules/probe.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/probe.sh b/modules/probe.sh index 31f7fd4..d7fd221 100644 --- a/modules/probe.sh +++ b/modules/probe.sh @@ -30,7 +30,7 @@ probe_arch() { done if [ -z "${file_info}" ]; then - log_fatal "Sorry, where not able to determinate target architecture" + log_fatal "Sorry, not able to determinate target architecture" fi target_arch="unknown" From 9b50cdbb9bf909b364c89ea04531a0c1ec580507 Mon Sep 17 00:00:00 2001 From: Ole Petter Date: Thu, 16 Jan 2020 13:13:54 +0100 Subject: [PATCH 2/6] MEN-3051: Change the output filename naming scheme to mender.img Previously this was '.sdimg'. But due to this not being a standard fileformat, and unfamiliar to Debian users, the decision was made so standardize it on a custom 'filename-mender.img' image naming convention. Changelog: Title Signed-off-by: Ole Petter --- mender-convert-package | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/mender-convert-package b/mender-convert-package index 7b870f8..c2bf1ea 100755 --- a/mender-convert-package +++ b/mender-convert-package @@ -194,7 +194,7 @@ mender_create_artifact "${device_type}" "${artifact_name}" log_info "Creating Mender compatible disk-image" -sdimg_path=deploy/${image_name}.sdimg +img_path=deploy/${image_name}-mender.img log_info "Total disk size: $(disk_sectors_to_mb ${disk_image_total_sectors}) MiB" log_info " Boot partition $(disk_sectors_to_mb ${boot_part_sectors}) MiB" @@ -203,7 +203,7 @@ log_info " Data partition $(disk_sectors_to_mb ${data_part_sectors}) MiB" # Initialize sdcard image file run_and_log_cmd \ - "dd if=/dev/zero of=${sdimg_path} bs=512 count=0 seek=${disk_image_total_sectors} status=none" + "dd if=/dev/zero of=${img_path} bs=512 count=0 seek=${disk_image_total_sectors} status=none" # boot_part_start, is defined at the beginning of this file boot_part_end=$(( ${boot_part_start} + ${boot_part_sectors} - 1 )) @@ -218,25 +218,25 @@ 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 ${sdimg_path} mklabel msdos" -run_and_log_cmd "${PARTED} -s ${sdimg_path} unit s mkpart primary fat32 ${boot_part_start} ${boot_part_end}" -run_and_log_cmd "${PARTED} -s ${sdimg_path} set 1 boot on" -run_and_log_cmd "${PARTED} -s ${sdimg_path} -- unit s mkpart primary ext2 ${rootfsa_start} ${rootfsa_end}" -run_and_log_cmd "${PARTED} -s ${sdimg_path} -- unit s mkpart primary ext2 ${rootfsb_start} ${rootfsb_end}" -run_and_log_cmd "${PARTED} -s ${sdimg_path} -- unit s mkpart primary ext2 ${data_start} ${data_end}" -run_and_log_cmd "${PARTED} -s ${sdimg_path} print" +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}" +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}" +run_and_log_cmd "${PARTED} -s ${img_path} -- unit s mkpart primary ext2 ${data_start} ${data_end}" +run_and_log_cmd "${PARTED} -s ${img_path} print" # Write boot-gap if [ "${MENDER_COPY_BOOT_GAP}" == "y" ]; then log_info "Writing boot gap of size: ${boot_part_sectors} (sectors)" - disk_write_at_offset "${output_dir}/boot-gap.bin" "${sdimg_path}" "1" + disk_write_at_offset "${output_dir}/boot-gap.bin" "${img_path}" "1" fi # Burn Partitions -disk_write_at_offset "${boot_part}" "${sdimg_path}" "${boot_part_start}" -disk_write_at_offset "${output_dir}/rootfs.img" "${sdimg_path}" "${rootfsa_start}" -disk_write_at_offset "${output_dir}/rootfs.img" "${sdimg_path}" "${rootfsb_start}" -disk_write_at_offset "${output_dir}/data.img" "${sdimg_path}" "${data_start}" +disk_write_at_offset "${boot_part}" "${img_path}" "${boot_part_start}" +disk_write_at_offset "${output_dir}/rootfs.img" "${img_path}" "${rootfsa_start}" +disk_write_at_offset "${output_dir}/rootfs.img" "${img_path}" "${rootfsb_start}" +disk_write_at_offset "${output_dir}/data.img" "${img_path}" "${data_start}" log_info "Performing platform specific package operations (if any)" platform_package @@ -248,17 +248,17 @@ if [ "${MENDER_USE_BMAP}" == "y" ]; then log_error "You have enabled the MENDER_USE_BMAP option, but we could not find the required 'bmaptool'" log_fatal "You can install 'bmaptool' with: apt-get install bmap-tools (on Debian based distributions)" fi - run_and_log_cmd "${BMAP_TOOL} create ${sdimg_path} > ${sdimg_path}.bmap" + run_and_log_cmd "${BMAP_TOOL} create ${img_path} > ${img_path}.bmap" fi case "${MENDER_COMPRESS_DISK_IMAGE}" in gzip) - log_info "Compressing ${sdimg_path}.gz" - run_and_log_cmd "pigz --best --force ${sdimg_path}" + log_info "Compressing ${img_path}.gz" + run_and_log_cmd "pigz --best --force ${img_path}" ;; lzma) - log_info "Compressing ${sdimg_path}.xz" - run_and_log_cmd "pxz --best --force ${sdimg_path}" + log_info "Compressing ${img_path}.xz" + run_and_log_cmd "pxz --best --force ${img_path}" ;; none) : From 9001af9857bbcd2cf96161e9d484355ef4443320 Mon Sep 17 00:00:00 2001 From: Ole Petter Date: Thu, 16 Jan 2020 13:50:44 +0100 Subject: [PATCH 3/6] MEN-3051: Update the gitlab-ci file to conform the the new format Changelog: None Signed-off-by: Ole Petter --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c920344..e21be35 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -148,7 +148,7 @@ publish:s3: # Prepare high privilege S3 keys (the base keys are for the tmp storage only) - export AWS_ACCESS_KEY_ID=$PUBLISH_AWS_ACCESS_KEY_ID - export AWS_SECRET_ACCESS_KEY=$PUBLISH_AWS_SECRET_ACCESS_KEY - - aws s3 cp deploy/raspberrypi-${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.sdimg.xz + - aws s3 cp deploy/raspberrypi-${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}-mender.img.xz s3://$S3_BUCKET_NAME/${RASPBIAN_NAME}/arm/${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.img.xz - aws s3api put-object-acl --acl public-read --bucket $S3_BUCKET_NAME --key ${RASPBIAN_NAME}/arm/${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.img.xz From 83684f80ca96ea81bc07c4157da3e9f3847525ff Mon Sep 17 00:00:00 2001 From: Ole Petter Date: Thu, 16 Jan 2020 15:36:46 +0100 Subject: [PATCH 4/6] MEN-3051: Update the rockpro64 config to use the new img_path variable Changelog: None Signed-off-by: Ole Petter --- configs/rockpro64_config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/rockpro64_config b/configs/rockpro64_config index d011136..60f0d86 100644 --- a/configs/rockpro64_config +++ b/configs/rockpro64_config @@ -27,6 +27,6 @@ function platform_modify() { function platform_package() { log_info "Embedding bootloader in disk image" - run_and_log_cmd "dd if=work/rockpro64/rksd_loader.img of=${sdimg_path} \ + run_and_log_cmd "dd if=work/rockpro64/rksd_loader.img of=${img_path} \ seek=64 conv=notrunc status=none" } From 5e2bbf12940361c3cab6fe97ac3b0b35d553bb42 Mon Sep 17 00:00:00 2001 From: Ole Petter Date: Fri, 17 Jan 2020 15:21:48 +0100 Subject: [PATCH 5/6] MEN-3051: [tests] Change the name back to sdimg for testing This is done to aling with the internal naming conventions we are using when testing other images of the same type, which has the `.sdimg` naming extension in our Yocto setup. Changelog: None Signed-off-by: Ole Petter --- scripts/test/test-utils.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/test/test-utils.sh b/scripts/test/test-utils.sh index 86df3a8..f26835a 100644 --- a/scripts/test/test-utils.sh +++ b/scripts/test/test-utils.sh @@ -59,7 +59,7 @@ convert_and_test() { local ret=0 run_tests "${device_type}" "${artifact_name}" || ret=$? - rm -f deploy/${device_type}-${artifact_name}.* + rm -f deploy/${device_type}-${artifact_name}* return $ret } @@ -76,12 +76,18 @@ run_tests() { # Need to decompress images built with MENDER_COMPRESS_DISK_IMAGE=gzip before # running tests. - if [ -f deploy/${device_type}-${artifact_name}.sdimg.gz ]; then + if [ -f deploy/${device_type}-${artifact_name}-mender.img.gz ]; then # sudo is needed because the image is created using docker-mender-convert # which sets root permissions on the image - sudo gunzip --force deploy/${device_type}-${artifact_name}.sdimg.gz + sudo gunzip --force deploy/${device_type}-${artifact_name}-mender.img.gz fi + # MEN-3051: Rename the files back to .sdimg, as the sdimg extension has meaning + # in the test-infrastructure. + for file in ${MENDER_CONVERT_DIR}/deploy/*.img; do + mv $file "${file%-mender.img}.sdimg" + done + cd ${WORKSPACE}/mender-image-tests python3 -m pytest --verbose \ From 5b626c1c2f6cf5d88864f16dbcc5bb70e05e1531 Mon Sep 17 00:00:00 2001 From: Ole Petter Date: Mon, 20 Jan 2020 12:53:17 +0100 Subject: [PATCH 6/6] [testing] decompress the proper prebuild image Changelog: None Signed-off-by: Ole Petter --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e21be35..5922ffd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -76,7 +76,7 @@ test_acceptance_prebuilt_raspberrypi: - aws s3 cp s3://mender-gitlab-tmp-storage/$CI_PROJECT_NAME/$CI_PIPELINE_ID/deploy.tar.gz deploy.tar.gz - tar xzf deploy.tar.gz # Extract converted Raspbian artifacts - - unxz deploy/raspberrypi-${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}.sdimg.xz + - unxz deploy/raspberrypi-${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION}-mender.img.xz - ./scripts/test/run-tests.sh --no-pull --prebuilt-image raspberrypi ${RASPBIAN_NAME}-mender-${MENDER_CLIENT_VERSION} test_acceptance_qemux86_64: