Hi all,
平台: x86_64
我成功地在虚拟机上安装了一个(LEDE) x86/64 (与OpenWRT相同)。
我用SDK为Linux嵌入式开发环境(LEDE)开发了一个自定义包"Hello“,并进行了交叉编译。然后,在我的虚拟机上进行了测试,结果成功了。但是,我有自己的代码来移植,也就是说,对于c中的原始数据包嗅探器,我想移植该代码。因此,我在“helloworld.c”(helloworld.c)的相同文件下复制了相同的代码。再次,我成功地交叉编译了新的二进制"*.ipk格式“,然后将它发送到我的LEDE虚拟机上,并执行了opkg install xxxxxx.ipk
。它安装了,但是输出相同。我是说“你好世界”。
我不知道是怎么回事。因为这次代码变了。然后,再次为测试编写了一个简单的阶乘代码。在虚拟机中进行测试。我发现它不起作用,因为同样的输出,也就是"Hello“。
文档:我正在使用SDK而不是源代码来开发用于LEDE使用LEDE Source,我跟踪文档中的每一件事,不包括源代码编译等等。
SDK文档:使用SDK编译自定义包
Hello代码的Makefile:
include $(TOPDIR)/rules.mk
# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=helloworld
PKG_VERSION:=1.0
PKG_RELEASE:=1
# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below
SOURCE_DIR:=/home/buildbot/helloworld
include $(INCLUDE_DIR)/package.mk
# Package definition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/helloworld
SECTION:=examples
CATEGORY:=Examples
TITLE:=Hello, World!
endef
# Package description; a more verbose description on what our package does
define Package/helloworld/description
A simple "Hello, world!" -application.
endef
# Package preparation instructions; create the build directory and copy the source code.
# The last command is necessary to ensure our preparation instructions remain compatible with the patching system.
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
cp $(SOURCE_DIR)/* $(PKG_BUILD_DIR)
$(Build/Patch)
endef
# Package build instructions; invoke the target-specific compiler to first compile the source file, and then to link the file into the final executable
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/helloworld.o -c $(PKG_BUILD_DIR)/helloworld.c
$(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/helloworld.o
endef
# Package install instructions; create a directory inside the package to hold our executable, and then copy the executable we built previously into the folder
define Package/helloworld/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/usr/bin
endef
# This command is always the last, it uses the definitions and variables we give above in order to get the job done
$(eval $(call BuildPackage,helloworld))
发布于 2017-11-16 07:28:08
我再次交叉编译了相同的代码,并使用LinkIt Smart 7688
对其进行了测试,一切都如愿以偿。所以,我觉得我为测试而创建的LEDE虚拟机出了点问题。
LinkIt Smart7688:是一个基于OpenWrt Linux发行版和MT7688的开放式开发板。该平台还提供了用Python、Node.js和C编程语言创建设备应用程序的选项。 因此,我认为这是一个最好的董事会为IoT的东西在12.90美元。
https://stackoverflow.com/questions/47299242
复制相似问题