Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions general/package/xiongmai-opensdk-xm510/Config.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
config BR2_PACKAGE_XIONGMAI_OPENSDK_XM510
bool "xiongmai-opensdk-xm510"
depends on BR2_LINUX_KERNEL
help
Library for running uclibc applications in musl environment
Library for running uclibc applications in musl environment,
and the open MMZ (open_mmz) and H.264 encoder (open_h264)
kernel modules from OpenIPC/openxiongmai.

https://openipc.org
https://github.com/OpenIPC/openxiongmai
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
################################################################################
#
# xiongmai_opensdk_xm510
# xiongmai-opensdk-xm510
#
################################################################################

XIONGMAI_OPENSDK_XM510_LICENSE = MIT
XIONGMAI_OPENSDK_XM510_SITE = $(call github,openipc,openxiongmai,$(XIONGMAI_OPENSDK_XM510_VERSION))
XIONGMAI_OPENSDK_XM510_VERSION = 0e82ee26e74c813a7ec98496a4138d05f8c5e36f

XIONGMAI_OPENSDK_XM510_LICENSE = MIT (libwrapper), GPL-2.0 (open_mmz, open_h264 kernel modules)
XIONGMAI_OPENSDK_XM510_LICENSE_FILES = LICENSE

define XIONGMAI_OPENSDK_XM510_EXTRACT_CMDS
cp $(XIONGMAI_OPENSDK_XM510_PKGDIR)/src/lib/wrapper.c $(@D)/
endef
# Install after osdrv, as xiongmai-opensdk does with xiongmai-osdrv-xm530.
ifeq ($(BR2_PACKAGE_XIONGMAI_OSDRV_XM510),y)
XIONGMAI_OPENSDK_XM510_DEPENDENCIES += xiongmai-osdrv-xm510
endif

# The open drivers, which load_xiongmai prefers over the vendor modules:
# drivers/xm_mmz (open_mmz.ko), the XM510 mmz.ko's allocator and /proc
# layout, and drivers/hx280enc (open_h264.ko), the encoder driver in place of
# xm510_h264.ko. The kernel-module infrastructure installs them under
# /lib/modules/<kver>/extra/. Neither needs a vendor module's symbols.
XIONGMAI_OPENSDK_XM510_MODULE_SUBDIRS = drivers/xm_mmz drivers/hx280enc

# libwrapper (uclibc symbols for the vendor binaries on musl) is this
# package's own source, not openxiongmai's.
define XIONGMAI_OPENSDK_XM510_BUILD_CMDS
(cd $(@D); $(TARGET_CC) -fPIC -shared -s wrapper.c -o libwrapper.so )
$(TARGET_CC) -fPIC -shared -s $(XIONGMAI_OPENSDK_XM510_PKGDIR)/src/lib/wrapper.c \
-o $(@D)/libwrapper.so
endef

define XIONGMAI_OPENSDK_XM510_INSTALL_TARGET_CMDS
install -m 0755 -D $(@D)/libwrapper.so $(TARGET_DIR)/lib/libwrapper.so
ln -sfv libwrapper.so $(TARGET_DIR)/lib/libwrapper.so.0
endef

$(eval $(kernel-module))
$(eval $(generic-package))
33 changes: 30 additions & 3 deletions general/package/xiongmai-osdrv-xm510/files/script/load_xiongmai
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,32 @@ remove_sns()
rmmod -w ssp_sony &> /dev/null
}

# MMZ and the encoder: the open drivers when xiongmai-opensdk-xm510 installed
# them (OpenIPC/openxiongmai drivers/xm_mmz and drivers/hx280enc), the vendor
# modules otherwise, which depmod indexes here under xiongmai/. Neither open
# module needs a vendor module's symbols.
insert_mmz()
{
modprobe open_mmz mmz_start=$MEM_START mmz_size=$MEM_LEN 2>/dev/null ||
modprobe mmz mmz_start=$MEM_START mmz_size=$MEM_LEN ||
report_error
}

remove_mmz()
{
rmmod -w open_mmz 2>/dev/null || rmmod -w mmz
}

insert_h264()
{
modprobe open_h264 2>/dev/null || modprobe xm510_h264
}

remove_h264()
{
rmmod -w open_h264 2>/dev/null || rmmod -w xm510_h264
}

insert_ko()
{
# low power control
Expand All @@ -83,11 +109,11 @@ insert_ko()
# driver load
cd /lib/modules/3.0.101/xiongmai/
insert_sns > /dev/null
insmod mmz.ko mmz_start=$MEM_START mmz_size=$MEM_LEN
insert_mmz
insmod xm510_vi.ko buffer=$VI_BUFF
insmod xm510_isp.ko
insmod xm510_rgn.ko
insmod xm510_h264.ko
insert_h264
insmod xm_rtc.ko
# The watchdog is the kernel's sp805_wdt (/dev/watchdog), not xm_wdt.ko: see
# OpenIPC/firmware#2611.
Expand All @@ -100,10 +126,11 @@ remove_ko()
{
#remove_audio
rmmod -w xm_rtc
rmmod -w xm510_h264
remove_h264
rmmod -w xm510_rgn
rmmod -w xm510_isp
rmmod -w xm510_vi
remove_mmz

remove_sns
}
Expand Down
Loading