Plattform: x86_64
ich erfolgreich ein Embedded Linux Entwicklungsumgebung (LEDE) x86/64 (die gleichen wie OpenWRT) installiert zu meiner virtuellen Maschine.
Ich entwickelte ein benutzerdefiniertes Paket "Hallo Welt" für Linux Embedded Development Environment (LEDE) mit SDK und kompiliert es. Dann habe ich es auf meiner virtuellen Maschine getestet und es hat funktioniert. Aber dann habe ich meinen eigenen Code zu portieren, der für rohen Paket-Sniffer in c ist, und ich möchte diesen Code portieren. Also kopierte ich denselben Code unter der gleichen Datei, die ich für "Hallo Welt" (helloworld.c) verwendet habe. Wiederum kompilierte ich das neue binäre "* .ipk Format" erfolgreich und sendete es dann auf meine LEDE virtuelle Maschine und tat opkg install xxxxxx.ipk
. Es installiert, aber gleiche Ausgabe. Ich meine "Hallo Welt".
Ich weiß nicht wie. Denn der Code hat sich diesmal geändert. Dann, wieder zum Testen ein schrieb einen einfachen Fakultät Code und wieder. Während des Tests in der virtuellen Maschine. Ich habe festgestellt, dass es nicht funktioniert, weil die gleiche Ausgabe wieder "Hallo Welt" ist.
Dokumentation: Hello world package for LEDE using LEDE Source Ich entwickle mit SDK anstelle von Quelle.Ich folgte alle Dinge in der Dokumentation mit Ausnahme der Quellkompilierung und alle.
Dokumentation für SDK: Compile custom package using SDK
Makefile für Hallo Welt Code:
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))
Danke, es scheint einfach und leicht zu verstehen. Aber, in meinem Fall hatte ich Probleme mit der virtuellen Maschine, auf der ich die OpenWRT-basierte Firmware namens LEDE installiert habe (Das LEDE-Projekt ("Linux Embedded Development Environment" [link] (https://lede-project.org/)) ist ein Linux-Betriebssystem basierend auf OpenWrt). Noch weiß ich nicht über das Problem, warum das passiert ist. –
Weil ich das '* .ipk' Paket mit zcat entpackt habe und nach' Hallo Welt' Schlüsselwort gesucht habe, aber zu der Zeit, als binary in meinem Cross-Complation-Rechner war, gab es nichts, dann habe ich es mit scp zur Ziel-openwrt virtuellen Maschine geschickt , dann habe ich mit 'opkg install helloworld * .ipk' installiert dann wieder während der Ausführung druckt" Hello world ".So, dieses Mal habe ich es wieder entpackt und nach" Hello world "gesucht, dann habe ich dort einen Hallo Welt String gefunden . Ich weiß immer noch nicht, woher das kommt. –