From 2b31412f065fe403c6c1f3f208ff49f0e552640e Mon Sep 17 00:00:00 2001 From: Simon Guigui Date: Thu, 29 Aug 2019 18:40:59 +0200 Subject: [PATCH 1/5] Fix some race conditions when running multiple instances of mender-convert in parallel Use losetup's automatic allocation mode to atomically find and allocate loop devices. This should make mender-convert safer to use concurrently with itself and other applications allocating loop devices. Changelog: Title Signed-off-by: Simon Guigui --- mender-convert | 22 ++++++++++------------ mender-convert-functions.sh | 3 ++- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/mender-convert b/mender-convert index 6a042a5..45c2001 100755 --- a/mender-convert +++ b/mender-convert @@ -140,20 +140,19 @@ do_raw_disk_image_shrink_rootfs() { get_raw_disk_sizes ${raw_disk_image} raw_disk_counts raw_disk_sizes local sector_size=${raw_disk_sizes[sector_size]} - # Find first available loopback device. - loopdevice=($(losetup -f)) - [ $? -ne 0 ] && { log "Error: inaccesible loopback device"; return 1; } - - # Mount appropriate partition. if [[ $raw_disk_counts -eq 1 ]]; then - sudo losetup $loopdevice $raw_disk_image -o $((${raw_disk_sizes[pboot_start]} * $sector_size)) + offset=${raw_disk_sizes[pboot_start]} elif [[ $raw_disk_counts -eq 2 ]]; then - sudo losetup $loopdevice $raw_disk_image -o $((${raw_disk_sizes[prootfs_start]} * $sector_size)) + offset=${raw_disk_sizes[prootfs_start]} else log "Warning: invalid/unsupported embedded raw disk image. Skipping resize..." return 0 fi + # Find first available loopback device and mount appropriate partition. + loopdevice=$(sudo losetup --show -f -o $((${offset} * $sector_size)) $raw_disk_image) + [ $? -ne 0 ] && { log "Error: inaccesible loopback device"; return 1; } + block_size=($(sudo dumpe2fs -h $loopdevice | grep 'Block size' | tr -s ' ' | cut -d ' ' -f3)) min_size_blocks=($(sudo resize2fs -P $loopdevice | awk '{print $NF}')) @@ -170,7 +169,7 @@ do_raw_disk_image_shrink_rootfs() { sudo e2fsck -y -f $loopdevice >> "$build_log" 2>&1 sudo losetup -d $loopdevice - sudo losetup $loopdevice $raw_disk_image + loopdevice=$(sudo losetup --show -f $raw_disk_image) if [[ $raw_disk_counts -eq 1 ]]; then create_single_disk_partition_table $loopdevice \ @@ -622,14 +621,13 @@ do_mender_disk_image_to_artifact() { [[ $ret -ne 0 ]] && \ { log "Error: checking $mender_rootfs_basename file system failed. Aborting."; } - # Find first available loopback device. - loopdevice=($(sudo losetup -f || ret=$?)) + # Find first available loopback device and use it. + loopdevice=($(sudo losetup --show -f ${mender_rootfs_image} || ret=$?)) [[ $ret -ne 0 ]] && \ { log "Error: cannot find an unused loop device. Aborting."; } if [ $ret -eq 0 ]; then - #Mount extracted ext4 partition to verify 'artifact_info' file content. - sudo losetup $loopdevice ${mender_rootfs_image} + # Mount extracted ext4 partition to verify 'artifact_info' file content. rootfs_mountpoint=${output_dir}/mnt/${rootfs_partition_id} mkdir -p ${rootfs_mountpoint} sudo mount $loopdevice ${rootfs_mountpoint} diff --git a/mender-convert-functions.sh b/mender-convert-functions.sh index dd90525..93b4b90 100755 --- a/mender-convert-functions.sh +++ b/mender-convert-functions.sh @@ -589,7 +589,8 @@ create_device_maps() { local -n mappings=$2 if [[ -n "$1" ]]; then - mapfile -t mappings < <( sudo kpartx -v -a $1 | grep 'loop' | cut -d' ' -f3 ) + loopdevice=$(sudo losetup --show -f $1) + mapfile -t mappings < <( sudo kpartx -s -v -a $loopdevice | grep 'loop' | cut -d' ' -f3 ) [[ ${#mappings[@]} -eq 0 ]] \ && { log "Error: partition mappings failed. Aborting."; exit 1; } else From 6430f036db3ad544b5906d06f6b9d8b15af34f4c Mon Sep 17 00:00:00 2001 From: Mirza Krak Date: Wed, 25 Sep 2019 12:51:04 +0000 Subject: [PATCH 2/5] README: update URL to Mender logo It was pointing to a resource on mender.io, which duo to recent website updates was moved/removed. Update the URL to use the logo that is present in mendersoftware/mender, which hopefully will not move as much. Changelog: None Signed-off-by: Mirza Krak --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 93d6beb..d016429 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ image by restructuring partition table and injecting the necessary files. Currently official Raspberry Pi 3 and BeagleBone Black images are supported and this will be extended. -![Mender logo](https://mender.io/user/pages/resources/06.digital-assets/mender.io.png) +![Mender logo](https://github.com/mendersoftware/mender/raw/master/mender_logo.png) ## Getting started From d685991ff59ba443ffac4a3f220aeb697126db7b Mon Sep 17 00:00:00 2001 From: Mirza Krak Date: Thu, 10 Oct 2019 13:42:28 +0000 Subject: [PATCH 3/5] rpi: bump U-Boot version This includes only one change: 2a8a20f01d4 Disable addition of simple-framebuffer by U-boot Fixes: MEN-2685 Changelog: Fix "yellow" HDMI output on Raspbian Buster Signed-off-by: Mirza Krak --- rpi-convert-stage-5.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpi-convert-stage-5.sh b/rpi-convert-stage-5.sh index 7eda331..90489ba 100755 --- a/rpi-convert-stage-5.sh +++ b/rpi-convert-stage-5.sh @@ -34,7 +34,7 @@ build_uboot_files() { local CROSS_COMPILE=${1}- local ARCH=arm local branch="mender-rpi-2018.07" - local commit="884893e54a" + local commit="50f05ab10e" local uboot_repo_vc_dir=$uboot_dir/.git local defconfig="rpi_3_32b_defconfig" From dc2572ac4f43b51137a826bf0fcfcdd78bfa0fe7 Mon Sep 17 00:00:00 2001 From: Kristian Amlie Date: Thu, 24 Oct 2019 08:27:36 +0200 Subject: [PATCH 4/5] Upgrade client and mender-artifact to 2.1.1 and 3.2.0, respectively. Changelog: Title Signed-off-by: Kristian Amlie --- Dockerfile | 2 +- device-image-shell/Dockerfile | 2 +- docker-build | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 45ea5a7..e2f17d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:18.04 -ARG MENDER_ARTIFACT_VERSION=3.1.0 +ARG MENDER_ARTIFACT_VERSION=3.2.0 ARG GOLANG_VERSION=1.11.2 RUN apt-get update && apt-get install -y \ diff --git a/device-image-shell/Dockerfile b/device-image-shell/Dockerfile index 85accb8..328af3a 100644 --- a/device-image-shell/Dockerfile +++ b/device-image-shell/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:18.04 -ARG MENDER_ARTIFACT_VERSION=3.1.0 +ARG MENDER_ARTIFACT_VERSION=3.2.0 RUN apt-get update && apt-get install -y \ wget \ diff --git a/docker-build b/docker-build index 73b2a30..6cc5958 100755 --- a/docker-build +++ b/docker-build @@ -6,7 +6,7 @@ if [ -z "$IMAGE_NAME" ]; then IMAGE_NAME=mender-convert fi -MENDER_CLIENT_VERSION="2.1.0" +MENDER_CLIENT_VERSION="2.1.1" DOCKER_ARGS="--build-arg mender_client_version=${MENDER_CLIENT_VERSION}" From c88c79b07ac009b1f6ef7f220c0c50cc54f64a0a Mon Sep 17 00:00:00 2001 From: Kristian Amlie Date: Wed, 15 Feb 2017 20:19:59 +0100 Subject: [PATCH 5/5] Fix inability to use branches and tags interchangably. Changelog: None Signed-off-by: Kristian Amlie --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index d29c9b0..cf8e04e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,16 @@ dist: trusty before_script: - git clone git://github.com/mendersoftware/mendertesting + # Rename the branch we're on, so that it's not in the way for the + # subsequent fetch. It's ok if this fails, it just means we're not on any + # branch. + - git branch -m temp-branch || true + # Git trick: Fetch directly into our local branches instead of remote + # branches. + - git fetch origin 'refs/heads/*:refs/heads/*' + # Get last remaining tags, if any. + - git fetch --tags origin + script: # Check commit compliance. - mendertesting/check_commits.sh