目前日期文章:201508 (4)

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

安裝步驟

  • sudo apt-get install dpkg-dev
    安裝 dpkg-source 指令。
  • apt-get source vsftpd

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

/etc/vsftpd.conf

listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
user_sub_token=$USER
local_root=/data/home/$USER
guest_enable=YES
guest_username=ftp
nopriv_user=ftp
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
chmod_enable=YES
write_enable=YES
local_umask=022
file_open_mode=0755
anon_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
allow_writeable_chroot=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO

/etc/pam.d/vsftpd

用來設定 vsftpd 使用的密碼檔案

auth  required  pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth  required  pam_pwdfile.so pwdfile /var/svn/account
account required pam_permit.so

參考資料

  1. ubuntu vsftpd 安裝筆記
  2. Fixing 500 OOPS: vsftpd: refusing to run with writable root inside chroot ()
  3. VSFTP + pam htpasswd + virtual users = "500 OOPS: cannot locate user entry:"
  4. vsftpd 550 Permission denied 出错解决方案
  5. FreeBSD 使用 vsftpd 的亂碼問題
  6. Changing upload permissions in vsftpd

台南小新 發表在 痞客邦 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) 人氣()