Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

凯美瑞车机刷机请教 #4

Open
LF369 opened this issue Jul 28, 2024 · 1 comment
Open

凯美瑞车机刷机请教 #4

LF369 opened this issue Jul 28, 2024 · 1 comment

Comments

@LF369
Copy link

LF369 commented Jul 28, 2024

你好,我的汽车是21款凯美瑞,车机型号NVF-9108ZT,我参照您的代码修改了我的校验加密算法,我修改过的刷机包可以成功通过车机的校验,重启进入recovery模式,但是在刷机进度到76%时,会提示错误,“Update error code: 000314”,请教下是什么原因呢
IMG_20240727_195820

下面是我修改后的代码,
`#! /bin/bash

originalPRGFile="PJ190PLT.PRG"
imgToMakePRG="PJ190PLT.IMG"

sudo umount sysmain
sudo img2simg "${imgToMakePRG}.ext4" "${imgToMakePRG}"

dd if="${originalPRGFile}" of="${originalPRGFile}.1" bs=4 skip=3 count=9
dd if="${originalPRGFile}" of="${originalPRGFile}.2" bs=4 skip=14 count=114

SIZE="$(stat -c%s ${imgToMakePRG})"
file_size="$(printf '%x\n' $SIZE)"
vsize="$file_size"
swap_size="${vsize:6:2}${vsize:4:2}${vsize:2:2}${vsize:0:2}"
LEN=$(echo ${#swap_size})
if [ $LEN -eq 6 ]; then
swap_size=${swap_size}00
fi

file_crc="$(crc32 ${imgToMakePRG}.ext4)"
vCRC="$file_crc"
swap_crc="${vCRC:6:2}${vCRC:4:2}${vCRC:2:2}${vCRC:0:2}"

echo "${imgToMakePRG} Swapped size hex is: $swap_size"
echo "${imgToMakePRG}.ext4 Swapped crc hex is: $swap_crc"

perl -e "print pack 'H*', 'A55A5AA5${swap_size}${swap_crc}'" > new_head.1

#create new header
SIZE="$(stat -c%s ${imgToMakePRG}.ext4)"
file_size="$(printf '%x\n' $SIZE)"
vsize="$file_size"
swap_size="${vsize:6:2}${vsize:4:2}${vsize:2:2}${vsize:0:2}"
LEN=$(echo ${#swap_size})
if [ $LEN -eq 6 ]; then
swap_size=${swap_size}00
fi

file_crc="$(crc32 ${imgToMakePRG})"
vCRC="$file_crc"
swap_crc="${vCRC:6:2}${vCRC:4:2}${vCRC:2:2}${vCRC:0:2}"
echo "${imgToMakePRG}.ext4 Swapped size hex is: $swap_size"
echo "${imgToMakePRG} Swapped crc hex is: $swap_crc"

perl -e "print pack 'H*', '${swap_crc}${swap_size}'" > new_head.2
cat new_head.1 ${originalPRGFile}.1 new_head.2 ${originalPRGFile}.2 "$imgToMakePRG" > "$originalPRGFile.new"
rm -rf new_head.1
rm -rf new_head.2
rm -rf ${originalPRGFile}.1
rm -rf ${originalPRGFile}.2
rm -rf ${originalPRGFile}
mv ${originalPRGFile}.new ${originalPRGFile}`

`#! /bin/bash

originalVerFile="PJ190PLT.VER"
prgFile="PJ190PLT.PRG"

dd if="$originalVerFile" of="$originalVerFile.part1" bs=172 skip=0 count=1

SIZE="$(stat -c%s $prgFile)"
echo "$prgFile size is: $SIZE"
UNSWAPPEDHEXSIZE="$(printf '%x\n' $SIZE)"
vSIZE="$UNSWAPPEDHEXSIZE"
SWAPPEDHEXSIZE="${vSIZE:6:2}${vSIZE:4:2}${vSIZE:2:2}${vSIZE:0:2}"
LEN=$(echo ${#SWAPPEDHEXSIZE})
if [ $LEN -eq 6 ]; then
SWAPPEDHEXSIZE=${SWAPPEDHEXSIZE}00
fi
UNSWAPPEDHEXCRC="$(crc32 $prgFile)"
vCRC="$UNSWAPPEDHEXCRC"
SWAPPEDHEXCRC="${vCRC:6:2}${vCRC:4:2}${vCRC:2:2}${vCRC:0:2}"

echo "$prgFile Unswapped prg size hex is: $UNSWAPPEDHEXSIZE"
echo "$prgFile Swapped prg size hex is: $SWAPPEDHEXSIZE"
echo "$prgFile Unswapped prg crc hex is: $UNSWAPPEDHEXCRC"
echo "$prgFile Swapped prg crc hex is: $SWAPPEDHEXCRC"
perl -e "print pack 'H*', '${SWAPPEDHEXSIZE}${SWAPPEDHEXCRC}A55A5AA5'" > "$originalVerFile.part2"

cat "$originalVerFile.part1" "$originalVerFile.part2" > "$originalVerFile.combined"

rm -rf "$originalVerFile.part1"
rm -rf "$originalVerFile.part2"

UNSWAPPEDHEXCRC="$(crc32 $originalVerFile.combined)"
vCRC="$UNSWAPPEDHEXCRC"
SWAPPEDHEXCRC="${vCRC:6:2}${vCRC:4:2}${vCRC:2:2}${vCRC:0:2}"
echo "$originalVerFile.combined Unswapped verstart crc hex is: $UNSWAPPEDHEXCRC"
echo "$originalVerFile.combined Swapped verstart crc hex is: $SWAPPEDHEXCRC"

perl -e "print pack 'H*', '${SWAPPEDHEXCRC}'" > "$originalVerFile.combined1"

cat "$originalVerFile.combined" "$originalVerFile.combined1" > "$originalVerFile.new"
rm -rf "$originalVerFile.combined"
rm -rf "$originalVerFile.combined1"
rm -rf "$originalVerFile"
mv "$originalVerFile.new" "$originalVerFile"
`

@LF369
Copy link
Author

LF369 commented Jul 28, 2024

PJ190REC.zip
这是rec文件,获取能帮助分析

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant