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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章