Skip to content

Commit

Permalink
read android device serial number from sysfs node
Browse files Browse the repository at this point in the history
read android serial number value from sysfs node
instead of kernel command line. Upstream boot managers
e.g., systemd-boot does not populate kernel command line
with parameter androidboot.serialno.

Reading serial number from sysfs node
/sys/devices/soc0/serial_number generalizes the approach
and makes it independent of bootloader that loads kernel.

Signed-off-by: Vishwas Udupa <quic_vudupa@quicinc.com>
  • Loading branch information
vishwasudupa authored and Linux Build Service Account committed Nov 17, 2023
1 parent 41e37ca commit bb770cf
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
manufacturer=Qualcomm
model=`hostname`
androidserial="$(sed -n -e '/androidboot.serialno/ s/.*androidboot.serialno=\([^ ]*\).*/\1/gp ' /proc/cmdline)"
androidserial="$(printf "%x" "$(cat /sys/devices/soc0/serial_number)")"
[ -n "$androidserial" ] && serial="$androidserial"

0 comments on commit bb770cf

Please sign in to comment.