From 1749748819caa03e249e8a5df1311498550cbd3b Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 18 Jul 2020 08:53:44 +0200 Subject: [PATCH 68/83] ipq807x: add the Qualcomm AX target support Signed-off-by: John Crispin --- config/Config-kernel.in | 9 ++++++ include/image.mk | 6 +++- include/kernel-version.mk | 2 +- package/boot/uboot-envtools/files/ipq807x | 37 +++++++++++++++++++++++ toolchain/kernel-headers/Makefile | 8 +++++ 5 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 package/boot/uboot-envtools/files/ipq807x diff --git a/config/Config-kernel.in b/config/Config-kernel.in index d4648a5064..2d5c9f1437 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -2,6 +2,15 @@ # # Copyright (C) 2006-2014 OpenWrt.org +config KERNEL_IPQ_MEM_PROFILE + int "Different memory profile " + range 0 1024 + default 512 + depends on TARGET_ipq807x + help + This option select memory profile to be used,which defines + the reserved memory configuration used in device tree. + config KERNEL_BUILD_USER string "Custom Kernel Build User Name" default "builder" if BUILDBOT diff --git a/include/image.mk b/include/image.mk index 6fc02a3f6b..92b23321b1 100644 --- a/include/image.mk +++ b/include/image.mk @@ -179,6 +179,10 @@ define Image/pad-root-squashfs $(call Image/pad-to,$(KDIR)/root.squashfs,$(if $(1),$(1),$(ROOTFS_PARTSIZE))) endef +ifeq ($(CONFIG_IPQ_MEM_PROFILE),512) +DTC_CFLAGS = -D __IPQ_MEM_PROFILE_512_MB__ +endif + # $(1) source dts file # $(2) target dtb file # $(3) extra CPP flags @@ -188,7 +192,7 @@ define Image/BuildDTB -I$(DTS_DIR) \ -I$(DTS_DIR)/include \ -I$(LINUX_DIR)/include/ \ - -undef -D__DTS__ $(3) \ + -undef -D__DTS__ $(DTC_CFLAGS) $(3) \ -o $(2).tmp $(1) $(LINUX_DIR)/scripts/dtc/dtc -O dtb \ -i$(dir $(1)) $(DTC_FLAGS) $(4) \ diff --git a/package/boot/uboot-envtools/files/ipq807x b/package/boot/uboot-envtools/files/ipq807x new file mode 100644 index 0000000000..6c429f1852 --- /dev/null +++ b/package/boot/uboot-envtools/files/ipq807x @@ -0,0 +1,37 @@ +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +ubootenv_mtdinfo () { + UBOOTENV_PART=$(cat /proc/mtd | grep APPSBLENV) + mtd_dev=$(echo $UBOOTENV_PART | awk '{print $1}' | sed 's/:$//') + mtd_size=$(echo $UBOOTENV_PART | awk '{print "0x"$2}') + mtd_erase=$(echo $UBOOTENV_PART | awk '{print "0x"$3}') + nor_flash=$(find /sys/bus/spi/devices/*/mtd -name ${mtd_dev}) + + if [ -n "$nor_flash" ]; then + ubootenv_size=$mtd_size + else + # size is fixed to 0x40000 in u-boot + ubootenv_size=0x40000 + fi + + sectors=$(( $ubootenv_size / $mtd_erase )) + echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors +} + +case "$board" in +*) + ubootenv_add_uci_config $(ubootenv_mtdinfo) + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 -- 2.25.1