mvebu: base-files: autodetect upgrade device
Since some boards could be also booted from other mediums than SD card, lets make the upgrade block device autodetected. Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
This commit is contained in:
		 Tomasz Maciej Nowak
					Tomasz Maciej Nowak
				
			
				
					committed by
					
						 Hauke Mehrtens
						Hauke Mehrtens
					
				
			
			
				
	
			
			
			 Hauke Mehrtens
						Hauke Mehrtens
					
				
			
						parent
						
							727c3df5bb
						
					
				
				
					commit
					4e8345ff68
				
			| @@ -1,12 +1,13 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
| # Copyright (C) 2015 OpenWrt.org | # Copyright (C) 2015 OpenWrt.org | ||||||
|  |  | ||||||
| BOOTPART=/dev/mmcblk0p1 |  | ||||||
|  |  | ||||||
| . /lib/functions.sh | . /lib/functions.sh | ||||||
|  | . /lib/upgrade/common.sh | ||||||
|  |  | ||||||
| move_config() { | move_config() { | ||||||
| 	if [ -b $BOOTPART ]; then | 	local partdev | ||||||
|  |  | ||||||
|  | 	if export_bootdevice && export_partdevice partdev 1; then | ||||||
| 		case $(board_name) in | 		case $(board_name) in | ||||||
| 			turris-omnia) | 			turris-omnia) | ||||||
| 			insmod nls_cp437 | 			insmod nls_cp437 | ||||||
| @@ -16,7 +17,7 @@ move_config() { | |||||||
| 			;; | 			;; | ||||||
| 		esac | 		esac | ||||||
| 		mkdir -p /boot | 		mkdir -p /boot | ||||||
| 		mount -o rw,noatime $BOOTPART /boot | 		mount -o rw,noatime "/dev/$partdev" /boot | ||||||
| 		[ -f /boot/sysupgrade.tgz ] && mv -f /boot/sysupgrade.tgz / | 		[ -f /boot/sysupgrade.tgz ] && mv -f /boot/sysupgrade.tgz / | ||||||
| 		umount /boot | 		umount /boot | ||||||
| 	fi | 	fi | ||||||
|   | |||||||
| @@ -19,9 +19,12 @@ platform_check_image_sdcard() { | |||||||
|  |  | ||||||
| platform_do_upgrade_sdcard() { | platform_do_upgrade_sdcard() { | ||||||
| 	local board=$(board_name) | 	local board=$(board_name) | ||||||
|  | 	local diskdev | ||||||
|  |  | ||||||
| 	sync | 	sync | ||||||
| 	get_image "$1" | dd of=/dev/mmcblk0 bs=2M conv=fsync | 	if export_bootdevice && export_partdevice diskdev 0; then | ||||||
|  | 		get_image "$1" | dd of=/dev/$diskdev bs=2M conv=fsync | ||||||
|  | 	fi | ||||||
|  |  | ||||||
| 	case "$board" in | 	case "$board" in | ||||||
| 	armada-385-turris-omnia) | 	armada-385-turris-omnia) | ||||||
| @@ -36,9 +39,13 @@ platform_do_upgrade_sdcard() { | |||||||
| } | } | ||||||
|  |  | ||||||
| platform_copy_config_sdcard() { | platform_copy_config_sdcard() { | ||||||
|  | 	local partdev | ||||||
|  |  | ||||||
|  | 	if export_partdevice partdev 1; then | ||||||
| 		mkdir -p /boot | 		mkdir -p /boot | ||||||
| 	[ -f /boot/kernel.img ] || mount -o rw,noatime /dev/mmcblk0p1 /boot | 		[ -f /boot/kernel.img ] || mount -o rw,noatime /dev/$partdev /boot | ||||||
| 		cp -af "$CONF_TAR" /boot/ | 		cp -af "$CONF_TAR" /boot/ | ||||||
| 		sync | 		sync | ||||||
| 		umount /boot | 		umount /boot | ||||||
|  | 	fi | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user