开发流程
1. 在packet下建立相关的自定义的包
mkdir src
touch Makefile
2. 拷贝一个makefile模板,进行修改
$(eval $(call BuildPackage,$(PKG_NAME)))
当前编译的包需要在主机内使用
3. 进行源码文件中的源码设计与Makefile设计
4. 进行make menuconfig 的配置
选择对应的应用模块程序,选择为M 进行模块类型编译
5. make package/hello/compile V=s
6. 在/bin/packages/i386_pentium4/base 下找到对应的IPK包
7. python -m SimpleHTTPServer 8080 wget方式进行ipk包传递
scp方式进行包的传递
8. 安装ipk包,测试是否满足
opkg install hello_1-1.0_i386_pentium4.ipk
9. 卸载ipk包
opkg remove hello(包名)
Makefile编写
#
# Copyright (C) 2015-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
# 新添加
include $(INCLUDE_DIR)/kernel.mk
#PKG_NAME:=adbyby
#PKG_VERSION:=2.7
#PKG_RELEASE:=20160110
PKG_NAME:=hello
PKG_VERSION:=1
PKG_RELEASE:=20191227
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
# SECTION:=net
# 一般utils放通用的东西
SECTION:=utils
# CATEGORY:=Network
# 分类
CATEGORY:=hello
# TITLE:=Powerful adblock module to block ad.
TITLE:=hello test ipk mouse study
# DEPENDS:=+libstdcpp
# URL:=http://www.adbyby.com/
endef
define Package/$(PKG_NAME)/description
#Adbyby is a powerful adblock module to block ad,just like adblock.
Mouse is studing !!!!!!!!!!!! hello world!!!!!!
endef
define Build/Prepare
#新添加
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
# 新添加
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS)" \
CPPFLAGS="$(TARGET_CPPFLAGS)"
endef
define Package/$(PKG_NAME)/install
# $(INSTALL_DIR) $(1)/usr/share/adbyby
$(INSTALL_DIR) $(1)/bin
# $(INSTALL_BIN) ./files/adbyby.sh $(1)/usr/share/adbyby/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hello $(1)/bin/
endef
# 表明工具是镜像(主机)上要使用的
$(eval $(call BuildPackage,$(PKG_NAME)))