飛騰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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章