目前分類:Ralink SDK (29)

瀏覽方式: 標題列表 簡短摘要

設定關鍵字

  • struct config_files 用來存放 config 檔案結構,fileHeader 用來存放檔案名,不包含 .conf。
  • struct config_line 用來存放 config 檔內的指令結構,config_token 為指令名,parse_line 為處理函數。
  • internal_register_config_handler 用來加入指令,static function 不對外。
  • snmplib/read_config.c,register_prenetsnmp_mib_handler,register_config_handler,register_const_config_handler,直接呼叫 internal_register_config_handler。
  • snmplib/read_config.c,register_app_config_handler 是對外函數,直接呼叫 register_config_handler 再呼叫 internal_register_config_handler。
  • agent/agent_read_config.c,snmpd_register_config_handler,snmpd_register_const_config_handler 是對外函數,直接呼叫 register_app_config_handler 再呼叫 register_config_handler 最後呼叫 internal_register_config_handler。
  • mibgroup/agentx/agentx_config.c,agentx_register_config_handler 是對外函數,直接呼叫 register_config_handler 再呼叫 internal_register_config_handler。使用 ":agentx" 做檔案名,所以會先設定 snmpd.conf 再設定 agentx.conf 的關鍵字。
  • ltmp = &((*ltmp)->next) 會直接把記憶體位址傳給 ltmp,一般寫法是會宣告 struct config_line *ltmp 而不是 struct config_line **ltmp,ltmp->next=calloc() 來設定 next 指標,而它是用 *ltmp=calloc() 來設定 next 指標。
  • agent/agent_read_config.c,init_agent_read_config() 設定關鍵字。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

  • snmplib/default_store.c(說明),主要設計來儲存全域變數。
  • 參數 m: 用來設定環境變數 MIBS,snmplib/mib.c 的 netsnmp_init_mib() 會使用,如果 MIBS 沒設定則使用 NETSNMP_DEFAULT_MIBS 放在 include/net-snmp/net-snmp-config.h。
  • 參數 M: 用來設定環境變數 MIBDIRS, snmplib/mib.c 的 netsnmp_get_mib_directory() 會用到,函數有點複雜,有空在整理。
  • init_agent() 用來初始化一個 agent,原始碼在 agent/snmp_vars.c,函數有點複雜,有空在整理。
  • init_mib_modules() 只是用來執行 netsnmp_access_interface_init() 跟註冊 shutdown 機制,有點怪怪,再研究。

snmplib/callback.c

  • snmp_call_callbacks: 用來執行 callback 函數。
  • snmp_register_callback: 用來註冊 callback 函數。
  • snmp_unregister_callback: 用來移除 callback 函數。

snmplib/parse.c

  • parse -> parse_compliance ->read_module_internal -> parse()。
  • parse -> parse_imports ->read_module_internal -> parse()。
  • main -> init_snmp -> netsnmp_init_mib -> netsnmp_read_module ->read_module_internal -> parse()

snmplib/read_config.c

  • read_configs() -> read_configs_optional() ->read_config_with_type_when() -> read_config()。
  • init_agent() -> init_agent_read_config() -> register_app_config_handler() -> register_config_handler() -> internal_register_config_handler() -> (*ltmp)->parse_line = parser;
  • init_agent() -> agent_module_inits.h -> init_vacm_conf() -> init_vacm_config_tokens() -> register_app_config_handler() -> .......

snmplib/mib.c(netsnmp_init_mib)

  • netsnmp_init_mib_internals: 初始化變數。
  • netsnmp_fixup_mib_directory: 修正 mib 目錄,把環境變數 HOME 替換掉 $HOME 字串。
  • netsnmp_mibindex_load: 載入 mib index,這個不知作用。
  • add_mibdir 待寫。

NETSNMP_DS_LIB_MIBDIRS

  • netsnmp_set_mib_directory: 設定 MIB 目錄。
  • snmpd 使用參數 M 用來設定 MIB 目錄。
  • netsnmp_get_mib_directory: 用來讀取 MIB 目錄。
  • 沒有使用參數 M 用來設定 MIB 目錄,則讀取環境變數 MIBDIRS。
  • 沒有環境變數 MIBDIRS,就使用 confmibdir 變數(由handle_mibs_conf()設定)。
  • 沒有confmibdir 變數,最後就使用 NETSNMP_DEFAULT_MIBDIRS($HOME/.snmp/mibs:/usr/share/snmp/mibs)。

snmplib/snmp_api.c (_init_snmp)

  • snmp_res_init(): 用來初始化 mutex 變數。

讀取 config 檔案

檔案 函數 執行
+agent/snmpd.c main init_snmp(app_name)
++snmplib/snmp_api.c init_snmp read_premib_configs
+++snmplib/read_config.c read_premib_configs read_config_files(PREMIB_CONFIG)
++++snmplib/read_config.c read_config_files read_config_files_of_type
+++++snmplib/read_config.c read_config_files_of_type read_config_files_in_path
++++++snmplib/read_config.c read_config_files_in_path read_config
+++snmplib/read_config.c read_premib_configs read_configs_optional
++++snmplib/read_config.c read_configs_optional read_config_with_type_when
+++++snmplib/read_config.c read_config_with_type_when read_config
++snmplib/snmp_api.c init_snmp read_configs
以下都相同,只差在 snmp_call_callbacks 函數,參數 SNMP_CALLBACK_PRE_READ_CONFIG 及 SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG 不同。
  • read_config_files_of_type 如果 netsnmp_getenv("SNMPCONFPATH") 有值則只讀取這個目錄下的 config 檔,不然會透過 get_configuration_directory() 來讀取 config 檔。
  • read_config_files_in_path 根據 ctmp->fileHeader 來決定要讀取的 config 檔案。
  • snmpd -C 會取消搜尋預設目錄下的 config 檔案,設定 NETSNMP_DS_LIB_DONT_READ_CONFIGS 為 1,在 read_config_files_of_type 讀取 NETSNMP_DS_LIB_DISABLE_CONFIG_LOAD 判斷,二者值皆為 6。
  • snmpd -c 會讀取自建的 config 檔案,可用分隔符號 "," 來輸入多個 config 檔案。在 read_premib_configs 內 改成 read_configs_optional() -> read_config_with_type_when() -> read_config()。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

snmptrap -M /usr/share/snmp/mibs \
-m /usr/share/snmp/mibs/SNMPv2-MIB.txt \
-v 2c -c public 192.168.150.11:162 "" 1.3.6.1.6.3.1.1.5.1
  • -M 指定 mibs 存放的位置
  • -m 載入的 mib 檔案
  • -v specifies SNMP version to use
  • -c set the community string
  • 192.168.150.11:162 snmp server ip
  • "" up-time,使用 "" 會自動抓取系統值,不然就輸入數字。
  • 1.3.6.1.6.3.1.1.5.1 oid
snmptrap -M /usr/share/snmp/mibs \
-m /usr/share/snmp/mibs/IF-MIB.txt \
-v 2c -c public 192.168.150.11 "" linkDown linkDown i 3
  • -M 指定 mibs 存放的位置
  • -m 載入的 mib 檔案
  • -v specifies SNMP version to use
  • -c set the community string
  • 192.168.150.11 snmp server ip
  • "" up-time,使用 "" 會自動抓取系統值,不然就輸入數字。
  • linkDown oid
  • linkDown i 3 輸出的值,linkDown 為 oid,i 為 integer,3 為輸出值。

參考資料


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

原始 MTK 設計 NoForwarding(IsolateInterStaTraffic) 是用來做同一個 SSID 內的 client 不能互相溝通,NoForwardingBTNBSSID(IsolateInterStaTrafficBTNBSSID) 是用來做不同 SSID 的 client 不能互相溝通。

修改 rt2860v2/ap/ap_data.c
BOOLEAN APFowardWirelessStaToWirelessSta(
......
......
  if (pEntry && (pEntry->Sst == SST_ASSOC) && IS_ENTRY_CLIENT(pEntry))
  {
    bDirectForward = TRUE;
    bAnnounce = FALSE;
#if 0
    if (FromWhichBSSID == pEntry->apidx)
    {/* STAs in same SSID */
      if ((pAd->ApCfg.MBSSID[pEntry->apidx].IsolateInterStaTraffic == 1))
      {
        bDirectForward = FALSE;
        bAnnounce = FALSE;
      }
    }
    else
    {/* STAs in different SSID */
      if (pAd->ApCfg.IsolateInterStaTrafficBTNBSSID == 1 ||
        ((FromWhichBSSID < MAX_MBSSID_NUM(pAd)) &&
        (FromWhichBSSID < HW_BEACON_MAX_NUM) &&
        (pAd->ApCfg.MBSSID[pEntry->apidx].VLAN_VID != pAd->ApCfg.MBSSID[FromWhichBSSID].VLAN_VID)))
        /* destination VLAN ID != source VLAN ID */
      {
        bDirectForward = FALSE;
        bAnnounce = FALSE;
      }
    }
#else
    if ((pAd->ApCfg.MBSSID[FromWhichBSSID].IsolateInterStaTraffic == 1) || (pAd->ApCfg.MBSSID[pEntry->apidx].IsolateInterStaTraffic == 1))
    {
      bDirectForward = FALSE;
      bAnnounce = FALSE;
    }
#endif
  }
......
......

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

整合

  • 記得先將 gmp 整合到 SDK。
  • 將 strongswan-5.3.5.tar.gz 解壓到 user 目錄。
  • 修改 user/Makefile,在 # application 下面新增一行。
    # application
    app_y += strongswan-5.3.5
    
  • 修改 user/Makefile,在 prepare: 下面新增數行。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

修改 Makefile

  • CFLAGS:=-Wall -Wunused -Werror 改成 CFLAGS:=-Wall -Wunused
  • CC:=gcc 改成 CC:=/opt/buildroot-gcc342/bin/mipsel-linux-gcc
  • KERNEL_INCLUDES?=include/ 改成 KERNEL_INCLUDES?=../../linux-2.6.36.x/include/

build code

  • 修改 Makefile
  • 修改 extensions/ebt_ip6.c 把 EBT_IP6_ICMP6 相關程式碼移除
  • make
  • make static

install

  • 把 ethertypes 拷貝到 /etc/ethertypes
  • make static 後會產生一個 static 的執行檔,可以直接執行不用其它 .so 檔。
  • ebtables 為另一個執行檔,需要 .so 檔,把 extensions/*.so 拷貝到 /lib 即可。

問題排解

/opt/buildroot-gcc342/bin/mipsel-linux-gcc -Wall -Wunused -Werror -fPIC -O3 -DPROGVERSION=\"2.0.10-4\" -DPROGNAME=\"ebtables\" -DPROGDATE=\"December\ 2011\" -D_PATH_ETHERTYPES=\"/etc/ethertypes\" -DEBTD_ARGC_MAX=50 -DEBTD_CMDLINE_MAXLN=2048 -DLOCKFILE=\"/var/lib/ebtables/lock\" -DLOCKDIR=\"/var/lib/ebtables/\" -c -o extensions/ebt_nat.o extensions/ebt_nat.c -I/home/enos/FGN-R3/RT288x_SDK/source/linux-2.6.36.x/include/
extensions/ebt_nat.c: In function `parse_s':
extensions/ebt_nat.c:95: warning: 'tmp' might be used uninitialized in this function
make: *** [extensions/ebt_nat.o] Error 1
CFLAGS:=-Wall -Wunused -Werror 改成 CFLAGS:=-Wall -Wunused
/opt/buildroot-gcc342/bin/mipsel-linux-gcc -Wall -Wunused -fPIC -O3 -DPROGVERSION=\"2.0.10-4\" -DPROGNAME=\"ebtables\" -DPROGDATE=\"December\ 2011\" -D_PATH_ETHERTYPES=\"/etc/ethertypes\" -DEBTD_ARGC_MAX=50 -DEBTD_CMDLINE_MAXLN=2048 -DLOCKFILE=\"/var/lib/ebtables/lock\" -DLOCKDIR=\"/var/lib/ebtables/\" -c -o extensions/ebt_ip6.o extensions/ebt_ip6.c -I/home/enos/FGN-R3/RT288x_SDK/source/linux-2.6.36.x/include/
extensions/ebt_ip6.c: In function `parse':
extensions/ebt_ip6.c:369: error: `EBT_IP6_ICMP6' undeclared (first use in this function)
extensions/ebt_ip6.c:369: error: (Each undeclared identifier is reported only once
extensions/ebt_ip6.c:369: error: for each function it appears in.)
extensions/ebt_ip6.c:373: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:373: error: structure has no member named `icmpv6_code'
extensions/ebt_ip6.c: In function `final_check':
extensions/ebt_ip6.c:430: error: `EBT_IP6_ICMP6' undeclared (first use in this function)
extensions/ebt_ip6.c: In function `print':
extensions/ebt_ip6.c:488: error: `EBT_IP6_ICMP6' undeclared (first use in this function)
extensions/ebt_ip6.c:492: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:492: error: structure has no member named `icmpv6_code'
extensions/ebt_ip6.c: In function `compare':
extensions/ebt_ip6.c:536: error: `EBT_IP6_ICMP6' undeclared (first use in this function)
extensions/ebt_ip6.c:537: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:537: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:538: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:538: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:539: error: structure has no member named `icmpv6_code'
extensions/ebt_ip6.c:539: error: structure has no member named `icmpv6_code'
extensions/ebt_ip6.c:540: error: structure has no member named `icmpv6_code'
extensions/ebt_ip6.c:540: error: structure has no member named `icmpv6_code'
make: *** [extensions/ebt_ip6.o] Error 1
由於 linux-2.6.36.x 不支援 EBT_IP6_ICMP6,所以必須把 EBT_IP6_ICMP6 相關程式碼移除。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

其實很簡單,只要把 wanif 加入 bridge 再把 ipv4 protocol 全擋掉即可。

如果只是單純把 wanif 加入 bridge 會造成 ipv6 通,但 ipv4 不通。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

iwpriv rai0 set AutoChannelSel=1

rlt_wifi/common/scan.c scan_ch_restore APStartUp()
rlt_wifi/ap/ap.c APStartUp mt76x2_calibration
rlt_wifi/chips/mt76x2.c mt76x2_calibration
rlt_wifi/ap/ap_autoChSel.c SelectBestChannel SelectClearChannelApCnt()
rlt_wifi/ap/ap_autoChSel.c SelectClearChannelApCnt ...

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

RT288x_SDK\source\linux-2.6.36.x\drivers\net\raeth\raether.c,esw_link_status_changed()←esw_interrupt()←request_irq(SURFBOARDINT_ESW, esw_interrupt, IRQF_DISABLED, "Ralink_ESW", dev)。


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

下載檔案

環境設定

  • export PKG_CONFIG_PATH=/opt/wget/lib/pkgconfig/
  • export PATH=/opt/buildroot-gcc342/bin:$PATH
  • export CC=/opt/buildroot-gcc342/bin/mipsel-linux-gcc
  • export CXX=/opt/buildroot-gcc342/bin/mipsel-linux-g++
  • export AR=/opt/buildroot-gcc342/bin/mipsel-linux-ar
  • export AS=/opt/buildroot-gcc342/bin/mipsel-linux-as
  • export NM=/opt/buildroot-gcc342/bin/mipsel-linux-nm
  • export LD=/opt/buildroot-gcc342/bin/mipsel-linux-ld
  • export STRIP=/opt/buildroot-gcc342/bin/mipsel-linux-strip
  • export RANLIB=/opt/buildroot-gcc342/bin/mipsel-linux-ranlib

編譯 zlib-1.2.8

  • ./configure --static --prefix=/opt/wget
  • make
  • sudo make install

編譯 openssl-1.0.2d

  • single-threading
    ./Configure dist no-asm no-shared --prefix=/opt/wget
  • multi-threading

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

iperf 2.0.5

  • configure 沒問題
    ac_cv_func_malloc_0_nonnull=yes \
    ./configure --build=i686-linux --host=mipsel-linux \
    CFLAGS=-static CXXFLAGS=-static \
    CC=/opt/buildroot-gcc342/bin/mipsel-linux-gcc \
    CXX=/opt/buildroot-gcc342/bin/mipsel-linux-g++ \
    STRIP=/opt/buildroot-gcc342/bin/mipsel-linux-strip \
    RANLIB=/opt/buildroot-gcc342/bin/mipsel-linux-ranlib
           
    
  • make 沒問題
    $make
    
  • make 出錯是因為少做了 ac_cv_func_malloc_0_nonnull=yes
    $make
    make  all-recursive
    make[1]: Entering directory `/home/enos/iperf-2.0.5'
    Making all in compat
    .... 略
    .... 略
    .... 略
    /opt/buildroot-gcc342/bin/mipsel-linux-g++ -Wall -O2    -o iperf -O2  -pthread  -DHAVE_CONFIG_H Client.o Extractor.o Launch.o List.o Listener.o Locale.o PerfSocket.o ReportCSV.o ReportDefault.o Reporter.o Server.o Settings.o SocketAddr.o gnu_getopt.o gnu_getopt_long.o main.o service.o sockets.o stdio.o tcp_window_size.o ../compat/libcompat.a 
    ReportCSV.o: In function `CSV_peer':ReportCSV.c:(.text+0x28): undefined reference to `rpl_malloc'
    Reporter.o: In function `InitMulti':Reporter.c:(.text+0x7c): undefined reference to `rpl_malloc'
    :Reporter.c:(.text+0x128): undefined reference to `rpl_malloc'
    Reporter.o: In function `InitReport':Reporter.c:(.text+0x834): undefined reference to `rpl_malloc'
    :Reporter.c:(.text+0xa34): undefined reference to `rpl_malloc'
    Reporter.o:Reporter.c:(.text+0xe18): more undefined references to `rpl_malloc' follow
    collect2: ld returned 1 exit status
    make[2]: *** [iperf] Error 1
    make[2]: Leaving directory `/home/enos/iperf-2.0.5/src'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/enos/iperf-2.0.5'
    make: *** [all] Error 2
           
    

iperf 3.0.11

  • 修改 src/Makefile.in
    --- iperf-3.0.11-old/src/Makefile.in    2015-01-10 01:44:11.000000000 +0800
    +++ iperf-3.0.11-new/src/Makefile.in    2015-08-18 11:40:03.619391694 +0800
    @@ -593,9 +593,9 @@
     iperf3_profile_SOURCES = main.c \
                                                      $(libiperf_la_SOURCES)
    -iperf3_profile_CFLAGS = -pg -g
    +iperf3_profile_CFLAGS = -g
     iperf3_profile_LDADD = libiperf.la
    -iperf3_profile_LDFLAGS = -pg -g
    +iperf3_profile_LDFLAGS = -g
     # Specify the sources and various flags for the test cases
     t_timer_SOURCES = t_timer.c
           
    
  • configure 沒問題
    ./configure --build=i686-linux --host=mipsel-linux \
    --disable-shared --enable-static \
    CC=/opt/buildroot-gcc342/bin/mipsel-linux-gcc \
    CXX=/opt/buildroot-gcc342/bin/mipsel-linux-g++ \
    STRIP=/opt/buildroot-gcc342/bin/mipsel-linux-strip \
    RANLIB=/opt/buildroot-gcc342/bin/mipsel-linux-ranlib \
    OBJDUMP=/opt/buildroot-gcc342/bin/mipsel-linux-objdump \
    AR=/opt/buildroot-gcc342/bin/mipsel-linux-ar
           
    
  • 修改 src/iperf_api.c,由於 Ralink SDK 不支援 affinity,所以直接取消這個功能。
    --- iperf-3.0.11-old/src/iperf_api.c     2015-01-10 01:44:11.000000000 +0800
    +++ iperf-3.0.11-new/src/iperf_api.c    2015-08-18 11:29:33.067193354 +0800
    @@ -2614,7 +2614,7 @@
     int
     iperf_setaffinity(int affinity)
     {
    -#ifdef linux
    +#if 0
         cpu_set_t cpu_set;
         CPU_ZERO(&cpu_set);
    @@ -2633,7 +2633,7 @@
     int
     iperf_clearaffinity(void)
     {
    -#ifdef linux
    +#if 0
         cpu_set_t cpu_set;
         int i;
           
    
  • 修改 src/tcp_info.c。
    --- iperf-3.0.11-old/src/tcp_info.c     2015-01-10 01:44:11.000000000 +0800
    +++ iperf-3.0.11-new/src/tcp_info.c     2015-08-18 11:51:54.431410178 +0800
    @@ -46,7 +46,6 @@
     #include 
            
            #include 
            #include 
            -#include 
            #include 
            #include 
            #include
    
  • make 沒問題
    $make
    
  • make 出錯,請修正 src/iperf_api.c。
    $ make
    Making all in src
    make[1]: Entering directory `/home/enos/iperf-3.0.11/src'
    make  all-am
    make[2]: Entering directory `/home/enos/iperf-3.0.11/src'
    /bin/sh ../libtool  --tag=CC   --mode=compile /opt/buildroot-gcc342/bin/mipsel-linux-gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT cjson.lo -MD -MP -MF .deps/cjson.Tpo -c -o cjson.lo cjson.c
    libtool: compile:  /opt/buildroot-gcc342/bin/mipsel-linux-gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT cjson.lo -MD -MP -MF .deps/cjson.Tpo -c cjson.c -o cjson.o
    mv -f .deps/cjson.Tpo .deps/cjson.Plo
    /bin/sh ../libtool  --tag=CC   --mode=compile /opt/buildroot-gcc342/bin/mipsel-linux-gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_api.lo -MD -MP -MF .deps/iperf_api.Tpo -c -o iperf_api.lo iperf_api.c
    libtool: compile:  /opt/buildroot-gcc342/bin/mipsel-linux-gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_api.lo -MD -MP -MF .deps/iperf_api.Tpo -c iperf_api.c -o iperf_api.o
    iperf_api.c: In function `iperf_setaffinity':
    iperf_api.c:2618: error: `cpu_set_t' undeclared (first use in this function)
    iperf_api.c:2618: error: (Each undeclared identifier is reported only once
    iperf_api.c:2618: error: for each function it appears in.)
    iperf_api.c:2618: error: parse error before "cpu_set"
    iperf_api.c:2620: warning: implicit declaration of function `CPU_ZERO'
    iperf_api.c:2620: error: `cpu_set' undeclared (first use in this function)
    iperf_api.c:2621: warning: implicit declaration of function `CPU_SET'
    iperf_api.c:2622: warning: implicit declaration of function `sched_setaffinity'
    iperf_api.c: In function `iperf_clearaffinity':
    iperf_api.c:2637: error: `cpu_set_t' undeclared (first use in this function)
    iperf_api.c:2637: error: parse error before "cpu_set"
    iperf_api.c:2640: error: `cpu_set' undeclared (first use in this function)
    iperf_api.c:2641: error: `CPU_SETSIZE' undeclared (first use in this function)
    make[2]: *** [iperf_api.lo] Error 1
    make[2]: Leaving directory `/home/enos/iperf-3.0.11/src'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/enos/iperf-3.0.11/src'
    make: *** [all-recursive] Error 1
           
    
  • make 出錯,請修正 src/Makefile.in。
    $ make
    Making all in src
    make[1]: Entering directory `/home/enos/iperf-3.0.11-new/src'
    make  all-am
    make[2]: Entering directory `/home/enos/iperf-3.0.11-new/src'
    .... 略
    .... 略
    .... 略
    libtool: link: /opt/buildroot-gcc342/bin/mipsel-linux-gcc -pg -g -g -O2 -Wall -pg -g -o iperf3_profile iperf3_profile-main.o iperf3_profile-cjson.o iperf3_profile-iperf_api.o iperf3_profile-iperf_error.o iperf3_profile-iperf_client_api.o iperf3_profile-iperf_locale.o iperf3_profile-iperf_server_api.o iperf3_profile-iperf_tcp.o iperf3_profile-iperf_udp.o iperf3_profile-iperf_util.o iperf3_profile-net.o iperf3_profile-tcp_info.o iperf3_profile-tcp_window_size.o iperf3_profile-timer.o iperf3_profile-units.o  ./.libs/libiperf.a
    /opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/bin/ld: gcrt1.o: No such file: No such file or directory
    collect2: ld returned 1 exit status
    make[2]: *** [iperf3_profile] Error 1
    make[2]: Leaving directory `/home/enos/iperf-3.0.11-new/src'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/enos/iperf-3.0.11-new/src'
    make: *** [all-recursive] Error 1
           
    

參考資料


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

ralink 有一個試範專案為 hello_world,不懂的話可以參考它的 Makefile。由於主要的變數都直接從 user/Makefile 繼承而來,所以都可以直接使用,不用宣告,讓 Makefile 變得很乾淨。

  • 修改 source/config/config.in,參考 "Hello World Example",在 make menuconfig 時出現一個選項。
  • 修改 source/user/Makefile,參考 "CONFIG_USER_HELLO_WORLD",在做 make user_only 才會一起編譯。
  • 把你的專案拷貝到 user 目錄下,並參考 source/user/hello_world/Makefile 去修改。
  • Makefile 主要是新增一個 romfs 把執行檔拷貝到執行目錄,另外可以使用 echo "test" >> $(ROMFSDIR)/etc_ro/rcS,讓程式一開機就執行。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

今天在測試 VPN Passthrough,發現找不到 ip_conntrack_pptp.ko。google 了半天也找不到資料,在 linux menuconfig 也找不到相關設定,最後只找到一個 PPTP protocol support,死馬當活馬醫,結果編出來變成 nf_conntrack_pptp.ko。最後去 google nf_conntrack_pptp.ko+ip_conntrack_pptp.ko 才知道兩者是一樣的東西,主要是 net/netfilter/Kconfig 的名稱變成 CONFIG_NF_CONNTRACK 而不是 CONFIG_NF_CONNTRACK_SUPPORT,所以造成抓錯檔了。

  • [*] Networking support --->
  •   Network options --->
  •     [*] Network packet filtering framework (Netfilter) --->
  •       [*] Advanced netfilter configuration
  •       Core Netfilter Configuration --->
  •         [*] Netfilter connection tracking support
  •         [M] PPTP protocol support
修改 user/rt2880_app/scripts/vpn-passthru.sh
--- user-old/rt2880_app/scripts/vpn-passthru.sh 2015-07-31 14:31:13.158474337 +0800
+++ user/rt2880_app/scripts/vpn-passthru.sh     2015-07-31 14:31:49.765942167 +0800
@@ -9,7 +9,7 @@


 # note: they must be removed in order
-if [ "$CONFIG_NF_CONNTRACK_SUPPORT" = "y" ]; then
+if [ "$CONFIG_NF_CONNTRACK" = "y" ]; then
        rmmod nf_nat_pptp 1>/dev/null 2>&1
        rmmod nf_conntrack_pptp 1>/dev/null 2>&1
        rmmod nf_nat_proto_gre 1>/dev/null 2>&1
@@ -20,7 +20,7 @@
 fi

 if [ "$pptp_pt" = "1" -o "$l2tp_pt" = "1" -o "$ipsec_pt" = "1" ]; then
-if [ "$CONFIG_NF_CONNTRACK_SUPPORT" = "y" ]; then
+if [ "$CONFIG_NF_CONNTRACK" = "y" ]; then
        insmod -q nf_conntrack_proto_gre
        insmod -q nf_nat_proto_gre

另外因為 VPN Passthrough 全都是用 nf_conntrack_proto_gre.ko 及 nf_nat_proto_gre.ko 來管理,所以只要開啟一個等於三個全都通。要單獨開啟一個選項,就變成要從 firewall 去禁止另一個 portocol。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

iptables -A web_filter -p tcp -m tcp -m webstr --url  yahoo -j REJECT --reject-with tcp-reset
iptables: No chain/target/match by that name.
今天在測試鎖 URL 功能時一直出現錯誤 "No chain/target/match by that name",我想應該還是 kernel 沒開權限的問題,果然 bingo。
  • [*] Networking support --->
  •   Network options --->
  •     [*] Network packet filtering framework (Netfilter) --->
  •       [*] Advanced netfilter configuration
  •       Core Netfilter Configuration --->
  •         [*] "webstr" match support

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

iptables -A macipport_filter -m mac --mac-source 40:8D:5C:16:20:54 -j DROP
iptables: No chain/target/match by that name.
今天在測試鎖 mac 功能時一直出現錯誤 "No chain/target/match by that name",google 也找不到答案,突然想到會不會是 kernel 沒開權限,果然 bingo。
  • [*] Networking support --->
  •   Network options --->
  •     [*] Network packet filtering framework (Netfilter) --->
  •       Core Netfilter Configuration --->
  •         [*] "mac" address match support

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

編譯步驟

  • ----- 解壓 --------
  • cd toolchain
  • tar jxvf buildroot-gcc463-src.tar.bz2
  • cd buildroot-2012.11.1
  • ----- 修正 gcc bug --------
  • cd dl
  • tar jxvf gcc-4.6.3.tar.bz2
  • vi gcc-4.6.3/gcc/ira-int.h
    --- gcc-4.6.3-old/gcc/ira-int.h 2015-07-27 12:51:58.898656272 +0800
    +++ gcc-4.6.3/gcc/ira-int.h     2015-07-27 12:53:33.644588455 +0800
    @@ -1123,8 +1123,13 @@
     ira_allocno_object_iter_cond (ira_allocno_object_iterator *i, ira_allocno_t a,
                                  ira_object_t *o)
     {
    -  *o = ALLOCNO_OBJECT (a, i->n);
    -  return i->n++ < ALLOCNO_NUM_OBJECTS (a);
    +  int n = i->n++;
    +  if (n < ALLOCNO_NUM_OBJECTS (a))
    +    {
    +      *o = ALLOCNO_OBJECT (a, n);
    +      return true;
    +    }
    +  return false;
     }
    
     /* Loop over all objects associated with allocno A.  In each
    
  • rm gcc-4.6.3.tar.bz2
  • tar cjvf gcc-4.6.3.tar.bz2 gcc-4.6.3
  • cd ..
  • ----- 安裝所需套件 --------
  • sudo apt-get install make gcc g++ bison flex gettext unzip
  • wget http://ftp.gnu.org/gnu/texinfo/texinfo-4.13a.tar.gz
  • tar zxvf texinfo-4.13a.tar.gz
  • cd texinfo-4.13
  • ./configure
  • make
  • sudo make install
  • cd ..
  • ----- 開始編譯 --------
  • sudo make clean
  • sudo make
  • sudo mv /opt/buildroot-gcc463/usr /opt/buildroot-gcc342
  • cd ..
  • ----- build mksquash_lzma --------
  • vi mksquash_lzma-3.2/squashfs3.2-r2/squashfs-tools/Makefile
    --- mksquash_lzma-3.2-old/squashfs3.2-r2/squashfs-tools/Makefile        2015-07-27 15:22:39.617734535 +0800
    +++ mksquash_lzma-3.2/squashfs3.2-r2/squashfs-tools/Makefile    2015-07-27 15:23:24.100545345 +0800
    @@ -7,7 +7,7 @@
     DebugFlags = -g -Wall -Wno-unused-variable -O0 -UNDEBUG
     endif
     CFLAGS += -I${Sqlzma} -D_REENTRANT -DNDEBUG ${DebugFlags}
    -LDLIBS += -lz -L${LzmaAlone} -L${LzmaC}
    +LDLIBS += -L${LzmaAlone} -L${LzmaC}
     Tgt = mksquashfs unsquashfs
    
     all: ${Tgt}
    @@ -21,14 +21,14 @@
            ${Sqlzma}/sqlzma.h ${Sqlzma}/sqmagic.h \
            ${LzmaAlone}/liblzma_r.a ${LzmaC}/libunlzma_r.a
    
    -mksquashfs: LDLIBS += -lpthread -lunlzma_r -llzma_r -lstdc++
    +mksquashfs: LDLIBS += -lpthread -lunlzma_r -llzma_r -lstdc++ -lz -lm
     mksquashfs: mksquashfs.o read_fs.o sort.o
    
     unsquashfs.o: CFLAGS += -U_REENTRANT
     unsquashfs.o: unsquashfs.c squashfs_fs.h read_fs.h global.h \
            ${Sqlzma}/sqlzma.h ${Sqlzma}/sqmagic.h ${LzmaC}/libunlzma.a
    
    -unsquashfs: LDLIBS += -lunlzma
    +unsquashfs: LDLIBS += -lunlzma -lz
     unsquashfs: unsquashfs.o
    
     clean:
    
  • cd mksquash_lzma-3.2
  • make
  • sudo make install
  • cd ..
  • ----- build lzma --------
  • tar zxvf lzma-4.32.7.tar.gz
  • cd lzma-4.32.7
  • ./configure --prefix=/opt/lzma
  • make
  • sudo make install
  • cd ..
  • ----- 修正 new lzma Makefile bug --------
  • cd ../source
  • vi vendors/Ralink/MT7620/Makefile
    --- vendors-old/Ralink/MT7620/Makefile  2015-07-30 16:18:43.458566161 +0800
    +++ vendors/Ralink/MT7620/Makefile      2015-07-30 14:11:38.416326082 +0800
    @@ -150,7 +150,7 @@
    
     image: mkimage
            $(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S $(ROOTDIR)/$(LINUXDIR)/vmlinux  $(KERNELZ)
    -       cd $(IMAGEDIR) ; rm -f $(KERNELZ).*; $(COMP) -9 -f -S .$(COMP) $(KERNELZ)
    +       cd $(IMAGEDIR) ; rm -f $(KERNELZ).*; /opt/lzma/bin/$(COMP) -9 -f -S .$(COMP) $(KERNELZ)
    
     ifeq   ($(CONFIG_BLK_DEV_INITRD),)
     ifeq   ($(CONFIG_ROOTFS_IN_FLASH_NO_PADDING),)
    
  • ----- 修正 busybox Makefile --------
  • vi user/busybox/Makefile
    --- user-old/busybox/Makefile   2015-07-27 13:47:37.904017728 +0800
    +++ user/busybox/Makefile       2015-07-27 13:49:20.712446619 +0800
    @@ -418,7 +418,7 @@
     -include $(srctree)/arch/$(ARCH)/Makefile
     export KBUILD_DEFCONFIG
    
    -config %config: scripts_basic outputmakefile FORCE
    +%config: scripts_basic outputmakefile FORCE
            $(Q)mkdir -p include
            $(Q)$(MAKE) $(build)=scripts/kconfig $@
            $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease
    
  • ----- 修正 uClibc++ _associative_citer bug --------
  • vi uClibc++/include/associative_base
    --- uClibc++_old/include/associative_base       2015-07-27 14:34:10.973985418 +0800
    +++ uClibc++/include/associative_base   2015-07-27 14:37:23.036954612 +0800
    @@ -320,7 +320,7 @@
            typedef std::list listtype;
    
            typename listtype::iterator base_iter;
    -       typedef _associative_citer _associative_citer;
    +       typedef _associative_citer __associative_citer;
    
    
     public:
    @@ -349,13 +349,13 @@
            bool operator==(const _associative_iter & m) const{
                    return m.base_iter == base_iter;
            }
    -       bool operator==(const _associative_citer & m) const{
    +       bool operator==(const __associative_citer & m) const{
                    return m.base_iter == base_iter;
            }
            bool operator!=(const _associative_iter & m) const{
                    return m.base_iter != base_iter;
            }
    -       bool operator!=(const _associative_citer & m) const{
    +       bool operator!=(const __associative_citer & m) const{
                    return m.base_iter != base_iter;
            }
            _associative_iter & operator++(){
    @@ -380,8 +380,8 @@
                    --base_iter;
                    return temp;
            }
    -       operator _associative_citer() const{
    -               return _associative_citer(base_iter);
    +       operator __associative_citer() const{
    +               return __associative_citer(base_iter);
            }
            typename listtype::iterator base_iterator(){
                    return base_iter;
    

問題排解

  • $ make
    The program 'make' can be found in the following packages:
     * make
     * make-guile
    Try: sudo apt-get install
    
    解決方法: sudo apt-get install make
  • $ sudo make
    /bin/bash: gcc: command not found
    /bin/bash: line 0: test: -lt: unary operator expected
    mkdir -p /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/target
    if ! [ -d "/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/target/bin" ]; then \
            if [ -d "/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/system/skeleton" ]; then \
                    cp -fa /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/system/skeleton/* /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/target/; \
            fi; \
    fi
    cp support/misc/target-dir-warning.txt /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
    find /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/target -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf
    find /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/target -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf
    touch /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/build/.root
    
    You must install 'gcc' on your build machine
    
    support/dependencies/dependencies.mk:24: recipe for target 'core-dependencies' failed
    make: *** [core-dependencies] Error 1
    
    解決方法: sudo apt-get install gcc
  • $ sudo make
    
    You may have to install 'g++' on your build machine
    
    
    You must install 'bison' on your build machine
    
    
    support/dependencies/dependencies.mk:24: recipe for target 'core-dependencies' failed
    make: *** [core-dependencies] Error 1
    
    解決方法: sudo apt-get install g++ bison
  • $ sudo make
    
    You must install 'flex' on your build machine
    
    
    support/dependencies/dependencies.mk:24: recipe for target 'core-dependencies' failed
    make: *** [core-dependencies] Error 1
    
    解決方法: sudo apt-get install flex
  • $ sudo make
    
    You must install 'msgfmt' on your build machine
    msgfmt is usually part of the gettext package in your distribution
    
    support/dependencies/dependencies.mk:24: recipe for target 'core-dependencies' failed
    make: *** [core-dependencies] Error 1
    
    解決方法: sudo apt-get install gettext
  • $ sudo make
    
    You must install 'makeinfo' on your build machine
    makeinfo is usually part of the texinfo package in your distribution
    
    support/dependencies/dependencies.mk:24: recipe for target 'core-dependencies' failed
    make: *** [core-dependencies] Error 1
    
    解決方法: sudo apt-get install texinfo
  • $ sudo make
    
    You must install 'unzip' on your build machine
    
    
    support/dependencies/dependencies.mk:24: recipe for target 'core-dependencies' failed
    make: *** [core-dependencies] Error 1
    
    解決方法: sudo apt-get install unzip
  • /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3/gcc/doc/service.texi:6: warning: node up `Service' in menu `Bugs' and in sectioning `Top' differ
    Makefile:4270: recipe for target 'doc/gcc.info' failed
    make[2]: *** [doc/gcc.info] Error 1
    rm gcc.pod
    make[2]: Leaving directory '/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3-initial/gcc'
    Makefile:5252: recipe for target 'all-gcc' failed
    make[1]: *** [all-gcc] Error 2
    make[1]: Leaving directory '/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3-initial'
    toolchain/gcc/gcc-uclibc-4.x.mk:318: recipe for target '/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3-initial/.compiled' failed
    make: *** [/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3-initial/.compiled] Error 2
    
    這個主要是 apt-get install texinfo 的版本是 5.2.0,而 gcc 4.6.3 當時的環境是用 texinfo 4.x 的版本,但是很不幸的是 texinfo 4.x 跟 5.x 並不相容,所以只能安裝舊版本才能解決。
  • *** Error in `/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3-intermediate/./gcc/cc1': double free or corruption (fasttop): 0x00000000028cf280 ***
    /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3/libgcc/../gcc/libgcc2.c: In function '__muldi3':
    /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3/libgcc/../gcc/libgcc2.c:558:1: internal compiler error: Aborted
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See  for instructions.
    Makefile:377: recipe for target '_muldi3.o' failed
    make[2]: *** [_muldi3.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3/libgcc/../gcc/libgcc2.c: In function '__negdi2':
    /home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3/libgcc/../gcc/libgcc2.c:72:1: internal compiler error: Segmentation fault
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See  for instructions.
    Makefile:377: recipe for target '_negdi2.o' failed
    make[2]: *** [_negdi2.o] Error 1
    make[2]: Leaving directory '/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3-intermediate/mipsel-buildroot-linux-uclibc/libgcc'
    Makefile:12668: recipe for target 'all-target-libgcc' failed
    make[1]: *** [all-target-libgcc] Error 2
    make[1]: Leaving directory '/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3-intermediate'
    toolchain/gcc/gcc-uclibc-4.x.mk:383: recipe for target '/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3-intermediate/.compiled' failed
    make: *** [/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/output/toolchain/gcc-4.6.3-intermediate/.compiled] Error 2
    
    解決方法: 修正 gcc bug
  • terminal.o:/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/texinfo-4.13/info/terminal.c:272: more undefined references to `tputs' follow
    collect2: error: ld returned 1 exit status
    Makefile:556: recipe for target 'ginfo' failed
    make[3]: *** [ginfo] Error 1
    make[3]: Leaving directory '/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/texinfo-4.13/info'
    Makefile:496: recipe for target 'all' failed
    make[2]: *** [all] Error 2
    make[2]: Leaving directory '/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/texinfo-4.13/info'
    Makefile:516: recipe for target 'all-recursive' failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory '/home/enos/RT288x_SDK/toolchain/buildroot-2012.11.1/texinfo-4.13'
    Makefile:455: recipe for target 'all' failed
    make: *** [all] Error 2
    
    解決方法: 重新做 ./configure make clean make 即可。
  • make[3]: Entering directory '/home/enos/RT288x_SDK/source/user/busybox'
    Makefile:1262: *** mixed implicit and normal rules: deprecated syntax
    /home/enos/RT288x_SDK/source/user/busybox/Makefile:421: *** mixed implicit and normal rules: deprecated syntax
    /home/enos/RT288x_SDK/source/user/busybox/Makefile:1262: *** mixed implicit and normal rules: deprecated syntax
    make[4]: *** No rule to make target 'silentoldconfig'.  Stop.
    Makefile:497: recipe for target 'include/autoconf.h' failed
    make[3]: *** [include/autoconf.h] Error 2
    make[3]: Leaving directory '/home/enos/RT288x_SDK/source/user/busybox'
    Makefile:177: recipe for target 'busybox' failed
    make[2]: *** [busybox] Error 2
    make[2]: Leaving directory '/home/enos/RT288x_SDK/source/user'
    Makefile:169: recipe for target 'all' failed
    make[1]: *** [all] Error 2
    make[1]: Leaving directory '/home/enos/RT288x_SDK/source/user'
    Makefile:427: recipe for target 'user_only' failed
    make: *** [user_only] Error 2
    
    解決方法: 修正 busybox Makefile
  • /opt/buildroot-gcc342/bin/mipsel-linux-g++ -fno-builtin -nostdinc++ -DGCC_HASCLASSVISIBILITY -I../include -Wall -Wno-trigraphs -pedantic -ansi -O0 -g3 -fPIC -o map.o -c map.cpp
    In file included from ../include/map:26:0,
                     from map.cpp:20:
    ../include/associative_base:323:60: error: declaration of 'typedef class std::_associative_citer std::_associative_iter::_associative_citer' [-fpermissive]
    ../include/associative_base:242:65: error: changes meaning of '_associative_citer' from 'class std::_associative_citer' [-fpermissive]
    Makefile:74: recipe for target 'map.o' failed
    make[2]: *** [map.o] Error 1
    make[2]: Leaving directory '/home/enos/RT288x_SDK/source/uClibc++/src'
    Makefile:16: recipe for target 'all' failed
    make[1]: *** [all] Error 2
    make[1]: Leaving directory '/home/enos/RT288x_SDK/source/uClibc++'
    Makefile:427: recipe for target 'uClibc++_only' failed
    make: *** [uClibc++_only] Error 2
    
    解決方法: 修正 uClibc++ _associative_citer bug
  • "/opt/buildroot-gcc342/bin"/mipsel-linux-gcc -Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,defs -nodefaultlibs -shared -Wl,-soname,libstdc++.so.0 `echo ""` -o libstdc++-0.2.2.so algorithm.o iomanip.o streambuf.o numeric.o map.o fstream.o bitset.o eh_alloc.o set.o new_op.o ostream.o char_traits.o limits.o associative_base.o stack.o stdexcept.o eh_globals.o string.o func_exception.o new_opv.o new_opnt.o deque.o exception.o new_handler.o iostream.o queue.o locale.o list.o ios.o del_opvnt.o valarray.o del_op.o complex.o del_opv.o utility.o iterator.o new_opvnt.o sstream.o vector.o istream.o del_opnt.o abi/abi.o abi/libsupc/eh_throw.o abi/libsupc/cp-demangle.o abi/libsupc/hash_bytes.o abi/libsupc/bad_alloc.o abi/libsupc/pmem_type_info.o abi/libsupc/tinfo.o abi/libsupc/eh_terminate.o abi/libsupc/eh_personality.o abi/libsupc/dyncast.o abi/libsupc/eh_type.o abi/libsupc/vec.o abi/libsupc/guard_error.o abi/libsupc/eh_exception.o abi/libsupc/eh_unex_handler.o abi/libsupc/atexit_arm.o abi/libsupc/class_type_info.o abi/libsupc/vterminate.o abi/libsupc/pointer_type_info.o abi/libsupc/si_class_type_info.o abi/libsupc/pbase_type_info.o abi/libsupc/bad_typeid.o abi/libsupc/guard.o abi/libsupc/bad_cast.o abi/libsupc/function_type_info.o abi/libsupc/eh_term_handler.o abi/libsupc/eh_arm.o abi/libsupc/eh_call.o abi/libsupc/tinfo2.o abi/libsupc/fundamental_type_info.o abi/libsupc/eh_ptr.o abi/libsupc/enum_type_info.o abi/libsupc/eh_aux_runtime.o abi/libsupc/array_type_info.o abi/libsupc/nested_exception.o abi/libsupc/eh_catch.o abi/libsupc/vmi_class_type_info.o   -L/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-buildroot-linux-uclibc/4.6.3/ -lc -lgcc -Wl,--as-needed -lgcc_s -Wl,--no-as-needed
    /opt/buildroot-gcc342/bin/../lib/gcc/mipsel-buildroot-linux-uclibc/4.6.3/../../../../mipsel-buildroot-linux-uclibc/bin/ld: abi/libsupc/eh_throw.o: relocation R_MIPS_HI16 against `__gnu_local_gp' can not be used when making a shared object; recompile with -fPIC
    abi/libsupc/eh_throw.o: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    Makefile:64: recipe for target 'libstdc++-0.2.2.so' failed
    make[2]: *** [libstdc++-0.2.2.so] Error 1
    make[2]: Leaving directory '/home/enos/RT288x_SDK/source/uClibc++/src'
    Makefile:16: recipe for target 'all' failed
    make[1]: *** [all] Error 2
    make[1]: Leaving directory '/home/enos/RT288x_SDK/source/uClibc++'
    Makefile:427: recipe for target 'uClibc++_only' failed
    make: *** [uClibc++_only] Error 2
    
    解決方法: cd uClibc++; make menuconfig 選項 Library Installation Options ---> Build static library 及 Build only static library 二個都打勾。
  • make[1]: Entering directory '/home/enos/RT288x_SDK/source/linux-2.6.36.x'
      CHK     include/linux/version.h
      CHK     include/generated/utsrelease.h
      CALL    scripts/checksyscalls.sh
      CC      init/main.o
      CHK     include/generated/compile.h
      CC      init/version.o
      CC      init/do_mounts.o
      CC      init/do_mounts_rd.o
      CC      init/do_mounts_initrd.o
      LD      init/mounts.o
      CC      init/initramfs.o
      CC      init/calibrate.o
      LD      init/built-in.o
      HOSTCC  usr/gen_init_cpio
      GEN     usr/initramfs_data.cpio.lzma
    /home/enos/RT288x_SDK/source/linux-2.6.36.x/scripts/gen_initramfs_list.sh: line 300: /opt/buildroot-gcc342/bin/lzma_alone: No such file or directory
    /home/enos/RT288x_SDK/source/linux-2.6.36.x/usr/Makefile:65: recipe for target 'usr/initramfs_data.cpio.lzma' failed
    make[2]: *** [usr/initramfs_data.cpio.lzma] Error 1
    Makefile:893: recipe for target 'usr' failed
    make[1]: *** [usr] Error 2
    make[1]: Leaving directory '/home/enos/RT288x_SDK/source/linux-2.6.36.x'
    Makefile:346: recipe for target 'linux' failed
    make: *** [linux] Error 1
    
    解決方法: 安裝 mksquash_lzma
  • cc   mksquashfs.o read_fs.o sort.o  -lz -L/home/enos/RT288x_SDK/toolchain/mksquash_lzma-3.2/lzma443/C/7zip/Compress/LZMA_Alone -L/home/enos/RT288x_SDK/toolchain/mksquash_lzma-3.2/lzma443/C/7zip/Compress/LZMA_C -lpthread -lunlzma_r -llzma_r -lstdc++ -o mksquashfs
    /usr/bin/ld: mksquashfs.o: undefined reference to symbol 'log10@@GLIBC_2.2.5'
    /lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    : recipe for target 'mksquashfs' failed
    make[1]: *** [mksquashfs] Error 1
    make[1]: Leaving directory '/home/enos/RT288x_SDK/toolchain/mksquash_lzma-3.2/squashfs3.2-r2/squashfs-tools'
    Makefile:28: recipe for target 'all' failed
    make: *** [all] Error 2
    
    解決方法: 修正 mksquash_lzma Makefile bug

參考資料


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

$ make menuconfig
The program 'make' can be found in the following packages:
 * make
 * make-guile
Try: sudo apt-get install
解決方法: sudo apt-get install make
$ make menuconfig
Makefile:345: *** mixed implicit and normal rules: deprecated syntax
config/mkconfig > config.in
make -C /home/enos/RT288x_SDK/source/config/scripts/lxdialog all
make[1]: Entering directory '/home/enos/RT288x_SDK/source/config/scripts/lxdialog'
/bin/sh: 1: cc: not found
-e
>> Unable to find the Ncurses libraries.
>>
>> You must have Ncurses installed in order
>> to use 'make menuconfig'

Makefile:31: recipe for target 'ncurses' failed
make[1]: *** [ncurses] Error 1
make[1]: Leaving directory '/home/enos/RT288x_SDK/source/config/scripts/lxdialog'
Makefile:213: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2
解決方法: sudo apt-get install gcc libncurses5-dev
make -C /home/enos/RT288x_SDK/source/vendors/Ralink/MT7620/. dir_v=/home/enos/RT288x_SDK/source/vendors/Ralink/MT7620/. -f /home/enos/RT288x_SDK/source/vendors/vendors-common.mak image
make[2]: Entering directory '/home/enos/RT288x_SDK/source/vendors/Ralink/MT7620'
cc  -DUSE_HOSTCC -o mkimage -I/home/enos/RT288x_SDK/source/user/mkimage/include /home/enos/RT288x_SDK/source/user/mkimage/crc32.c /home/enos/RT288x_SDK/source/user/mkimage/mkimage.c
/home/enos/RT288x_SDK/source/user/mkimage/crc32.c:15:18: fatal error: zlib.h: No such file or directory
 #include "zlib.h"
                  ^
compilation terminated.
/home/enos/RT288x_SDK/source/vendors/Ralink/MT7620/./Makefile:149: recipe for target 'mkimage' failed
make[2]: *** [mkimage] Error 1
make[2]: Leaving directory '/home/enos/RT288x_SDK/source/vendors/Ralink/MT7620'
Makefile:29: recipe for target 'image' failed
make[1]: *** [image] Error 2
make[1]: Leaving directory '/home/enos/RT288x_SDK/source/vendors'
Makefile:323: recipe for target 'image' failed
make: *** [image] Error 2
解決方法: sudo apt-get install zlib1g-dev
/home/enos/RT288x_SDK/source/user/iptables-1.4.10/libtool: 1: eval: libtool_args+=: not found
/home/enos/RT288x_SDK/source/user/iptables-1.4.10/libtool: 1: eval: libtool_args+=: not found
libtool: link: /opt/buildroot-gcc342/bin/mipsel-linux-gcc  libiptc/.libs/libip4tc.so extensions/libext4.a ./.libs/libxtables.so -lm
/opt/buildroot-gcc342/bin/../mipsel-buildroot-linux-uclibc/sysroot/usr/lib/crt1.o: In function `__start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
Makefile:531: recipe for target 'iptables-multi' failed
make[5]: *** [iptables-multi] Error 1
make[5]: Leaving directory '/home/enos/RT288x_SDK/source/user/iptables-1.4.10'
Makefile:833: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '/home/enos/RT288x_SDK/source/user/iptables-1.4.10'
Makefile:385: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/enos/RT288x_SDK/source/user/iptables-1.4.10'
Makefile:177: recipe for target 'iptables-1.4.10' failed
make[2]: *** [iptables-1.4.10] Error 2
make[2]: Leaving directory '/home/enos/RT288x_SDK/source/user'
Makefile:169: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/enos/RT288x_SDK/source/user'
Makefile:427: recipe for target 'user_only' failed
make: *** [user_only] Error 2
解決方法: sudo ln -fs /bin/bash /bin/sh
Image Name:   Linux Kernel Image
Created:      Fri Jul 24 10:53:48 2015
Image Type:   MIPS Linux Kernel Image (lzma compressed)
Data Size:    4316615 Bytes = 4215.44 kB = 4.12 MB
Load Address: 0x80000000
Entry Point:  0x8000C150
Kernel Size:  0x00000000
make[2]: Leaving directory '/home/enos/RT288x_SDK/source/vendors/Ralink/MT7620'
make[1]: Leaving directory '/home/enos/RT288x_SDK/source/vendors'
cp /home/enos/RT288x_SDK/source/images/enos_uImage /tftpboot
cp: cannot create regular file ‘/tftpboot’: Permission denied
Makefile:323: recipe for target 'image' failed
解決方法: sudo mkdir /tftpboot; sudo chmod 777 /tftpboot
bison -y  -d gram.y && mv y.tab.c gram.c
/bin/sh: bison: command not found
Makefile:31: recipe for target 'gram.c' failed
make[3]: *** [gram.c] Error 127
make[3]: Leaving directory '/home/enos/RT288x_SDK/source/user/radvd-1.0'
Makefile:177: recipe for target 'radvd-1.0' failed
make[2]: *** [radvd-1.0] Error 2
make[2]: Leaving directory '/home/enos/RT288x_SDK/source/user'
Makefile:169: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/enos/RT288x_SDK/source/user'
Makefile:427: recipe for target 'user_only' failed
make: *** [user_only] Error 2
解決方法: sudo apt-get install bison
flex   scanner.l && mv lex.yy.c scanner.c
/bin/sh: flex: command not found
Makefile:28: recipe for target 'scanner.c' failed
make[3]: *** [scanner.c] Error 127
make[3]: Leaving directory '/home/enos/RT288x_SDK/source/user/radvd-1.0'
Makefile:177: recipe for target 'radvd-1.0' failed
make[2]: *** [radvd-1.0] Error 2
make[2]: Leaving directory '/home/enos/RT288x_SDK/source/user'
Makefile:169: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/enos/RT288x_SDK/source/user'
Makefile:427: recipe for target 'user_only' failed
make: *** [user_only] Error 2
解決方法: sudo apt-get install flex

ubuntu 15.04 才有的問題

make[3]: Entering directory '/home/enos/RT288x_SDK/source/user/busybox'
Makefile:1262: *** mixed implicit and normal rules: deprecated syntax
/home/enos/RT288x_SDK/source/user/busybox/Makefile:421: *** mixed implicit and normal rules: deprecated syntax
/home/enos/RT288x_SDK/source/user/busybox/Makefile:1262: *** mixed implicit and normal rules: deprecated syntax
make[4]: *** No rule to make target 'silentoldconfig'.  Stop.
Makefile:497: recipe for target 'include/autoconf.h' failed
make[3]: *** [include/autoconf.h] Error 2
make[3]: Leaving directory '/home/enos/RT288x_SDK/source/user/busybox'
Makefile:177: recipe for target 'busybox' failed
make[2]: *** [busybox] Error 2
make[2]: Leaving directory '/home/enos/RT288x_SDK/source/user'
Makefile:169: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/enos/RT288x_SDK/source/user'
Makefile:427: recipe for target 'user_only' failed
make: *** [user_only] Error 2
解決方法: vi user/busybox/Makefile
--- user-old/busybox/Makefile   2015-07-27 13:47:37.904017728 +0800
+++ user/busybox/Makefile       2015-07-27 13:49:20.712446619 +0800
@@ -418,7 +418,7 @@
 -include $(srctree)/arch/$(ARCH)/Makefile
 export KBUILD_DEFCONFIG

-config %config: scripts_basic outputmakefile FORCE
+%config: scripts_basic outputmakefile FORCE
        $(Q)mkdir -p include
        $(Q)$(MAKE) $(build)=scripts/kconfig $@
        $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease
改完記得要 make clean 再 make, 不然會有奇怪的錯誤。
## Booting image at bc050000 ...
raspi_read: from:50000 len:40
   Image Name:   Linux Kernel Image
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    5757730 Bytes =  5.5 MB
   Load Address: 80000000
   Entry Point:  8000c150
raspi_read: from:50040 len:57db22
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover
解決方法: 這個問題是在於 ubuntu 15.04 的 lzma 版本為 5.1.x,而 Ralink bootcode 的開發環境的 lzma 版本為 4.32.7,很不幸的是 lzma 的 5.x 並無法相容於 4.x,所以會造成 bootloader 無法解壓的問題。只要重新安裝 Ralink SDK 的 toolchain 目錄中的 lzma 版本即可。

台南小新 發表在 痞客邦 PIXNET 留言(1) 人氣()

參考資料


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

Kernel

  • File systems --->
  •   [*] Network File Systems --->
  •     [*] CIFS support (advanced network filesystem, SMBFS successor)
  •       [*] CIFS Statistics
  •         [*] Extended Statistics
  •       [*] CIFS Extended Attributes
  •         [*] CIFS POSIX Extentions

Busybox

  • Linux System Utilities --->
  •   [*] mount
  •     [*] Support mounting CIFS/SMB file systems

問題排解

  • # ls /mnt
    ls: can't open '/mnt': Value too large for defined data type
    
    這個問題常出現在 windows 分享的資料夾,只要在 -o 加上 "nounix,noserverino" 就可以解決問題。

參考資料


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

1 2