base-files: safer sysupgrade.tar for kernel-out-of-UBI
Ensure that the kernel CRC is invalidated while rootfs is being updated. This allows the bootloader to detect an interrupted sysupgrade and fall back to an alternate booting method, such as TFTP, instead of just going ahead with normal boot and effectively bricking the device. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
This commit is contained in:
		 Rodrigo Balerdi
					Rodrigo Balerdi
				
			
				
					committed by
					
						 Daniel Golle
						Daniel Golle
					
				
			
			
				
	
			
			
			 Daniel Golle
						Daniel Golle
					
				
			
						parent
						
							073dc450b5
						
					
				
				
					commit
					ecbcc0b595
				
			| @@ -303,7 +303,7 @@ nand_upgrade_tar() { | |||||||
| 	local has_env=0 | 	local has_env=0 | ||||||
|  |  | ||||||
| 	[ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && { | 	[ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && { | ||||||
| 		tar xf "$tar_file" ${board_dir}/kernel -O | mtd write - $CI_KERNPART | 		mtd erase $CI_KERNPART | ||||||
| 	} | 	} | ||||||
| 	[ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel= | 	[ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel= | ||||||
| 	[ "$CI_KERNPART" = "none" ] && has_kernel= | 	[ "$CI_KERNPART" = "none" ] && has_kernel= | ||||||
| @@ -317,6 +317,10 @@ nand_upgrade_tar() { | |||||||
| 			ubiupdatevol /dev/$root_ubivol -s $rootfs_length - | 			ubiupdatevol /dev/$root_ubivol -s $rootfs_length - | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	[ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && { | ||||||
|  | 		tar xf "$tar_file" ${board_dir}/kernel -O | \ | ||||||
|  | 			mtd -n write - $CI_KERNPART | ||||||
|  | 	} | ||||||
| 	[ "$has_kernel" = "1" ] && { | 	[ "$has_kernel" = "1" ] && { | ||||||
| 		local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )" | 		local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )" | ||||||
| 		tar xf "$tar_file" ${board_dir}/kernel -O | \ | 		tar xf "$tar_file" ${board_dir}/kernel -O | \ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user