Skip to content

Commit

Permalink
modified S01InitHost to output the hardware model.
Browse files Browse the repository at this point in the history
  • Loading branch information
jens-maus committed Nov 3, 2023
1 parent 9dedd04 commit 8951b56
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
15 changes: 14 additions & 1 deletion buildroot-external/overlay/base/etc/init.d/S01InitHost
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ identify_host() {
HM_LED_RED_MODE2=${rootfs_trigger}
fi

# identify hardware model
HWMODEL="n/a"
if [[ -f /proc/device-tree/model ]]; then
HWMODEL=$(cat /proc/device-tree/model)
elif [[ -f /sys/devices/virtual/dmi/id/sys_vendor ]]; then
VENDOR=$(cat /sys/devices/virtual/dmi/id/sys_vendor)
PNAME=""
if [[ -f /sys/devices/virtual/dmi/id/product_name ]]; then
PNAME=$(cat /sys/devices/virtual/dmi/id/product_name)
fi
HWMODEL="${VENDOR} ${PNAME}"
fi

# identify HM_HOST based on PLATFORM
case "${PLATFORM}" in

Expand Down Expand Up @@ -206,7 +219,7 @@ start() {
set | grep '^HM_' >/var/hm_mode

if [[ -n "${HM_HOST}" ]]; then
echo "${HM_HOST}, OK"
echo "${HWMODEL}, ${HM_HOST}, OK"
else
echo "ERROR"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ identify_host() {
HM_LED_GREEN_MODE2=${rootfs_trigger}
fi

# identify hardware model
HWMODEL="n/a"
if [[ -f /proc/device-tree/model ]]; then
HWMODEL=$(cat /proc/device-tree/model)
elif [[ -f /sys/devices/virtual/dmi/id/sys_vendor ]]; then
VENDOR=$(cat /sys/devices/virtual/dmi/id/sys_vendor)
PNAME=""
if [[ -f /sys/devices/virtual/dmi/id/product_name ]]; then
PNAME=$(cat /sys/devices/virtual/dmi/id/product_name)
fi
HWMODEL="${VENDOR} ${PNAME}"
fi

# identify HM_HOST based on PLATFORM
case "${PLATFORM}" in

Expand Down Expand Up @@ -196,7 +209,7 @@ start() {
set | grep '^HM_' >/var/hm_mode

if [[ -n "${HM_HOST}" ]]; then
echo "${HM_HOST}, OK"
echo "${HWMODEL}, ${HM_HOST}, OK"
else
echo "ERROR"
fi
Expand Down

0 comments on commit 8951b56

Please sign in to comment.