ARM ASPEED 2500 uboot openbmc linux 启动记录

支持原创,转载请注明出处

 

ARM ASPEED 2500 uboot openbmc linux 启动记录

前言

其实openbmc 官方推荐的方法是使用Yocto poky方法来定制aspeed 2500相关的组件,看起来也很方便,一站式解决所有问题,但是由于鄙人不太熟悉Yocto那套编译方法所以就放弃了, 我采用了单独编译Uboot,openbmc/linux ,busybox的方法。

[注]  linux 源码:https://github.com/openbmc/linux 

        u-boot源码:https://github.com/openbmc/u-boot

u-boot编译

  1. git clone https://github.com/openbmc/u-boot
  2. u-boot/configs下找到2500的defconfig,make ast_g5_phy_defconfig,这样就会把defconfig的内容放入.config
  3. 接下来,如果需要定制其他功能,可以make menuconfig或者直接改.config来定制
  4. 指定ARCH 和 CROSS-COMPILE
  5. make 即可

linux编译,同时会默认生成device tree 

  • git clone https://github.com/openbmc/linux -b dev-4.13 openbmc-dev
  • cd openbmc-dev
  • export ARCH=arm
  • export CROSS_COMPILE=arm-linux-gnueabi-
  • make aspeed_g5_defconfig
  • make -j $(nproc)

结束以后会生成如下的文件:
    arch/arm/boot/zImage: 压缩后的内核
    arch/arm/boot/dts/aspeed-ast2500-evb.dtb: 设备树文件
    vmlinux: kernel ELF for debugging

  • 接下来制作FIT 镜像文件,根文件系统initramfs cpio我这里略过,制作FIT的mk.its如下:
/dts-v1/;

/ {
        description = "test kernel";
        #address-cells = <1>;

        images {
                kernel@1 {
                        description = "Linux kernel";
                        data = /incbin/("arch/arm/boot/zImage");
                        type = "kernel";
                        arch = "arm";
                        os = "linux";
                        compression = "none";
                        load = <0x83000000>;
                        entry = <0x83000000>;
                };
                fdt@1 {
                        description = "device tree";
                        data = /incbin/("arch/arm/boot/dts/aspeed-ast2500-evb.dtb");
                        type = "flat_dt";
                        arch = "arm";
                        compression = "none";
                };
                ramdisk@1 {
                        description = "initramfs";
                        data = /incbin/("broomstick.cpio.xz");
                        type = "ramdisk";
                        arch = "arm";
                        os = "linux";
                };
	};

        configurations {
                default = "conf@1";
                conf@1 {
                        description = "Boot Linux kernel with FDT blob, ramdisk";
			kernel = "kernel@1";
			fdt = "fdt@1";
			ramdisk = "ramdisk@1";
                };
	};
};
  • 其中load address 和entry point 可以参考include/configs/ast-g5-ncsi.h:15:#define CONFIG_SYS_LOAD_ADDR        0x83000000
  • mkimage -f mk.its its,这样就生成了包含内核文件系统以及dtb的its image文件

文件烧写入norflash

这里其实有多种方式,如果u-boot的网口已经调通,那就可以直接通过tftp或者其它方式启动,这里不赘述;

我这里提供的方法是通过直接把uboot和its文件一起烧录到norflash的方法:

  • cp u-boot.bin image.bin
  • truncate image.bin -c -s 1M
  • cat its >> image.bin
  • 这里我是把its 放到1M开始的地方,这样就把u-boot.bin和its合并成一个image.bin文件了
  • 使用烧录软件将Image.bin烧入norflash
  • 设备启动进入u-boot之后可以通过imls 查看norflash上的its 镜像存放情况

参考资料:

https://shenki.github.io/Booting-an-OpenBMC-kernel/

https://blog.csdn.net/JerryGou/article/details/80645712

http://blog.itpub.net/13771794/viewspace-623670

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值