2. sync的目录结构是src file两个目录和Makefile文件, 将自己的文件放到src上
3. sudo make menuconfig 在yeetec中选中sync,保存
4. sudo make 时间比较长,生成的ipk放在bin/ramips/packages/base/
5. sudo make V=s package/sync/compile 单独编译,生成的ipk放在bin/ramips/packages/base/
6. 使用winscp放到板子上
7. 执行opkg install _.ipk 这个会被安装到/usr/bin下
8. 直接执行对应的命令,这里是./sync
这里主要的是Makefile的书写
这里在sync目录下的Makefile文件内容如下
/***************************************/
include $(TOPDIR)/rules.mk
PKG_NAME:=sync
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel.mk
define Package/sync
SECTION:=base
CATEGORY:=Yeetec
DEPENDS:=+libcurl +libjson-c +libsqlite3
TITLE:=datas and info sync
endef
TARGET_CPPFLAGS :=
TARGET_LDFLAGS :=
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Build/Configure/Default
endef
Build/Configure = $(Build/Configure/Default)
define Build/Compile
CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
$(MAKE) -f Makefile -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS)
endef
define Package/sync/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/sync $(1)/usr/bin
$(INSTALL_BIN) ./files/sync.init $(1)/etc/init.d/sync
endef
$(eval $(call BuildPackage,sync))