Compare commits

...

1 Commits

Author SHA1 Message Date
wingate5678
af75e017cf WIFI-15120 sonicfi squashfs certifiacte storage improve
Signed-off-by: wingate5678 <wingate.chi@cybertan.com.tw>
2025-09-10 01:14:52 +00:00
3 changed files with 15 additions and 28 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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