temp/u-boot-pinephone: written data checksum validation (MR 2155)

This commit is contained in:
Bobby The Builder 2021-05-10 17:46:53 -04:00 committed by Oliver Smith
parent 9620ea0093
commit b3ba1b4c45
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 25 additions and 2 deletions

View file

@ -35,13 +35,16 @@ build() {
cat configs/pinephone_defconfig | grep CONFIG_DRAM_CLK cat configs/pinephone_defconfig | grep CONFIG_DRAM_CLK
make O="$BUILD_DIR-$freq" HOSTCC=gcc ARCH=arm pinephone_defconfig make O="$BUILD_DIR-$freq" HOSTCC=gcc ARCH=arm pinephone_defconfig
make O="$BUILD_DIR-$freq" HOSTCC=gcc ARCH=arm all make O="$BUILD_DIR-$freq" HOSTCC=gcc ARCH=arm all
sha512sum -b "$BUILD_DIR-$freq/u-boot-sunxi-with-spl.bin" > "$BUILD_DIR-$freq/u-boot-sunxi-with-spl.bin.sha512"
done done
} }
package() { package() {
for freq in $frequencies; do for freq in $frequencies; do
install -D -m644 "build-$freq/u-boot-sunxi-with-spl.bin" \ install -D -m644 "build-$freq/u-boot-sunxi-with-spl.bin" \
"$pkgdir"/usr/share/u-boot/pine64-pinephone/u-boot-sunxi-with-spl-$freq.bin "$pkgdir/usr/share/u-boot/pine64-pinephone/u-boot-sunxi-with-spl-$freq.bin"
install -D -m644 "build-$freq/u-boot-sunxi-with-spl.bin.sha512" \
"$pkgdir/usr/share/u-boot/pine64-pinephone/u-boot-sunxi-with-spl-$freq.bin.sha512"
done done
install -D -m 755 "$srcdir"/update-u-boot "$pkgdir"/usr/sbin/update-u-boot install -D -m 755 "$srcdir"/update-u-boot "$pkgdir"/usr/sbin/update-u-boot
} }
@ -49,5 +52,5 @@ package() {
sha512sums=" sha512sums="
73b132cdc26113a83d060f0d243320ca989b4efa98fe95a2205526a42f615ced7046bb9d4878c67a9a550b04c2519d90be3c2272be97c878d759bf5d027cf536 u-boot-7492749fec31b1086bc8933bf113a766aea021aa.tar.gz 73b132cdc26113a83d060f0d243320ca989b4efa98fe95a2205526a42f615ced7046bb9d4878c67a9a550b04c2519d90be3c2272be97c878d759bf5d027cf536 u-boot-7492749fec31b1086bc8933bf113a766aea021aa.tar.gz
3cba8a0e899be8cb0b9260b7a86d4115f74c279a1bac8c1403ee669adf91dca8215d8d2d6395ebb3cd67ce000f37a51d6e033b62a8d616b346a9072fa58a4b70 0001-expose-DRAM-clock-speed.patch 3cba8a0e899be8cb0b9260b7a86d4115f74c279a1bac8c1403ee669adf91dca8215d8d2d6395ebb3cd67ce000f37a51d6e033b62a8d616b346a9072fa58a4b70 0001-expose-DRAM-clock-speed.patch
3a0f2b96dc16ba0e38609b65243d41e3021cbd8fabb6e53ef8ae4ff82720e00feb0e5b83f03901c386cf3892c401be7b34bd689055aab045379801608a5965b4 update-u-boot df23f3009430dfb8afc4129a47cd73f182178c91eefef5fa9dab65088115c87e66d37f13e72a9f4280c3f6aeb18bbea0f28830905e260d872a01cae1da00b0e8 update-u-boot
" "

View file

@ -85,6 +85,25 @@ options:
EOF EOF
} }
validate_checksum() {
file="$1"
file_sha512="$file.sha512"
file_size=$(stat -c%s $file)
device="$2"
bs="$3"
seek="$4"
checksum0=$(cat $file_sha512 | awk {'print $1'})
checksum1=$(dd if=$device bs=1 skip=$(($seek * $bs)) count=$file_size status=none | sha512sum | awk {'print $1'})
if [ "$checksum0" != "$checksum1" ]; then
echo "File: $checksum0"
echo "Part: $checksum1"
die "Checksum failed"
fi
echo "Successful U-Boot image checksum verification on $device :"
echo -e "\t$checksum1"
}
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
opt="$1" opt="$1"
shift shift
@ -184,6 +203,7 @@ pinebookpro|rockpro64)
pinephone) pinephone)
[ -e "$imagedir/pine64-pinephone/" ] || die "pinephone images not installed, apk add u-boot-pinephone" [ -e "$imagedir/pine64-pinephone/" ] || die "pinephone images not installed, apk add u-boot-pinephone"
$dryrun dd if=$imagedir/pine64-pinephone/u-boot-sunxi-with-spl-$freq.bin of=$device bs=1024 seek=8 oflag=direct status=none $dryrun dd if=$imagedir/pine64-pinephone/u-boot-sunxi-with-spl-$freq.bin of=$device bs=1024 seek=8 oflag=direct status=none
[ -z "$dryrun" ] && validate_checksum $imagedir/pine64-pinephone/u-boot-sunxi-with-spl-$freq.bin $device 1024 8
;; ;;
esac esac
$dryrun sync $dryrun sync