aspeed 2600适配u-boot/kernel

news2024/9/19 23:03:18

1.说明

本文采取aspeed sdk v09.01版本来适配自己的实际的硬件开发平台。!!非采取qemu模拟方式!!

2.采用的镜像文件

2.1 采用网站编译好的镜像

采用网站: https://github.com/AspeedTech-BMC/openbmc/releases的文件:
1.ast2600-default-515-obmc.tar.gz.选择里面的文件image-bmc.发现BMC启动不了,u-boot挂了。
2.ast2600-default-obmc.tar.gz里面的image-bmc.发现BMC启动不了,报错:

Boot from spi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Error loading kernel FIT image
ast# BP1c00

在这里插入图片描述

注意: 使用openbmc中的u-boot更新固件,在u-boot命令行可以采用的命令如下:

# mw 0x1E620064 0x500  //停止WDT2
# setenv gatewayip 10.245.27.1 //设置gatewayip
# setenv netmask 255.255.255.0 //设置网关
# dhcp //获取bmc ip 或者使用 setenv ipaddr 10.245.27.xx
# setenv serverip 10.245.27.xx  //设置tftp服务器ip目的地址
# tftp 0x81000000 image-bmc  //tftp 下载文件
# sf probe 0:0     //选中 flash0
# sf update 0x81000000 0x000000 0x4000000 //更新固件

2.2 自行编译镜像

从网站: https://github.com/AspeedTech-BMC/openbmc 上选择sdkv09.01版本的代码之后,编译:

$ source setup ast2600-default
$ bitbake obmc-phosphor-image

产生的固件image-bmc烧录之后,发现报错:

libfdt fdt_check_header(): FDT_ERR_BADMAGIC

使用命令print查看环境信息:

ast# print
baudrate=115200
boot_ast2700=echo "Boot from ${boot_device}!";if test ${boot_device} = mmc; then run bootmmc; fi;if test ${boot_device} = spi; then run bootspi; fi;ves
boot_device=spi
boota=setenv bootpart 2; setenv rootfs rofs-a; run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm; echo Error loading kernel FITe
bootargs=console=ttyS4,115200n8 root=/dev/ram rw
bootb=setenv bootpart 3; setenv rootfs rofs-b; run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm; echo Error loading kernel FITe
bootcmd=echo Boot from ${boot_device}; if test ${boot_device} = mmc; then run bootmmc; fi; if test ${boot_device} = spi; then run bootspi; fi;
bootdelay=2
bootfile=all.bin
bootmmc=if test "${bootside}" = "b"; then run bootb; run boota; else run boota; run bootb; fi
bootside=a
bootspi=fdt addr 20160000 && fdt header get fitsize totalsize && cp.b 20160000 ${loadaddr} ${fitsize} && bootm; echo Error loading kernel FIT image
fdtcontroladdr=bcf55f18
gatewayip=192.168.0.1
ipaddr=192.168.0.45
loadaddr=0x83000000
netmask=255.255.255.0
rootfs=rofs-a
serverip=192.168.0.81
setmmcargs=setenv bootargs ${bootargs} rootwait root=PARTLABEL=${rootfs}
stderr=serial@1e784000
stdin=serial@1e784000
stdout=serial@1e784000

Environment size: 1265/131068 bytes

环境变量默认值来源于:build/ast2600-default/workspace/sources/u-boot-aspeed-sdk/include/configs/evb_ast2600.h.
然后使用命令fdt addr:

ast# fdt addr 20160000
libfdt fdt_check_header(): FDT_ERR_BADMAGIC

分析到文件:meta-aspeed/conf/machine/evb-ast2600.conf中使用的dts信息:

KERNEL_DEVICETREE = "aspeed/aspeed-ast2600-evb.dtb"

UBOOT_MACHINE = "ast2600_openbmc_spl_defconfig"
UBOOT_DEVICETREE = "ast2600-evb"

查看linuxflash layout:
build/ast2600-default/workspace/sources/linux-aspeed/arch/arm/boot/dts/aspeed/aspeed-ast2600-evb.dts
中,引用了build/ast2600-default/workspace/sources/linux-aspeed/arch/arm/boot/dts/aspeed/aspeed-evb-flash-layout-64.dtsi

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2023 ASPEED.
 */

