Skip to content
Snippets Groups Projects
Select Git revision
  • d4a69c00047f72696a2400cd7129be032de458e3
  • v2018.2.x default protected
  • 0x4A6F-rpi4
  • 0x4A6F-master
  • master
  • v2018.2.2-ffs
  • v2016.2.4-batmanbug
  • radv-filterd
  • v2016.2.x
  • hoodselector
  • v2016.1.x
  • babel
  • v2015.1.x
  • 2014.4.x
  • 2014.3.x
  • v2018.2.2-ffs0.1
  • v2018.2.1-ffs0.1
  • v2018.2.1
  • v2018.2-ffs0.1
  • v2018.2
  • v2018.1.4
  • v2018.1.3
  • v2018.1.2
  • v2018.1.1
  • v2018.1
  • v2017.1.8
  • v2017.1.7
  • v2017.1.6
  • v2017.1.5
  • v2017.1.4
  • v2017.1.3
  • v2017.1.2
  • v2016.2.7
  • v2017.1.1
  • v2017.1
35 results

0113-x86-sysupgrade-move-partition-table-change-check-to-platform_check_image.patch

Blame
  • Forked from firmware / FFS Gluon
    Source project has a limited visibility.
    0113-x86-sysupgrade-move-partition-table-change-check-to-platform_check_image.patch 1.91 KiB
    From: Matthias Schiffer <mschiffer@universe-factory.net>
    Date: Wed, 3 May 2017 08:57:29 +0200
    Subject: x86: sysupgrade: move partition table change check to platform_check_image
    
    The staged sysupgrade will prevent us from using ask_bool in
    platform_do_upgrade; therefore, the check is moved to platform_check_image.
    
    Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
    
    diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh
    index d3e9f360aadedad0995da55205364940c9884ba4..81b349a81816033eef9df464b2a70fdb998e5a1d 100644
    --- a/target/linux/x86/base-files/lib/upgrade/platform.sh
    +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh
    @@ -1,13 +1,37 @@
     platform_check_image() {
    +	local diskdev partdev diff
     	[ "$#" -gt 1 ] && return 1
     
     	case "$(get_magic_word "$1")" in
    -		eb48|eb63) return 0;;
    +		eb48|eb63) ;;
     		*)
     			echo "Invalid image type"
     			return 1
     		;;
     	esac
    +
    +	export_bootdevice && export_partdevice diskdev 0 || {
    +		echo "Unable to determine upgrade device"
    +		return 1
    +	}
    +
    +	get_partitions "/dev/$diskdev" bootdisk
    +
    +	#extract the boot sector from the image
    +	get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b 2>/dev/null
    +
    +	get_partitions /tmp/image.bs image
    +
    +	#compare tables
    +	diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
    +
    +	rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
    +
    +	if [ -n "$diff" ]; then
    +		echo "Partition layout has changed. Full image will be written."
    +		ask_bool 0 "Abort" && exit 1
    +		return 0
    +	fi
     }
     
     platform_copy_config() {
    @@ -36,9 +60,6 @@ platform_do_upgrade() {
     			#compare tables
     			diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
     			if [ -n "$diff" ]; then
    -				echo "Partition layout is changed.  Full image will be written."
    -				ask_bool 0 "Abort" && exit
    -
     				get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
     				return 0
     			fi