OpenWRT環境構築

*******************************************************************
https://git.archive.openwrt.org/15.05/openwrt.git
https://github.com/MediaTek-Labs/linkit-smart-7688-feed
*******************************************************************
マニュアル:
https://github.com/MediaTek-Labs/linkit-smart-7688-feed

Develop Evn make step:

1. sudo git clone git://git.archive.openwrt.org/15.05/openwrt.git
2. sudo apt-get install git g++ make libncurses5-dev subversion libssl-dev gawk libxml-parser-perl unzip wget python xz-utils
3. git checkout c170d84bbe08e0f049c99d3f376aae170a36458e -b pre_3_18_84
4. cp feeds.conf.default feeds.conf
5. echo src-git linkit https://github.com/MediaTek-Labs/linkit-smart-7688-feed.git >> feeds.conf
6. ./scripts/feeds update
7. ./scripts/feeds install -a
8. make prereq
9. make menuconfig
  Target System: Ralink RT288x/RT3xxx
  Subtarget: MT7688 based boards
  Target Profile: LinkIt7688
  * 禁止設定:
  Global build settings->Compile with support for patented functionality
  Libraries->IoT->libupm
  Libraries->libmraa
  It compiles fine then

10. make V=99  



*******************************************************************
SDK download and compile source:

マニュアル:
https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/tutorials/c-c++-programming/using-openwrt-sdk-to-build-c-c++-programs

* 先ずはsudo apt-get install ccacheコマンドを実行する。
* コマンド変更:
   「make package/helloworld/compile」   =>  「make -j1 V=s」






SSID:    jlabs-smart-office_5G
プロトコル:    802.11ac
セキュリティの種類:    WPA2-パーソナル
ネットワーク帯域:    5 GHz
ネットワーク チャネル:    36
IPv4 アドレス:    192.168.2.110
IPv4 DNS サーバー:    192.168.2.1
製造元:    Qualcomm Atheros Communications Inc.
説明:    Qualcomm Atheros QCA9377 Wireless Network Adapter
ドライバーのバージョン:    12.0.0.307
物理アドレス (MAC):    40-9F-38-AB-BA-A5





Compile:

cmake: --> BeagleBone

1. mkdir buildBB

2./home/test/OpenWrt-SDK/ ..... あり

3. ./CMakeList.txt   ..... 修正

     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/home/test/OpenWrt-SDK/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include/")
     set(OPENSSL_LIBRARIES "-L/home/test/OpenWrt-SDK/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/lib/ -lssl -lcrypto -lusb-1.0")

4.cmake command:
  /home/test/OpenWrt-SDK/staging_dir/host/bin/cmake -DCMAKE_C_COMPILER=/home/test/OpenWrt-SDK/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc  ..

5. make


/home/test/openwrt/OpenWrt-SDK/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc

SET(CMAKE_C_COMPILER "/home/test/openwrt/Toolchain/toolchain/bin/mipsel-openwrt-linux-uclibc-gcc")                            
SET(CMAKE_CXX_COMPILER "/home/test/openwrt/Toolchain/toolchain/bin/mipsel-openwrt-linux-uclibc-g++")                            
SET(CMAKE_AR "/home/test/openwrt/Toolchain/toolchain/bin/mipsel-openwrt-linux-uclibc-ar")                            
SET(CMAKE_LINKER "/home/test/openwrt/Toolchain/toolchain/bin/mipsel-openwrt-linux-uclibc-ld")                            
SET(CMAKE_RANLIB "/home/test/openwrt/Toolchain/toolchain/bin/mipsel-openwrt-linux-ranlib")                            
SET(CMAKE_NM "/home/test/openwrt/Toolchain/toolchain/bin/mipsel-openwrt-linux-nm")                            
SET(CMAKE_OBJDUMP "/home/test/openwrt/Toolchain/toolchain/bin/mipsel-openwrt-linux-objdump")                            
SET(CMAKE_OBJCOPY "/home/test/openwrt/Toolchain/toolchain/bin/mipsel-openwrt-linux-objcopy")                            
SET(CMAKE_STRIP "/home/test/openwrt/Toolchain/toolchain/bin/mipsel-openwrt-linux-strip")                            

mipsel-openwrt-linux-uclibc-g++

解决警告,打开终端                        
sudo vim /etc/profile                        
在最后面加上                        
"export PATH=/home/test/openwrt/OpenWrt-SDK/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin:$PATH
"                        
生成文件前,加上                        
export STAGING_DIR=/home/test/openwrt/OpenWrt-SDK/staging_dir                        
/home/test/openwrt/openwrt/staging_dir/host/bin/cmake -DCMAKE_C_COMPILER=/home/test/openwrt/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/bin/mipsel-openwrt-linux-musl-gcc .

原文地址:https://www.cnblogs.com/orangezs/p/8675229.html