partitions {
	compatible = "fixed-partitions";
	#address-cells = <1>;
	#size-cells = <1>;

	u-boot@0 {
		reg = <0x0 0x140000>; // 1280KB
		label = "u-boot";
	};

	u-boot-env@140000 {
		reg = <0x140000 0x20000>; // 128KB
		label = "u-boot-env";
	};

	kernel@160000 {
		reg = <0x160000 0x800000>; // 8MB
		label = "kernel";
	};

	rofs@960000 {
		reg = <0x960000 0x24a0000>; // 36.625MB
		label = "rofs";
	};

	rwfs@2e00000 {
		reg = <0x2e00000 0x1200000>; // 18MB
		label = "rwfs";
	};
};

从基本信息来看,代码基本上没问题,那么,进入u-boot中手动去加载dts,查看是否仍然有问题:

1.在u-boot中disable FMC_WDT2

# mw 0x1e620064 0x0  //disable FMC_WDT2

2.在主机中,将fitImage文件拷贝到tftp服务器中:

# cp tmp/deploy/images/ast2600-default/fitImage /home/wityuan/Desktop/tftp

3.设置BMC的ip等信息

# setenv gatewayip 10.245.27.1
# setenv netmask 255.255.255.0
# dhcp
# setenv serverip 10.245.27.69 //服务器ip

4.在u-boot中加载fitImage

# tftp 0x83000000 fitImage

5.使用fdt addr加载fdt信息

# fdt addr 0x83000000
# fdt header get fitsize totalsize
# cp.b 0x83000000 ${loadaddr} ${fitsize}

6.启动linux

使用命令:

# bootm

可以看到系统加载成功。

在这里插入图片描述

7.排查

1.tftp 0x83000000 fitImage //将数据加载到0x83000000 地址上
2.使用md.b 0x83000000  20 查看数据
2.使用notepad++查看image-bmc的0x00160000地址上的数据

在这里插入图片描述
在这里插入图片描述
使用sf read读取flash0地址,发现数据不正确:
在这里插入图片描述
在这里插入图片描述
切换到flash2启动(包含正常启动的uboot),然后使用flash2排查flash1的数据:
在这里插入图片描述
数据符合预期。

因此: sdk09.01uboot代码是有问题的. 工具sf read需要修正或者仅仅是dts配置有问题,导致spi工作不正常。

修改build/ast2600-default/workspace/sources/u-boot-aspeed-sdk/arch/arm/dts/ast2600-evb.dts中:

&fmc {
	status = "okay";

	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_fmcquad_default>;

	flash@0 {
		compatible = "spi-flash", "sst,w25q256";
		status = "okay";
		spi-max-frequency = <50000000>;
		spi-tx-bus-width = <2>;
		spi-rx-bus-width = <2>;
	};

	flash@1 {
		compatible = "spi-flash", "sst,w25q256";
		status = "okay";
		spi-max-frequency = <50000000>;
		spi-tx-bus-width = <2>;
		spi-rx-bus-width = <2>;
	};
};

执行:

# bitbake -c build u-boot-aspeed-sdk
# bitbake -c deploy u-boot-aspeed-sdk

对于flash(mx66l512)芯片,默认的是3B模式,需要注意,后面u-boot代码都改为设置4B模式一次,详见代码:

在这里插入图片描述
另外,需要修改linux代码:build/ast2600-default/workspace/sources/linux-aspeed/arch/arm/boot/dts/aspeed/aspeed-ast2600-evb.dts:

&fmc {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_fwqspi_default>;

	flash@0 {
		status = "okay";
		m25p,fast-read;
		label = "bmc";
		spi-rx-bus-width = <2>;
		spi-tx-bus-width = <2>;
		spi-max-frequency = <50000000>;
#include "aspeed-evb-flash-layout-64.dtsi"
	};

	flash@1 {
		status = "okay";
		m25p,fast-read;
		label = "fmc0:1";
		spi-rx-bus-width = <2>;
		spi-tx-bus-width = <2>;
		spi-max-frequency = <50000000>;
	};

	flash@2 {
		status = "disabled";
		m25p,fast-read;
		label = "fmc0:2";
		spi-rx-bus-width = <4>;
		spi-tx-bus-width = <4>;
		spi-max-frequency = <50000000>;
	};
};

