飞腾FT2000/4 u-boot/UEFI开发环境搭建

参考

UEFI开发与调试—edk2中子目录介绍
ACP基础——Resource Descriptors for ACPI
ubuntu16.04操作系统下的edk2安装

安装

环境:

  • ubuntu16.04.6
  • gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu

安装编译u-boot所需依赖,

qe@ubuntu:~/program/ft2000-4$ sudo apt-get install make-guile
qe@ubuntu:~/program/ft2000-4$ sudo apt-get install make gcc bison flex

安装编译UEFI所需依赖,

qe@ubuntu:~/program/ft2000-4$ sudo apt-get install libncurses5-dev libncursesw5-dev uuid-dev acpica-tools python g++

u-boot

解压u-boot文件,打补丁,

u-boot-ft2004-v0.1$ patch -p1 < ../patch/diff_v0.7_for_uboot.patch 
...
u-boot-ft2004-v0.1$ patch -p1 < ../patch/diff_v1.1_for_u-boot.patch 
$ source ~/program/fdk/settings.sh -t ft2000
$ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-

用u-boot.bin替换bl33.bin,打包。

UEFI

编译

初始化环境变量,

$ export PATH=/home/qe/program/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin:$PATH
$ export CROSS_COMPILE=aarch64-linux-gnu-
qe@ubuntu:~/program/ft2000-4/edk2-for-support$ ./build2004.sh init # OSError: [Errno 13] Permission denied
qe@ubuntu:~/program/ft2000-4/edk2-for-support$ ./build2004.sh r # 

错误

OSError: [Errno 13] Permission denied

qe@ubuntu:~/program/ft2000-4/edk2-for-support$ ls -ld /usr/local/lib/python2.7
drwxrwsr-x 4 root staff 4096 Mar 28 07:08 /usr/local/lib/python2.7
qe@ubuntu:~/program/ft2000-4/edk2-for-support$ ls -l ~
total 56
drwxr-xr-x  2 qe qe 4096 Jun 21  2019 Desktop
qe@ubuntu:~/program/ft2000-4/edk2-for-support$ sudo chown -R qe /usr/local/lib/python2.7
qe@ubuntu:~/program/ft2000-4/edk2-for-support$ ls -ld /usr/local/lib/python2.7
drwxrwsr-x 4 qe staff 4096 Mar 28 07:08 /usr/local/lib/python2.7

