Skip to content

Commit

Permalink
* fix cvi_base deadlock2
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Jan 4, 2025
1 parent d3b91ff commit c4bd8d0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/S02devicekey
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

if [ "$1" = "start" ]
then
# Cache uid to prevent deadlock during cvi_base operation
if [ ! -e /boot/cvi_base_uid ]; then
$(cat /sys/class/cvi-base/base_uid > /boot/cvi_base_uid)
fi

str_value=$(cat /sys/class/cvi-base/base_uid | awk '{print $2}')
first_uint=$(echo $str_value | cut -d'_' -f1)
second_uint=$(echo $str_value | cut -d'_' -f2)
Expand Down
12 changes: 10 additions & 2 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/S10uuid
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ then
prefix=$(cat /boot/hostname.prefix)
fi
old_hostname=$(cat /etc/hostname)
new_hostname=${prefix}-$(sha512sum /sys/class/cvi-base/base_uid | head -c 4)
if [ -e /boot/cvi_base_uid ]; then
new_hostname=${prefix}-$(sha512sum /boot/cvi_base_uid | head -c 4)
else
new_hostname=${prefix}-$(sha512sum /sys/class/cvi-base/base_uid | head -c 4)
fi

if [ -e /boot/hostname ]
then
Expand All @@ -38,7 +42,11 @@ then
then
new_ethmac=$(cat /boot/ethmac)
else
new_ethmac=$(hex2mac 48da356f$(sha512sum /sys/class/cvi-base/base_uid | head -c 4))
if [ -e /boot/cvi_base_uid ]; then
new_ethmac=$(hex2mac 48da356f$(sha512sum /boot/cvi_base_uid | head -c 4))
else
new_ethmac=$(hex2mac 48da356f$(sha512sum /sys/class/cvi-base/base_uid | head -c 4))
fi
fi

ifconfig eth0 down
Expand Down

0 comments on commit c4bd8d0

Please sign in to comment.