mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-30 01:52:51 +00:00 
			
		
		
		
	mount_certs: sonicfi squashfs certifiacte storage improve
Fixes: WIFI-15120 Signed-off-by: wingate5678 <wingate.chi@cybertan.com.tw>
This commit is contained in:
		 wingate5678
					wingate5678
				
			
				
					committed by
					
						 John Crispin
						John Crispin
					
				
			
			
				
	
			
			
			 John Crispin
						John Crispin
					
				
			
						parent
						
							e9d3e39d5e
						
					
				
				
					commit
					741007178f
				
			| @@ -25,6 +25,11 @@ copy_certificates() { | ||||
| } | ||||
|  | ||||
| boot() { | ||||
| 	case "$(board_name)" in | ||||
| 	sonicfi,rap6*) | ||||
| 		touch /tmp/squashfs | ||||
| 	;; | ||||
| 	esac | ||||
| 	[ -f /etc/ucentral/key.pem ] && return | ||||
| 	/usr/bin/mount_certs | ||||
| 	copy_certificates | ||||
|   | ||||
| @@ -37,13 +37,16 @@ sonicfi,rap7*) | ||||
| 		mtd=$(find_mtd_index certificates) | ||||
| 		[ -n "$mtd" ] && mount -t ext4 /dev/mtdblock$mtd /certificates | ||||
| 	fi | ||||
| 	if [ ! -f /certificates/cert.pem ] || [ ! -f /certificates/key.pem ]; then | ||||
| 		part=$(tar_part_lookup "0:BOOTCONFIG" "0:BOOTCONFIG1") | ||||
| 		if [ -n "part" ]; then | ||||
| 			mmc_dev=$(echo $(find_mmc_part "$part") | sed 's/^.\{5\}//') | ||||
| 			[ -n "$mmc_dev" ] && tar xf /dev/$mmc_dev -C /certificates | ||||
| 		fi | ||||
| 	;; | ||||
| sonicfi,rap6*) | ||||
| 	mtd=$(find_mtd_index certificates) | ||||
| 	if [ "$(head -c 4 /dev/mtd$mtd)" == "hsqs" ]; then | ||||
| 		mount -t squashfs /dev/mtdblock$mtd /mnt | ||||
| 		cp /mnt/* /certificates | ||||
| 		umount /mnt | ||||
| 	fi | ||||
| 		mtd=$(find_mtd_index devinfo) | ||||
| 		[ -n "$mtd" ] && tar xf /dev/mtdblock$mtd -C /certificates | ||||
| 	;; | ||||
| udaya,a5-id2|\ | ||||
| yuncore,ax820) | ||||
| @@ -59,19 +62,6 @@ yuncore,ax820) | ||||
| 		[ -n "$mtd" ] && tar xf /dev/mtdblock$mtd -C /certificates | ||||
| 	fi | ||||
| 	;; | ||||
| sonicfi,rap6*) | ||||
| 	mtd=$(find_mtd_index certificates) | ||||
| 	if [ "$(head -c 4 /dev/mtd$mtd)" == "hsqs" ]; then | ||||
| 		mount -t squashfs /dev/mtdblock$mtd /mnt | ||||
| 		cp /mnt/* /certificates | ||||
| 		umount /mnt | ||||
| 	fi | ||||
| 	part=$(tar_part_lookup "devinfo" "certificates") | ||||
| 	if [ -n "$part" ]; then | ||||
| 		mtd=$(find_mtd_index $part) | ||||
| 		[ -n "$mtd" ] && tar xf /dev/mtdblock$mtd -C /certificates | ||||
| 	fi | ||||
| 	;; | ||||
| *) | ||||
| 	mtd=$(find_mtd_index certificates) | ||||
|  | ||||
|   | ||||
| @@ -14,13 +14,6 @@ tar_part_lookup() { | ||||
|  | ||||
| . /lib/functions.sh | ||||
| case "$(board_name)" in | ||||
| sonicfi,rap7110c-341x) | ||||
| 	cd /certificates | ||||
| 	tar cf /tmp/certs.tar . | ||||
| 	part=$(tar_part_lookup "0:BOOTCONFIG" "0:BOOTCONFIG1") | ||||
| 	mmc_dev=$(echo $(find_mmc_part $part) | sed 's/^.\{5\}//') | ||||
| 	dd if=/tmp/certs.tar of=/dev/$mmc_dev | ||||
| 	;; | ||||
| udaya,a5-id2|\ | ||||
| yuncore,ax820) | ||||
| 	cd /certificates | ||||
| @@ -33,8 +26,7 @@ sonicfi,rap6*) | ||||
| 	if [ "$(fw_printenv -n store_certs_disabled)" != "1" ]; then | ||||
| 		cd /certificates | ||||
| 		tar cf /tmp/certs.tar . | ||||
| 		part=$(tar_part_lookup "devinfo" "certificates") | ||||
| 		mtd=$(find_mtd_index $part) | ||||
| 		mtd=$(find_mtd_index devinfo) | ||||
| 		block_size=$(cat /sys/class/mtd/mtd$mtd/size) | ||||
| 		dd if=/tmp/certs.tar of=/tmp/certs_pad.tar bs=$block_size conv=sync | ||||
| 		mtd write /tmp/certs_pad.tar /dev/mtd$mtd | ||||
|   | ||||
		Reference in New Issue
	
	Block a user