-
Notifications
You must be signed in to change notification settings - Fork 10
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
[BeaglePlay] Wrong hostname on beagleplay #6
Comments
I'll leave things here as an investigation log :-) Things related to hostname happens in #!/bin/sh
if [ ! -f /proc/device-tree/serial-number ]; then
serial="recovery-mode"
else
serial=$(tr -d '\0' </proc/device-tree/serial-number)
#if serial number is empty we append no-serial-number string
if [ -z "$serial" -a "$serial" != " " ]; then
serial="no-serial-number"
fi
fi
hostname=@@MACHINE@@"-"${serial}
if [ -f /usr/bin/hostnamectl ]; then
/usr/bin/hostnamectl set-hostname ${hostname}
else
hostname ${hostname}
fi So, we need to get the correct serial number for it wherever beagleplay make it available for us |
There is a project whose goal is to get the serial of various boards. It's called boardid. It supports reading beagleplay serial and also gives us a hint on how to get it: static void extract_beagleplay_serial(const unsigned char *data, char *buffer)
{
// BeaglePlay EEPROM Layout
// See https://git.beagleboard.org/beagleplay/beagleplay/-/blob/main/EEPROM.md
//
// Multibyte integers are little endian
//
// Offset Size Contents
// 0 4 Header (AA,55,33,EE)
// 4 1 Type (1)
// 5 2 Payload size (0x37)
// 7 1 BRD_INFO (0x10)
// 8 2 0x2e
// 10 16 Board_Name (BEAGLEPLAY-A0-\0\0)
// 26 2 Design_Rev (0x02)
// 28 4 PROC_Nbr
// ...
// 40 2 VendorID (ASCII "64")
// 42 2 Build_Week (ASCII)
// 44 2 Build_Year (ASCII)
// 46 6 Board_ID (ASCII)
// 52 4 Serial_Nbr (ASCII "SSSS")
//
// The serial number is set to all S's, so use the Board_ID.
// The Board_ID is the last 6 digits on the QRCode sticker.
// E.g., BPVA2022510000123 where 2022 is the Build_Year and 51 is the
// Build_Week.
const int digits = 6;
memcpy(buffer, &data[46], digits);
buffer[digits] = 0;
}
// Read the serial number from the Beaglebone's EEPROM
bool beagleboneblack_id(const struct boardid_options *options, char *buffer)
{
// Try both the Linux 3.8 and 4.1 EEPROM locations
FILE *fp = fopen_helper("/sys/bus/i2c/devices/0-0050/eeprom", "r");
if (!fp)
fp = fopen_helper("/sys/bus/i2c/devices/0-0050/at24-0/nvmem", "r");
if (!fp)
return 0;
unsigned char data[56];
if (fread(data, 1, sizeof(data), fp) != sizeof(data)) {
fclose(fp);
return false;
}
fclose(fp);
// Verify that the EEPROM was programmed
if (data[0] != 0xaa ||
data[1] != 0x55 ||
data[2] != 0x33 ||
data[3] != 0xee)
return false;
// BeaglePlay has a non-ASCII 1 at offset 4 and follow it with the data
// size. Beagleboards should have ASCII letters there.
if (data[4] == 0x01 && data[5] == 0x37 && data[6] == 0)
extract_beagleplay_serial(data, buffer);
else
extract_bbb_serial(data, buffer);
return true;
} We can't even get from uboot env, it's all set to |
This command does the trick, but it's a pretty poor solution in my opinion: tail -c +47 /sys/bus/i2c/devices/0-0050/eeprom | head -c 6 @microhobby do you have any recommendations on how to proceed at this point? |
@charles2910 did you think that there is some issue on u-boot side? I mean, u-boot should fill the env with the serial, or no? |
…-support kernel-devsrc.bbappend: support arm64 kernel 5.19+ on Kirkstone
This
beagleplay-recovery-mode
does not sounds correct. We need to investigate and get the actual serial number instead, as all the other models.The text was updated successfully, but these errors were encountered: