bbb sd6 无e2 修改
1. u-boot修改
? ? board/ti/am335x/board.c
? ??void s_init(void)和static int read_eeprom(void)這兩個函數要從e2中讀取數據,只需要把原版的bbb的e2中的數據讀出來并添充到相應的數據結構里即可。
? ?最終是要填充這個結構體
? ?struct am335x_baseboard_id {
unsigned int ?magic;
char name[HDR_NAME_LEN];
char version[4];
char serial[12];
char config[32];
char mac_addr[HDR_NO_OF_MAC_ADDR][HDR_ETH_ALEN];
? };
? 先在原版的板子上打印這個結構體數據
? ?int i = 0;
? ?uchar *tmp = (uchar *)&header; ? ? ? //header即為am335x_baseboard_id的變量
? ?for(i = 0; i < sizeof(header); i++)
? ?{
? ? ? ? if(i%10 == 0)
? ? ? ? printf("\n");
? ? ? ? printf("%x ", *tmp);
? ? ? ? tmp++;
? ?}
? ?數據如下:
? ?unsigned char e2_data[80] = {0xaa, 0x55, 0x33, 0xee, 0x41, 0x33, 0x33, 0x35, 0x42, 0x4e,
? ? ? ? ? ? ? ? ? ?0x4c, 0x54, 0x30, 0x30, 0x41, 0x35, 0x35, 0x30, 0x30, 0x34,
? ? ? ? ? ? ? ? ? ?0x42, 0x42, 0x42, 0x4b, 0x32, 0x37, 0x35, 0x30, 0x58, 0x41,
? ? ? ? ? ? ? ? ? ?0x58, 0x58, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
? ? ? ? ? ? ? ? ? ?0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x30, 0x31,
? ? ? ? ? ? ? ? ? ?0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42,
? ? ? ? ? ? ? ? ? ?0x43, 0x44, 0x45, 0x46, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
? ? ? ? ? ? ? ? ? ?0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
? ? 然后,在代碼里填充這個結構體即可
? ??int i = 0;
? ? uchar *tmp = (uchar *)&header;
? ? for(i = 0; i < sizeof(header); i++)
? ? {
? ? ? ? tmp[i] = e2_data[i];
? ? }
? ?然后修改代碼,找不到和讀不到e2時,別讓程序return就可以了
2. kernel修改
? ? arch/arm/mach-omap2/board-am335xevm.c
? ??static void am335x_evm_setup(struct memory_accessor *mem_acc, void *context)
? ? 修改以下兩個地方即可
? ??if (ret != sizeof(am335x_mac_addr)) {
? ? ? ? ? pr_warning("AM335X: EVM Config read fail: %d\n", ret);
? ? ? ? ? //return;
? ? ? ? ? memcpy(am335x_mac_addr, e2_data + EEPROM_MAC_ADDRESS_OFFSET, sizeof(am335x_mac_addr));
? ? }
? ? if (ret != sizeof(config)) {
? ? ? ? ? pr_err("AM335X EVM config read fail, read %d bytes\n", ret);
? ? ? ? ? pr_err("This likely means that there either is no/or a failed EEPROM\n");
? ? ? ? ? //goto out;
? ? ? ? ? memcpy((char *)&config, e2_data, sizeof(config));
? ? }
? ? ?
總結
以上是生活随笔為你收集整理的bbb sd6 无e2 修改的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基于TCP协议的网络程序(基础学习)
- 下一篇: Asterisk配置文件说明