Nossiac / mtk-openwrt-feeds

mtk-openwrt-feeds
428 stars 204 forks source link

About MT7620 Antenna's INTERNAL mode and EXTERNAL mode #16

Closed chobitsos closed 6 years ago

chobitsos commented 6 years ago

Hello dear developer,This driver works very well!My only question is: I did not find the antenna mode choice when compiling the firmware.

Usually in the old driver which has the following mode selection

CONFIG_RT2860V2_SINGLE_SKU CONFIG_INTERNAL_PA_INTERNAL_LNA CONFIG_INTERNAL_PA_EXTERNAL_LNA CONFIG_EXTERNAL_PA_EXTERNAL_LNA CONFIG_RT2860V2_AP_RTMP_INTERNAL_TX_ALC CONFIG_RT2860V2_AP_RTMP_TEMPERATURE_COMPENSATION

Does your current driver support these modes?

Nossiac commented 6 years ago

The driver was built with "CONFIG_INTERNAL_PA_INTERNAL_LNA=y". If you want to customize the driver as you wish, I suggest that you build it on your own. According to the NDA, I'm not going to publish the source code here, but I believe you will be able to find it somewhere else, even on github, :-)

chobitsos commented 6 years ago

i just need CONFIG_INTERNAL_PA_INTERNAL_LNA = y :-)

namoaton commented 6 years ago

hello. Where to get precompiled mt712 driver with enabled external LNA and PA?

kennylam777 commented 6 years ago

Well, I know there is an NDA, so I am not asking for the source code.

I am asking for the building method instead :)

Driver version: mtk-openwrt-sdk-20170518-1443366e LEDE version: lede-v17.04.4 Target module: mt7620 on linux-4.4.92

What I did was

  1. Copy "mtk-openwrt-sdk-20170518-1443366e/package/ramips" to "lede/packge/ramips"
  2. Copy "mtk-openwrt-sdk-20170518-1443366e/dl/mt7620-p4rev-120998.tar.bz2" to "lede/dl/mt7620-p4rev-120998.tar.bz2"
  3. make menuconfig, select a mt7620 board , enable the mt7620 module in "MTK Properties" -> "Drivers"
  4. make package/mt7620/compile

And then I got following error message.

