0x01 Openwrt system --- application is compiled

  1. In the package compiled directory, create a folder hello.
  2. In hello folder and then create a src folder and Makefile.
    Makefile:
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=hello
PKG_VERSION:=1
PKG_RELEASE:=20191015

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
	SECTION:=utils
	CATEGORY:=hello
	TITLE:=hello world! test .
endef

define Package/$(PKG_NAME)/description
hello world! test .hello world! test .
endef

define Build/Prepare
	@echo -e "b"
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)

endef

define Build/Configure
endef

define Build/Compile
	@echo -e "ccccccc"
	$(MAKE) -C $(PKG_BUILD_DIR) \
		$(TARGET_CONFIGURE_OPTS) \
		CFLAGS="$(TARGET_CFLAGS)" \
		CPPFLAGS="$(TARGET_CPPFLAGS)" \
		LDFLAGS="$(TARGET_LDFLAGS)"
	@echo -e "ccccccc"
endef

define Package/$(PKG_NAME)/install
	@echo -e "dddddd"
	$(INSTALL_DIR) $(1)/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/hello $(1)/bin/
	@echo -e "dddddd"
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
  1. Create a folder and then src Makefile file.
    Makefile:
all:
	$(CC) $(CFLAGS) hello.c -o hello
	
clean:
	rm *.o hello
  1. make menuconfig -> hello to the
  2. make package / hello / compile V = s compiled
  3. Get IPK package:
    1. In Openwrt system, using scp link @ Destination: absolute path to a local file path
    2. In the Ubuntu system, using python -m SimpleHTTPServer 8080, using wget destination address in the Openwrt: 8080 // target file
  4. In Openwrt system installation package IPK:
    1. opkg install target IPK package
Published 31 original articles · won praise 17 · views 10000 +

Guess you like

Origin blog.csdn.net/q759451733/article/details/102671145