Error 6126 - syntax error, unexpected PARSEOP_NAMESEG, expecting ‘(’ ^

/home/qe/program/ft2000-4/edk2-for-support/Build/PhytiumPkg/Phytium2004Pkg/Phytium/RELEASE_GCC49/AARCH64/PhytiumPkg/Phytium2004Pkg/Drivers/AcpiTables/AcpiTables/OUTPUT/./Dsdt.iiii    419:                  I2CSerialBusV2 (0x68, ControllerInitiated, 100000,AddressingMode7Bit, "\\_SB.I2C1", 0, ResourceConsumer, ,)
Error    6126 -                                                                                                                                                  syntax error, unexpected PARSEOP_NAMESEG, expecting '(' ^

/home/qe/program/ft2000-4/edk2-for-support/Build/PhytiumPkg/Phytium2004Pkg/Phytium/RELEASE_GCC49/AARCH64/PhytiumPkg/Phytium2004Pkg/Drivers/AcpiTables/AcpiTables/OUTPUT/./Dsdt.iiii    736:
Error    6126 - syntax error, unexpected '}', expecting $end and premature End-Of-File

怀疑是acpica-tools的版本导致,

qe@ubuntu:~/program/ft2000-4/edk2-for-support$ dpkg -l | grep acpica
ii  acpica-tools                               20160108-2                                      amd64        ACPICA tools for the development and debug of ACPI tables

暂将I2CSerialBusV2改为I2CSerialBus

./build2004.sh: line 59: ./PhytiumPkg/Phytium2004Pkg/pbf/fiptool: cannot execute binary file: Exec format error

飞腾官方发布的edk包内有一个不开放源代码的工具fiptool,据我估计,这个工具的作用就是把多个文件合并成一个文件。这个工具是针对ubuntu18.04.1的,和我们的编译服务器版本不一样,现在国内的开源镜像网站上只有ubuntu18.04.4的,不知道这个工具能否和ubuntu18.04.4兼容,需寻求技术支持提供我们编译服务器ubuntu16.04.6版本的fiptool,或者提供一下fiptool的源代码。
打开了ubuntu18.04.1的虚拟机,确实acpica-tools的版本新一点,

ly@ly:~$ dpkg -l | grep acpica
ii  acpica-tools                               20180105-1                                   amd64        ACPICA tools for the development and debug of ACPI tables
ly@ly:~$ uname -a
Linux ly 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
ly@ly:~$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"

fiptool替换后编译成功,

ly@ly:~/edk2-for-support/PhytiumPkg/Phytium2004Pkg/pbf$ mv fiptool fiptool_arm
ly@ly:~/edk2-for-support/PhytiumPkg/Phytium2004Pkg/pbf$ cp ~/pack_for_custom/my_scripts/fiptool_x86 .
ly@ly:~/edk2-for-support/PhytiumPkg/Phytium2004Pkg/pbf$ ln -s fiptool_x86 fiptool
ly@ly:~/edk2-for-support$ ./build2004.sh r
...
- Done -
Build end time: 20:35:06, Apr.16 2020
Build total time: 00:00:07

0+1 records in
0+1 records out
656617 bytes (657 kB, 641 KiB) copied, 0.000867209 s, 757 MB/s
0+1 records in
0+1 records out
932912 bytes (933 kB, 911 KiB) copied, 0.000989232 s, 943 MB/s
3+1 records in
3+1 records out
4128768 bytes (4.1 MB, 3.9 MiB) copied, 0.00305691 s, 1.4 GB/s

    generate ft2004.fd OK.
    10420224 ft2004.fd

build end.

pack,提供的虚拟机是中文的ubuntu,导致脚本工作不正确,手动更新pack.shupdate_bl.shARCH=x86_64

ly@ly:~/pack_for_custom$ ls -l
总用量 9516
lrwxrwxrwx 1 ly ly      31 1月   8 18:45 bl33_new.bin -> ../../edk2-for-support/bios2004
drwxr-xr-x 2 ly ly    4096 3月   4 19:53 build
-rwxr-xr-x 1 ly ly 8323072 3月   5 01:06 ft2000_4_root_62510623_200305_010600.bin
drwxr-xr-x 2 ly ly    4096 3月   2 00:06 my_scripts
-rw-r--r-- 1 ly ly    1058 3月   5 01:06 parameter.log
-rwxr-xr-x 1 ly ly  932912 11月 18 02:48 phyinit201707.bin
-rwxr-xr-x 1 ly ly  468328 12月 16 23:23 phyinit201707-ddr3.bin
-rwxr-xr-x 1 ly ly     638 12月 16 23:23 readme.txt
ly@ly:~/pack_for_custom$ rm bl33_new.bin 
ly@ly:~/pack_for_custom$ ln -s ~/edk2-for-support/bios2004 bl33_new.bin
ly@ly:~/pack_for_custom$ ./my_scripts/pack.sh 
current path is /home/ly/pack_for_custom
cpu arch is x86_64

enabled update bl33.bin
>>>>fip-all.bin pk <<<<
6.0M	fip-all.bin
fatal: 不是一个 git 仓库(或者任何父目录):.git

/**************************************************/
/******************USE MAKE CONFIG*****************/
/**************************************************/
Version : -- RELEASE -- v0.5


/****** Common info ----- Magic : 0x54460010 ******/

cpu info : cluster_0-core_0 /cluster_0-core_1 /cluster_1-core_0 /cluster_1-core_1 /

cpu frq : 2600 MHZ
lmu frq : 0 MHZ

/**************************************************/


/****** Peu info ----- Magic : 0x54460011 ******/

independent_tree mode : 0x0
PEU 0 : init--X16X1--RC--Gen3-Gen3
PEU 0 : equalization <0x48484848-0x48484848-0x48484848>
PEU 1 : init--X8X8X1--RC--Gen3-Gen3-Gen3
PEU 1 : equalization <0x48484848-0x48484848-0x48484848>

/**************************************************/


/****** Mcu info ----- Magic : 0x54460014 ******/

CH 0 :
	ecc type is from spd
	dm is enable
	not select spd force, will read from SPD!
CH 1 :
	ecc type is from spd
	dm is enable
	not select spd force, will read from SPD!

/**************************************************/

ly@ly:~/pack_for_custom$ ls -l
总用量 7452
lrwxrwxrwx 1 ly ly      34 4月  16 20:45 bl33_new.bin -> /home/ly/edk2-for-support/bios2004
drwxr-xr-x 2 ly ly    4096 3月   4 19:53 build
-rwxr-xr-x 1 ly ly 8323072 4月  16 20:52 ft2000_4_ly__200416_205238.bin
drwxr-xr-x 2 ly ly    4096 4月  16 20:52 my_scripts
-rw-r--r-- 1 ly ly    1058 4月  16 20:52 parameter.log
-rwxr-xr-x 1 ly ly  932912 11月 18 02:48 phyinit201707.bin
-rwxr-xr-x 1 ly ly  468328 12月 16 23:23 phyinit201707-ddr3.bin
-rwxr-xr-x 1 ly ly     638 12月 16 23:23 readme.txt

你可能感兴趣的:(linux内核与驱动开发)