最重要的是需要设置:

		spi-rx-bus-width = <2>;
		spi-tx-bus-width = <2>;

否则会发生报错:

在这里插入图片描述
以上,修改完成后,在ac上电时候,需要进入u-boot手动禁止掉watchdog:

//disable fmc watchdog
# mw 0x1e620064 0x0
# //disable watchdog 
mw 0x1e78508c 0x0

以上,成功进入BMC系统:

在这里插入图片描述
在这里插入图片描述

3.适配网络

当前系统启动,网络并不能分配地址,报错如:
在这里插入图片描述

当前使用的是硬件上的MAC1(datasheet数值加1)连接RTL8211,作为dedicated网络。MAC2(datasheet数值加1)不做网络用途。

在这里插入图片描述

修改代码build/ast2600-default/workspace/sources/linux-aspeed/arch/arm/boot/dts/aspeed/aspeed-ast2600-evb.dts内容:

&mdio0 {
	status = "okay";

	ethphy0: ethernet-phy@0 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <1>;
	};
};

启动BMC后,能找到网卡设备:
在这里插入图片描述
在这里插入图片描述
web可以访问:

在这里插入图片描述
ssh也可以访问到:
在这里插入图片描述
ipmitool也可以访问到:
在这里插入图片描述

简单看一下"reg = <0x1>"的解析流程:

build/ast2600-default/workspace/sources/linux-aspeed/drivers/net/mdio/of_mdio.c
__of_mdiobus_register()
	 build/ast2600-default/workspace/sources/linux-aspeed/include/linux/of_mdio.h
--->  of_mdio_parse_addr() 
	---> ret = of_property_read_u32(np, "reg", &addr);
		/* A PHY must have a reg property in the range [0-31] */
    ---> if (addr >= PHY_MAX_ADDR) {  
        ...
		}

所以该:reg值的范围是0~31,概念为:PHY_MAX_ADDR.

原理图上为:

在这里插入图片描述

在这里插入图片描述
此处描述如果有误,还请告知^ _ ^ .

4.修复重启

如果AC,会发现BMC执行到kernel一段时间之后就会启动到flash2上,这是因为fmc watchdog的超时导致。

可以在uboot代码中:build/ast2600-default/workspace/sources/u-boot-aspeed-sdk/arch/arm/mach-aspeed/ast2600/board_common.c添加一段代码:

void board_add_ram_info(int use_default)
{
...
	//disable fmc watchdog and watchdog
	{
		unsigned long value = 0;
        //disable watchdog
        *((volatile unsigned long *)(0x1e78508c)) = 0x0;
		value = *((volatile unsigned long *)(0x1e78508c));
        printf("\nwatchdog stop: 0x%08x \n", value);
		//disable fmc watchdog
        *((volatile unsigned long *)(0x1e620064)) = 0x0;
		value = *((volatile unsigned long *)(0x1e620064));
        printf("\nfmc watchdog stop: 0x%08x \n", value);

	}
}
...

备注

  • 1.u-boot的编译结果可以查看目录:build/ast2600-default/workspace/sources/u-boot-aspeed-sdk/oe-workdir/build/
  • 2.当前采用的fmc spi芯片是mx66l51235l,要注意一个问题: mtd: spi-nor: fix options for mx66l51235f
  • 3.本节的所有内容的修改,可以参考gitee提交: https://gitee.com/wit_yuan/sdk_v09.01_ast2600/tree/ast2600_porting_base_network/
  • 4.单独更新u-boot的方法:
# setenv gatewayip 10.245.xx.xx
# setenv netmask 255.255.255.0
# dhcp
# setenv serverip 10.245.xx.xx
# tftp 0x83000000 image-u-boot
# sf probe 0
# sf update 0x83000000 0 $filesize
  • 5.单独更新kernel的方法:
# setenv gatewayip 10.245.xx.xx
# setenv netmask 255.255.255.0
# dhcp
# setenv serverip 10.245.xx.xx
# tftp 0x83000000 fitimage
# sf probe 0
# sf update 0x83000000 0 $filesize
  • 6.单独更新bmc的方法:
# setenv gatewayip 10.245.xx.xx
# setenv netmask 255.255.255.0
# dhcp
# setenv serverip 10.245.xx.xx
# tftp 0x83000000 image-bmc
# sf probe 0
# sf update 0x83000000 0 $filesize

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1954068.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【初阶数据结构篇】单链表的实现(赋源码)

文章目录 单链表的实现代码位置概念与结构概念&#xff1a;结构&#xff1a; 链表的性质链表的分类单链表的实现单链表的创建和打印及销毁单链表的创建单链表的打印单链表的销毁 单链表的插入单链表头插单链表尾插单链表在指定位置之前插入数据单链表在指定位置之后插入数据 单…

ChatTTS(文本转语音) 一键本地安装爆火语音模型

想不想让你喜欢的文章&#xff0c;有着一个动听的配音&#xff0c;没错&#xff0c;他就可以实现。 ChatTTS 是一款专为对话场景设计的文本转语音模型&#xff0c;例如 LLM 助手对话任务。它支持英语和中文两种语言。 当下爆火模型&#xff0c;在Git收获23.5k的Star&#xff…

Flink-CDC解析(第47天)

前言 本文主要概述了Flink-CDC. 1. CDC 概述 1.1 什么是CDC&#xff1f; CDC是&#xff08;Change Data Capture 变更数据获取&#xff09;的简称 &#xff0c;在广义的概念上&#xff0c;只要是能捕获数据变更的技术&#xff0c;都可以称之为 CDC。 核心思想是&#xff0c…

【C语言】【数据结构】二分查找(数组的练习)

目录 一、什么是二分查找 二、算法思想 2.1、概述 2.2、举例 &#xff08;1&#xff09;查找3&#xff08;数组里面存在的数&#xff09; &#xff08;2&#xff09;查找12&#xff08;数组里面不存在的数&#xff09; 三、代码实现 四、计算mid公式的优化 一、…

二阶段测试:

二阶段测试&#xff1a; 架构&#xff1a; 服务器类型部署组件ip地址DR1调度服务器 主&#xff08;ha01&#xff09;KeepalivedLVS-DR192.168.60.30DR2调度服务器 备 (ha02)KeepalivedLVS-DR192.168.60.40web1节点服务器 (slave01)NginxTomcatMySQL 备MHA managerMHA node192.…

Open3D 点云按xyz轴等距切片

目录 一、概述 1.1原理 1.2实现步骤 1.3应用 二、代码实现 2.1关键函数 2.2完整代码 三、实现效果 3.1原始点云 3.2按x轴切片 3.3按y轴切片 3.4按z轴切片 Open3D点云算法汇总及实战案例汇总的目录地址&#xff1a; Open3D点云算法与点云深度学习案例汇总&#xff…

计算机网络通信基础概念

目录 1、网络通信的本质 2、网络的发展 3、网络协议&#xff08;TCP\IP协议&#xff09; 3.1 协议实现通信的原理 3.2 协议的具体概念 3.3 协议的模型 4、数据链路层 5、网络协议栈和操作系统的关系 6、网络协议通信过程 6.1 通信过程的封装与解包 7、以太网通信…

助力樱桃智能自动化采摘,基于嵌入式端超轻量级模型LeYOLO全系列【n/s/m/l】参数模型开发构建果园种植采摘场景下樱桃成熟度智能检测识别系统

随着科技的飞速发展&#xff0c;人工智能&#xff08;AI&#xff09;技术已经渗透到我们生活的方方面面&#xff0c;从智能家居到自动驾驶&#xff0c;再到医疗健康&#xff0c;其影响力无处不在。然而&#xff0c;当我们把目光转向中国的农业领域时&#xff0c;一个令人惊讶的…

【AI】SpringCloudAlibaba AI 学习

