安装依赖软件:
sudo apt-get install iasl uuid-dev acpica-tools
首先下载相关代码仓:
git clone https://git.linaro.org/uefi/uefi-tools.git
git clone https://github.com/tianocore/edk2.git
git submodule update --init
git clone https://github.com/tianocore/edk2-non-osi.git
git clone https://github.com/tianocore/edk2-platforms.git
git clone https://github.com/ARM-software/arm-trusted-firmware.git
开始编译:
./uefi-tools/edk2-build.sh --arm-tf-dir arm-trusted-firmware --edk2-dir edk2 -b DEBUG rpi3
最后生成镜像:
Fd File Name:RPI_EFI (/home/jun/uefi/Build/RPi3/DEBUG_GCC5/FV/RPI_EFI.fd)
Generate Region at Offset 0x0
Region Size = 0x10000
Region File Name = /home/jun/uefi/edk2-non-osi/Platform/RaspberryPi/RPi3/TrustedFirmware/bl1.bin
Generate Region at Offset 0x10000
Region Size = 0x10000
Region Name = DATA
Generate Region at Offset 0x20000
Region Size = 0x10000
Region File Name = /home/jun/uefi/edk2-non-osi/Platform/RaspberryPi/RPi3/TrustedFirmware/fip.bin
Generate Region at Offset 0x30000
Region Size = 0x1B0000
Region Name = FV
Generating FVMAIN_COMPACT FV
Generating FVMAIN FV
Generate Region at Offset 0x1E0000
Region Size = 0xE000
Region Name = DATA
Generate Region at Offset 0x1EE000
Region Size = 0x1000
Region Name = None
Generate Region at Offset 0x1EF000
Region Size = 0x1000
Region Name = DATA
Generate Region at Offset 0x1F0000
Region Size = 0x10000
Region Name = None
GUID cross reference file can be found at /home/jun/uefi/Build/RPi3/DEBUG_GCC5/FV/Guid.xref
FV Space Information
FVMAIN [99%Full] 6846080 total, 6846040 used, 40 free
FVMAIN_COMPACT [56%Full] 1769472 total, 1002848 used, 766624 free
- Done -
Build end time: 06:40:43, Sep.01 2019
Build total time: 00:00:12
Platform 'rpi3' is not configured to build ARM Trusted Firmware.
------------------------------------------------------------
Raspberry Pi 3 (AARCH64) DEBUG pass
------------------------------------------------------------
pass 1
fail 0
将https://github.com/raspberrypi/firmware/tree/master/boot目录里面的下面三个拷贝到FAT32格式sd卡里面
- bootcode.bin
- fixup.dat
- start.elf
最后将后上面编译生成的RPI_EFI.fd
拷贝到sd卡里面,在sd卡里面创建config.txt
,内容如下:
arm_64bit
bootcode_delay=3
boot_delay=3
boot_delay_ms=0
start_file=start.elf
fixup_file=fixup.dat
dtdebug=1
enable_uart=1
arm_control=0x200
armstub=RPI_EFI.fd
disable_commandline_tags=1