centos7 配置coreboot编译环境 以及编译问题解决-CSDN博客

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

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

参考文章

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

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

https://poe.com/ChatGPT

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

1. 下载coreboot源码

#切换下home目录
cd /home
#克隆下coreboot源码
git clone https://gitee.com/coreboot/coreboot.git


#下载完成后 查看状态 并切换到 coreboot4.6
cd coreboot
git status
git checkout 4.6

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

#执行命令
make menuconfig
或者
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 自带的交叉编译工具。

make crossgcc-i386

#会自动执行下载资源
出现报错的话, 有的因为墙的 原因下载不了, 需要手动下载(google或者百度) 并保存到 固定目录中


这个网站里面可能有你需要的苦 https://ftp.jaist.ac.jp/pub/
https://sources.openwrt.org/libelf-0.8.13.tar.gz

下载的东西保存到这个目录 
/home/coreboot/util/crossgcc/tarballs/


4. 等待crossgcc编辑完成

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

#出现下面这个话 说明安装编译工具成功  

You can now run i386-elf cross GCC from /home/coreboot/util/crossgcc/xgcc.
Welcome to the coreboot cross toolchain builder v1.50 (October 15th, 2017)

Building toolchain using 1 thread(s).

Downloading and verifing tarballs ... 
 * acpica-unix2-20161222.tar.gz (cached)... hash verified (73e57d4d558c9bc831165c71adbff577b526f256)
Downloaded tarballs ... ok
Unpacking and patching ... 
 * acpica-unix2-20161222.tar.gz
   o acpica-unix2-20161222_iasl.patch
Unpacked and patched ... ok
Building packages ... 
Building IASL v20161222 for host ... ok
Packages built ... ok
Copied EDK2 tools template ... ok
Cleaning up temporary files... ok

目录下文件如下


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

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

#切换目录
cd /home/coreboot/3rdparty/blobs/
#用git下载
git clone https://gitee.com/coreboot/blobs


#官网的话在这个网址瞎子
https://www.coreboot.org/downloads.html

6. make 出固件 coreboot.rom

#回到coreboot目录并make下
cd /home/coreboot
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 

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: centos

“centos7 配置coreboot编译环境 以及编译问题解决-CSDN博客” 的相关文章