Initial commit

This commit is contained in:
DanyLE
2025-07-11 10:52:26 +02:00
parent 14e5176fa5
commit d0a8888bce
76 changed files with 8450 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
DESCRIPTION = "ARM Trusted Firmware Allwinner"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://docs/license.rst;md5=b2c740efedc159745b9b31f88ff03dde"
SRC_URI = "git://github.com/ARM-software/arm-trusted-firmware;branch=master;protocol=https"
SRCREV = "d3e71ead6ea5bc3555ac90a446efec84ef6c6122"
# v2.9
S = "${WORKDIR}/git"
B = "${WORKDIR}/build"
COMPATIBLE_MACHINE = "(sun50i|sun50i-a64)"
PLATFORM = "sun50i_a64"
LDFLAGS[unexport] = "1"
do_compile() {
oe_runmake -C ${S} BUILD_BASE=${B} \
CROSS_COMPILE=${TARGET_PREFIX} \
PLAT=${PLATFORM} \
bl31 \
all
}
do_install() {
install -D -p -m 0644 ${B}/${PLATFORM}/release/bl31.bin ${DEPLOY_DIR_IMAGE}/bl31.bin
}

View File

@@ -0,0 +1,76 @@
# default values
setenv load_addr "0x45000000"
setenv overlay_error "false"
setenv rootdev "/dev/mmcblk1p2"
setenv verbosity "1"
setenv rootfstype "ext4"
setenv console "both"
setenv bootlogo "false"
setenv overlay_prefix "sun50i-a64"
setenv recovery "false"
setenv recovery_image "recovery.initramfs"
# Print boot source
itest.b *0x10028 == 0x00 && echo "U-boot loaded from SD"
itest.b *0x10028 == 0x02 && echo "U-boot loaded from eMMC or secondary SD"
itest.b *0x10028 == 0x03 && echo "U-boot loaded from SPI"
echo "Boot script loaded from ${devtype}"
if test -e ${devtype} ${devnum} diya-config.txt; then
load ${devtype} ${devnum} ${load_addr} diya-config.txt
env import -t ${load_addr} ${filesize}
fi
if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=ttyS0,115200 console=tty1"; fi
if test "${console}" = "serial"; then setenv consoleargs "console=ttyS0,115200"; fi
if test "${bootlogo}" = "true"; then
setenv consoleargs "splash plymouth.ignore-serial-consoles ${consoleargs}"
else
setenv consoleargs "splash=verbose ${consoleargs}"
fi
# get PARTUUID of first partition on SD/eMMC it was loaded from
# mmc 0 is always mapped to device u-boot (2016.09+) was loaded from
if test "${devtype}" = "mmc"; then part uuid mmc 0:1 partuuid; fi
# consoleblank=0 loglevel=${verbosity}
setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} ubootpart=${partuuid} usb-storage.quirks=${usbstoragequirks} ${extraargs} ${extraboardargs}"
load ${devtype} ${devnum} ${fdt_addr_r} ${fdtfile}
fdt addr ${fdt_addr_r}
fdt resize 65536
for overlay_file in ${overlays}; do
if load ${devtype} ${devnum} ${load_addr} allwinner/overlay/${overlay_prefix}-${overlay_file}.dtbo; then
echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo"
fdt apply ${load_addr} || setenv overlay_error "true"
fi
done
if test "${overlay_error}" = "true"; then
echo "Error applying DT overlays, restoring original DT"
load ${devtype} ${devnum} ${fdt_addr_r} ${fdtfile}
fi
if test "${ethernet_phy}" = "rtl8211f"; then
fdt set /soc/ethernet@5020000 allwinner,rx-delay-ps <3100>
fdt set /soc/ethernet@5020000 allwinner,tx-delay-ps <700>
fi
if test "${ethernet_phy}" = "yt8531c"; then
fdt set /soc/ethernet@5020000 allwinner,rx-delay-ps <0>
fdt set /soc/ethernet@5020000 allwinner,tx-delay-ps <600>
fi
load ${devtype} ${devnum} ${kernel_addr_r} Image
if test "${recovery}" = "true"; then
load ${devtype} ${devnum} ${ramdisk_addr_r} ${recovery_image}
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
else
booti ${kernel_addr_r} - ${fdt_addr_r}
fi
# Recompile with:
# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

View File

@@ -0,0 +1,56 @@
DESCRIPTION = "U-Boot port for pinephone"
require recipes-bsp/u-boot/u-boot.inc
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://Licenses/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263"
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
DEPENDS:append = " bc-native dtc-native swig-native python3-native flex-native bison-native python3-setuptools-native "
DEPENDS:append = " atf-50i-a64 "
# No patches for other machines yet
PROVIDES += " u-boot virtual/bootloader "
COMPATIBLE_MACHINE = "(sun50i|sun50i-a64|pinephone)"
DEFAULT_PREFERENCE:sun50i = "1"
DEFAULT_PREFERENCE:pinephone="1"
SRC_URI = " \
git://git.iohub.dev/dany/u-boot-megous.git;protocol=https;branch=megi-v2025.01 \
file://boot.cmd \
"
PE = "1"
PV = "v2025.01+git${SRCPV}"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
PACKAGE_ARCH = "${MACHINE_ARCH}"
SPL_BINARY="u-boot-sunxi-with-spl.bin"
UBOOT_ENV_SUFFIX = "scr"
UBOOT_ENV = "boot"
EXTRA_OEMAKE:append = ' HOSTLDSHARED="${BUILD_CC} -shared ${BUILD_LDFLAGS} ${BUILD_CFLAGS}" '
EXTRA_OEMAKE:append = " BL31=${DEPLOY_DIR_IMAGE}/bl31.bin SCP=/dev/null"
do_compile[depends] += "atf-50i-a64:do_install"
do_configure() {
oe_runmake ${UBOOT_MACHINE}
# oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE} mrproper
}
do_compile() {
oe_runmake
oe_runmake u-boot-initial-env
${B}/tools/mkimage -C none -A arm -T script -d ${WORKDIR}/boot.cmd ${WORKDIR}/${UBOOT_ENV_BINARY}
}