Spring Cloud Alibaba AI 简介 Spring Cloud Alibaba AI 以 Spring AI 为基础&#xff0c;并在此基础上提供阿里云通义系列大模型全面适配&#xff0c;让用户在 5 分钟内开发基于通义大模型的 Java AI 应用。 官网&#xff1a; https://sca.aliyun.com/ https://sca.aliyun.co…

理解 HTTP 请求中 Query 和 Body 的异同

本文将深入探讨HTTP请求中的两个关键要素&#xff1a;查询参数&#xff08;Query&#xff09;和请求体&#xff08;Body&#xff09;。我们将阐明它们之间的差异&#xff0c;并讨论在何种情况下使用每一种。 HTTP 请求概述 HTTP 请求是客户端&#xff08;如浏览器&#xff09…

知道秘密的人

一、力扣题目&#xff1a; 二、理论分析 由于 天数是一天一天变化的&#xff0c;用 数组的下标代表天数i, 数组中的 数据代表知道秘密在第i天的人数 假设在某个人在知道秘密的第3天开始传播&#xff0c;在第6天忘记&#xff0c;由于 第1天1个人发现了秘密 spread为能传播秘密的…

MATLAB-bode图编程

num[1 1];den [2 1];tf(num,den)bode(tf(num,den));hold on

【QT】TCP

目录 核心API 示例&#xff1a;服务器和客户端信息互发 服务器代码实现 第一步&#xff1a;创建QTcpServer对象的实例 第二步&#xff1a;绑定信号槽&#xff0c;处理新的连接 第三步&#xff1a;绑定并监听端口号 客户端代码实现 第一步&#xff1a;创建socket对象的实…

【计算机网络】WireShark和简单http抓包实验

一&#xff1a;实验目的 1&#xff1a;熟悉WireShark的安装流程和界面操作流程。 2&#xff1a;学会简单http的抓取和过滤&#xff0c;并分析导出结果。 二&#xff1a;实验仪器设备及软件 硬件&#xff1a; Windows 2019操作系统的计算机等。 软件&#xff1a;WireShark、…

智能PDF转markdown

嘿&#xff0c;各位技术大咖们&#xff0c;今天我要给大家带来一个超酷的项目——“智能PDF转Markdown”&#xff0c;这可是数字化办公的神器&#xff0c;基于Marker技术&#xff0c;让PDF文档秒变Markdown&#xff0c;轻松应对RAG知识库构建等任务的挑战&#xff01; 打造了一…

Python | Leetcode Python题解之第299题猜数字游戏

题目&#xff1a; 题解&#xff1a; class Solution:def getHint(self, secret: str, guess: str) -> str:bulls 0cntS, cntG [0] * 10, [0] * 10for s, g in zip(secret, guess):if s g:bulls 1else:cntS[int(s)] 1cntG[int(g)] 1cows sum(min(s, g) for s, g in z…

学习笔记 韩顺平 零基础30天学会Java(2024.7.22)

P407 接口使用细节2 P407 接口课堂练习 对于最后一个的输出&#xff1a;B因为实现了A的接口&#xff0c;所以和继承一样&#xff0c;B可以访问A的变量 P409 接口VS继承 接口对单继承机制&#xff08;是指只能继承一个类&#xff09;进行了补充 也可以理解为&#xff0c;子类通过…

IndexError: list index out of range

IndexError: list index out of range 欢迎来到我的主页&#xff0c;我是博主英杰&#xff0c;211科班出身&#xff0c;就职于医疗科技公司&#xff0c;热衷分享知识&#xff0c;武汉城市开发者社区主理人 擅长.net、C、python开发&#xff0c; 如果遇到技术问题&#xff0c;即…

锅总介绍CNCF主要目标、全景图及发展历史

一、CNCF简介 云原生计算基金会&#xff08;Cloud Native Computing Foundation&#xff0c;简称 CNCF&#xff09;是一个成立于 2015 年的非营利性组织&#xff0c;隶属于 Linux 基金会。CNCF 的主要目标是通过开源软件推动云原生计算技术的发展和普及&#xff0c;帮助企业更…