diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b36f5b9786..c13ccae66b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,6 +73,7 @@ jobs: # Hisilicon [HI3516CV300] - hi3516cv300_lite + - hi3516cv300_neo - hi3516ev100_lite # Hisilicon [HI3516CV500] diff --git a/br-ext-chip-hisilicon/board/hi3516cv300/hi3516cv300.neo.config b/br-ext-chip-hisilicon/board/hi3516cv300/hi3516cv300.neo.config new file mode 100644 index 0000000000..7a1fb2d443 --- /dev/null +++ b/br-ext-chip-hisilicon/board/hi3516cv300/hi3516cv300.neo.config @@ -0,0 +1,214 @@ +# +# Seed kernel config for hi3516cv300_neo (V3 platform, modern kernel). +# Expand with: make ARCH=arm olddefconfig +# + +# Architecture — ARM926EJ-S, ARMv5TE, single-core, no FPU +CONFIG_ARM=y +CONFIG_ARCH_MULTI_V5=y +# CONFIG_ARCH_MULTI_V6 is not set +# CONFIG_ARCH_MULTI_V7 is not set +CONFIG_CPU_ARM926T=y +# CONFIG_SMP is not set +CONFIG_AEABI=y +# CONFIG_VFP is not set +# CONFIG_NEON is not set +# CONFIG_THUMB2_KERNEL is not set +# CONFIG_CACHE_L2X0 is not set + +# HiSilicon BVT platform — hi3516cv300 (ARMv5) +CONFIG_ARCH_HISI_BVT=y +CONFIG_ARCH_HI3516CV300=y +# CONFIG_ARCH_HI3516A is not set +# CONFIG_ARCH_HI3516CV500 is not set +# CONFIG_ARCH_HI3516DV300 is not set +# CONFIG_ARCH_HI3516EV200 is not set +# CONFIG_ARCH_HI3516EV300 is not set +# CONFIG_ARCH_HI3518EV300 is not set +# CONFIG_ARCH_HI3516DV200 is not set +# CONFIG_ARCH_HI3556V200 is not set +# CONFIG_ARCH_HI3559V200 is not set +# CONFIG_HISI_MC is not set +# CONFIG_ARCH_HISI is not set + +# Boot — appended DTB (uImage = zImage + DTB wrapped by neo-post-image.sh) +CONFIG_ARM_APPENDED_DTB=y +CONFIG_ARM_ATAG_DTB_COMPAT=y +CONFIG_CMDLINE="earlycon=pl011,0x12100000" +CONFIG_CMDLINE_EXTEND=y +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 + +# General +CONFIG_LOCALVERSION="" +CONFIG_DEFAULT_HOSTNAME="openipc" +CONFIG_SYSVIPC=y +# CONFIG_SWAP is not set +# CONFIG_USELIB is not set +# CONFIG_CROSS_MEMORY_ATTACH is not set +CONFIG_KERNEL_XZ=y + +# Timers — cv300 has dual SP804 +CONFIG_HZ_PERIODIC=y +# CONFIG_HIGH_RES_TIMERS is not set +CONFIG_PREEMPT_NONE=y + +# Memory — 128MB RAM at 0x80000000; CMA for openhisilicon MMZ +CONFIG_CMA=y +CONFIG_DMA_CMA=y +CONFIG_CMA_SIZE_MBYTES=0 +CONFIG_CMA_AREAS=7 +CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_FLATMEM=y +CONFIG_COMPACTION=y + +# Clocks + reset — cv300 CRG driver lives in upstream-patches already +CONFIG_COMMON_CLK_HI3516CV300=y +CONFIG_RESET_HISI=y + +# Interrupt + timer — cv300 uses PL190 VIC + SP804 +CONFIG_ARM_VIC=y +CONFIG_ARM_TIMER_SP804=y + +# Block devices +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=65536 + +# MTD — SPI NOR flash (cv300 boards typically 8/16MB NOR) +CONFIG_MTD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_SPI_NOR=y + +# Network — HiSilicon FEMAC (cv300 DT uses hisilicon,hi3516cv300-femac) +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_PNP is not set +# CONFIG_NETFILTER is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_IPV6 is not set +CONFIG_NETDEVICES=y +CONFIG_ETHERNET=y +CONFIG_NET_VENDOR_HISILICON=y +CONFIG_HISI_FEMAC=y +CONFIG_MDIO_HISI_FEMAC=y +CONFIG_PHYLIB=y +CONFIG_FIXED_PHY=y +# Disable all other ethernet vendors +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_NET_VENDOR_ALACRITECH is not set +# CONFIG_NET_VENDOR_AMAZON is not set +# CONFIG_NET_VENDOR_AMD is not set +# CONFIG_NET_VENDOR_AQUANTIA is not set +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_VENDOR_ATHEROS is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_CADENCE is not set +# CONFIG_NET_VENDOR_CAVIUM is not set +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_CORTINA is not set +# CONFIG_NET_VENDOR_DAVICOM is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_FREESCALE is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MEDIATEK is not set +# CONFIG_NET_VENDOR_MELLANOX is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_NETRONOME is not set +# CONFIG_NET_VENDOR_NI is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_REALTEK is not set +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_TI is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +# CONFIG_NET_VENDOR_XILINX is not set +# CONFIG_WLAN is not set +# CONFIG_WIRELESS is not set + +# I2C +CONFIG_I2C=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_HIBVT=y + +# SPI +CONFIG_SPI=y +CONFIG_SPI_PL022=y + +# GPIO +CONFIG_GPIOLIB=y +CONFIG_GPIO_PL061=y + +# Serial / UART +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +CONFIG_SERIAL_EARLYCON=y + +# Power +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON=y + +# Filesystems +CONFIG_TMPFS=y +CONFIG_SQUASHFS=y +CONFIG_SQUASHFS_XZ=y +CONFIG_OVERLAY_FS=y +CONFIG_JFFS2_FS=y +# CONFIG_NETWORK_FILESYSTEMS is not set +CONFIG_PROC_FS=y +CONFIG_SYSFS=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y + +# Initrd / initramfs +CONFIG_BLK_DEV_INITRD=y +CONFIG_RD_XZ=y +# CONFIG_RD_GZIP is not set +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +# CONFIG_RD_ZSTD is not set + +# Debug — earlycon for boot debugging +CONFIG_EARLY_PRINTK=y + +# Trim — cv300 is RAM-constrained (128MB) +# CONFIG_COREDUMP is not set +# CONFIG_ETHTOOL_NETLINK is not set +# CONFIG_BPF_SYSCALL is not set +# CONFIG_AUDIT is not set +# CONFIG_PROFILING is not set +# CONFIG_KPROBES is not set +# CONFIG_FTRACE is not set +# CONFIG_KALLSYMS is not set +# CONFIG_PRINTK_TIME is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y + +# Disable subsystems not needed on IP cameras +# CONFIG_INPUT is not set +# CONFIG_VT is not set +# CONFIG_SOUND is not set +# CONFIG_FB is not set +# CONFIG_SCSI is not set +# CONFIG_F2FS_FS is not set +# CONFIG_FAT_FS is not set +# CONFIG_CONFIGFS_FS is not set +# CONFIG_CGROUPS is not set +# CONFIG_NAMESPACES is not set +# CONFIG_USB_SUPPORT is not set +# CONFIG_WATCHDOG is not set +# CONFIG_MMC is not set +# CONFIG_CRAMFS is not set diff --git a/br-ext-chip-hisilicon/board/hi3516cv300/neo-post-image.sh b/br-ext-chip-hisilicon/board/hi3516cv300/neo-post-image.sh new file mode 100755 index 0000000000..3f65c98336 --- /dev/null +++ b/br-ext-chip-hisilicon/board/hi3516cv300/neo-post-image.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Post-image: append cv300 DTB to zImage and wrap as uImage for hi3516cv300_neo. +IMAGES_DIR="${BINARIES_DIR:-$1}" +BUILD_DIR="${BUILD_DIR:-$(dirname $IMAGES_DIR)/build}" +HOST_DIR="${HOST_DIR:-$(dirname $IMAGES_DIR)/host}" +KDIR="$BUILD_DIR/linux-custom" +ZIMAGE="$IMAGES_DIR/zImage" +DTB="$KDIR/arch/arm/boot/dts/hisilicon/hi3516cv300-demb.dtb" +LOADADDR=0x80008000 + +MKIMAGE="" +for p in \ + "${HOST_DIR}/bin/mkimage" \ + "$(dirname $IMAGES_DIR)/host/bin/mkimage" \ + "$(find $(dirname $IMAGES_DIR)/per-package -name mkimage -type f 2>/dev/null | head -1)" \ + "$(which mkimage 2>/dev/null)"; do + [ -x "$p" ] && MKIMAGE="$p" && break +done +[ -z "$MKIMAGE" ] && echo "neo-post-image: ERROR: mkimage not found" >&2 && exit 1 + +[ -f "$ZIMAGE" ] || exit 0 +[ -f "$DTB" ] || exit 0 + +KREL=$(sed 's/-//g' "$KDIR/include/config/kernel.release") + +cat "$ZIMAGE" "$DTB" > "${IMAGES_DIR}/zImage-dtb" +$MKIMAGE -A arm -O linux -T kernel -C none \ + -a $LOADADDR -e $LOADADDR \ + -n "Linux-${KREL}-hi3516cv300" \ + -d "${IMAGES_DIR}/zImage-dtb" "${IMAGES_DIR}/uImage" +rm -f "${IMAGES_DIR}/zImage-dtb" +if [ -f "${IMAGES_DIR}/uImage" ]; then + echo "neo-post-image: uImage $(( $(stat -c%s ${IMAGES_DIR}/uImage) / 1024 ))KB" +else + echo "neo-post-image: ERROR: mkimage failed" >&2 + exit 1 +fi diff --git a/br-ext-chip-hisilicon/configs/hi3516cv300_neo_defconfig b/br-ext-chip-hisilicon/configs/hi3516cv300_neo_defconfig new file mode 100644 index 0000000000..3c9b4848c5 --- /dev/null +++ b/br-ext-chip-hisilicon/configs/hi3516cv300_neo_defconfig @@ -0,0 +1,79 @@ +# Architecture — ARM926EJ-S (ARMv5TE), single-core, no FPU +BR2_arm=y +BR2_arm926t=y +BR2_ARM_EABI=y +BR2_ARM_SOFT_FLOAT=y + +# Toolchain — reuse cv300_lite musl ARMv5 (vendor v3 toolchain). +# Kernel headers stay at 3.18 (toolchain ABI) — Linux preserves syscall +# backward compat, so 3.18 headers compile cleanly against 6.6+ kernels. +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y +BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y +BR2_TOOLCHAIN_EXTERNAL_URL="https://github.com/openipc/firmware/releases/download/$(OPENIPC_TOOLCHAIN).tgz" +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-openipc-linux-musleabi" +BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_18=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y +BR2_TOOLCHAIN_EXTERNAL_CXX=y + +# Kernel — openipc/linux upstream-patches branch (same source as ev300_neo +# / av300_neo). cv300 mainline DT lives in this branch via the companion +# openipc/linux PR: arch/arm/boot/dts/hisilicon/hi3516cv300{.dtsi,-demb.dts} +# + ARCH_HI3516CV300 Kconfig in mach-hibvt. +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/openipc/linux/archive/upstream-patches.tar.gz" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/hi3516cv300.neo.config" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage" +BR2_LINUX_KERNEL_XZ=y + +# Skip legacy kernel patches (4.9-era GCC compat, not needed for 6.x+). +BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL)/package/all-patches-neo" + +# Filesystem +BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_ZLIB=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +# WireGuard is built into Linux 6.6+ — no compat module needed +# BR2_PACKAGE_WIREGUARD_LINUX_COMPAT is not set +BR2_PACKAGE_WIREGUARD_TOOLS=y +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_SQUASHFS=y +BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y + +# OpenIPC +BR2_OPENIPC_SOC_VENDOR="hisilicon" +BR2_OPENIPC_SOC_MODEL="hi3516cv300" +BR2_OPENIPC_SOC_FAMILY="hi3516cv300" +BR2_OPENIPC_VARIANT="neo" +BR2_OPENIPC_FLASH_SIZE="8" + +# Packages — openhisilicon-opensdk provides open_*.ko; vendor osdrv is +# 3.18-only and won't compile against the upstream-patches 7.0 base. +BR2_PACKAGE_DROPBEAR_OPENIPC=y +BR2_PACKAGE_HISILICON_OPENSDK=y +# BR2_PACKAGE_HISILICON_OSDRV_HI3516CV300 is not set +BR2_PACKAGE_IPCTOOL=y +BR2_PACKAGE_JSONFILTER=y +BR2_PACKAGE_LIBCURL_OPENIPC=y +BR2_PACKAGE_LIBCURL_OPENIPC_CURL=y +# BR2_PACKAGE_LIBCURL_OPENIPC_PROXY_SUPPORT is not set +# BR2_PACKAGE_LIBCURL_OPENIPC_COOKIES_SUPPORT is not set +# BR2_PACKAGE_LIBCURL_OPENIPC_EXTRA_PROTOCOLS_FEATURES is not set +BR2_PACKAGE_LIBEVENT_OPENIPC=y +BR2_PACKAGE_LIBOGG_OPENIPC=y +BR2_PACKAGE_MAJESTIC_FONTS=y +BR2_PACKAGE_MAJESTIC_WEBUI=y +BR2_PACKAGE_MAJESTIC=y +BR2_PACKAGE_MBEDTLS_OPENIPC=y +BR2_PACKAGE_MOTORS=y +BR2_PACKAGE_OPUS_OPENIPC=y +BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y +BR2_PACKAGE_VTUND_OPENIPC=y +BR2_PACKAGE_YAML_CLI=y + +# Post-image: wrap zImage + DTB into uImage so U-Boot bootm works. +BR2_ROOTFS_POST_IMAGE_SCRIPT="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/neo-post-image.sh" diff --git a/general/package/hisilicon-opensdk/hisilicon-opensdk.mk b/general/package/hisilicon-opensdk/hisilicon-opensdk.mk index 32d1f2118b..69ef0e3b39 100644 --- a/general/package/hisilicon-opensdk/hisilicon-opensdk.mk +++ b/general/package/hisilicon-opensdk/hisilicon-opensdk.mk @@ -5,7 +5,7 @@ ################################################################################ HISILICON_OPENSDK_SITE = $(call github,openipc,openhisilicon,$(HISILICON_OPENSDK_VERSION)) -HISILICON_OPENSDK_VERSION = 5b1aa42 +HISILICON_OPENSDK_VERSION = b128a0c HISILICON_OPENSDK_LICENSE = GPL-3.0 HISILICON_OPENSDK_LICENSE_FILES = LICENSE @@ -456,19 +456,62 @@ define HISILICON_OPENSDK_FINALIZE_MODULES_GK7205V200 rc rgn sys vedu venc vgs vi vpss; do \ rm -f $(TARGET_DIR)/lib/modules/*/extra/open_$${mod}.ko; \ done + rm -f $(TARGET_DIR)/lib/modules/*/extra/open_ive_neo.ko + rm -f $(TARGET_DIR)/lib/modules/*/extra/open_adc.ko $(LINUX_RUN_DEPMOD) endef HISILICON_OPENSDK_TARGET_FINALIZE_HOOKS += HISILICON_OPENSDK_FINALIZE_MODULES_GK7205V200 endif +# Modules built for V4 ev200 by openhisilicon's Kbuild but never insmod'd +# on V4 — load_hisilicon doesn't reference them, majestic / userspace MPI +# doesn't call in, no init script loads them. Shipped as dead weight in +# /lib/modules//extra/ on every ev200 lite rootfs. Skip the install +# so the bytes don't compete with majestic for the 5 MB NOR partition cap +# on boards like hi3518ev300_lite. +# +# - open_ive_neo.ko (~12 KB) — cv500-targeted experimental, also +# compiles for V4; the .c grew from +# 66 KB → 130 KB source in recent +# cv500 dispatch work. +# - open_adc.ko (~6 KB) — generic ADC driver, only relevant for +# boards exposing GPIO/temp via sysfs; +# not referenced anywhere on +# ev300_lite / gk7205v200_lite nightly. +# +# Both still compile in CI (Kbuild unchanged) and cv500 keeps whatever +# subset its own kbuild includes. gk7205v200 handles the same cleanup +# inline in HISILICON_OPENSDK_FINALIZE_MODULES_GK7205V200 above — putting +# it in a separate post-hook would re-run the rsync from per-package and +# undo the goke/ rename cleanup, re-introducing 1.9 MB of heavy modules +# in extra/ on gk7205v200 lite builds. +ifeq ($(OPENIPC_SOC_FAMILY),hi3516ev200) +define HISILICON_OPENSDK_SKIP_UNUSED_EV200 + $(if $(BR2_PER_PACKAGE_DIRECTORIES),rsync -a $(PER_PACKAGE_DIR)/hisilicon-opensdk/target/lib/modules/ $(TARGET_DIR)/lib/modules/) + rm -f $(TARGET_DIR)/lib/modules/*/extra/open_ive_neo.ko + rm -f $(TARGET_DIR)/lib/modules/*/extra/open_adc.ko + $(LINUX_RUN_DEPMOD) +endef +HISILICON_OPENSDK_TARGET_FINALIZE_HOOKS += HISILICON_OPENSDK_SKIP_UNUSED_EV200 +endif + # hi3518ev300_lite ships with a 5 MB rootfs partition that is already at # 5120/5120 KB on master — no margin for new sensors. Trim SP2308 (.so + .ini) # so this board variant keeps building; other ev200/gk7205v200 variants have # room and keep the sensor. +# +# TODO: SC500AI and GC5603 are temporarily trimmed too to absorb a recent +# majestic binary growth (+41 KB) that pushed ev300_lite past the cap. +# This breaks sysupgrade for any deployed camera using those sensors — +# the openipc.org-hosted sysupgrade payload will no longer ship their +# .so files. Address via compaction in a follow-up PR (strip flags, +# unused-symbol removal, partition rebalance) and restore the sensors. ifeq ($(OPENIPC_SOC_MODEL)/$(OPENIPC_VARIANT),hi3518ev300/lite) define HISILICON_OPENSDK_TRIM_SP2308 rm -f $(TARGET_DIR)/usr/lib/sensors/libsns_sp2308.so rm -f $(TARGET_DIR)/etc/sensors/sp2308_i2c_1080p.ini + rm -f $(TARGET_DIR)/usr/lib/sensors/libsns_sc500ai.so + rm -f $(TARGET_DIR)/usr/lib/sensors/libsns_gc5603.so endef HISILICON_OPENSDK_TARGET_FINALIZE_HOOKS += HISILICON_OPENSDK_TRIM_SP2308 endif