Skip to content

Commit

Permalink
radxa-zero3e
Browse files Browse the repository at this point in the history
  • Loading branch information
maurerr committed Jun 28, 2024
1 parent 48375a5 commit 9afeb5a
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 0 deletions.
142 changes: 142 additions & 0 deletions include/u-boot-radxa.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
include $(INCLUDE_DIR)/prereq.mk

PKG_NAME ?= u-boot

ifndef PKG_SOURCE_PROTO
PKG_SOURCE = $(PKG_VERSION).tar.gz
PKG_SOURCE_URL = \
https://github.com/maurerr/u-boot/archive/refs/heads/
endif

PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)

PKG_TARGETS := bin
PKG_FLAGS:=nonshared

PKG_LICENSE:=GPL-2.0 GPL-2.0+
PKG_LICENSE_FILES:=Licenses/README

PKG_BUILD_PARALLEL ?= 1

ifdef UBOOT_USE_BINMAN
$(eval $(call TestHostCommand,python3-pyelftools, \
Please install the Python3 elftools module, \
$(STAGING_DIR_HOST)/bin/python3 -c 'import elftools'))
endif

ifdef UBOOT_USE_INTREE_DTC
$(eval $(call TestHostCommand,python3-dev, \
Please install the python3-dev package, \
python3.11-config --includes 2>&1 | grep 'python3', \
python3.10-config --includes 2>&1 | grep 'python3', \
python3.9-config --includes 2>&1 | grep 'python3', \
python3.8-config --includes 2>&1 | grep 'python3', \
python3.7-config --includes 2>&1 | grep 'python3', \
python3-config --includes 2>&1 | grep -E 'python3\.([7-9]|[0-9][0-9])\.?'))

$(eval $(call TestHostCommand,python3-setuptools, \
Please install the Python3 setuptools module, \
$(STAGING_DIR_HOST)/bin/python3 -c 'import setuptools'))

$(eval $(call TestHostCommand,swig, \
Please install the swig package, \
swig -version))
endif

export GCC_HONOUR_COPTS=s

define Package/u-boot/install/default
$(CP) $(patsubst %,$(PKG_BUILD_DIR)/%,$(UBOOT_IMAGE)) $(1)/
endef

Package/u-boot/install = $(Package/u-boot/install/default)

define U-Boot/Init
BUILD_TARGET:=
BUILD_SUBTARGET:=
BUILD_DEVICES:=
NAME:=
DEPENDS:=
HIDDEN:=
DEFAULT:=
VARIANT:=$(1)
UBOOT_CONFIG:=$(1)
UBOOT_IMAGE:=u-boot.bin
endef

TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET))

UBOOT_MAKE_FLAGS = \
PATH=$(STAGING_DIR_HOST)/bin:$(PATH) \
HOSTCC="$(HOSTCC)" \
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \
HOSTLDFLAGS="$(HOST_LDFLAGS)" \
LOCALVERSION="-OpenWrt-$(REVISION)" \
STAGING_PREFIX="$(STAGING_DIR_HOST)" \
PKG_CONFIG_PATH="$(STAGING_DIR_HOST)/lib/pkgconfig" \
PKG_CONFIG_LIBDIR="$(STAGING_DIR_HOST)/lib/pkgconfig" \
PKG_CONFIG_EXTRAARGS="--static" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')

define Build/U-Boot/Target
$(eval $(call U-Boot/Init,$(1)))
$(eval $(call U-Boot/Default,$(1)))
$(eval $(call U-Boot/$(1),$(1)))

define Package/u-boot-$(1)
SECTION:=boot
CATEGORY:=Boot Loaders
TITLE:=U-Boot for $(NAME)
VARIANT:=$(VARIANT)
DEPENDS:=@!IN_SDK $(DEPENDS)
HIDDEN:=$(HIDDEN)
ifneq ($(BUILD_TARGET),)
DEPENDS += @$(TARGET_DEP)
ifneq ($(BUILD_DEVICES),)
DEFAULT := y if ($(TARGET_DEP)_Default \
$(patsubst %,|| $(TARGET_DEP)_DEVICE_%,$(BUILD_DEVICES)) \
$(patsubst %,|| $(patsubst TARGET_%,TARGET_DEVICE_%,$(TARGET_DEP))_DEVICE_%,$(BUILD_DEVICES)))
endif
endif
$(if $(DEFAULT),DEFAULT:=$(DEFAULT))
URL:=http://www.denx.de/wiki/U-Boot
endef

define Package/u-boot-$(1)/install
$$(Package/u-boot/install)
endef
endef

define Build/Configure/U-Boot
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) $(UBOOT_CONFIG)_config
$(if $(strip $(UBOOT_CUSTOMIZE_CONFIG)),
$(PKG_BUILD_DIR)/scripts/config --file $(PKG_BUILD_DIR)/.config $(UBOOT_CUSTOMIZE_CONFIG)
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) oldconfig)
endef

ifndef UBOOT_USE_INTREE_DTC
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
endif

define Build/Compile/U-Boot
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
CROSS_COMPILE=$(TARGET_CROSS) \
$(if $(DTC),DTC="$(DTC)") \
$(UBOOT_MAKE_FLAGS)
endef

define BuildPackage/U-Boot/Defaults
Build/Configure/Default = $$$$(Build/Configure/U-Boot)
Build/Compile/Default = $$$$(Build/Compile/U-Boot)
endef

define BuildPackage/U-Boot
$(eval $(call BuildPackage/U-Boot/Defaults))
$(foreach type,$(if $(DUMP),$(UBOOT_TARGETS),$(BUILD_VARIANT)), \
$(eval $(call Build/U-Boot/Target,$(type)))
)
$(eval $(call Build/DefaultTargets))
$(foreach type,$(if $(DUMP),$(UBOOT_TARGETS),$(BUILD_VARIANT)), \
$(call BuildPackage,u-boot-$(type))
)
endef
13 changes: 13 additions & 0 deletions package/boot/uboot-rockchip/patches/010-add-radxa-zero-3e.patch
Original file line number Diff line number Diff line change
Expand Up @@ -656,3 +656,16 @@
+CONFIG_USB_GADGET=y
+CONFIG_USB_DWC3_GENERIC=y
+CONFIG_USB_FUNCTION_FASTBOOT=n
--- /dev/null
+++ b/arch/arm/dts/rk3566-radxa-zero-3e-u-boot.dtsi
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2021 Rockchip Electronics Co., Ltd
+ */
+
+#include "rk356x-u-boot.dtsi"
+
+&sdhci {
+ cap-mmc-highspeed;
+};

0 comments on commit 9afeb5a

Please sign in to comment.