Update build.yml #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build rk3399-edk2 | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
env: | |
REPO_URL: https://github.com/shantur/rk3399-edk2 | |
REPO_BRANCH: master | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
SSH_ACTIONS: false | |
UPLOAD_BIN_DIR: false | |
UPLOAD_FIRMWARE: true | |
UPLOAD_COWTRANSFER: false | |
UPLOAD_WETRANSFER: false | |
TZ: Asia/Shanghai | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Initialization environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
sudo -E apt-get update | |
sudo -E apt-get install build-essential acpica-tools nasm uuid-dev gcc-aarch64-linux-gnu | |
sudo timedatectl set-timezone "$TZ" | |
export WORKSPACE=/workspace | |
sudo mkdir -p /workspace | |
cd /workspace | |
sudo chown $USER:$GROUPS /workspace | |
- name: Clone source code | |
working-directory: /workspace | |
run: | | |
git clone https://github.com/tianocore/edk2.git | |
pushd edk2 | |
git checkout 46f4c9677c615d862649459392f8f55b3e6567c2 | |
popd | |
git clone https://github.com/tianocore/edk2-non-osi.git | |
pushd edk2-non-osi | |
git checkout 1e2ca640be54d7a4d5d804c4f33894d099432de3 | |
popd | |
git clone https://github.com/tianocore/edk2-platforms.git | |
pushd edk2-platforms | |
git checkout 861c200cda1417539d46fe3b1eba2b582fa72cbb | |
popd | |
git clone https://github.com/shantur/rk3399-edk2.git edk2-platforms/Platform/Rockchip | |
- name: Compile the EDK2 | |
id: compile | |
run: | | |
export WORKSPACE=/workspace | |
export GCC5_AARCH64_PREFIX=aarch64-linux-gnu- | |
export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms:$WORKSPACE/edk2-non-osi | |
export CFLAGS="-Wno-error" | |
export CXXFLAGS="-Wno-error" | |
cd /workspace | |
. edk2/edksetup.sh | |
make -C edk2/BaseTools | |
build -a AARCH64 -t GCC5 -p edk2-platforms/Platform/Rockchip/Rk3399Pkg/Rk3399-SDK.dsc -b DEBUG | |
edk2-platforms/Platform/Rockchip/Rk3399Pkg/Tools/loaderimage --pack --uboot Build/Rk3399-SDK/DEBUG_GCC5/FV/RK3399_SDK_UEFI.fd RK3399_SDK_UEFI.img | |
mkdir /workspace/uefi_output | |
- name: Create image file | |
run: | | |
# イメージファイル名とサイズ | |
IMAGE_FILE="/workspace/uefi_output/rk3399_image.img" | |
IMAGE_SIZE=$((262144 * 512)) # セクタ数 * セクタサイズ (512バイト) | |
# バイナリファイルのパス | |
IDBLOADER_BIN="/workspace/edk2-platforms/Platform/Rockchip/Rk3399Pkg/Tools/Bin/idbloader.bin" | |
UEFI_IMG="/workspace/RK3399_SDK_UEFI.img" | |
TRUST_IMG="/workspace/edk2-platforms/Platform/Rockchip/Rk3399Pkg/Tools/Bin/trust.img" | |
# イメージファイル作成 | |
dd if=/dev/zero of=${IMAGE_FILE} bs=1 count=0 seek=${IMAGE_SIZE} | |
# ループバックデバイスに関連付け | |
LOOP_DEVICE=$(sudo losetup --show -fP ${IMAGE_FILE}) | |
# パーティション作成 | |
sudo parted ${LOOP_DEVICE} mklabel gpt | |
sudo parted ${LOOP_DEVICE} mkpart loader1 64s 8063s | |
sudo parted ${LOOP_DEVICE} mkpart reserved1 8064s 8191s | |
sudo parted ${LOOP_DEVICE} mkpart reserved2 8192s 16383s | |
sudo parted ${LOOP_DEVICE} mkpart loader2 16384s 24575s | |
sudo parted ${LOOP_DEVICE} mkpart atf 24576s 32767s | |
sudo parted ${LOOP_DEVICE} mkpart efi esp 32768s 262143s | |
sudo parted ${LOOP_DEVICE} set 6 esp on | |
# 各パーティションにファイルを書き込む | |
sudo dd if=${IDBLOADER_BIN} of=${LOOP_DEVICE}p1 bs=512 seek=64 | |
sudo dd if=${UEFI_IMG} of=${LOOP_DEVICE}p4 bs=512 seek=0 | |
sudo dd if=${TRUST_IMG} of=${LOOP_DEVICE}p5 bs=512 seek=0 | |
# ループバックデバイスをデタッチ | |
sudo losetup -d ${LOOP_DEVICE} | |
echo "イメージファイル ${IMAGE_FILE} が作成されました。" | |
- name: SSH connection to Actions | |
uses: csexton/debugger-action@master | |
if: env.SSH_ACTIONS == 'true' || contains(github.event.action, 'ssh') | |
- name: Copy files | |
run: | | |
ls | |
pwd | |
ls * | |
cp /workspace/RK3399_SDK_UEFI.img /workspace/uefi_output | |
cp /workspace/Build/Rk3399-SDK/DEBUG_GCC5/FV/RK3399_SDK_UEFI.fd /workspace/uefi_output | |
cp /workspace/edk2-platforms/Platform/Rockchip/Rk3399Pkg/Tools/Bin/idbloader.bin /workspace/uefi_output/idbloader.bin | |
cp /workspace/edk2-platforms/Platform/Rockchip/Rk3399Pkg/Tools/Bin/trust.img /workspace/uefi_output/trust.img | |
- name: Check space usage | |
if: (!cancelled()) | |
run: df -hT | |
- name: Upload bin directory | |
uses: actions/upload-artifact@master | |
if: env.UPLOAD_BIN_DIR == 'true' | |
with: | |
name: efi_target | |
path: /workspace/uefi_output | |
- name: Organize files | |
id: organize | |
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled() | |
run: | | |
cd /workspace/uefi_output | |
echo "::set-env name=FIRMWARE::$PWD" | |
echo "::set-output name=status::success" | |
- name: Upload firmware directory | |
uses: actions/upload-artifact@master | |
if: steps.organize.outputs.status == 'success' && !cancelled() | |
with: | |
name: uefi_firmware | |
path: ${{ env.FIRMWARE }} |