From c5f7ac3977f50309ac816b54f470c4021573bf5e Mon Sep 17 00:00:00 2001 From: Valentin von Plata Date: Fri, 6 Sep 2024 16:40:43 +0000 Subject: [PATCH] Add Starfive VisionFive 2 Board Support Co-authored-by: f1bu --- Makefile | 2 +- mkutils/plat/starfive/visionfive2/run.mk | 14 + .../starfive/visionfive2/10-end0.network | 5 + .../starfive/visionfive2/20-end1.network | 5 + .../board/starfive/visionfive2/extlinux.conf | 4 + .../starfive/visionfive2/genimage_sdcard.cfg | 21 + .../linux-starfive-visionfive2-defconfig | 446 +++++++ .../visionfive2/patches/linux/linux-led.patch | 37 + .../opensbi/opensbi-remove-kconfig.patch | 1027 +++++++++++++++++ .../board/starfive/visionfive2/post-build.sh | 12 + .../board/starfive/visionfive2/sshd_config | 116 ++ .../riscv64_starfive_visionfive2_defconfig | 109 ++ sm/plat/generic/config.mk | 4 + sm/plat/generic/objects.mk | 29 +- sm/plat/starfive/visionfive2/objects.mk | 3 + sm/plat/starfive/visionfive2/visionfive2.c | 14 + sm/src/platform/generic/platform.c | 3 + .../platform/starfive/visionfive2/platform.c | 44 + .../platform/starfive/visionfive2/platform.h | 28 + sm/src/sm.c | 3 + 20 files changed, 1924 insertions(+), 2 deletions(-) create mode 100644 mkutils/plat/starfive/visionfive2/run.mk create mode 100644 overlays/keystone/board/starfive/visionfive2/10-end0.network create mode 100644 overlays/keystone/board/starfive/visionfive2/20-end1.network create mode 100644 overlays/keystone/board/starfive/visionfive2/extlinux.conf create mode 100644 overlays/keystone/board/starfive/visionfive2/genimage_sdcard.cfg create mode 100644 overlays/keystone/board/starfive/visionfive2/linux-starfive-visionfive2-defconfig create mode 100644 overlays/keystone/board/starfive/visionfive2/patches/linux/linux-led.patch create mode 100644 overlays/keystone/board/starfive/visionfive2/patches/opensbi/opensbi-remove-kconfig.patch create mode 100755 overlays/keystone/board/starfive/visionfive2/post-build.sh create mode 100644 overlays/keystone/board/starfive/visionfive2/sshd_config create mode 100644 overlays/keystone/configs/riscv64_starfive_visionfive2_defconfig create mode 100644 sm/plat/starfive/visionfive2/objects.mk create mode 100644 sm/plat/starfive/visionfive2/visionfive2.c create mode 100644 sm/src/platform/starfive/visionfive2/platform.c create mode 100644 sm/src/platform/starfive/visionfive2/platform.h diff --git a/Makefile b/Makefile index 0429b63aa..2d956ee00 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ export BUILDROOT_OVERLAYDIR ?= $(BUILDDIR)/overlay export BUILDROOT_BUILDDIR ?= $(BUILDDIR)/buildroot.build -# options: generic, cva6, hifive_unmatched, mpfs +# options: generic, cva6, hifive_unmatched, mpfs, starfive/visionfive2 export KEYSTONE_PLATFORM ?= generic export KEYSTONE_BITS ?= 64 diff --git a/mkutils/plat/starfive/visionfive2/run.mk b/mkutils/plat/starfive/visionfive2/run.mk new file mode 100644 index 000000000..7048e34d8 --- /dev/null +++ b/mkutils/plat/starfive/visionfive2/run.mk @@ -0,0 +1,14 @@ +######################### +## Flash SD card image ## +######################### + +DEVICE ?= +SDIMAGE ?= $(BUILDROOT_BUILDDIR)/images/sdcard.img + +flash: +ifeq ($(DEVICE),) + $(call log,error,Set target device to env DEVICE, e.g. DEVICE=/dev/mmcblk0) +else + $(call log,info,Flashing SD image) + sudo dd if=$(SDIMAGE) of=$(DEVICE) bs=4M conv=fdatasync status=progress +endif \ No newline at end of file diff --git a/overlays/keystone/board/starfive/visionfive2/10-end0.network b/overlays/keystone/board/starfive/visionfive2/10-end0.network new file mode 100644 index 000000000..54711dae7 --- /dev/null +++ b/overlays/keystone/board/starfive/visionfive2/10-end0.network @@ -0,0 +1,5 @@ +[Match] +Name=end0 + +[Network] +DHCP=yes \ No newline at end of file diff --git a/overlays/keystone/board/starfive/visionfive2/20-end1.network b/overlays/keystone/board/starfive/visionfive2/20-end1.network new file mode 100644 index 000000000..b0a49e62b --- /dev/null +++ b/overlays/keystone/board/starfive/visionfive2/20-end1.network @@ -0,0 +1,5 @@ +[Match] +Name=end1 + +[Network] +DHCP=yes \ No newline at end of file diff --git a/overlays/keystone/board/starfive/visionfive2/extlinux.conf b/overlays/keystone/board/starfive/visionfive2/extlinux.conf new file mode 100644 index 000000000..82258b04f --- /dev/null +++ b/overlays/keystone/board/starfive/visionfive2/extlinux.conf @@ -0,0 +1,4 @@ +label linux + kernel /boot/Image + devicetree /boot/jh7110-starfive-visionfive-2-v1.3b.dtb + append console=ttyS0,115200 root=/dev/mmcblk1p3 cma=1024M@0-4G \ No newline at end of file diff --git a/overlays/keystone/board/starfive/visionfive2/genimage_sdcard.cfg b/overlays/keystone/board/starfive/visionfive2/genimage_sdcard.cfg new file mode 100644 index 000000000..e5bc6dd9b --- /dev/null +++ b/overlays/keystone/board/starfive/visionfive2/genimage_sdcard.cfg @@ -0,0 +1,21 @@ +image sdcard.img { + hdimage { + partition-table-type = "gpt" + } + + partition spl { + partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985 + image = "u-boot-spl.bin.normal.out" + } + + partition uboot { + partition-type-uuid = BC13C2FF-59E6-4262-A352-B275FD6F7172 + image = "u-boot.itb" + } + + partition rootfs { + partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 + bootable = true + image = "rootfs.ext4" + } +} \ No newline at end of file diff --git a/overlays/keystone/board/starfive/visionfive2/linux-starfive-visionfive2-defconfig b/overlays/keystone/board/starfive/visionfive2/linux-starfive-visionfive2-defconfig new file mode 100644 index 000000000..ef023ec66 --- /dev/null +++ b/overlays/keystone/board/starfive/visionfive2/linux-starfive-visionfive2-defconfig @@ -0,0 +1,446 @@ +CONFIG_COMPILE_TEST=y +# CONFIG_WERROR is not set +CONFIG_DEFAULT_HOSTNAME="StarFive" +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_USELIB=y +CONFIG_NO_HZ_IDLE=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_BPF_SYSCALL=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_CGROUPS=y +CONFIG_CGROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_CGROUP_BPF=y +CONFIG_NAMESPACES=y +CONFIG_USER_NS=y +CONFIG_CHECKPOINT_RESTORE=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_EXPERT=y +CONFIG_PERF_EVENTS=y +CONFIG_SOC_STARFIVE=y +CONFIG_SOC_STARFIVE_JH7110=y +CONFIG_SMP=y +CONFIG_HZ_100=y +CONFIG_HIBERNATION=y +CONFIG_PM_STD_PARTITION="PARTLABEL=hibernation" +CONFIG_PM_DEBUG=y +CONFIG_PM_ADVANCED_DEBUG=y +CONFIG_PM_TEST_SUSPEND=y +CONFIG_CPU_IDLE=y +CONFIG_RISCV_SBI_CPUIDLE=y +# CONFIG_SECCOMP is not set +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_BINFMT_MISC=y +CONFIG_PAGE_REPORTING=y +CONFIG_CMA=y +CONFIG_CMA_AREAS=7 +CONFIG_DMA_CMA=y +CONFIG_CMA_SIZE_MBYTES=1024 +CONFIG_CMA_SIZE_SEL_MBYTES=y +CONFIG_CMA_ALIGNMENT=9 +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +CONFIG_NETFILTER=y +CONFIG_NETFILTER_NETLINK_ACCT=y +CONFIG_NETFILTER_NETLINK_QUEUE=y +CONFIG_NF_CONNTRACK=y +CONFIG_NF_TABLES=y +CONFIG_NFT_CT=y +CONFIG_NFT_COMPAT=y +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y +CONFIG_NETFILTER_XT_MATCH_IPCOMP=y +CONFIG_NETFILTER_XT_MATCH_IPRANGE=y +CONFIG_NETFILTER_XT_MATCH_MAC=y +CONFIG_NETFILTER_XT_MATCH_MARK=y +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y +CONFIG_NETFILTER_XT_MATCH_SOCKET=y +CONFIG_NETFILTER_XT_MATCH_STATE=y +CONFIG_NETFILTER_XT_MATCH_STRING=y +CONFIG_NETFILTER_XT_MATCH_U32=y +CONFIG_NF_TABLES_IPV4=y +CONFIG_NFT_DUP_IPV4=y +CONFIG_NFT_FIB_IPV4=y +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_TARGET_REJECT=y +CONFIG_IP_NF_NAT=y +CONFIG_IP_NF_TARGET_MASQUERADE=y +CONFIG_IP_NF_TARGET_NETMAP=y +CONFIG_IP_NF_TARGET_REDIRECT=y +CONFIG_NETLINK_DIAG=y +CONFIG_CAN=y +CONFIG_IPMS_CAN=y +CONFIG_BT=y +CONFIG_BT_RFCOMM=y +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=y +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +CONFIG_BT_HCIBTUSB=m +# CONFIG_BT_HCIBTUSB_BCM is not set +# CONFIG_BT_HCIBTUSB_RTL is not set +CONFIG_BT_AICUSB=y +CONFIG_CFG80211=y +CONFIG_MAC80211=y +CONFIG_RFKILL=y +CONFIG_NET_9P=y +CONFIG_NET_9P_VIRTIO=y +CONFIG_PCI=y +# CONFIG_PCIEASPM is not set +CONFIG_PCIE_PLDA=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_MTD=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_SPI_NOR=y +CONFIG_OF_CONFIGFS=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_VIRTIO_BLK=y +CONFIG_BLK_DEV_NVME=y +CONFIG_EEPROM_AT24=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_DEV_SR=y +CONFIG_SCSI_VIRTIO=y +CONFIG_ATA=y +CONFIG_SATA_AHCI=y +CONFIG_MD=y +CONFIG_BLK_DEV_DM=m +CONFIG_NETDEVICES=y +CONFIG_TUN=m +CONFIG_VIRTIO_NET=y +# CONFIG_NET_VENDOR_ALACRITECH is not set +# CONFIG_NET_VENDOR_AMAZON is not set +# CONFIG_NET_VENDOR_AQUANTIA is not set +# CONFIG_NET_VENDOR_ARC 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_CORTINA is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +# CONFIG_NET_VENDOR_GOOGLE is not set +# CONFIG_NET_VENDOR_HUAWEI is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL 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_MICROSEMI 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_PENSANDO is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +CONFIG_R8169=y +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SOLARFLARE is not set +# CONFIG_NET_VENDOR_SOCIONEXT is not set +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_SELFTESTS=y +CONFIG_DWMAC_DWC_QOS_ETH=y +CONFIG_DWMAC_STARFIVE_PLAT=y +# CONFIG_NET_VENDOR_SYNOPSYS 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_MARVELL_PHY=y +CONFIG_MICREL_PHY=y +CONFIG_MOTORCOMM_PHY=y +CONFIG_IWLWIFI=y +CONFIG_IWLDVM=y +CONFIG_IWLMVM=y +CONFIG_HOSTAP=y +# CONFIG_RTL_CARDS is not set +CONFIG_USB_WIFI_ECR6600U=y +CONFIG_AIC_WLAN_SUPPORT=y +CONFIG_AIC8800_WLAN_SUPPORT=m +CONFIG_AIC_LOADFW_SUPPORT=m +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_GOODIX=y +CONFIG_TOUCHSCREEN_TINKER_FT5406=y +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_NR_UARTS=6 +CONFIG_SERIAL_8250_RUNTIME_UARTS=6 +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +CONFIG_SERIAL_8250_DW=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_EARLYCON_RISCV_SBI=y +CONFIG_HVC_RISCV_SBI=y +CONFIG_TTY_PRINTK=y +CONFIG_VIRTIO_CONSOLE=y +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_STARFIVE=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_DESIGNWARE_PLATFORM=y +CONFIG_SPI=y +CONFIG_SPI_CADENCE_QUADSPI=y +CONFIG_SPI_PL022_STARFIVE=y +CONFIG_SPI_SIFIVE=y +CONFIG_SPI_SPIDEV=y +# CONFIG_PTP_1588_CLOCK is not set +CONFIG_PINCTRL=y +CONFIG_PINCTRL_STARFIVE=y +CONFIG_PINCTRL_STARFIVE_JH7110=y +CONFIG_GPIO_SYSFS=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO_RESTART=y +CONFIG_POWER_RESET_SYSCON=y +CONFIG_POWER_RESET_SYSCON_POWEROFF=y +CONFIG_SENSORS_SFCTEMP=y +CONFIG_THERMAL=y +CONFIG_THERMAL_WRITABLE_TRIPS=y +CONFIG_CPU_THERMAL=y +CONFIG_THERMAL_EMULATION=y +CONFIG_WATCHDOG=y +CONFIG_WATCHDOG_SYSFS=y +CONFIG_STARFIVE_WATCHDOG=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_AXP15060=y +# CONFIG_MEDIA_CEC_SUPPORT is not set +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_USB_SUPPORT=y +CONFIG_USB_VIDEO_CLASS=y +CONFIG_V4L_PLATFORM_DRIVERS=y +CONFIG_VIDEO_STF_VIN=y +CONFIG_VIN_SENSOR_OV4689=y +CONFIG_VIN_SENSOR_IMX219=y +CONFIG_V4L_MEM2MEM_DRIVERS=y +CONFIG_VIDEO_WAVE_VPU=m +CONFIG_VIDEO_IMX708=y +CONFIG_DRM_PANEL_JADARD_JD9365DA_H3=y +CONFIG_DRM_PANEL_STARFIVE_10INCH=y +CONFIG_DRM_VERISILICON=y +CONFIG_STARFIVE_INNO_HDMI=y +CONFIG_STARFIVE_DSI=y +CONFIG_DRM_IMG_ROGUE=y +CONFIG_DRM_LEGACY=y +CONFIG_FB=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_PWM=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_USB_AUDIO=y +CONFIG_SND_SOC=y +CONFIG_SND_DESIGNWARE_I2S=y +CONFIG_SND_SOC_SOF_TOPLEVEL=y +CONFIG_SND_SOC_SOF_OF=y +CONFIG_SND_SOC_SOF_STARFIVE_TOPLEVEL=y +CONFIG_SND_SOC_SOF_STARFIVE_SUPPORT=y +CONFIG_STARFIVE_DSP=y +CONFIG_SND_SOC_STARFIVE=y +CONFIG_SND_SOC_STARFIVE_PWMDAC=y +CONFIG_SND_SOC_STARFIVE_I2S=y +CONFIG_SND_SOC_STARFIVE_SOF_TDM_DAI=y +CONFIG_SND_SOC_AC108=y +CONFIG_SND_SOC_WM8960=y +CONFIG_SND_SIMPLE_CARD=y +CONFIG_UHID=y +CONFIG_USB=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_USB_UAS=y +CONFIG_USB_CDNS_SUPPORT=y +CONFIG_USB_CDNS3=y +CONFIG_USB_CDNS3_GADGET=y +CONFIG_USB_CDNS3_HOST=y +CONFIG_USB_CDNS3_STARFIVE=y +CONFIG_USB_SERIAL=m +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_AIRCABLE=m +CONFIG_USB_SERIAL_ARK3116=m +CONFIG_USB_SERIAL_BELKIN=m +CONFIG_USB_SERIAL_CH341=m +CONFIG_USB_SERIAL_WHITEHEAT=m +CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m +CONFIG_USB_SERIAL_CP210X=m +CONFIG_USB_SERIAL_CYPRESS_M8=m +CONFIG_USB_SERIAL_EMPEG=m +CONFIG_USB_SERIAL_FTDI_SIO=m +CONFIG_USB_SERIAL_VISOR=m +CONFIG_USB_SERIAL_IPAQ=m +CONFIG_USB_SERIAL_IR=m +CONFIG_USB_SERIAL_EDGEPORT=m +CONFIG_USB_SERIAL_EDGEPORT_TI=m +CONFIG_USB_SERIAL_F81232=m +CONFIG_USB_SERIAL_GARMIN=m +CONFIG_USB_SERIAL_IPW=m +CONFIG_USB_SERIAL_IUU=m +CONFIG_USB_SERIAL_KEYSPAN_PDA=m +CONFIG_USB_SERIAL_KEYSPAN=m +CONFIG_USB_SERIAL_KLSI=m +CONFIG_USB_SERIAL_KOBIL_SCT=m +CONFIG_USB_SERIAL_MCT_U232=m +CONFIG_USB_SERIAL_METRO=m +CONFIG_USB_SERIAL_MOS7720=m +CONFIG_USB_SERIAL_MOS7840=m +CONFIG_USB_SERIAL_NAVMAN=m +CONFIG_USB_SERIAL_PL2303=m +CONFIG_USB_SERIAL_OTI6858=m +CONFIG_USB_SERIAL_QCAUX=m +CONFIG_USB_SERIAL_QUALCOMM=m +CONFIG_USB_SERIAL_SPCP8X5=m +CONFIG_USB_SERIAL_SAFE=m +CONFIG_USB_SERIAL_SIERRAWIRELESS=m +CONFIG_USB_SERIAL_SYMBOL=m +CONFIG_USB_SERIAL_TI=m +CONFIG_USB_SERIAL_CYBERJACK=m +CONFIG_USB_SERIAL_OMNINET=m +CONFIG_USB_SERIAL_OPTICON=m +CONFIG_USB_SERIAL_XSENS_MT=m +CONFIG_USB_SERIAL_WISHBONE=m +CONFIG_USB_SERIAL_SSU100=m +CONFIG_USB_SERIAL_DEBUG=m +CONFIG_USB_GADGET=y +CONFIG_USB_CONFIGFS=y +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_MMC=y +CONFIG_MMC_DEBUG=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_OF_DWCMSHC=y +CONFIG_MMC_SPI=y +CONFIG_MMC_DW=y +CONFIG_MMC_DW_STARFIVE=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_STARFIVE=y +CONFIG_RTC_DRV_GOLDFISH=y +CONFIG_DMADEVICES=y +CONFIG_DW_AXI_DMAC=y +CONFIG_DMATEST=y +# CONFIG_VIRTIO_MENU is not set +# CONFIG_VHOST_MENU is not set +CONFIG_GOLDFISH=y +CONFIG_STARFIVE_TIMER=y +CONFIG_MAILBOX=y +CONFIG_STARFIVE_MBOX=y +CONFIG_STARFIVE_MBOX_TEST=m +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_RPMSG_CHAR=y +CONFIG_RPMSG_VIRTIO=y +CONFIG_SIFIVE_L2_FLUSH_START=0x40000000 +CONFIG_SIFIVE_L2_FLUSH_SIZE=0x400000000 +CONFIG_STARFIVE_PMU=y +CONFIG_IIO=y +CONFIG_IIO_ST_ACCEL_3AXIS=y +CONFIG_PWM=y +CONFIG_PWM_STARFIVE_PTC=y +CONFIG_PHY_M31_DPHY_RX0=y +CONFIG_RAS=y +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_STAT=y +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y +CONFIG_CPUFREQ_DT=y +CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=y +CONFIG_CUSE=y +CONFIG_VIRTIO_FS=y +CONFIG_OVERLAY_FS=y +CONFIG_OVERLAY_FS_INDEX=y +CONFIG_OVERLAY_FS_XINO_AUTO=y +CONFIG_OVERLAY_FS_METACOPY=y +CONFIG_FSCACHE=y +CONFIG_FSCACHE_STATS=y +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_UTF8=y +CONFIG_EXFAT_FS=y +CONFIG_NTFS_FS=y +CONFIG_NTFS_RW=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_HUGETLBFS=y +CONFIG_JFFS2_FS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V4=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_ROOT_NFS=y +CONFIG_CIFS=m +# CONFIG_CIFS_STATS2 is not set +CONFIG_CIFS_UPCALL=y +CONFIG_CIFS_XATTR=y +CONFIG_CIFS_POSIX=y +# CONFIG_CIFS_DEBUG is not set +CONFIG_CIFS_DFS_UPCALL=y +CONFIG_CIFS_FSCACHE=y +CONFIG_SMB_SERVER=m +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_CRYPTO_USER=y +CONFIG_CRYPTO_TEST=m +CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y +CONFIG_CRYPTO_USER_API_RNG=y +CONFIG_CRYPTO_USER_API_AEAD=y +CONFIG_CRYPTO_USER_API_AKCIPHER=y +CONFIG_CRYPTO_DEV_VIRTIO=y +CONFIG_CRYPTO_DEV_JH7110_ENCRYPT=y +CONFIG_PRINTK_TIME=y +CONFIG_DEBUG_FS=y +CONFIG_SOFTLOCKUP_DETECTOR=y +CONFIG_WQ_WATCHDOG=y +CONFIG_DEBUG_TIMEKEEPING=y +CONFIG_DEBUG_RT_MUTEXES=y +CONFIG_DEBUG_SPINLOCK=y +CONFIG_DEBUG_RWSEMS=y +CONFIG_STACKTRACE=y +CONFIG_DEBUG_LIST=y +CONFIG_DEBUG_PLIST=y +CONFIG_DEBUG_SG=y +# CONFIG_RCU_TRACE is not set +CONFIG_RCU_EQS_DEBUG=y +# CONFIG_FTRACE is not set +# CONFIG_RUNTIME_TESTING_MENU is not set +CONFIG_MEMTEST=y + + +#for tracing: +#CONFIG_KALLSYMS=y +#CONFIG_TRACEPOINTS=y +#CONFIG_KPROBES =y + +#for i2c +#CONFIG_I2C_COMPAT=y +#CONFIG_I2C=y +#CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_DESIGNWARE_SLAVE=y +CONFIG_I2C_DESIGNWARE_PLATFORM=y +CONFIG_I2C_STUB=m +CONFIG_I2C=y +CONFIG_I2C_OCORES=y + +CONFIG_LEDS_TRIGGERS=y diff --git a/overlays/keystone/board/starfive/visionfive2/patches/linux/linux-led.patch b/overlays/keystone/board/starfive/visionfive2/patches/linux/linux-led.patch new file mode 100644 index 000000000..dbbdc1f75 --- /dev/null +++ b/overlays/keystone/board/starfive/visionfive2/patches/linux/linux-led.patch @@ -0,0 +1,37 @@ +--- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi 2024-06-24 17:10:56.102667746 +0000 ++++ "b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi" 2024-06-24 17:15:17.500790752 +0000 +@@ -8,6 +8,8 @@ + #include "jh7110.dtsi" + #include "jh7110-pinfunc.h" + #include ++#include ++#include + + / { + aliases { +@@ -21,6 +23,7 @@ + mmc1 = &mmc1; + serial0 = &uart0; + }; ++ + + chosen { + stdout-path = "serial0:115200n8"; +@@ -67,6 +70,17 @@ + }; + }; + }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ gpios = <&aongpio 3 GPIO_ACTIVE_HIGH>; ++ color = ; ++ function = LED_FUNCTION_HEARTBEAT; ++ linux,default-trigger = "heartbeat"; ++ }; ++ }; + }; + + &dvp_clk { diff --git a/overlays/keystone/board/starfive/visionfive2/patches/opensbi/opensbi-remove-kconfig.patch b/overlays/keystone/board/starfive/visionfive2/patches/opensbi/opensbi-remove-kconfig.patch new file mode 100644 index 000000000..2be0e58ea --- /dev/null +++ b/overlays/keystone/board/starfive/visionfive2/patches/opensbi/opensbi-remove-kconfig.patch @@ -0,0 +1,1027 @@ +diff -Naur opensbi/firmware/Kconfig ../opensbi/firmware/Kconfig +--- opensbi/firmware/Kconfig 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/firmware/Kconfig 1970-01-01 00:00:00.000000000 +0000 +@@ -1 +0,0 @@ +-# SPDX-License-Identifier: BSD-2-Clause +diff -Naur opensbi/include/sbi_utils/fdt/fdt_domain.h ../opensbi/include/sbi_utils/fdt/fdt_domain.h +--- opensbi/include/sbi_utils/fdt/fdt_domain.h 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/include/sbi_utils/fdt/fdt_domain.h 2024-06-14 15:14:32.539517864 +0000 +@@ -13,8 +13,6 @@ + + #include + +-#ifdef CONFIG_FDT_DOMAIN +- + struct sbi_domain; + + /** +@@ -72,11 +70,4 @@ + */ + int fdt_domains_populate(void *fdt); + +-#else +- +-static inline void fdt_domain_fixup(void *fdt) { } +-static inline int fdt_domains_populate(void *fdt) { return 0; } +- +-#endif +- + #endif /* __FDT_DOMAIN_H__ */ +diff -Naur opensbi/include/sbi_utils/fdt/fdt_pmu.h ../opensbi/include/sbi_utils/fdt/fdt_pmu.h +--- opensbi/include/sbi_utils/fdt/fdt_pmu.h 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/include/sbi_utils/fdt/fdt_pmu.h 2024-06-14 15:15:16.352491872 +0000 +@@ -13,8 +13,6 @@ + + #include + +-#ifdef CONFIG_FDT_PMU +- + /** + * Fix up the PMU node in the device tree + * +@@ -45,12 +43,4 @@ + */ + uint64_t fdt_pmu_get_select_value(uint32_t event_idx); + +-#else +- +-static inline void fdt_pmu_fixup(void *fdt) { } +-static inline int fdt_pmu_setup(void *fdt) { return 0; } +-static inline uint64_t fdt_pmu_get_select_value(uint32_t event_idx) { return 0; } +- +-#endif +- + #endif +diff -Naur opensbi/include/sbi_utils/ipi/fdt_ipi.h ../opensbi/include/sbi_utils/ipi/fdt_ipi.h +--- opensbi/include/sbi_utils/ipi/fdt_ipi.h 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/include/sbi_utils/ipi/fdt_ipi.h 2024-06-14 15:15:25.948705708 +0000 +@@ -12,8 +12,6 @@ + + #include + +-#ifdef CONFIG_FDT_IPI +- + struct fdt_ipi { + const struct fdt_match *match_table; + int (*cold_init)(void *fdt, int nodeoff, const struct fdt_match *match); +@@ -25,11 +23,4 @@ + + int fdt_ipi_init(bool cold_boot); + +-#else +- +-static inline void fdt_ipi_exit(void) { } +-static inline int fdt_ipi_init(bool cold_boot) { return 0; } +- +-#endif +- + #endif +diff -Naur opensbi/include/sbi_utils/irqchip/fdt_irqchip.h ../opensbi/include/sbi_utils/irqchip/fdt_irqchip.h +--- opensbi/include/sbi_utils/irqchip/fdt_irqchip.h 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/include/sbi_utils/irqchip/fdt_irqchip.h 2024-06-14 15:15:33.992885093 +0000 +@@ -12,8 +12,6 @@ + + #include + +-#ifdef CONFIG_FDT_IRQCHIP +- + struct fdt_irqchip { + const struct fdt_match *match_table; + int (*cold_init)(void *fdt, int nodeoff, const struct fdt_match *match); +@@ -24,13 +22,4 @@ + void fdt_irqchip_exit(void); + + int fdt_irqchip_init(bool cold_boot); +- +-#else +- +-static inline void fdt_irqchip_exit(void) { } +- +-static inline int fdt_irqchip_init(bool cold_boot) { return 0; } +- +-#endif +- + #endif +diff -Naur opensbi/include/sbi_utils/irqchip/imsic.h ../opensbi/include/sbi_utils/irqchip/imsic.h +--- opensbi/include/sbi_utils/irqchip/imsic.h 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/include/sbi_utils/irqchip/imsic.h 2024-06-14 15:15:51.381273260 +0000 +@@ -33,8 +33,6 @@ + struct imsic_regs regs[IMSIC_MAX_REGS]; + }; + +-#ifdef CONFIG_IRQCHIP_IMSIC +- + int imsic_map_hartid_to_data(u32 hartid, struct imsic_data *imsic, int file); + + struct imsic_data *imsic_get_data(u32 hartid); +@@ -49,12 +47,4 @@ + + int imsic_cold_irqchip_init(struct imsic_data *imsic); + +-#else +- +-static inline void imsic_local_irqchip_init(void) { } +- +-static inline int imsic_data_check(struct imsic_data *imsic) { return 0; } +- +-#endif +- + #endif +diff -Naur opensbi/include/sbi_utils/reset/fdt_reset.h ../opensbi/include/sbi_utils/reset/fdt_reset.h +--- opensbi/include/sbi_utils/reset/fdt_reset.h 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/include/sbi_utils/reset/fdt_reset.h 2024-06-14 15:16:06.077601754 +0000 +@@ -17,8 +17,6 @@ + int (*init)(void *fdt, int nodeoff, const struct fdt_match *match); + }; + +-#ifdef CONFIG_FDT_RESET +- + /** + * fdt_reset_driver_init() - initialize reset driver based on the device-tree + */ +@@ -31,14 +29,4 @@ + */ + void fdt_reset_init(void); + +-#else +- +-static inline int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv) +-{ +- return 0; +-} +-static inline void fdt_reset_init(void) { } +- +-#endif +- + #endif +diff -Naur opensbi/include/sbi_utils/serial/fdt_serial.h ../opensbi/include/sbi_utils/serial/fdt_serial.h +--- opensbi/include/sbi_utils/serial/fdt_serial.h 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/include/sbi_utils/serial/fdt_serial.h 2024-06-14 15:16:16.209828449 +0000 +@@ -12,8 +12,6 @@ + + #include + +-#ifdef CONFIG_FDT_SERIAL +- + struct fdt_serial { + const struct fdt_match *match_table; + int (*init)(void *fdt, int nodeoff, const struct fdt_match *match); +@@ -21,10 +19,4 @@ + + int fdt_serial_init(void); + +-#else +- +-static inline int fdt_serial_init(void) { return 0; } +- +-#endif +- + #endif +diff -Naur opensbi/include/sbi_utils/serial/semihosting.h ../opensbi/include/sbi_utils/serial/semihosting.h +--- opensbi/include/sbi_utils/serial/semihosting.h 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/include/sbi_utils/serial/semihosting.h 2024-06-14 15:16:30.594150580 +0000 +@@ -36,12 +36,7 @@ + MODE_APPEND = 0x8, + }; + +-#ifdef CONFIG_SERIAL_SEMIHOSTING + int semihosting_init(void); + int semihosting_enabled(void); +-#else +-static inline int semihosting_init(void) { return SBI_ENODEV; } +-static inline int semihosting_enabled(void) { return 0; } +-#endif + + #endif +diff -Naur opensbi/include/sbi_utils/timer/fdt_timer.h ../opensbi/include/sbi_utils/timer/fdt_timer.h +--- opensbi/include/sbi_utils/timer/fdt_timer.h 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/include/sbi_utils/timer/fdt_timer.h 2024-06-14 15:16:58.658780052 +0000 +@@ -12,8 +12,6 @@ + + #include + +-#ifdef CONFIG_FDT_TIMER +- + struct fdt_timer { + const struct fdt_match *match_table; + int (*cold_init)(void *fdt, int nodeoff, const struct fdt_match *match); +@@ -25,11 +23,4 @@ + + int fdt_timer_init(bool cold_boot); + +-#else +- +-static inline void fdt_timer_exit(void) { } +-static inline int fdt_timer_init(bool cold_boot) { return 0; } +- +-#endif +- + #endif +diff -Naur opensbi/Kconfig ../opensbi/Kconfig +--- opensbi/Kconfig 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/Kconfig 1970-01-01 00:00:00.000000000 +0000 +@@ -1,25 +0,0 @@ +-# SPDX-License-Identifier: BSD-2-Clause +- +-mainmenu "OpenSBI $(OPENSBI_PLATFORM) Configuration" +- +-config OPENSBI_SRC_DIR +- string +- option env="OPENSBI_SRC_DIR" +- +-config OPENSBI_PLATFORM +- string +- option env="OPENSBI_PLATFORM" +- +-config OPENSBI_PLATFORM_SRC_DIR +- string +- option env="OPENSBI_PLATFORM_SRC_DIR" +- +-menu "Platform Options" +-source "$(OPENSBI_PLATFORM_SRC_DIR)/Kconfig" +-endmenu +- +-source "$(OPENSBI_SRC_DIR)/lib/sbi/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/firmware/Kconfig" +diff -Naur opensbi/lib/sbi/objects.mk ../opensbi/lib/sbi/objects.mk +--- opensbi/lib/sbi/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/sbi/objects.mk 2024-06-14 15:06:51.753151513 +0000 +@@ -16,38 +16,38 @@ + libsbi-objs-y += sbi_ecall_exts.o + + # The order of below extensions is performance optimized +-carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_TIME) += ecall_time +-libsbi-objs-$(CONFIG_SBI_ECALL_TIME) += sbi_ecall_time.o ++carray-sbi_ecall_exts-y += ecall_time ++libsbi-objs-y += sbi_ecall_time.o + +-carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_RFENCE) += ecall_rfence +-libsbi-objs-$(CONFIG_SBI_ECALL_RFENCE) += sbi_ecall_rfence.o ++carray-sbi_ecall_exts-y += ecall_rfence ++libsbi-objs-y += sbi_ecall_rfence.o + +-carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_IPI) += ecall_ipi +-libsbi-objs-$(CONFIG_SBI_ECALL_IPI) += sbi_ecall_ipi.o ++carray-sbi_ecall_exts-y += ecall_ipi ++libsbi-objs-y += sbi_ecall_ipi.o + + carray-sbi_ecall_exts-y += ecall_base + libsbi-objs-y += sbi_ecall_base.o + +-carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_HSM) += ecall_hsm +-libsbi-objs-$(CONFIG_SBI_ECALL_HSM) += sbi_ecall_hsm.o ++carray-sbi_ecall_exts-y += ecall_hsm ++libsbi-objs-y += sbi_ecall_hsm.o + +-carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_SRST) += ecall_srst +-libsbi-objs-$(CONFIG_SBI_ECALL_SRST) += sbi_ecall_srst.o ++carray-sbi_ecall_exts-y += ecall_srst ++libsbi-objs-y += sbi_ecall_srst.o + +-carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_SUSP) += ecall_susp +-libsbi-objs-$(CONFIG_SBI_ECALL_SUSP) += sbi_ecall_susp.o ++carray-sbi_ecall_exts-y += ecall_susp ++libsbi-objs-y += sbi_ecall_susp.o + +-carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_PMU) += ecall_pmu +-libsbi-objs-$(CONFIG_SBI_ECALL_PMU) += sbi_ecall_pmu.o ++carray-sbi_ecall_exts-y += ecall_pmu ++libsbi-objs-y += sbi_ecall_pmu.o + +-carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_DBCN) += ecall_dbcn +-libsbi-objs-$(CONFIG_SBI_ECALL_DBCN) += sbi_ecall_dbcn.o ++carray-sbi_ecall_exts-y += ecall_dbcn ++libsbi-objs-y += sbi_ecall_dbcn.o + +-carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_LEGACY) += ecall_legacy +-libsbi-objs-$(CONFIG_SBI_ECALL_LEGACY) += sbi_ecall_legacy.o ++carray-sbi_ecall_exts-y += ecall_legacy ++libsbi-objs-y += sbi_ecall_legacy.o + +-carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_VENDOR) += ecall_vendor +-libsbi-objs-$(CONFIG_SBI_ECALL_VENDOR) += sbi_ecall_vendor.o ++carray-sbi_ecall_exts-y += ecall_vendor ++libsbi-objs-y += sbi_ecall_vendor.o + + libsbi-objs-y += sbi_bitmap.o + libsbi-objs-y += sbi_bitops.o +diff -Naur opensbi/lib/utils/fdt/objects.mk ../opensbi/lib/utils/fdt/objects.mk +--- opensbi/lib/utils/fdt/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/fdt/objects.mk 2024-06-14 15:18:07.940339146 +0000 +@@ -4,7 +4,7 @@ + # Copyright (C) 2020 Bin Meng + # + +-libsbiutils-objs-$(CONFIG_FDT_DOMAIN) += fdt/fdt_domain.o +-libsbiutils-objs-$(CONFIG_FDT_PMU) += fdt/fdt_pmu.o +-libsbiutils-objs-$(CONFIG_FDT) += fdt/fdt_helper.o +-libsbiutils-objs-$(CONFIG_FDT) += fdt/fdt_fixup.o ++libsbiutils-objs-y += fdt/fdt_domain.o ++libsbiutils-objs-y += fdt/fdt_pmu.o ++libsbiutils-objs-y += fdt/fdt_helper.o ++libsbiutils-objs-y += fdt/fdt_fixup.o +diff -Naur opensbi/lib/utils/gpio/objects.mk ../opensbi/lib/utils/gpio/objects.mk +--- opensbi/lib/utils/gpio/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/gpio/objects.mk 2024-06-14 15:18:28.584805037 +0000 +@@ -7,13 +7,13 @@ + # Anup Patel + # + +-libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio.o +-libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio_drivers.o ++libsbiutils-objs-y += gpio/fdt_gpio.o ++libsbiutils-objs-y += gpio/fdt_gpio_drivers.o + +-carray-fdt_gpio_drivers-$(CONFIG_FDT_GPIO_SIFIVE) += fdt_gpio_sifive +-libsbiutils-objs-$(CONFIG_FDT_GPIO_SIFIVE) += gpio/fdt_gpio_sifive.o ++carray-fdt_gpio_drivers-y += fdt_gpio_sifive ++libsbiutils-objs-y += gpio/fdt_gpio_sifive.o + +-carray-fdt_gpio_drivers-$(CONFIG_FDT_GPIO_STARFIVE) += fdt_gpio_starfive +-libsbiutils-objs-$(CONFIG_FDT_GPIO_STARFIVE) += gpio/fdt_gpio_starfive.o ++carray-fdt_gpio_drivers-y += fdt_gpio_starfive ++libsbiutils-objs-y += gpio/fdt_gpio_starfive.o + +-libsbiutils-objs-$(CONFIG_GPIO) += gpio/gpio.o ++libsbiutils-objs-y += gpio/gpio.o +diff -Naur opensbi/lib/utils/i2c/objects.mk ../opensbi/lib/utils/i2c/objects.mk +--- opensbi/lib/utils/i2c/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/i2c/objects.mk 2024-06-14 15:18:50.077290660 +0000 +@@ -7,15 +7,15 @@ + # Nikita Shubin + # + +-libsbiutils-objs-$(CONFIG_I2C) += i2c/i2c.o ++libsbiutils-objs-y += i2c/i2c.o + +-libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c.o +-libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c_adapter_drivers.o ++libsbiutils-objs-y += i2c/fdt_i2c.o ++libsbiutils-objs-y += i2c/fdt_i2c_adapter_drivers.o + +-carray-fdt_i2c_adapter_drivers-$(CONFIG_FDT_I2C_SIFIVE) += fdt_i2c_adapter_sifive +-libsbiutils-objs-$(CONFIG_FDT_I2C_SIFIVE) += i2c/fdt_i2c_sifive.o ++carray-fdt_i2c_adapter_drivers-y += fdt_i2c_adapter_sifive ++libsbiutils-objs-y += i2c/fdt_i2c_sifive.o + +-carray-fdt_i2c_adapter_drivers-$(CONFIG_FDT_I2C_DW) += fdt_i2c_adapter_dw +-libsbiutils-objs-$(CONFIG_FDT_I2C_DW) += i2c/fdt_i2c_dw.o ++carray-fdt_i2c_adapter_drivers-y += fdt_i2c_adapter_dw ++libsbiutils-objs-y += i2c/fdt_i2c_dw.o + +-libsbiutils-objs-$(CONFIG_I2C_DW) += i2c/dw_i2c.o ++libsbiutils-objs-y += i2c/dw_i2c.o +diff -Naur opensbi/lib/utils/ipi/objects.mk ../opensbi/lib/utils/ipi/objects.mk +--- opensbi/lib/utils/ipi/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/ipi/objects.mk 2024-06-14 15:19:17.785917594 +0000 +@@ -7,14 +7,14 @@ + # Anup Patel + # + +-libsbiutils-objs-$(CONFIG_IPI_MSWI) += ipi/aclint_mswi.o +-libsbiutils-objs-$(CONFIG_IPI_PLICSW) += ipi/andes_plicsw.o ++libsbiutils-objs-y += ipi/aclint_mswi.o ++libsbiutils-objs-y += ipi/andes_plicsw.o + +-libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi.o +-libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi_drivers.o ++libsbiutils-objs-y += ipi/fdt_ipi.o ++libsbiutils-objs-y += ipi/fdt_ipi_drivers.o + +-carray-fdt_ipi_drivers-$(CONFIG_FDT_IPI_MSWI) += fdt_ipi_mswi +-libsbiutils-objs-$(CONFIG_FDT_IPI_MSWI) += ipi/fdt_ipi_mswi.o ++carray-fdt_ipi_drivers-y += fdt_ipi_mswi ++libsbiutils-objs-y += ipi/fdt_ipi_mswi.o + +-carray-fdt_ipi_drivers-$(CONFIG_FDT_IPI_PLICSW) += fdt_ipi_plicsw +-libsbiutils-objs-$(CONFIG_FDT_IPI_PLICSW) += ipi/fdt_ipi_plicsw.o ++carray-fdt_ipi_drivers-y += fdt_ipi_plicsw ++libsbiutils-objs-y += ipi/fdt_ipi_plicsw.o +diff -Naur opensbi/lib/utils/irqchip/objects.mk ../opensbi/lib/utils/irqchip/objects.mk +--- opensbi/lib/utils/irqchip/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/irqchip/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -7,18 +7,18 @@ + # Anup Patel + # + +-libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip.o +-libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip_drivers.o ++libsbiutils-objs-y += irqchip/fdt_irqchip.o ++libsbiutils-objs-y += irqchip/fdt_irqchip_drivers.o + +-carray-fdt_irqchip_drivers-$(CONFIG_FDT_IRQCHIP_APLIC) += fdt_irqchip_aplic +-libsbiutils-objs-$(CONFIG_FDT_IRQCHIP_APLIC) += irqchip/fdt_irqchip_aplic.o ++carray-fdt_irqchip_drivers-y += fdt_irqchip_aplic ++libsbiutils-objs-y += irqchip/fdt_irqchip_aplic.o + +-carray-fdt_irqchip_drivers-$(CONFIG_FDT_IRQCHIP_IMSIC) += fdt_irqchip_imsic +-libsbiutils-objs-$(CONFIG_FDT_IRQCHIP_IMSIC) += irqchip/fdt_irqchip_imsic.o ++carray-fdt_irqchip_drivers-y += fdt_irqchip_imsic ++libsbiutils-objs-y += irqchip/fdt_irqchip_imsic.o + +-carray-fdt_irqchip_drivers-$(CONFIG_FDT_IRQCHIP_PLIC) += fdt_irqchip_plic +-libsbiutils-objs-$(CONFIG_FDT_IRQCHIP_PLIC) += irqchip/fdt_irqchip_plic.o ++carray-fdt_irqchip_drivers-y += fdt_irqchip_plic ++libsbiutils-objs-y += irqchip/fdt_irqchip_plic.o + +-libsbiutils-objs-$(CONFIG_IRQCHIP_APLIC) += irqchip/aplic.o +-libsbiutils-objs-$(CONFIG_IRQCHIP_IMSIC) += irqchip/imsic.o +-libsbiutils-objs-$(CONFIG_IRQCHIP_PLIC) += irqchip/plic.o ++libsbiutils-objs-y += irqchip/aplic.o ++libsbiutils-objs-y += irqchip/imsic.o ++libsbiutils-objs-y += irqchip/plic.o +diff -Naur opensbi/lib/utils/Kconfig ../opensbi/lib/utils/Kconfig +--- opensbi/lib/utils/Kconfig 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/Kconfig 1970-01-01 00:00:00.000000000 +0000 +@@ -1,25 +0,0 @@ +-# SPDX-License-Identifier: BSD-2-Clause +- +-menu "Utils and Drivers Support" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/fdt/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/gpio/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/i2c/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/ipi/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/irqchip/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/libfdt/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/reset/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/serial/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/sys/Kconfig" +- +-source "$(OPENSBI_SRC_DIR)/lib/utils/timer/Kconfig" +- +-endmenu +diff -Naur opensbi/lib/utils/libfdt/objects.mk ../opensbi/lib/utils/libfdt/objects.mk +--- opensbi/lib/utils/libfdt/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/libfdt/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -12,5 +12,5 @@ + $(foreach file, $(libfdt_files), \ + $(eval CFLAGS_$(file) = -I$(src)/../../utils/libfdt)) + +-libsbiutils-objs-$(CONFIG_LIBFDT) += $(addprefix libfdt/,$(libfdt_files)) ++libsbiutils-objs-y += $(addprefix libfdt/,$(libfdt_files)) + libsbiutils-genflags-y += -I$(libsbiutils_dir)/libfdt/ +diff -Naur opensbi/lib/utils/reset/objects.mk ../opensbi/lib/utils/reset/objects.mk +--- opensbi/lib/utils/reset/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/reset/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -7,25 +7,25 @@ + # Anup Patel + # + +-libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset.o +-libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.o ++libsbiutils-objs-y += reset/fdt_reset.o ++libsbiutils-objs-y += reset/fdt_reset_drivers.o + +-carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_ATCWDT200) += fdt_reset_atcwdt200 +-libsbiutils-objs-$(CONFIG_FDT_RESET_ATCWDT200) += reset/fdt_reset_atcwdt200.o ++carray-fdt_reset_drivers-y += fdt_reset_atcwdt200 ++libsbiutils-objs-y += reset/fdt_reset_atcwdt200.o + +-carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_GPIO) += fdt_poweroff_gpio +-carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_GPIO) += fdt_reset_gpio +-libsbiutils-objs-$(CONFIG_FDT_RESET_GPIO) += reset/fdt_reset_gpio.o ++carray-fdt_reset_drivers-y += fdt_poweroff_gpio ++carray-fdt_reset_drivers-y += fdt_reset_gpio ++libsbiutils-objs-y += reset/fdt_reset_gpio.o + +-carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_HTIF) += fdt_reset_htif +-libsbiutils-objs-$(CONFIG_FDT_RESET_HTIF) += reset/fdt_reset_htif.o ++carray-fdt_reset_drivers-y += fdt_reset_htif ++libsbiutils-objs-y += reset/fdt_reset_htif.o + +-carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_SIFIVE_TEST) += fdt_reset_sifive_test +-libsbiutils-objs-$(CONFIG_FDT_RESET_SIFIVE_TEST) += reset/fdt_reset_sifive_test.o ++carray-fdt_reset_drivers-y += fdt_reset_sifive_test ++libsbiutils-objs-y += reset/fdt_reset_sifive_test.o + +-carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_SUNXI_WDT) += fdt_reset_sunxi_wdt +-libsbiutils-objs-$(CONFIG_FDT_RESET_SUNXI_WDT) += reset/fdt_reset_sunxi_wdt.o ++carray-fdt_reset_drivers-y += fdt_reset_sunxi_wdt ++libsbiutils-objs-y += reset/fdt_reset_sunxi_wdt.o + +-carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_THEAD) += fdt_reset_thead +-libsbiutils-objs-$(CONFIG_FDT_RESET_THEAD) += reset/fdt_reset_thead.o +-libsbiutils-objs-$(CONFIG_FDT_RESET_THEAD) += reset/fdt_reset_thead_asm.o ++carray-fdt_reset_drivers-y += fdt_reset_thead ++libsbiutils-objs-y += reset/fdt_reset_thead.o ++libsbiutils-objs-y += reset/fdt_reset_thead_asm.o +diff -Naur opensbi/lib/utils/serial/objects.mk ../opensbi/lib/utils/serial/objects.mk +--- opensbi/lib/utils/serial/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/serial/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -7,42 +7,42 @@ + # Anup Patel + # + +-libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial.o +-libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial_drivers.o ++libsbiutils-objs-y += serial/fdt_serial.o ++libsbiutils-objs-y += serial/fdt_serial_drivers.o + +-carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_CADENCE) += fdt_serial_cadence +-libsbiutils-objs-$(CONFIG_FDT_SERIAL_CADENCE) += serial/fdt_serial_cadence.o ++carray-fdt_serial_drivers-y += fdt_serial_cadence ++libsbiutils-objs-y += serial/fdt_serial_cadence.o + +-carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_GAISLER) += fdt_serial_gaisler +-libsbiutils-objs-$(CONFIG_FDT_SERIAL_GAISLER) += serial/fdt_serial_gaisler.o ++carray-fdt_serial_drivers-y += fdt_serial_gaisler ++libsbiutils-objs-y += serial/fdt_serial_gaisler.o + +-carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_HTIF) += fdt_serial_htif +-libsbiutils-objs-$(CONFIG_FDT_SERIAL_HTIF) += serial/fdt_serial_htif.o ++carray-fdt_serial_drivers-y += fdt_serial_htif ++libsbiutils-objs-y += serial/fdt_serial_htif.o + +-carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_RENESAS_SCIF) += fdt_serial_renesas_scif +-libsbiutils-objs-$(CONFIG_FDT_SERIAL_RENESAS_SCIF) += serial/fdt_serial_renesas_scif.o ++carray-fdt_serial_drivers-y += fdt_serial_renesas_scif ++libsbiutils-objs-y += serial/fdt_serial_renesas_scif.o + +-carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_SHAKTI) += fdt_serial_shakti +-libsbiutils-objs-$(CONFIG_FDT_SERIAL_SHAKTI) += serial/fdt_serial_shakti.o ++carray-fdt_serial_drivers-y += fdt_serial_shakti ++libsbiutils-objs-y += serial/fdt_serial_shakti.o + +-carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_SIFIVE) += fdt_serial_sifive +-libsbiutils-objs-$(CONFIG_FDT_SERIAL_SIFIVE) += serial/fdt_serial_sifive.o ++carray-fdt_serial_drivers-y += fdt_serial_sifive ++libsbiutils-objs-y += serial/fdt_serial_sifive.o + +-carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_LITEX) += fdt_serial_litex +-libsbiutils-objs-$(CONFIG_FDT_SERIAL_LITEX) += serial/fdt_serial_litex.o ++carray-fdt_serial_drivers-y += fdt_serial_litex ++libsbiutils-objs-y += serial/fdt_serial_litex.o + +-carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_UART8250) += fdt_serial_uart8250 +-libsbiutils-objs-$(CONFIG_FDT_SERIAL_UART8250) += serial/fdt_serial_uart8250.o ++carray-fdt_serial_drivers-y += fdt_serial_uart8250 ++libsbiutils-objs-y += serial/fdt_serial_uart8250.o + +-carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_XILINX_UARTLITE) += fdt_serial_xlnx_uartlite +-libsbiutils-objs-$(CONFIG_FDT_SERIAL_XILINX_UARTLITE) += serial/fdt_serial_xlnx_uartlite.o ++carray-fdt_serial_drivers-y += fdt_serial_xlnx_uartlite ++libsbiutils-objs-y += serial/fdt_serial_xlnx_uartlite.o + +-libsbiutils-objs-$(CONFIG_SERIAL_CADENCE) += serial/cadence-uart.o +-libsbiutils-objs-$(CONFIG_SERIAL_GAISLER) += serial/gaisler-uart.o +-libsbiutils-objs-$(CONFIG_SERIAL_RENESAS_SCIF) += serial/renesas_scif.o +-libsbiutils-objs-$(CONFIG_SERIAL_SHAKTI) += serial/shakti-uart.o +-libsbiutils-objs-$(CONFIG_SERIAL_SIFIVE) += serial/sifive-uart.o +-libsbiutils-objs-$(CONFIG_SERIAL_LITEX) += serial/litex-uart.o +-libsbiutils-objs-$(CONFIG_SERIAL_UART8250) += serial/uart8250.o +-libsbiutils-objs-$(CONFIG_SERIAL_XILINX_UARTLITE) += serial/xlnx-uartlite.o +-libsbiutils-objs-$(CONFIG_SERIAL_SEMIHOSTING) += serial/semihosting.o ++libsbiutils-objs-y += serial/cadence-uart.o ++libsbiutils-objs-y += serial/gaisler-uart.o ++libsbiutils-objs-y += serial/renesas_scif.o ++libsbiutils-objs-y += serial/shakti-uart.o ++libsbiutils-objs-y += serial/sifive-uart.o ++libsbiutils-objs-y += serial/litex-uart.o ++libsbiutils-objs-y += serial/uart8250.o ++libsbiutils-objs-y += serial/xlnx-uartlite.o ++libsbiutils-objs-y += serial/semihosting.o +diff -Naur opensbi/lib/utils/sys/objects.mk ../opensbi/lib/utils/sys/objects.mk +--- opensbi/lib/utils/sys/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/sys/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -7,6 +7,6 @@ + # Anup Patel + # + +-libsbiutils-objs-$(CONFIG_SYS_HTIF) += sys/htif.o +-libsbiutils-objs-$(CONFIG_SYS_SIFIVE_TEST) += sys/sifive_test.o +-libsbiutils-objs-$(CONFIG_SYS_ATCSMU) += sys/atcsmu.o ++libsbiutils-objs-y += sys/htif.o ++libsbiutils-objs-y += sys/sifive_test.o ++libsbiutils-objs-y += sys/atcsmu.o +diff -Naur opensbi/lib/utils/timer/objects.mk ../opensbi/lib/utils/timer/objects.mk +--- opensbi/lib/utils/timer/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/lib/utils/timer/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -7,14 +7,14 @@ + # Anup Patel + # + +-libsbiutils-objs-$(CONFIG_TIMER_MTIMER) += timer/aclint_mtimer.o +-libsbiutils-objs-$(CONFIG_TIMER_PLMT) += timer/andes_plmt.o ++libsbiutils-objs-y += timer/aclint_mtimer.o ++libsbiutils-objs-y += timer/andes_plmt.o + +-libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer.o +-libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer_drivers.o ++libsbiutils-objs-y += timer/fdt_timer.o ++libsbiutils-objs-y += timer/fdt_timer_drivers.o + +-carray-fdt_timer_drivers-$(CONFIG_FDT_TIMER_MTIMER) += fdt_timer_mtimer +-libsbiutils-objs-$(CONFIG_FDT_TIMER_MTIMER) += timer/fdt_timer_mtimer.o ++carray-fdt_timer_drivers-y += fdt_timer_mtimer ++libsbiutils-objs-y += timer/fdt_timer_mtimer.o + +-carray-fdt_timer_drivers-$(CONFIG_FDT_TIMER_PLMT) += fdt_timer_plmt +-libsbiutils-objs-$(CONFIG_FDT_TIMER_PLMT) += timer/fdt_timer_plmt.o ++carray-fdt_timer_drivers-y += fdt_timer_plmt ++libsbiutils-objs-y += timer/fdt_timer_plmt.o +diff -Naur opensbi/Makefile ../opensbi/Makefile +--- opensbi/Makefile 2024-06-14 14:50:11.653732185 +0000 ++++ ../opensbi/Makefile 2024-06-14 15:01:44.909955082 +0000 +@@ -6,19 +6,16 @@ + # Authors: + # Anup Patel + # +- + # Select Make Options: + # o Do not use make's built-in rules + # o Do not print "Entering directory ..."; + MAKEFLAGS += -r --no-print-directory +- + # Readlink -f requires GNU readlink + ifeq ($(shell uname -s),Darwin) + READLINK ?= greadlink + else + READLINK ?= readlink + endif +- + # Find out source, build, and install directories + src_dir=$(CURDIR) + ifdef O +@@ -47,14 +44,11 @@ + platform_parent_dir=$(platform_dir_path) + else + PLATFORM=$(shell basename $(platform_dir_path)) +- platform_parent_dir=$(shell realpath ${platform_dir_path}/..) ++ platform_parent_dir=$(subst $(PLATFORM),,$(platform_dir_path)) + endif + else + platform_parent_dir=$(src_dir)/platform + endif +-ifndef PLATFORM_DEFCONFIG +-PLATFORM_DEFCONFIG=defconfig +-endif + + # Check if verbosity is ON for build process + CMD_PREFIX_DEFAULT := @ +@@ -73,20 +67,6 @@ + export libsbiutils_dir=$(CURDIR)/lib/utils + export firmware_dir=$(CURDIR)/firmware + +-# Setup variables for kconfig +-ifdef PLATFORM +-export PYTHONDONTWRITEBYTECODE=1 +-export KCONFIG_DIR=$(platform_build_dir)/kconfig +-export KCONFIG_AUTOLIST=$(KCONFIG_DIR)/auto.list +-export KCONFIG_AUTOHEADER=$(KCONFIG_DIR)/autoconf.h +-export KCONFIG_AUTOCMD=$(KCONFIG_DIR)/auto.conf.cmd +-export KCONFIG_CONFIG=$(KCONFIG_DIR)/.config +-# Additional exports for include paths in Kconfig files +-export OPENSBI_SRC_DIR=$(src_dir) +-export OPENSBI_PLATFORM=$(PLATFORM) +-export OPENSBI_PLATFORM_SRC_DIR=$(platform_src_dir) +-endif +- + # Find library version + OPENSBI_VERSION_MAJOR=`grep "define OPENSBI_VERSION_MAJOR" $(include_dir)/sbi/sbi_version.h | sed 's/.*MAJOR.*\([0-9][0-9]*\)/\1/'` + OPENSBI_VERSION_MINOR=`grep "define OPENSBI_VERSION_MINOR" $(include_dir)/sbi/sbi_version.h | sed 's/.*MINOR.*\([0-9][0-9]*\)/\1/'` +@@ -200,35 +180,9 @@ + libsbiutils-object-mks=$(shell if [ -d $(libsbiutils_dir) ]; then find $(libsbiutils_dir) -iname "objects.mk" | sort -r; fi) + firmware-object-mks=$(shell if [ -d $(firmware_dir) ]; then find $(firmware_dir) -iname "objects.mk" | sort -r; fi) + +-# The "make all" rule should always be first rule +-.PHONY: all +-all: + +-# Include platform specific .config + ifdef PLATFORM +-.PHONY: menuconfig +-menuconfig: $(platform_src_dir)/Kconfig $(src_dir)/Kconfig +- $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) +- $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/menuconfig.py $(src_dir)/Kconfig +- $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/genconfig.py --header-path $(KCONFIG_AUTOHEADER) --sync-deps $(KCONFIG_DIR) --file-list $(KCONFIG_AUTOLIST) $(src_dir)/Kconfig +- +-.PHONY: savedefconfig +-savedefconfig: $(platform_src_dir)/Kconfig $(src_dir)/Kconfig +- $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) +- $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/savedefconfig.py --kconfig $(src_dir)/Kconfig --out $(KCONFIG_DIR)/defconfig +- +-$(KCONFIG_CONFIG): $(platform_src_dir)/configs/$(PLATFORM_DEFCONFIG) $(platform_src_dir)/Kconfig $(src_dir)/Kconfig +- $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) +- $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/defconfig.py --kconfig $(src_dir)/Kconfig $(platform_src_dir)/configs/$(PLATFORM_DEFCONFIG) +- $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/genconfig.py --header-path $(KCONFIG_AUTOHEADER) --sync-deps $(KCONFIG_DIR) --file-list $(KCONFIG_AUTOLIST) $(src_dir)/Kconfig +- +-$(KCONFIG_AUTOCMD): $(KCONFIG_CONFIG) +- $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) +- $(CMD_PREFIX)printf "%s: " $(KCONFIG_CONFIG) > $(KCONFIG_AUTOCMD) +- $(CMD_PREFIX)cat $(KCONFIG_AUTOLIST) | tr '\n' ' ' >> $(KCONFIG_AUTOCMD) +- +-include $(KCONFIG_CONFIG) +-include $(KCONFIG_AUTOCMD) ++include $(platform_src_dir)/config.mk + endif + + # Include all objects.mk files +@@ -324,9 +278,6 @@ + GENFLAGS += -DOPENSBI_BUILD_TIME_STAMP="\"$(OPENSBI_BUILD_TIME_STAMP)\"" + GENFLAGS += -DOPENSBI_BUILD_COMPILER_VERSION="\"$(OPENSBI_BUILD_COMPILER_VERSION)\"" + endif +-ifdef PLATFORM +-GENFLAGS += -include $(KCONFIG_AUTOHEADER) +-endif + GENFLAGS += $(libsbiutils-genflags-y) + GENFLAGS += $(platform-genflags-y) + GENFLAGS += $(firmware-genflags-y) +@@ -489,14 +440,14 @@ + $(platform_build_dir)/lib/libplatsbi.a: $(libsbi-objs-path-y) $(libsbiutils-objs-path-y) $(platform-objs-path-y) + $(call compile_ar,$@,$^) + +-$(build_dir)/%.dep: $(src_dir)/%.carray $(KCONFIG_CONFIG) +- $(call compile_gen_dep,$@,.c,$< $(KCONFIG_CONFIG)) ++$(build_dir)/%.dep: $(src_dir)/%.carray ++ $(call compile_gen_dep,$@,.c,$<) + $(call compile_gen_dep,$@,.o,$(@:.dep=.c)) + + $(build_dir)/%.c: $(src_dir)/%.carray + $(call compile_carray,$@,$<) + +-$(build_dir)/%.dep: $(src_dir)/%.c $(KCONFIG_CONFIG) ++$(build_dir)/%.dep: $(src_dir)/%.c + $(call compile_cc_dep,$@,$<) + + $(build_dir)/%.o: $(src_dir)/%.c +@@ -510,24 +461,24 @@ + $(call compile_cc,$@,$<) + endif + +-$(build_dir)/%.dep: $(src_dir)/%.S $(KCONFIG_CONFIG) ++$(build_dir)/%.dep: $(src_dir)/%.S + $(call compile_as_dep,$@,$<) + + $(build_dir)/%.o: $(src_dir)/%.S + $(call compile_as,$@,$<) + + # Rules for platform sources +-$(platform_build_dir)/%.dep: $(platform_src_dir)/%.carray $(KCONFIG_CONFIG) +- $(call compile_gen_dep,$@,.c,$< $(KCONFIG_CONFIG)) ++$(platform_build_dir)/%.dep: $(platform_src_dir)/%.carray ++ $(call compile_gen_dep,$@,.c,$<) + $(call compile_gen_dep,$@,.o,$(@:.dep=.c)) + + $(platform_build_dir)/%.c: $(platform_src_dir)/%.carray + $(call compile_carray,$@,$<) + +-$(platform_build_dir)/%.dep: $(platform_src_dir)/%.c $(KCONFIG_CONFIG) ++$(platform_build_dir)/%.dep: $(platform_src_dir)/%.c + $(call compile_cc_dep,$@,$<) + +-$(platform_build_dir)/%.o: $(platform_src_dir)/%.c $(KCONFIG_CONFIG) ++$(platform_build_dir)/%.o: $(platform_src_dir)/%.c + $(call compile_cc,$@,$<) + + $(platform_build_dir)/%.dep: $(platform_src_dir)/%.S +@@ -536,8 +487,8 @@ + $(platform_build_dir)/%.o: $(platform_src_dir)/%.S + $(call compile_as,$@,$<) + +-$(platform_build_dir)/%.dep: $(platform_src_dir)/%.dts $(KCONFIG_CONFIG) +- $(call compile_gen_dep,$@,.dtb,$< $(KCONFIG_CONFIG)) ++$(platform_build_dir)/%.dep: $(platform_src_dir)/%.dts ++ $(call compile_gen_dep,$@,.dtb,$<) + $(call compile_gen_dep,$@,.c,$(@:.dep=.dtb)) + $(call compile_gen_dep,$@,.o,$(@:.dep=.c)) + +@@ -554,26 +505,26 @@ + $(platform_build_dir)/%.elf: $(platform_build_dir)/%.o $(platform_build_dir)/%.elf.ld $(platform_build_dir)/lib/libplatsbi.a + $(call compile_elf,$@,$@.ld,$< $(platform_build_dir)/lib/libplatsbi.a) + +-$(platform_build_dir)/%.dep: $(src_dir)/%.ldS $(KCONFIG_CONFIG) ++$(platform_build_dir)/%.dep: $(src_dir)/%.ldS + $(call compile_cpp_dep,$@,.ld,$<) + + $(platform_build_dir)/%.ld: $(src_dir)/%.ldS + $(call compile_cpp,$@,$<) + +-$(platform_build_dir)/%.dep: $(src_dir)/%.carray $(KCONFIG_CONFIG) +- $(call compile_gen_dep,$@,.c,$< $(KCONFIG_CONFIG)) ++$(platform_build_dir)/%.dep: $(src_dir)/%.carray ++ $(call compile_gen_dep,$@,.c,$<) + $(call compile_gen_dep,$@,.o,$(@:.dep=.c)) + + $(platform_build_dir)/%.c: $(src_dir)/%.carray + $(call compile_carray,$@,$<) + +-$(platform_build_dir)/%.dep: $(src_dir)/%.c $(KCONFIG_CONFIG) ++$(platform_build_dir)/%.dep: $(src_dir)/%.c + $(call compile_cc_dep,$@,$<) + + $(platform_build_dir)/%.o: $(src_dir)/%.c + $(call compile_cc,$@,$<) + +-$(platform_build_dir)/%.dep: $(src_dir)/%.S $(KCONFIG_CONFIG) ++$(platform_build_dir)/%.dep: $(src_dir)/%.S + $(call compile_as_dep,$@,$<) + + $(platform_build_dir)/%.o: $(src_dir)/%.S +diff -Naur opensbi/platform/generic/allwinner/objects.mk ../opensbi/platform/generic/allwinner/objects.mk +--- opensbi/platform/generic/allwinner/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/platform/generic/allwinner/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -2,5 +2,5 @@ + # SPDX-License-Identifier: BSD-2-Clause + # + +-carray-platform_override_modules-$(CONFIG_PLATFORM_ALLWINNER_D1) += sun20i_d1 +-platform-objs-$(CONFIG_PLATFORM_ALLWINNER_D1) += allwinner/sun20i-d1.o ++carray-platform_override_modules-y += sun20i_d1 ++platform-objs-y += allwinner/sun20i-d1.o +diff -Naur opensbi/platform/generic/andes/objects.mk ../opensbi/platform/generic/andes/objects.mk +--- opensbi/platform/generic/andes/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/platform/generic/andes/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -2,7 +2,7 @@ + # SPDX-License-Identifier: BSD-2-Clause + # + +-carray-platform_override_modules-$(CONFIG_PLATFORM_ANDES_AE350) += andes_ae350 +-platform-objs-$(CONFIG_PLATFORM_ANDES_AE350) += andes/ae350.o andes/sleep.o ++carray-platform_override_modules-y += andes_ae350 ++platform-objs-y += andes/ae350.o andes/sleep.o + +-platform-objs-$(CONFIG_ANDES45_PMA) += andes/andes45-pma.o ++platform-objs-y += andes/andes45-pma.o +diff -Naur opensbi/platform/generic/configs/defconfig ../opensbi/platform/generic/configs/defconfig +--- opensbi/platform/generic/configs/defconfig 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/platform/generic/configs/defconfig 1970-01-01 00:00:00.000000000 +0000 +@@ -1,40 +0,0 @@ +-CONFIG_PLATFORM_ALLWINNER_D1=y +-CONFIG_PLATFORM_ANDES_AE350=y +-CONFIG_PLATFORM_RENESAS_RZFIVE=y +-CONFIG_PLATFORM_SIFIVE_FU540=y +-CONFIG_PLATFORM_SIFIVE_FU740=y +-CONFIG_PLATFORM_STARFIVE_JH7110=y +-CONFIG_FDT_GPIO=y +-CONFIG_FDT_GPIO_SIFIVE=y +-CONFIG_FDT_GPIO_STARFIVE=y +-CONFIG_FDT_I2C=y +-CONFIG_FDT_I2C_SIFIVE=y +-CONFIG_FDT_I2C_DW=y +-CONFIG_FDT_IPI=y +-CONFIG_FDT_IPI_MSWI=y +-CONFIG_FDT_IPI_PLICSW=y +-CONFIG_FDT_IRQCHIP=y +-CONFIG_FDT_IRQCHIP_APLIC=y +-CONFIG_FDT_IRQCHIP_IMSIC=y +-CONFIG_FDT_IRQCHIP_PLIC=y +-CONFIG_FDT_RESET=y +-CONFIG_FDT_RESET_ATCWDT200=y +-CONFIG_FDT_RESET_GPIO=y +-CONFIG_FDT_RESET_HTIF=y +-CONFIG_FDT_RESET_SIFIVE_TEST=y +-CONFIG_FDT_RESET_SUNXI_WDT=y +-CONFIG_FDT_RESET_THEAD=y +-CONFIG_FDT_SERIAL=y +-CONFIG_FDT_SERIAL_CADENCE=y +-CONFIG_FDT_SERIAL_GAISLER=y +-CONFIG_FDT_SERIAL_HTIF=y +-CONFIG_FDT_SERIAL_RENESAS_SCIF=y +-CONFIG_FDT_SERIAL_SHAKTI=y +-CONFIG_FDT_SERIAL_SIFIVE=y +-CONFIG_FDT_SERIAL_LITEX=y +-CONFIG_FDT_SERIAL_UART8250=y +-CONFIG_FDT_SERIAL_XILINX_UARTLITE=y +-CONFIG_FDT_TIMER=y +-CONFIG_FDT_TIMER_MTIMER=y +-CONFIG_FDT_TIMER_PLMT=y +-CONFIG_SERIAL_SEMIHOSTING=y +diff -Naur opensbi/platform/generic/Kconfig ../opensbi/platform/generic/Kconfig +--- opensbi/platform/generic/Kconfig 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/platform/generic/Kconfig 1970-01-01 00:00:00.000000000 +0000 +@@ -1,56 +0,0 @@ +-# SPDX-License-Identifier: BSD-2-Clause +- +-config PLATFORM_GENERIC +- bool +- select FDT +- select FDT_DOMAIN +- select FDT_PMU +- default y +- +-if PLATFORM_GENERIC +- +-config PLATFORM_GENERIC_NAME +- string "Platform default name" +- default "Generic" +- +-config PLATFORM_GENERIC_MAJOR_VER +- int "Platform major version" +- range 0 65535 +- default 0 +- +-config PLATFORM_GENERIC_MINOR_VER +- int "Platform minor version" +- range 0 65535 +- default 1 +- +-config PLATFORM_ALLWINNER_D1 +- bool "Allwinner D1 support" +- depends on FDT_IRQCHIP_PLIC +- default n +- +-config PLATFORM_ANDES_AE350 +- bool "Andes AE350 support" +- select SYS_ATCSMU +- default n +- +-config PLATFORM_RENESAS_RZFIVE +- bool "Renesas RZ/Five support" +- select ANDES45_PMA +- default n +- +-config PLATFORM_SIFIVE_FU540 +- bool "SiFive FU540 support" +- default n +- +-config PLATFORM_SIFIVE_FU740 +- bool "SiFive FU740 support" +- depends on FDT_RESET && FDT_I2C +- default n +- +-config PLATFORM_STARFIVE_JH7110 +- bool "StarFive JH7110 support" +- default n +- +-source "$(OPENSBI_SRC_DIR)/platform/generic/andes/Kconfig" +- +-endif +diff -Naur opensbi/platform/generic/objects.mk ../opensbi/platform/generic/objects.mk +--- opensbi/platform/generic/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/platform/generic/objects.mk 2024-06-14 16:49:10.847765389 +0000 +@@ -22,7 +22,9 @@ + platform-objs-y += platform_override_modules.o + + # Blobs to build +-FW_TEXT_START=0x80000000 ++#FW_TEXT_START=0x80000000 ++# Needs to be changed for Starfive ++FW_TEXT_START=0x40000000 + FW_DYNAMIC=y + FW_JUMP=y + ifeq ($(PLATFORM_RISCV_XLEN), 32) +diff -Naur opensbi/platform/generic/platform.c ../opensbi/platform/generic/platform.c +--- opensbi/platform/generic/platform.c 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/platform/generic/platform.c 2024-06-14 17:37:45.480098837 +0000 +@@ -308,9 +308,8 @@ + struct sbi_platform platform = { + .opensbi_version = OPENSBI_VERSION, + .platform_version = +- SBI_PLATFORM_VERSION(CONFIG_PLATFORM_GENERIC_MAJOR_VER, +- CONFIG_PLATFORM_GENERIC_MINOR_VER), +- .name = CONFIG_PLATFORM_GENERIC_NAME, ++ SBI_PLATFORM_VERSION(0,1), ++ .name = "Generic", + .features = SBI_PLATFORM_DEFAULT_FEATURES, + .hart_count = SBI_HARTMASK_MAX_BITS, + .hart_index2id = generic_hart_index2id, +diff -Naur opensbi/platform/generic/renesas/rzfive/objects.mk ../opensbi/platform/generic/renesas/rzfive/objects.mk +--- opensbi/platform/generic/renesas/rzfive/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/platform/generic/renesas/rzfive/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -4,5 +4,5 @@ + # Copyright (C) 2022 Renesas Electronics Corp. + # + +-carray-platform_override_modules-$(CONFIG_PLATFORM_RENESAS_RZFIVE) += renesas_rzfive +-platform-objs-$(CONFIG_PLATFORM_RENESAS_RZFIVE) += renesas/rzfive/rzfive.o ++carray-platform_override_modules-y += renesas_rzfive ++platform-objs-y += renesas/rzfive/rzfive.o +diff -Naur opensbi/platform/generic/sifive/objects.mk ../opensbi/platform/generic/sifive/objects.mk +--- opensbi/platform/generic/sifive/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/platform/generic/sifive/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -2,8 +2,8 @@ + # SPDX-License-Identifier: BSD-2-Clause + # + +-carray-platform_override_modules-$(CONFIG_PLATFORM_SIFIVE_FU540) += sifive_fu540 +-platform-objs-$(CONFIG_PLATFORM_SIFIVE_FU540) += sifive/fu540.o ++carray-platform_override_modules-y += sifive_fu540 ++platform-objs-y += sifive/fu540.o + +-carray-platform_override_modules-$(CONFIG_PLATFORM_SIFIVE_FU740) += sifive_fu740 +-platform-objs-$(CONFIG_PLATFORM_SIFIVE_FU740) += sifive/fu740.o ++carray-platform_override_modules-y += sifive_fu740 ++platform-objs-y += sifive/fu740.o +diff -Naur opensbi/platform/generic/starfive/objects.mk ../opensbi/platform/generic/starfive/objects.mk +--- opensbi/platform/generic/starfive/objects.mk 2024-06-14 14:50:11.657732278 +0000 ++++ ../opensbi/platform/generic/starfive/objects.mk 2024-06-14 15:20:30.915576500 +0000 +@@ -2,5 +2,5 @@ + # SPDX-License-Identifier: BSD-2-Clause + # + +-carray-platform_override_modules-$(CONFIG_PLATFORM_STARFIVE_JH7110) += starfive_jh7110 +-platform-objs-$(CONFIG_PLATFORM_STARFIVE_JH7110) += starfive/jh7110.o ++carray-platform_override_modules-y += starfive_jh7110 ++platform-objs-y += starfive/jh7110.o diff --git a/overlays/keystone/board/starfive/visionfive2/post-build.sh b/overlays/keystone/board/starfive/visionfive2/post-build.sh new file mode 100755 index 000000000..0de214f96 --- /dev/null +++ b/overlays/keystone/board/starfive/visionfive2/post-build.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Copy extlinux config +mkdir -p $TARGET_DIR/boot/extlinux +cp $BR2_EXTERNAL_KEYSTONE_PATH/board/starfive/visionfive2/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.conf + +# Configure network interfaces +cp $BR2_EXTERNAL_KEYSTONE_PATH/board/starfive/visionfive2/10-end0.network $TARGET_DIR/etc/systemd/network/10-end0.network +cp $BR2_EXTERNAL_KEYSTONE_PATH/board/starfive/visionfive2/20-end1.network $TARGET_DIR/etc/systemd/network/20-end1.network + +# Copy sshd config to enable ssh root login, password is "starfive" +cp $BR2_EXTERNAL_KEYSTONE_PATH/board/starfive/visionfive2/sshd_config $TARGET_DIR/etc/ssh/sshd_config diff --git a/overlays/keystone/board/starfive/visionfive2/sshd_config b/overlays/keystone/board/starfive/visionfive2/sshd_config new file mode 100644 index 000000000..951964e9f --- /dev/null +++ b/overlays/keystone/board/starfive/visionfive2/sshd_config @@ -0,0 +1,116 @@ +# $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $ + +# This is the sshd server system-wide configuration file. See +# sshd_config(5) for more information. + +# This sshd was compiled with PATH=/usr/bin:/usr/sbin + +# The strategy used for options in the default sshd_config shipped with +# OpenSSH is to specify options with their default value where +# possible, but leave them commented. Uncommented options override the +# default value. + +#Port 22 +#AddressFamily any +#ListenAddress 0.0.0.0 +#ListenAddress :: + +#HostKey /etc/ssh/ssh_host_rsa_key +#HostKey /etc/ssh/ssh_host_ecdsa_key +#HostKey /etc/ssh/ssh_host_ed25519_key + +# Ciphers and keying +#RekeyLimit default none + +# Logging +#SyslogFacility AUTH +#LogLevel INFO + +# Authentication: + +#LoginGraceTime 2m +PermitRootLogin yes +#StrictModes yes +#MaxAuthTries 6 +#MaxSessions 10 + +#PubkeyAuthentication yes + +# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 +# but this is overridden so installations will only check .ssh/authorized_keys +AuthorizedKeysFile .ssh/authorized_keys + +#AuthorizedPrincipalsFile none + +#AuthorizedKeysCommand none +#AuthorizedKeysCommandUser nobody + +# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts +#HostbasedAuthentication no +# Change to yes if you don't trust ~/.ssh/known_hosts for +# HostbasedAuthentication +#IgnoreUserKnownHosts no +# Don't read the user's ~/.rhosts and ~/.shosts files +#IgnoreRhosts yes + +# To disable tunneled clear text passwords, change to no here! +#PasswordAuthentication yes +#PermitEmptyPasswords no + +# Change to no to disable s/key passwords +#KbdInteractiveAuthentication yes + +# Kerberos options +#KerberosAuthentication no +#KerberosOrLocalPasswd yes +#KerberosTicketCleanup yes +#KerberosGetAFSToken no + +# GSSAPI options +#GSSAPIAuthentication no +#GSSAPICleanupCredentials yes + +# Set this to 'yes' to enable PAM authentication, account processing, +# and session processing. If this is enabled, PAM authentication will +# be allowed through the KbdInteractiveAuthentication and +# PasswordAuthentication. Depending on your PAM configuration, +# PAM authentication via KbdInteractiveAuthentication may bypass +# the setting of "PermitRootLogin prohibit-password". +# If you just want the PAM account and session checks to run without +# PAM authentication, then enable this but set PasswordAuthentication +# and KbdInteractiveAuthentication to 'no'. +#UsePAM no + +#AllowAgentForwarding yes +#AllowTcpForwarding yes +#GatewayPorts no +#X11Forwarding no +#X11DisplayOffset 10 +#X11UseLocalhost yes +#PermitTTY yes +#PrintMotd yes +#PrintLastLog yes +#TCPKeepAlive yes +#PermitUserEnvironment no +#Compression delayed +#ClientAliveInterval 0 +#ClientAliveCountMax 3 +#UseDNS no +#PidFile /var/run/sshd.pid +#MaxStartups 10:30:100 +#PermitTunnel no +#ChrootDirectory none +#VersionAddendum none + +# no default banner path +#Banner none + +# override default of no subsystems +Subsystem sftp /usr/libexec/sftp-server + +# Example of overriding settings on a per-user basis +#Match User anoncvs +# X11Forwarding no +# AllowTcpForwarding no +# PermitTTY no +# ForceCommand cvs server diff --git a/overlays/keystone/configs/riscv64_starfive_visionfive2_defconfig b/overlays/keystone/configs/riscv64_starfive_visionfive2_defconfig new file mode 100644 index 000000000..4cf04b5c5 --- /dev/null +++ b/overlays/keystone/configs/riscv64_starfive_visionfive2_defconfig @@ -0,0 +1,109 @@ +# Shortened and adjusted VF2 defconfig, normal version is located here: +# https://github.com/starfive-tech/VisionFive2/blob/JH7110_VisionFive2_devel/conf/buildroot_rootfs_config +BR2_riscv=y +BR2_TOOLCHAIN_BUILDROOT_CXX=y +BR2_PACKAGE_GLIBC_UTILS=y +BR2_STRIP_EXCLUDE_FILES="ipa_starfive.so* libcamera-base.so* libcamera.so* libgstlibcamera.so v4l2-compat.so starfive_ipa_proxy" +BR2_BINUTILS_VERSION_2_39_X=y +BR2_GCC_VERSION_11_X=y +BR2_CCACHE=y +BR2_SSP_NONE=y +BR2_CCACHE_INITIAL_SETUP="-M0 -F0" +BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_KEYSTONE_PATH)/board/starfive/visionfive2/patches" +BR2_PER_PACKAGE_DIRECTORIES=y +BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y +BR2_GCC_ENABLE_LTO=y +BR2_GCC_ENABLE_OPENMP=y +BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY=y +BR2_INIT_SYSV=y +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y +BR2_TARGET_GENERIC_HOSTNAME="keystone" +BR2_TARGET_GENERIC_ROOT_PASSWD="starfive" +BR2_SYSTEM_DHCP="end0" +BR2_SYSTEM_DHCP_DUAL="end1" +BR2_INIT_SYSTEMD=y +BR2_SYSTEM_BIN_SH_BASH=y +BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_KEYSTONE_PATH)/board/starfive/visionfive2/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BR2_EXTERNAL_KEYSTONE_PATH)/board/starfive/visionfive2/genimage_sdcard.cfg" + +# Linux kernel configuration +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.7" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_KEYSTONE_PATH)/board/starfive/visionfive2/linux-starfive-visionfive2-defconfig" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="starfive/jh7110-starfive-visionfive-2-v1.3b" +BR2_LINUX_KERNEL_INSTALL_TARGET=y + + +# Root filesystem +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +BR2_TARGET_ROOTFS_EXT2_SIZE="500M" + +# U-Boot and OpenSBI configuration +BR2_TARGET_OPENSBI=y +BR2_TARGET_OPENSBI_CUSTOM_GIT=y +BR2_TARGET_OPENSBI_CUSTOM_REPO_URL="https://github.com/starfive-tech/opensbi.git" +BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION="JH7110_VisionFive2_devel" +BR2_TARGET_OPENSBI_PLAT="generic" +BR2_TARGET_OPENSBI_ADDITIONAL_VARIABLES="FW_TEXT_START=0x40000000" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.04" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="starfive_visionfive2" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y +BR2_TARGET_UBOOT_NEEDS_OPENSBI=y +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin.normal.out" +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_TARGET_KEYSTONE_SM=y +BR2_PACKAGE_KEYSTONE_DRIVER=y +BR2_PACKAGE_HOST_KEYSTONE_SDK=y +BR2_PACKAGE_KEYSTONE_RUNTIME=y +BR2_PACKAGE_KEYSTONE_EXAMPLES=y + +# Packages +BR2_PACKAGE_OPENSSH=y +BR2_PACKAGE_PYTHON3=y +BR2_PACKAGE_PYTHON3_PIP=y +BR2_PACKAGE_APT=y +BR2_PACKAGE_OPKG=y +BR2_PACKAGE_DPKG=y +BR2_PACKAGE_LIBSSL=y +BR2_PACKAGE_LIBCURL=y +BR2_PACKAGE_LIBCURL_CURL=y +BR2_PACKAGE_LIBOPENSSL=y +BR2_PACKAGE_LIBOPENSSL_BIN=y +BR2_PACKAGE_WGET=y +BR2_PACKAGE_NANO=y +BR2_PACKAGE_HOST_GENEXT2FS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_GPTFDISK=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_STFISP_SETFILE=y +BR2_PACKAGE_BASH=y +# BR2_PACKAGE_DHCP=y +# BR2_PACKAGE_DHCP_SERVER=y +# BR2_PACKAGE_DHCP_SERVER_DELAYED_ACK=y +BR2_PACKAGE_ETHTOOL=y +BR2_PACKAGE_IPROUTE2=y +BR2_PACKAGE_IPTABLES=y +BR2_PACKAGE_IPTABLES_NFTABLES=y +BR2_PACKAGE_IPUTILS=y +BR2_PACKAGE_LINUX_FIRMWARE=y +BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_AX210=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_8169=y +BR2_PACKAGE_DTC=y +BR2_PACKAGE_DTC_PROGRAMS=y +BR2_PACKAGE_HOST_GDB=y +BR2_PACKAGE_HOST_GDB_TUI=y +BR2_PACKAGE_HOST_GDB_PYTHON3=y +BR2_PACKAGE_HOST_GDB_SIM=y \ No newline at end of file diff --git a/sm/plat/generic/config.mk b/sm/plat/generic/config.mk index 5c97a1e79..7549979f1 100644 --- a/sm/plat/generic/config.mk +++ b/sm/plat/generic/config.mk @@ -1,5 +1,9 @@ # Here, we just include the config.mk from the standard generic implementation +# No longer supported in newer OpenSBI versions +# For now, only include this file for other platforms than VF2 +ifneq ($(KEYSTONE_PLATFORM),starfive/visionfive2) include $(src_dir)/platform/$(PLATFORM)/config.mk +endif # We do need to make sure to include headers for the SM ifeq ($(KEYSTONE_SM),) diff --git a/sm/plat/generic/objects.mk b/sm/plat/generic/objects.mk index 2d350241c..50675a241 100644 --- a/sm/plat/generic/objects.mk +++ b/sm/plat/generic/objects.mk @@ -6,11 +6,34 @@ endif include $(src_dir)/platform/$(PLATFORM)/objects.mk # And then also define custom keystone SM functionality +# The header is only correctly included for VF2 if we use KEYSTONE_PLATFORM instead of PLATFORM here +ifeq ($(KEYSTONE_PLATFORM),starfive/visionfive2) +platform-genflags-y += "-DTARGET_PLATFORM_HEADER=\"platform/$(KEYSTONE_PLATFORM)/platform.h\"" +platform-genflags-y += "-DBOARD_VISIONFIVE2" +else platform-genflags-y += "-DTARGET_PLATFORM_HEADER=\"platform/$(PLATFORM)/platform.h\"" +endif include $(KEYSTONE_SM)/src/objects.mk platform-objs-y += $(addprefix ../../src/,$(subst .c,.o,$(keystone-sm-sources))) +# We do need to make sure to include headers for the SM, +# since config.mk is no longer supported in newer OpenSBI versions +# we include the SM headers here +ifeq ($(KEYSTONE_PLATFORM),starfive/visionfive2) +ifeq ($(KEYSTONE_SM),) +$(error KEYSTONE_SM not defined for SM) +endif + +ifeq ($(KEYSTONE_SDK_DIR),) +$(error KEYSTONE_SDK_DIR not defined) +endif + +platform-cflags-y += -I$(KEYSTONE_SM)/src -I$(src_dir)/platform/$(PLATFORM)/include \ + -I$(KEYSTONE_SDK_DIR)/include/shared +endif + + ifeq ($(KEYSTONE_PLATFORM),generic) carray-platform_override_modules-y += generic @@ -20,4 +43,8 @@ else ifeq ($(KEYSTONE_PLATFORM),hifive_unmatched) include $(KEYSTONE_SM)/plat/hifive/unmatched/objects.mk -endif +else ifeq ($(KEYSTONE_PLATFORM),starfive/visionfive2) + +include $(KEYSTONE_SM)/plat/starfive/visionfive2/objects.mk + +endif \ No newline at end of file diff --git a/sm/plat/starfive/visionfive2/objects.mk b/sm/plat/starfive/visionfive2/objects.mk new file mode 100644 index 000000000..57bf5b776 --- /dev/null +++ b/sm/plat/starfive/visionfive2/objects.mk @@ -0,0 +1,3 @@ +carray-platform_override_modules-y += visionfive2 +platform-objs-y += ../starfive/visionfive2/visionfive2.o +platform-cflags-y += -I$(src_dir)/platform/generic/starfive \ No newline at end of file diff --git a/sm/plat/starfive/visionfive2/visionfive2.c b/sm/plat/starfive/visionfive2/visionfive2.c new file mode 100644 index 000000000..923ad2c5b --- /dev/null +++ b/sm/plat/starfive/visionfive2/visionfive2.c @@ -0,0 +1,14 @@ +#include "jh7110.c" +#include "sm.h" + +static int visionfive2_final_init(bool cold_boot, const struct fdt_match *match) { + sm_init(cold_boot); + return starfive_jh7110_final_init(cold_boot, match); +} + +const struct platform_override visionfive2 = { + .match_table = starfive_jh7110_match, + .cold_boot_allowed = starfive_jh7110_cold_boot_allowed, + .fw_init = starfive_jh7110_fw_init, + .final_init = visionfive2_final_init +}; diff --git a/sm/src/platform/generic/platform.c b/sm/src/platform/generic/platform.c index 16dd4f369..9c73d36d9 100644 --- a/sm/src/platform/generic/platform.c +++ b/sm/src/platform/generic/platform.c @@ -46,6 +46,8 @@ uint64_t platform_random(){ // Initialization functions +// Not optimal, but otherwise we get undefined reference errors +#ifndef BOARD_VISIONFIVE2 /* from Sanctum BootROM */ extern byte sanctum_sm_hash[MDSIZE]; extern byte sanctum_sm_signature[SIGNATURE_SIZE]; @@ -67,3 +69,4 @@ void sm_copy_key(void) sbi_memcpy(sm_private_key, sanctum_sm_secret_key, PRIVATE_KEY_SIZE); sbi_memcpy(dev_public_key, sanctum_dev_public_key, PUBLIC_KEY_SIZE); } +#endif \ No newline at end of file diff --git a/sm/src/platform/starfive/visionfive2/platform.c b/sm/src/platform/starfive/visionfive2/platform.c new file mode 100644 index 000000000..ac14b6fbb --- /dev/null +++ b/sm/src/platform/starfive/visionfive2/platform.c @@ -0,0 +1,44 @@ +/* Default platform does nothing special here */ +#include "../../enclave.h" + +unsigned long platform_init_global_once(){ + return SBI_ERR_SM_ENCLAVE_SUCCESS; +} + +unsigned long platform_init_global(){ + return SBI_ERR_SM_ENCLAVE_SUCCESS; +} + +void platform_init_enclave(struct enclave* enclave){ + return; +} + +void platform_destroy_enclave(struct enclave* enclave){ + return; +} + +unsigned long platform_create_enclave(struct enclave* enclave){ + return SBI_ERR_SM_ENCLAVE_SUCCESS; +} + +void platform_switch_to_enclave(struct enclave* enclave){ + return; +} + +void platform_switch_from_enclave(struct enclave* enclave){ + return; +} + +uint64_t platform_random(){ +#pragma message("Platform has no entropy source, this is unsafe. TEST ONLY") + static uint64_t w = 0, s = 0xb5ad4eceda1ce2a9; + + unsigned long cycles; + asm volatile ("rdcycle %0" : "=r" (cycles)); + + // from Middle Square Weyl Sequence algorithm + uint64_t x = cycles; + x *= x; + x += (w += s); + return (x>>32) | (x<<32); +} \ No newline at end of file diff --git a/sm/src/platform/starfive/visionfive2/platform.h b/sm/src/platform/starfive/visionfive2/platform.h new file mode 100644 index 000000000..019e2d8c4 --- /dev/null +++ b/sm/src/platform/starfive/visionfive2/platform.h @@ -0,0 +1,28 @@ +#ifndef _PLATFORM_H_ +#define _PLATFORM_H_ + +// No special data needed for default platform +struct platform_enclave_data{ + +}; + +// Enclave configuration +#define ENCL_MAX 16 +#define ENCLAVE_REGIONS_MAX 8 + +// SM configuration +#define SMM_BASE 0x80000000 +#define SMM_SIZE 0x200000 + +// PMP configuration +#define PMP_N_REG 8 +#define PMP_MAX_N_REGION 8 + +// CPU configuration +#define MAX_HARTS 5 + + +// Initialization functions +void sm_copy_key(void); + +#endif // _PLATFORM_H_ diff --git a/sm/src/sm.c b/sm/src/sm.c index 351d49848..62f41a6ab 100644 --- a/sm/src/sm.c +++ b/sm/src/sm.c @@ -141,7 +141,10 @@ void sm_init(bool cold_boot) sbi_hart_hang(); } // Copy the keypair from the root of trust + // Dont supported on visionfive2 for now + #ifndef BOARD_VISIONFIVE2 sm_copy_key(); + #endif // Init the enclave metadata enclave_init_metadata();