• centos7 配置coreboot编译环境 以及编译问题解决


    需要的配置 (有的资源在国外可能需要翻墙)
    操作系统: centos7.9

    参考文章

    coreboot源码分析之编译和运行coreboot - 知乎

    //coreboot编译总说明
    https://www.coreboot.org/Build_HOWTO#Requirements

    https://poe.com/ChatGPT

    注意: 因为github不稳定 所以gitee为主

    1. 下载coreboot源码

    1. #切换下home目录
    2. cd /home
    3. #克隆下coreboot源码
    4. git clone https://gitee.com/coreboot/coreboot.git
    5. #下载完成后 查看状态 并切换到 coreboot4.6
    6. cd coreboot
    7. git status
    8. git checkout 4.6

    2. 使用corebot自带功能 配置菜单

    1. #执行命令
    2. make menuconfig
    3. 或者
    4. make nconfig
    提示 curses.h:No such file or directory 的话

    查找资料得知,最小系统不支持图形显示造成的
    解决: yum install ncurses-devel ncurses

    提示下面这个的话 按照提示安装 对应的安装包即可

    ERROR: Missing tool: Please install 'm4'. (eg sudo apt-get install m4)
    ERROR: Missing tool: Please install 'bison'. (eg sudo apt-get install bison)
    ERROR: Missing tool: Please install 'flex'. (eg sudo apt-get install flex)
    ERROR: Missing tool: Please install 'zlib (zlib1g-dev or zlib-devel)'. (eg sudo apt-get install zlib1g-dev (zlib1g-dev or zlib-devel))

    正常情况下 会显示 菜单界面 (键盘左右上下可以控制菜单)

    直接save保存下 会生成 /home/coreboot/.config文件

    3.编译 coreboot toolchain

    虽然我们 host 上有安装 gcc, 但是 coreboot 官方强烈推荐使用 coreboot 自带的交叉编译工具。

    需要你的系统提前有了gcc, clang,  g++ 环境

    1. make crossgcc-i386
    2. #会自动执行下载资源
    3. 出现报错的话, 有的因为墙的 原因下载不了, 需要手动下载(google或者百度) 并保存到 固定目录中
    4. 这个网站里面可能有你需要的
    5. https://ftp.jaist.ac.jp/pub/
    6. https://fossies.org/
    7. libelf-0.8.13.tar.gz的话下面连接有
    8. https://sources.openwrt.org/libelf-0.8.13.tar.gz
    9. https://fossies.org/linux/misc/old/libelf-0.8.13.tar.gz
    10. 下载的东西保存到这个目录
    11. /home/coreboot/util/crossgcc/tarballs/


    4. 等待crossgcc编辑完成

    因为要编译各种平台的,所以这个过程很漫长, 基本上要1个小时多, 特别是卡在 gcc 的编译 一定要耐心的等待

    1. #出现下面这个话 说明安装编译工具成功  
    2. You can now run i386-elf cross GCC from /home/coreboot/util/crossgcc/xgcc.
    3. Welcome to the coreboot cross toolchain builder v1.50 (October 15th, 2017)
    4. Building toolchain using 1 thread(s).
    5. Downloading and verifing tarballs ... 
    6.  * acpica-unix2-20161222.tar.gz (cached)... hash verified (73e57d4d558c9bc831165c71adbff577b526f256)
    7. Downloaded tarballs ... ok
    8. Unpacking and patching ... 
    9.  * acpica-unix2-20161222.tar.gz
    10.    o acpica-unix2-20161222_iasl.patch
    11. Unpacked and patched ... ok
    12. Building packages ... 
    13. Building IASL v20161222 for host ... ok
    14. Packages built ... ok
    15. Copied EDK2 tools template ... ok
    16. Cleaning up temporary files... ok

    目录下文件如下


    5. 导入第三方blobs (真机下可能需要, 这个步骤模拟或者虚拟机或许不用)

    去coreboot官网 或者 git上获取需要的 blobs库

    1. #切换目录
    2. cd /home/coreboot/3rdparty/blobs/
    3. #用git下载
    4. git clone https://gitee.com/coreboot/blobs
    5. #官网的话在这个网址下载
    6. https://www.coreboot.org/downloads.html

    6. make 出固件 coreboot.rom

    1. #回到coreboot目录并make下
    2. cd /home/coreboot
    3. make

    之后会执行各种东西, 最后的话出现如下文字 说明编译成功

    It is possible to perform either the write action or the CBFS add/remove actions on every section listed above.
    To see the image's read-only sections as well, rerun with the -w option.
        CBFSPRINT  coreboot.rom

    Name                           Offset     Type           Size   Comp
    cbfs master header             0x0        cbfs header        32 none
    fallback/romstage              0x80       stage           82500 none
    cpu_microcode_blob.bin         0x14340    microcode       25600 none
    fallback/ramstage              0x1a7c0    stage           98822 none
    config                         0x32a00    raw               338 none
    revision                       0x32bc0    raw               559 none
    cmos_layout.bin                0x32e40    cmos_layout      1228 none
    pci8086,0102.rom               0x33380    optionrom       65536 none
    fallback/dsdt.aml              0x43400    raw              9869 none
    fallback/payload               0x45b00    simple_elf      68228 LZMA (130028 decompressed)
    payload_config                 0x56600    raw              1593 none
    payload_revision               0x56c80    raw               275 none
    (empty)                        0x56e00    null           559576 none
    bootblock                      0xdf800    bootblock        1968 none
        HOSTCC     cbfstool/ifwitool.o
        HOSTCC     cbfstool/ifwitool (link)

    并在 /home/coreboot/build/ 目录下生成了 coreboot.rom 

  • 相关阅读:
    【Maven】 基于Java的 Maven项目对象模型认识
    1788_通过CMD命令行启动操作MATLAB
    C++岗位方向暴力穷举法
    VsCode中运行C/C++
    2023最新SSM计算机毕业设计选题大全(附源码+LW)之java小区宠物管理系统k8n96
    Linux学习-31-Linux权限位及修改文件和目录的权限
    Matlab生成visio可导入的矢量图
    非零基础自学Java (老师:韩顺平) 第10章 面向对象编程(高级部分) 10.4 单例设计模式
    web网页设计期末课程大作业——香格里拉旅游网页设计 5页 HTML+CSS+JavaScript
    Origin分段显示柱状图
  • 原文地址:https://blog.csdn.net/qq635968970/article/details/130425112