Openwrt 使用git仓库制作软件包流程

  1. 比如仓库地址:

    https://gitee.com/flyrobot-openwrt/atheepmgr.git
    
  2. id:10f0602c6eca3a66ac88c3234cea686fb5281652

  3. Makefile

    #
    # Copyright (c) 2021 Sergey Ryazanov <ryazanov.s.a@gmail.com>
    #
    
    include $(TOPDIR)/rules.mk
    
    PKG_NAME:=wim-atheepmgr
    PKG_VERSION:=2.1.2
    PKG_RELEASE:=1
    
    PKG_SOURCE_PROTO:=git
    PKG_SOURCE_URL:=https://gitee.com/flyrobot-openwrt/atheepmgr.git
    PKG_SOURCE_VERSION:=10f0602c6eca3a66ac88c3234cea686fb5281652
    PKG_MIRROR_HASH:=8b8e210dac0a8d8b99d8c27c752c0a27cf0e5860544a7aac2653ee22c4cebbba
    PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
    PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
    
    
    PATCH_DIR:=./patches
    PKG_MAINTAINER:=Sergey Ryazanov <ryazanov.s.a@gmail.com>
    PKG_LICENSE:=ISC
    PKG_LICENSE_FILES:=LICENSE
    
    PKG_CONFIG_DEPENDS:=\
    	CONFIG_ATHEEPMGR_DANGEROUS_FUNCTIONS \
    
    include $(INCLUDE_DIR)/package.mk
    
    
    
    define Package/$(PKG_NAME)
      SECTION:=utils
      CATEGORY:=Utilities
      SUBMENU:=Boot Loaders
      TITLE:=EEPROM/boarddata management utility for Atheros WLAN chips
      MENU:=1
    endef
    
    define Package/$(PKG_NAME)/description
      This utility is intended to investigate the content of Atheros WLAN
      chips EEPROM (OTP, boarddata, ART, etc.). It supports data extraction,
      unpacking, parsing, dumping in a text form, saving binary data for
      further analysis, as well as quick editing of some basic fields (e.g.
      MAC address, etc.).
    
      The utility supports both data access methods: direct EEPROM (OTP)
      access (via the chip) and offline binary dumps handling.
    
    endef
    
    define Package/$(PKG_NAME)/config
    	if PACKAGE_wim-atheepmgr
    		config ATHEEPMGR_DANGEROUS_FUNCTIONS
    			bool "Enable dangerous functions"
    			default n
    			help
    			  This option enables some functions, the use of which could cause
    			  permanent hardware damages and (or) make the operation of the
    			  equipment illegal due to RF spectre usage violation.
    
    			  These functions are intended for use by developers and radio
    			  engineers.
    
    			  You have been warned. If unsure, say no.
    	endif
    endef
    
    MAKE_VARS += \
    	OS=Linux \
    	CONFIG_CON_PCI=n \
    	CONFIG_I_KNOW_WHAT_I_AM_DOING=$(CONFIG_ATHEEPMGR_DANGEROUS_FUNCTIONS) \
    
    define Package/$(PKG_NAME)/install
    	$(INSTALL_DIR) $(1)/usr/bin
    	$(INSTALL_BIN) $(PKG_BUILD_DIR)/atheepmgr $(1)/usr/bin/
    endef
    
    $(eval $(call BuildPackage,$(PKG_NAME)))
    
    

    注意:

    • PKG_VERSION是下载到dl目录后的版本

    • PKG_SOURCE_VERSION:指定git仓库版本

    • PKG_SOURCE:指定dl目录下的压缩文件名字

      dl/wim-atheepmgr-2.1.2-10f0602c6eca3a66ac88c3234cea686fb5281652.tar.xz
      
    • PKG_MIRROR_HASH:这个值是dl/压缩文件hash值,刚开始我们可以填skip

      第一次填skip的时候,执行

      make package/wim-atheepmgr/download		 #下载源码并切换到正确分支
      make package/wim-atheepmgr/check FIXUP=1 # 会自动把dl/wim-atheepmgr-2.1.2-10f0602c6eca3a66ac88c3234cea686fb5281652.tar.xz的hash值填到PKG_MIRROR_HASH位置
      
    • PKG_BUILD_DIR:指定编译目录为:

      build_dir/target-powerpc_8540_musl/wim-atheepmgr-2.1.2
      
    • PATCH_DIR:=./patches:指定patch目录