builder@6daa6f0816ca:/data/lede$ make package/mt7620/compile V=s
make[1]: Entering directory '/data/lede'
make[2]: Entering directory '/data/mtk-openwrt-feeds/drivers/mt7620'
. /data/lede/include/shell.sh; bzcat /data/lede/dl/mt7620-p4rev-120998.tar.bz2 | tar -C /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/ -xf - 
[ ! -d ./src/ ] || cp -fpR ./src/* /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998

Applying ./patches/001-fix-kernel-warning.patch using plaintext: 
patching file src/common/cmm_data_pci.c
patching file src/include/os/rt_drv.h
patching file src/include/os/rt_linux.h
patching file src/include/rtmp.h
patching file src/os/linux/rt_profile.c
patching file src/os/linux/rt_rbus_pci_drv.c

Applying ./patches/002-fix-insmod-fail.patch using plaintext: 
patching file src/os/linux/rt_rbus_pci_drv.c
Hunk #1 succeeded at 776 (offset 3 lines).

Applying ./patches/003-support-hwnat.patch using plaintext: 
patching file build/Makefile

Applying ./patches/025-wpa-key-mismatch.patch using plaintext: 
patching file src/ap/ap.c
patching file src/ap/ap_cfg.c
patching file src/common/cmm_profile.c
patching file src/include/rtmp.h
Hunk #1 succeeded at 1467 (offset -8 lines).
touch /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/.prepared_23bcf3a489b01103da9ceb3877dde7c4
rm -f /data/lede/staging_dir/target-mipsel_24kc_musl-1.1.16/stamp/.mt7620_installed
(cd /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/./; if [ -x ./configure ]; then find /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/ -name config.guess | xargs -r chmod u+w; find /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/ -name config.guess | xargs -r -n1 cp --remove-destination /data/lede/scripts/config.guess; find /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/ -name config.sub | xargs -r chmod u+w; find /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/ -name config.sub | xargs -r -n1 cp --remove-destination /data/lede/scripts/config.sub; AR="mipsel-openwrt-linux-musl-gcc-ar" AS="mipsel-openwrt-linux-musl-gcc -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998:mt7620-p4rev-120998 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=mipsel-openwrt-linux-musl-ld NM="mipsel-openwrt-linux-musl-gcc-nm" CC="mipsel-openwrt-linux-musl-gcc" GCC="mipsel-openwrt-linux-musl-gcc" CXX="mipsel-openwrt-linux-musl-g++" RANLIB="mipsel-openwrt-linux-musl-gcc-ranlib" STRIP=mipsel-openwrt-linux-musl-strip OBJCOPY=mipsel-openwrt-linux-musl-objcopy OBJDUMP=mipsel-openwrt-linux-musl-objdump SIZE=mipsel-openwrt-linux-musl-size CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998:mt7620-p4rev-120998 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998:mt7620-p4rev-120998 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CPPFLAGS="-I/data/lede/staging_dir/target-mipsel_24kc_musl-1.1.16/usr/include -I/data/lede/staging_dir/target-mipsel_24kc_musl-1.1.16/include -I/data/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/usr/include -I/data/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/include/fortify -I/data/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/include " LDFLAGS="-L/data/lede/staging_dir/target-mipsel_24kc_musl-1.1.16/usr/lib -L/data/lede/staging_dir/target-mipsel_24kc_musl-1.1.16/lib -L/data/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/usr/lib -L/data/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/lib -znow -zrelro "   ./configure --target=mipsel-openwrt-linux --host=mipsel-openwrt-linux --build=x86_64-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls   ; fi; )
rm -f /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/.configured_*
touch /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/.configured_yyyyyyyyyyyyy
make -C "/data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/linux-4.4.92" V=1 CROSS_COMPILE="mipsel-openwrt-linux-musl-" ARCH="mips" SUBDIRS="/data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/build/" CONFIG_RALINK_MT7620=y    CONFIG_RT2860V2_AP=y CONFIG_RT2860V2_AP_V24_DATA_STRUCTURE=y                      CONFIG_RT2860V2_AP_80211N_DRAFT3=y        CONFIG_EXTERNAL_PA_EXTERNAL_LNA=y          modules
make[3]: Entering directory '/data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/linux-4.4.92'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (        \
echo >&2;                           \
echo >&2 "  ERROR: Kernel configuration is invalid.";       \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
echo >&2 ;                          \
/bin/false)
mkdir -p /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/build//.tmp_versions ; rm -f /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/build//.tmp_versions/*
make -f ./scripts/Makefile.build obj=/data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/build/
(cat /dev/null; ) > /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/build//modules.order
make -f ./scripts/Makefile.modpost
  find /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/build//.tmp_versions -name '*.mod' | xargs -r grep -h '\.ko$' | sort -u | sed 's/\.ko$/.o/' | scripts/mod/modpost   -i ./Module.symvers -I /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/build//Module.symvers  -o /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/build//Module.symvers -S  -w  -s -T -
make[3]: Leaving directory '/data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/linux-4.4.92'
touch /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/.built
mkdir -p /data/lede/bin/targets/ramips/mt7620/packages /data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/ipkg-mipsel_24kc/kmod-mt7620/CONTROL /data/lede/staging_dir/target-mipsel_24kc_musl-1.1.16/pkginfo
ERROR: module '/data/lede/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7620/mt7620-p4rev-120998/build/mt7620.ko' is missing.
Makefile:89: recipe for target '/data/lede/bin/targets/ramips/mt7620/packages/kmod-mt7620_4.4.92+p4rev-120998-1_mipsel_24kc.ipk' failed
make[2]: *** [/data/lede/bin/targets/ramips/mt7620/packages/kmod-mt7620_4.4.92+p4rev-120998-1_mipsel_24kc.ipk] Error 1
make[2]: Leaving directory '/data/mtk-openwrt-feeds/drivers/mt7620'
package/Makefile:105: recipe for target 'package/feeds/mtk/mt7620/compile' failed
make[1]: *** [package/feeds/mtk/mt7620/compile] Error 2
make[1]: Leaving directory '/data/lede'
/data/lede/include/toplevel.mk:198: recipe for target 'package/mt7620/compile' failed
make: *** [package/mt7620/compile] Error 2
builder@6daa6f0816ca:/data/lede$

When I was compiling mt7620 on mtk-openwrt-sdk-20170518-1443366e , the message would be

......
make -f scripts/Makefile.build obj=/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-p4rev-120998/build/

make -C "/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/linux-3.10.14" V=1 CROSS_COMPILE="mipsel-openwrt-linux-uclibc-" ARCH="mips" SUBDIRS="/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-p4rev-120998/build/" CONFIG_RALINK_MT7620=y    CONFIG_RT2860V2_AP=y CONFIG_RT2860V2_AP_V24_DATA_STRUCTURE=y CONFIG_RT2860V2_AP_WSC=y CONFIG_RT2860V2_AP_WSC_V2=y   CONFIG_RT2860V2_AP_MBSS=y CONFIG_NEW_MBSSID_MODE=y CONFIG_RT2860V2_AP_APCLI=y CONFIG_RT2860V2_AP_MAC_REPEATER=y        CONFIG_RT2860V2_AP_COC=y      CONFIG_RT2860V2_AP_80211N_DRAFT3=y       CONFIG_INTERNAL_PA_EXTERNAL_LNA=y           modules
make[3]: Entering directory '/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/linux-3.10.14'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (        \
echo >&2;                           \
echo >&2 "  ERROR: Kernel configuration is invalid.";       \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
echo >&2 ;                          \
/bin/false)
mkdir -p /data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-p4rev-120998/build//.tmp_versions ; rm -f /data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-p4rev-120998/build//.tmp_versions/*
make -f scripts/Makefile.build obj=/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-p4rev-120998/build/
  mipsel-openwrt-linux-uclibc-gcc -Wp,-MD,/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-p4rev-120998/build//../src/common/.crypt_md5.o.d  -nostdinc -isystem /data/mtk-openwrt-sdk-20170518-1443366e/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/include -I/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/linux-3.10.14/arch/mips/include -Iarch/mips/include/generated  -Iinclude -I/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/linux-3.10.14/arch/mips/include/uapi -Iarch/mips/include/generated/uapi -I/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/linux-3.10.14/include/uapi -Iinclude/generated/uapi -include /data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/linux-3.10.14/include/linux/kconfig.h -D__KERNEL__ -DVMLINUX_LOAD_ADDRESS=0xffffffff80000000 -DDATAOFFSET=0 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -Wno-maybe-uninitialized -mno-check-zero-division -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -march=mips32r2 -Wa,-mips32r2 -Wa,--trap -I/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/linux-3.10.14/arch/mips/include/asm/mach-ralink -I/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/linux-3.10.14/arch/mips/include/asm/mach-generic -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -I/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-p4rev-120998/build//../src/include -I/data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-p4rev-120998/build//../src/ate/include -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT -DLINUX -Wall -Wstrict-prototypes -Wno-trigraphs -DCONFIG_AP_SUPPORT -DAP_SCAN_SUPPORT -DUAPSD_AP_SUPPORT -DUAPSD_SUPPORT -DRTMP_RBUS_SUPPORT -DRTMP_MAC_PCI -DDOT11_N_SUPPORT -DSTATS_COUNT_SUPPORT -DIAPP_SUPPORT -DDOT1X_SUPPORT -DRALINK_ATE -DRALINK_QA -DCONFIG_RT2880_ATE_CMD_NEW -DCONFIG_RA_NAT_NONE -DRT6352 -DRTMP_RF_RW_SUPPORT -DRF_BANK -DRTMP_FLASH_SUPPORT -DCONFIG_SWMCU_SUPPORT -DSPECIFIC_BCN_BUF_SUPPORT -DVCORECAL_SUPPORT -DRESOURCE_PRE_ALLOC -DENHANCED_STAT_DISPLAY -DLOFT_IQ_CAL_SUPPORT -DRTMP_TEMPERATURE_CALIBRATION -DDYNAMIC_VGA_SUPPORT -DMCS_LUT_SUPPORT -DPEER_DELBA_TX_ADAPT -DRT6352_EL_SUPPORT -DDOT11N_DRAFT3 -DWSC_AP_SUPPORT -DWSC_V2_SUPPORT -DMBSS_SUPPORT -DNEW_MBSSID_MODE -DENHANCE_NEW_MBSSID_MODE -DAPCLI_SUPPORT -DMAT_SUPPORT -DAPCLI_CONNECTION_TRIAL -DMAC_APCLI_SUPPORT -DMAC_REPEATER_SUPPORT -DGREENAP_SUPPORT -DCOC_SUPPORT -DDBG  -DMODULE -mlong-calls  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(crypt_md5)"  -D"KBUILD_MODNAME=KBUILD_STR(mt7620)" -c -o /data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-p4rev-120998/build//../src/common/crypt_md5.o /data/mtk-openwrt-sdk-20170518-1443366e/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-p4rev-120998/build//../src/common/crypt_md5.c
......kernel modules being compiled

It seems there was problem in LEDE after the line of

make -f scripts/Makefile.build obj=/***/linux-ramips_mt7620/mt7620-p4rev-120998/build/

and the module compiling was just skipped.

Nossiac commented 6 years ago

@kennylam777 according to your log, you should take a close look at 2 places:

  1. the overall build command was written in the Build/Compile section of openwrt's package makefile.
  2. the actual source code makefile was mt7620-p4rev-120998/build/Makefile.

and possible reasons:

  1. you gave a wrong path to openwrt's "Build/Compile".
  2. the driver did not configured properly so that the target was skipped/ignored. (make menuconfig)
cpktpoetkxwz commented 6 years ago

@kennylam777 @Nossiac Under the Openwrt build system, you need to build Linux before building the module. The Openwrt wiki actually states that. How to Build a Single Package

make menuconfig
make target/linux/compile
make package/mt7620/compile