Skip to content

Commit

Permalink
refactor: move the packages to milkv duo libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
gtxzsxxk committed Nov 30, 2023
1 parent b80885b commit bfa7d42
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 52 deletions.
1 change: 1 addition & 0 deletions configs/milkv_duo_musl_riscv64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y

# Packages for the sdcard image generating
BR2_PACKAGE_MILKV_DUO_LIBRARIES=y
BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL=y
BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL_64MB=y
BR2_PACKAGE_MILKV_DUO_PINMUX=y
Expand Down
1 change: 1 addition & 0 deletions configs/milkv_duo_musl_riscv64_ion_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y

# Packages for the sdcard image generating
BR2_PACKAGE_MILKV_DUO_LIBRARIES=y
BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL=y
BR2_PACKAGE_MILKV_DUO_SMALLCORE_FREERTOS=y
BR2_PACKAGE_MILKV_DUO_PINMUX=y
Expand Down
4 changes: 2 additions & 2 deletions package/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,6 @@ menu "Firmware"
source "package/b43-firmware/Config.in"
source "package/brcmfmac_sdio-firmware-rpi/Config.in"
source "package/linux-firmware/Config.in"
source "package/milkv-duo-firmware-fsbl/Config.in"
source "package/milkv-duo-smallcore-freertos/Config.in"
source "package/murata-cyw-fw/Config.in"
source "package/odroidc2-firmware/Config.in"
source "package/qcom-db410c-firmware/Config.in"
Expand Down Expand Up @@ -562,6 +560,8 @@ endmenu
source "package/memtester/Config.in"
source "package/memtool/Config.in"
source "package/mhz/Config.in"
source "package/milkv-duo-libraries/Config.in"
source "package/milkv-duo-smallcore-freertos/Config.in"
source "package/minicom/Config.in"
source "package/msr-tools/Config.in"
source "package/nanocom/Config.in"
Expand Down
47 changes: 0 additions & 47 deletions package/milkv-duo-firmware-fsbl/milkv-duo-firmware-fsbl.mk

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
config BR2_PACKAGE_MILKV_DUO_LIBRARIES
bool "milk-v duo libraries"
depends on BR2_riscv
help
Those packages provide board-specific hardware tools and
firmware for the Milk-V Duo platform.

if BR2_PACKAGE_MILKV_DUO_LIBRARIES

config BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL
bool "milkv-duo-firmware-fsbl"
depends on BR2_riscv
select BR2_PACKAGE_HOST_MTOOLS
help
This package is obtained from
Expand All @@ -15,10 +23,9 @@ config BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL

https://github.com/gtxzsxxk/milkv-duo-firmware-fsbl

if BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL

config BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL_64MB
bool "64 MiB Free RAM"
depends on BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL
default n
help
Say Y to this will disable the ION in order to
Expand Down
51 changes: 51 additions & 0 deletions package/milkv-duo-libraries/milkv-duo-libraries.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
################################################################################
#
# milkv-duo-libraries
#
################################################################################

MILKV_DUO_LIBRARIES_VERSION = f359994bd497f942bb67734280d81f6640c7c168
MILKV_DUO_LIBRARIES_SITE = $(call github,milkv-duo,milkv-duo-buildroot-libraries,$(MILKV_DUO_LIBRARIES_VERSION))
MILKV_DUO_LIBRARIES_INSTALL_STAGING = YES
MILKV_DUO_LIBRARIES_DEPENDENCIES = host-python3 host-mtools
MILKV_DUO_FIRMWARE_FSBL_64MB = ION

ifeq ($(BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL_64MB),y)
MILKV_DUO_FIRMWARE_FSBL_64MB = 64MB
endif

define MILKV_DUO_LIBRARIES_BUILD_CMDS
if [ $(BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL) = y ]; then \
$(MAKE) -C $(@D)/firmware \
ARCH=riscv BOOT_CPU=riscv CHIP_ARCH=cv180x \
PROJECT_FULLNAME=cv1800b_milkv_duo_sd \
CROSS_COMPILE=$(TARGET_CROSS) \
FREE_RAM_SIZE=$(MILKV_DUO_FIRMWARE_FSBL_64MB) \
bl2; \
fi

if [ $(BR2_PACKAGE_MILKV_DUO_PINMUX) = y ]; then \
$(TARGET_MAKE_ENV) $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
-I $(@D)/pinmux/include $(@D)/pinmux/src/*.c -o $(@D)/pinmux/duo-pinmux; \
fi
endef

define MILKV_DUO_LIBRARIES_INSTALL_STAGING_CMDS
if [ $(BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL) = y ]; then \
$(INSTALL) -D -m 0755 $(@D)/firmware/build/cv180x/bl2.bin $(BINARIES_DIR)/bl2.bin; \
$(INSTALL) -D -m 0755 $(@D)/firmware/plat/cv180x/chip_conf.bin $(BINARIES_DIR)/chip_conf.bin; \
$(INSTALL) -D -m 0755 $(@D)/firmware/plat/cv180x/fiptool.py $(BINARIES_DIR)/fiptool.py; \
$(INSTALL) -D -m 0644 $(@D)/firmware/plat/cv180x/multi.its $(BINARIES_DIR)/multi.its; \
$(INSTALL) -D -m 0755 $(@D)/firmware/test/cv181x/ddr_param.bin $(BINARIES_DIR)/ddr_param.bin; \
fi

if [ $(BR2_PACKAGE_MILKV_DUO_PINMUX) = y ]; then \
$(INSTALL) -D -m 0755 $(@D)/pinmux/duo-pinmux $(TARGET_DIR)/usr/bin/; \
fi

if [ $(BR2_PACKAGE_MILKV_DUO_FEATURES) = y ]; then \
cp $(@D)/overlay/* -r $(TARGET_DIR); \
fi
endef

$(eval $(generic-package))

0 comments on commit bfa7d42

Please sign in to comment.