2017-11-15 11 views
1

Hi all,コンパイルカスタムパッケージ(OpenWrtのと同じ)

プラットフォーム開発環境(LEDE):x86_64版

は、私が正常にインストールされたLinux組み込み開発環境(LEDE)のx86/64(OpenWrtのと同じ)私の仮想マシンに転送します。

私は、Linux Embedded Development Environment(LEDE)のカスタムパッケージ "Hello World"をSDKで開発し、クロスコンパイルしました。次に、それを私の仮想マシンでテストし、それがうまくいった。 しかし、私は自分のコードを持っています。これは、cでの生のパケットスニファのために、そのコードを移植したいのです。だから、同じコードを "Hello world"(helloworld.c)で使ったのと同じファイルにコピーしました。再び、私は正常に新しいバイナリ "* .ipk形式"をクロスコンパイルし、次にLEDE仮想マシンで送信し、opkg install xxxxxx.ipkを実行しました。それはインストールされましたが、同じ出力。私は "Hello world"を意味します。

どのようにわからないのですか?コードが今回変更されたためです。次に、テストのために再び単純な階乗符号を書いた。仮想マシンでのテスト中。私はそれが同じ出力、つまり "Hello world"のために再び動作しないことを発見しました。

ドキュメント:Hello world package for LEDE using LEDE Source ソースコードの代わりにSDKを使用して開発しています。ソースコンパイルとすべてを除いて、ドキュメント内のすべての記事に従っています。 SDKのため

ドキュメント:Hello WorldのコードのCompile custom package using SDK

の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)) 

答えて

1

私は再び同じコードをクロスコンパイルしLinkIt Smart 7688とすべてが期待どおりに働いていると、それをテストしました。だから、テスト用に作成したLEDE仮想マシンに何か問題があったと思います。

LinkItスマート7688: それはOpenWrtのLinuxディストリビューションとMT7688に基づいてオープンな開発ボードです。 プラットフォームには、 Python、Node.js、およびCプログラミング言語でデバイスアプリケーションを作成するオプションも用意されています。

だから、私はそれが12.90米ドル以内のIoTもののために利用できる最良のボードの1つだと思います。

0

私は正常にOpenWrtの中でカスタムパッケージを追加し、これが私のMakefileで、これはあなたに

include $(TOPDIR)/rules.mk 

PKG_NAME:=viva 
PKG_VERSION:=1.4 
PKG_RELEASE=$(PKG_SOURCE_VERSION) 
PKG_MAINTAINER:=Vishal <[email protected]> 
PKG_LICENSE:=ISC 

include $(INCLUDE_DIR)/package.mk 

define Package/viva/default 
    CATEGORY:=Network 
    SUBMENU:=Web Servers/Proxies 
    TITLE:=Webpage for package creation 
endef 

define Package/viva 
    $(Package/viva/default) 
    DEPENDS:=+uhttpd 
endef 

define Package/viva/description 
    A web page used for illustrating package creation 
endef 

define Package/viva/install 
    $(CP) ./files/* $(1)/ 
endef 

define Build/Compile 
    true 
endef 

$(eval $(call BuildPackage,viva)) 
+0

感謝を役に立てば幸い、それはシンプルで理解しやすいようです。しかし、私の場合は、OpenWRTベースのファームウェアであるLEDE(LEDE Project( "Linux Embedded Development Environment" [https://lede-project.org/])をインストールしたバーチャルマシンで問題が発生しました。 OpenWrtに基づくLinuxオペレーティングシステム)。それでも私はなぜこれが起こったのか分からない。 –

+0

私はzcatを使って '* .ipk'パッケージを解凍し、' hello world'キーワードを探しましたが、バイナリが私のクロスコンパクションマシンにある時は何もなかったので、scpを使ってopenwrt仮想マシンその後、私は 'opkg install helloworld * .ipk'をインストールして実行中に再び" Hello world "を表示します。これで、私は再びこれをアンパックして" Hello world "を検索しました。 。私はまだそれがどこから来るかわからない。 –

関連する問題