From 6b7be81109c86df0286b893275d56cbe2b8777aa Mon Sep 17 00:00:00 2001 From: Andrew Rynhard Date: Wed, 18 Nov 2020 19:10:20 -0800 Subject: [PATCH] feat: add u-boot This adds u-boot. Signed-off-by: Andrew Rynhard --- .drone.yml | 2 + Makefile | 3 ++ Pkgfile | 2 +- u-boot/pkg.yaml | 102 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 u-boot/pkg.yaml diff --git a/.drone.yml b/.drone.yml index c974fb0a2..5e580651b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -32,6 +32,7 @@ steps: DOCKER_CLI_EXPERIMENTAL: enabled commands: - make + - make arm64 when: event: include: @@ -55,6 +56,7 @@ steps: commands: - docker login ghcr.io --username "$${GHCR_USERNAME}" --password "$${GHCR_PASSWORD}" - make PUSH=true + - make arm64 PUSH=true when: event: exclude: diff --git a/Makefile b/Makefile index ca1dd3c25..52f0ba97d 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,9 @@ TARGETS = ca-certificates cni containerd cryptsetup dosfstools eudev fhs g all: $(TARGETS) ## Builds all known pkgs. +arm64: + $(MAKE) TARGETS=u-boot PLATFORM=linux/arm64 + .PHONY: help help: ## This help menu. @grep -E '^[a-zA-Z%_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' diff --git a/Pkgfile b/Pkgfile index 00e81043b..a5c599761 100644 --- a/Pkgfile +++ b/Pkgfile @@ -3,7 +3,7 @@ format: v1alpha2 vars: - TOOLS_IMAGE: ghcr.io/talos-systems/tools:v0.3.0-10-g83dc352 + TOOLS_IMAGE: ghcr.io/talos-systems/tools:v0.3.0-11-g84c834e labels: org.opencontainers.image.source: https://github.com/talos-systems/pkgs diff --git a/u-boot/pkg.yaml b/u-boot/pkg.yaml new file mode 100644 index 000000000..bf4dd0d85 --- /dev/null +++ b/u-boot/pkg.yaml @@ -0,0 +1,102 @@ +# References: +# U-Boot: +# - https://u-boot.readthedocs.io/en/latest +# Allwinner: +# - https://linux-sunxi.org/ +# - https://github.com/u-boot/u-boot/blob/master/board/sunxi/README.sunxi64 +# Rockchip: +# - http://opensource.rock-chips.com +# - https://github.com/u-boot/u-boot/blob/master/doc/board/rockchip/rockchip.rst +name: u-boot +variant: scratch +shell: /toolchain/bin/bash +dependencies: + - stage: base +steps: + - sources: + - url: https://github.com/ARM-software/arm-trusted-firmware/archive/v2.4.tar.gz + destination: arm-trusted-firmware.tar.gz + sha256: 4bfda9fdbe5022f2e88ad3344165f7d38a8ae4a0e2d91d44d9a1603425cc642d + sha512: 99c5b73345e605db70941a0d44cfe3a1d3df8bbc615e4f2602ca90055cc7150a205350d9ae73dec73fcee85e6877351136428f996d421e57147c931a36f6a330 + - url: https://ftp.denx.de/pub/u-boot/u-boot-2020.10.tar.bz2 + destination: u-boot.tar.bz2 + sha256: 0d481bbdc05c0ee74908ec2f56a6daa53166cc6a78a0e4fac2ac5d025770a622 + sha512: fd26534f2d72ffc3167919c32067c550636f6a4ee5fead6937e2583ba4ff6165e88b8b50fbbddde7354a8c42701433d0cb2ce982e43c014db60b08415288baf9 + env: + SUN50I_A64_ARM_TRUSTED_FIRMWARE: sun50i_a64_arm-trusted-firmware + RK3328_ARM_TRUSTED_FIRMWARE: rk3328_arm-trusted-firmware + LIBRETECH_ALL_H3_CC_H5_U_BOOT: libretech_all_h3_cc_h5_u-boot + EVB_RK3328_U_BOOT: evb_rk3328_u-boot + RPI_ARM64_U_BOOT: rpi_4_defconfig_u-boot + prepare: + - | + mkdir -p /usr/bin \ + && ln -sf /toolchain/bin/env /usr/bin/env \ + # sun50i_a64 + - | + mkdir ${SUN50I_A64_ARM_TRUSTED_FIRMWARE} + tar -xzf arm-trusted-firmware.tar.gz --strip-components=1 -C ${SUN50I_A64_ARM_TRUSTED_FIRMWARE} + # rk3328 + - | + mkdir ${RK3328_ARM_TRUSTED_FIRMWARE} + tar -xzf arm-trusted-firmware.tar.gz --strip-components=1 -C ${RK3328_ARM_TRUSTED_FIRMWARE} + # libretech_all_h3_cc_h5 + - | + mkdir ${LIBRETECH_ALL_H3_CC_H5_U_BOOT} + tar -xjf u-boot.tar.bz2 --strip-components=1 -C ${LIBRETECH_ALL_H3_CC_H5_U_BOOT} + cd ${LIBRETECH_ALL_H3_CC_H5_U_BOOT} + make libretech_all_h3_cc_h5_defconfig + # evb-rk3328 + - | + mkdir ${EVB_RK3328_U_BOOT} + tar -xjf u-boot.tar.bz2 --strip-components=1 -C ${EVB_RK3328_U_BOOT} + cd ${EVB_RK3328_U_BOOT} + make evb-rk3328_defconfig + # rpi_4_defconfig + - | + mkdir ${RPI_ARM64_U_BOOT} + tar -xjf u-boot.tar.bz2 --strip-components=1 -C ${RPI_ARM64_U_BOOT} + cd ${RPI_ARM64_U_BOOT} + make rpi_4_defconfig + build: + # sun50i_a64 + - | + cd ${SUN50I_A64_ARM_TRUSTED_FIRMWARE} + make -j $(nproc) PLAT=sun50i_a64 DEBUG=0 bl31 + # rk3328 + - | + cd ${RK3328_ARM_TRUSTED_FIRMWARE} + make -j $(nproc) PLAT=rk3328 DEBUG=0 bl31 + # libretech_all_h3_cc_h5 + - | + export BL31=$(pwd)/${SUN50I_A64_ARM_TRUSTED_FIRMWARE}/build/sun50i_a64/release/bl31.bin + cd ${LIBRETECH_ALL_H3_CC_H5_U_BOOT} + make -j $(nproc) + # evb-rk3328 + - | + export BL31=$(pwd)/${RK3328_ARM_TRUSTED_FIRMWARE}/build/rk3328/release/bl31/bl31.elf + cd ${EVB_RK3328_U_BOOT} + make -j $(nproc) + # rpi_4_defconfig + - | + cd ${RPI_ARM64_U_BOOT} + make -j $(nproc) + ls -lah + install: + # libretech_all_h3_cc_h5 + - | + mkdir -p /rootfs/libretech_all_h3_cc_h5 + cp -v ${LIBRETECH_ALL_H3_CC_H5_U_BOOT}/u-boot-sunxi-with-spl.bin /rootfs/libretech_all_h3_cc_h5 + # evb-rk3328 + - | + mkdir -p /rootfs/evb_rk3328 + cp -v ${EVB_RK3328_U_BOOT}/idbloader.img /rootfs/evb_rk3328 + cp -v ${EVB_RK3328_U_BOOT}/u-boot.itb /rootfs/evb_rk3328 + cp -v ${EVB_RK3328_U_BOOT}/u-boot-rockchip.bin /rootfs/evb_rk3328 + # rpi_4_defconfig + - | + mkdir -p /rootfs/rpi_4_defconfig + cp -v ${RPI_ARM64_U_BOOT}/u-boot.bin /rootfs/rpi_4_defconfig +finalize: + - from: /rootfs + to: /