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

centos7 配置coreboot编译环境 以及编译问题解决 需要的配置 (有的资源在国外可能需要翻墙)操作系统: centos7.9参考文章coreboot源码分析之编译和运行coreboot - 知乎//coreboot编译总说明https://www.coreboot.org/Build_HOWTO#Requirements注意: 因为国外gitxx不稳定 所以gitee为主1. 下载coreboot源码#切换下home目录 cd /home #克隆下coreboot源码 git clone https://gitee.com/coreboot/coreboot.git #下载完成后 查看状态 并切换到 coreboot4.6 cd coreboot git status git checkout 4.62. 使用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 自带的交叉编译工具。需要你的系统提前有了gcc, clang, g 环境make crossgcc-i386 #会自动执行下载资源 出现报错的话, 有的因为墙的 原因下载不了, 需要手动下载(google或者百度) 并保存到 固定目录中 这个网站里面可能有你需要的 https://ftp.jaist.ac.jp/pub/ https://fossies.org/ libelf-0.8.13.tar.gz的话下面连接有 https://sources.openwrt.org/libelf-0.8.13.tar.gz https://fossies.org/linux/misc/old/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.html6. 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 images read-only sections as well, rerun with the -w option.CBFSPRINT coreboot.romName Offset Type Size Compcbfs master header 0x0 cbfs header 32 nonefallback/romstage 0x80 stage 82500 nonecpu_microcode_blob.bin 0x14340 microcode 25600 nonefallback/ramstage 0x1a7c0 stage 98822 noneconfig 0x32a00 raw 338 nonerevision 0x32bc0 raw 559 nonecmos_layout.bin 0x32e40 cmos_layout 1228 nonepci8086,0102.rom 0x33380 optionrom 65536 nonefallback/dsdt.aml 0x43400 raw 9869 nonefallback/payload 0x45b00 simple_elf 68228 LZMA (130028 decompressed)payload_config 0x56600 raw 1593 nonepayload_revision 0x56c80 raw 275 none(empty) 0x56e00 null 559576 nonebootblock 0xdf800 bootblock 1968 noneHOSTCC cbfstool/ifwitool.oHOSTCC cbfstool/ifwitool (link)并在 /home/coreboot/build/ 目录下生成了 coreboot.rom