Hello!
Just sorry for my English, my native language is Russian. I try to write correctly and use an interpreter, but errors may occur.
I need to compile the source code in the IPK package for OpenWRT 15.05.
I have a control relay MP709 (http://www.olimp-z.ru/mp709)
Source code for Linux: http://www.olimp-z.ru/products/MP709/mp709_adriver.tar
My OS: Debian 8.
My router: TP-Link TL-MR3220 (ver. 1.2)
Here are the contents of the README:
requirements:
libusb 1.0
1. cd hidapi/linux
make
../../
make
2. Add udev rule like this:
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", MODE="0660", GROUP="masterkit"
Add user who works with mp709 to group "masterkit"
3. enjoy your new mp709
mp709 on
mp709 off
As I understand it, that first I need to compile hidapi, and then compile the relay control program mp709.
But due to lack of experience, I can not figure out how to compile this code for my router architecture.
I have read articles on the wiki.openwrt.org and on the Internet how to add a package OpenWRT and write makefile. But I get an error and I do not know how to fix them. I ask for help from the community.
I made these commands:
# git clone git://git.openwrt.org/15.05/openwrt.git
# cd openwrt
# ./scripts/feeds update -a && ./scripts/feeds install -a
# make prereq
At this stage there were errors due to a missing packet, but I found them all and installed.
Then I in openwrt/package folder created folder mp709. In it, I create a folder src to put the source code. And next to the folder src I created Makefile file.
Makefile
root@pc:/home/user/openwrt/package/mp709# cat Makefile
include $(TOPDIR)/rules.mk
PKG_NAME:=mp709
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/mp709
SECTION:=utils
CATEGORY:=Utilities
DEFAULT:=n
TITLE:=MP709 relay control utilities
DEPENDS:=+libusb-1.0
endef
define Package/mp709/description
MP709 relay control
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Build/Configure
$(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR))
endef
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) -Ihidapi/hidapi -Wall -g -c `pkg-config libusb-1.0 --cflags` -fpermissive -o $(PKG_BUILD_DIR)/mp709
endef
define Package/mp709/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mp709 $(1)/bin/
endef
$(eval $(call BuildPackage,mp709))
root@pc:/home/user/openwrt/package# ls mp709
Makefile src
root@pc:/home/user/openwrt/package/mp709# ls src
hidapi Makefile mp709.c mp709.o README
An error occurred while launching compile the package:
root@pc:/home/user/openwrt# make /package/mp709/compile V=99
make[1]: Entering directory '/home/user/openwrt'
make[1]: *** No rule to make target '/package/mp709/compile'. Stop.
make[1]: Leaving directory '/home/user/openwrt'
/home/user/openwrt/include/toplevel.mk:181: ошибка выполнения рецепта для цели «/package/mp709/compile»
make: *** [/package/mp709/compile] Error 2
Please tell me what is my mistake. Thank you!