You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
iansun2 0960374779 README 3 years ago
README.md README 3 years ago

README.md

編譯OpenWrt for ZTE E8820S

以版本 22.03-rc5 為例

環境建置

需要一個非ROOT但有sudo權限的使用者 系統版本建議為Ubuntu 20.04以上

sudo apt update
sudo apt install build-essential ccache ecj fastjar file g++ gawk gettext git java-propose-classpath libelf-dev libncurses5-dev libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget python-distutils-extra python3-setuptools python3-dev rsync subversion swig time xsltproc zlib1g-dev
  • 下載OpenWrt程式碼

#為求方便,放在使用者家目錄
cd ~
mkdir e8820s
git clone --depth 1 --branch v22.03.0-rc5 https://github.com/openwrt/openwrt.git
  • 安裝依賴的packages

cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a

編譯設定

  • 加入E8820S的DTS檔案

cd target/linux/ramips/dts
#從LEDE那邊拿
wget https://gitce.net/mirrors/lede/raw/branch/master/target/linux/ramips/dts/mt7621_zte_e8820s.dts
  • 將E8820S加入編譯列表

#target/linux/ramips/image/mk7621.mk
#將以下行加入檔案尾端
define Device/zte_e8820s
	$(Device/dsa-migration)
	$(Device/uimage-lzma-loader)
	BLOCKSIZE := 128k
	PAGESIZE := 2048
	KERNEL_SIZE := 4096k
	UBINIZE_OPTS := -E 5
	IMAGE_SIZE := 32768k
	IMAGES += factory.bin
	IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
	IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size
	DEVICE_VENDOR := ZTE
	DEVICE_MODEL := E8820S
	DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-openssl
endef
TARGET_DEVICES += zte_e8820s
  • 新增E8820S LED設定

#target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
#將以下行新增到檔案尾端的"esac"的前一行
zte,e8820s)
	ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "white:wlan2g" "ra0"
	ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "white:wlan5g" "rai0"
	;;
wget https://downloads.openwrt.org/releases/22.03.0-rc5/targets/ramips/mt7621/config.buildinfo -O .config
make defconfig
  • 圖形化設定

make menuconfig
#以下是必要更改的
Target System -> MediaTek Ralink MIPS
SubTarget -> MT7621 based boards
Target Profile -> ZTE E8820S
#以下是我常用的設定
Build the OpenWrt Image Builder -> N
Build the OpeWrt SDK -> N
Package the LLVM-BPF toolchain tarball -> N
Package the OpenWrt-based Toolchain -> N
[Global build settings]
	Select all target specific packages by default -> N
	Select all kernal module packages by default -> N
	Make debug information reproducible -> N
	Collect kernel debug information -> N
#剩下就是預安裝的部分,按照喜好選擇即可
#Kernal Module裡面的東西只能不包進去(選到M),不能不編譯,否則會導致vermagic改變,裝不上官方kmod

編譯

  • 普通編譯

#線程數 -j <num> 一般是(核心數*2)+1
#詳細輸出 V=s
make -j 13 V=s
#如果遇到錯誤,可以嘗試只使用單線程編譯
#普通清除(最常用)
make clean
#其他清除指令請參閱上方連結
#僅編譯kernel,通樣可以加線成數及詳細輸出的參數
make target/linux/{clean,compile} -j 13
#顯示vermagic
find build_dir/ -name .vermagic -exec cat {} \;