您好,登錄后才能下訂單哦!
編譯fw_printenv工具:
make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux- hi3521a_config
make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux-
make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux- env
編譯會(huì)出現(xiàn)問(wèn)題:只需進(jìn)入u-boot目錄
vi include/linux/types.h +154
//typedef u_int32_t uintmax_t;
//typedef int32_t intmax_t;
因?yàn)樵赼rm-hisiv300-linux/target/usr/include/stdint.h 已經(jīng)定已過(guò)了
2.安裝fw_printenv工具
到/tools/env目錄中,將編譯好的fw_printenv拷貝到目標(biāo)機(jī)的文件系統(tǒng)中,并通過(guò)"ln -s fw_printenv fw_setenv",創(chuàng)建一個(gè)fw_setenv到fw_printenv的軟鏈。
注意可以用:
arm-hisiv300-linux-strip fw_printenv
來(lái)去掉相應(yīng)的符號(hào)來(lái)減少空間的浪費(fèi)
3.這個(gè)工具還需要一個(gè)配置文件,以獲取uboot的ENV區(qū)域的位置信息。默認(rèn)狀態(tài)下,請(qǐng)將fw_env.config文件拷貝到目標(biāo)機(jī)的文件系統(tǒng)的/etc目錄下。然后結(jié)合uboot配置中定義的ENV區(qū)和Linux下mtd分區(qū)的情況修改配置文件。具體的修改方法見fw_env.config文件中的說(shuō)明及/tools/env/README文件。
移植ppp相關(guān):
1: 配置編譯內(nèi)核
在內(nèi)核原代碼主目錄下make menuconfig內(nèi)核加入了ppp,socket 等選項(xiàng)
Device Drivers -> Network device support -> <*> PPP (point-to-point protocol)中,選中所有ppp選項(xiàng):
Device Drivers ->
Network Device Support->
<*> PPP (point-to-point protocol) support
[*] PPP multilink support
<*> PPP support for async serial ports
<*> PPP support for sync tty ports
<*> SLIP (serial line) support
[*] CSLIP compressed headers
Device Drivers -> Network device support -> <*> Universal TUN/TAP device driver support
退出,保存配置,重新執(zhí)行make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux- uImage .
將arch/arm/boot/下的uImage下載到開發(fā)板上重啟系統(tǒng)。
我的內(nèi)核設(shè)置為:
Device Drivers -> Network device support -> <*> PPP (point-to-point protocol)中,選中所有ppp選項(xiàng):
Device Drivers ->
Network Device Support->
<M> PPP (point-to-point protocol) support
[*] PPP multilink support
<M> PPP support for async serial ports
<M> PPP support for sync tty ports
<M> SLIP (serial line) support
[*] CSLIP compressed headers
Device Drivers -> Network device support -> <M> Universal TUN/TAP device driver support
需要將未安裝的模塊使用insmod命令加載.ko。 也可以直接向上面那樣,編譯出具有這些功能的內(nèi)核(推薦)
2、配置
進(jìn)入ppp/ppp-2.4.5/
有兩個(gè)目錄etc.ppp scripts
2.1 修改源代碼scripts目錄下的ppp-on ppp-on-dialer ppp-off
之后復(fù)制到/etc/ppp目錄下
并修改執(zhí)行權(quán)限,chmod +x ppp-on ppp-off ppp-on-dialer
2.2 pppd提供認(rèn)證信息時(shí),可能協(xié)商使用PAP或者CHAP認(rèn)證方式,所以需要修改源代碼etc.ppp目錄下的pap-secrets和chap-secrets,
在pap-secrets添加需要的用戶名和密碼
card * card *
在chap-secrets添加需要的用戶名和口令
card * card *
之后將它們復(fù)制到/etc/ppp目錄下
相應(yīng)的maefile如下:
TOOLS_TOP_DIR ?= $(shell pwd)
TOOL_TAR_BALL := ppp-2.4.5.tar.gz
TOOL_NAME :=ppp-2.4.5
TOOL_BIN := bin
OSDRV_CROSS ?= arm-hisiv300-linux
OSDRV_CROSS_CFLAGS ?= -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4
subdir := pppd pppdump pppstats chat
all:
-rm $(TOOLS_TOP_DIR)/$(TOOL_NAME) -rf;
tar -xvf $(TOOL_TAR_BALL);
mkdir -p $(TOOLS_TOP_DIR)/$(TOOL_NAME)/$(TOOL_BIN)/;
mkdir -p $(TOOLS_TOP_DIR)/$(TOOL_BIN)/;
pushd $(TOOLS_TOP_DIR)/$(TOOL_NAME)/; \
./configure > /dev/null; \
make CC=arm-hisiv300-linux-gcc -j 20 > /dev/null; \
for d in $(subdir); do(arm-hisiv300-linux-strip $$d/$$d;cp $$d/$$d $(TOOLS_TOP_DIR)/$(TOOL_BIN) -rf); done
popd
.PHONY: clean
-pushd $(TOOLS_TOP_DIR)/$(TOOL_NAME)/ &&\
make -C $(TOOLS_TOP_DIR)/$(TOOL_NAME)/ clean && \
popd
.PHONY: distclean
distclean:
-rm $(TOOLS_TOP_DIR)/$(TOOL_NAME) -rf;
-rm $(TOOLS_TOP_DIR)/$(TOOL_BIN) -rf;
iptables的配置:
一、配置內(nèi)核并編譯,支持netfilter
cd linux-3.10.y
make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux- menuconfig
[*] Networking support --->
Networking options --->
[*] Network packet filtering framework (Netfilter) --->
Core Netfilter Configuration --->(全部選上)
IP: Netfilter Configuration ---> (全部選上)
注意:這里的所有選項(xiàng)一定選為built-in [*],而不能選為Module [M],如果選為Module,重新燒制的系統(tǒng)內(nèi)核里用modprobe ip_tables 命令將不能找到iptables模塊。上一步還有一點(diǎn)要注意的是IP: Netfilter configuration中的FULL NAT選項(xiàng)一定要選中,否則將不能使用 iptables -t nat命令
makefile修改入下:
TOOLS_TOP_DIR ?= $(shell pwd)
TOOL_TAR_BALL := iptables-1.6.1.tar.bz2
TOOL_NAME :=iptables-1.6.1
TOOL_BIN := install
OSDRV_CROSS ?= arm-hisiv300-linux
OSDRV_CROSS_CFLAGS ?= -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4
all:
-rm $(TOOLS_TOP_DIR)/$(TOOL_NAME) -rf;
tar -xvf $(TOOL_TAR_BALL);
mkdir -p $(TOOLS_TOP_DIR)/$(TOOL_BIN)/;
pushd $(TOOLS_TOP_DIR)/$(TOOL_NAME)/; \
./configure --host=$(OSDRV_CROSS) --prefix=$(TOOLS_TOP_DIR)/$(TOOL_BIN) \
--enable-static --disable-shared --disable-ipv6 --disable-nftables \
--disable-largefile > /dev/null; \
make -j 20 > /dev/null; \
make install > /dev/null; \
arm-hisiv300-linux-strip $(TOOLS_TOP_DIR)/$(TOOL_BIN)/sbin/xtables-multi
rm -rf $(TOOLS_TOP_DIR)/$(TOOL_BIN)/sbin/iptables*
mv $(TOOLS_TOP_DIR)/$(TOOL_BIN)/sbin/xtables-multi $(TOOLS_TOP_DIR)/$(TOOL_BIN)/sbin/iptables
popd
.PHONY: clean
clean:
-pushd $(TOOLS_TOP_DIR)/$(TOOL_NAME)/ &&\
make -C $(TOOLS_TOP_DIR)/$(TOOL_NAME)/ clean && \
popd
.PHONY: distclean
distclean:
-rm $(TOOLS_TOP_DIR)/$(TOOL_NAME) -rf;
-rm $(TOOLS_TOP_DIR)/$(TOOL_BIN) -rf;
移植e2fsprogs相關(guān)
TOOLS_TOP_DIR ?= $(shell pwd)
TOOL_TAR_BALL := e2fsprogs-1.41.11.tar.gz
TOOL_NAME := e2fsprogs-1.41.11
TOOL_BIN := bin
OSDRV_CROSS ?= arm-hisiv300-linux
OSDRV_CROSS_CFLAGS ?= -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4
all:
-rm $(TOOLS_TOP_DIR)/$(TOOL_NAME) -rf;
tar -xzf $(TOOL_TAR_BALL);
mkdir -p $(TOOLS_TOP_DIR)/$(TOOL_NAME)/$(TOOL_BIN)/;
mkdir -p $(TOOLS_TOP_DIR)/$(TOOL_BIN)/;
pushd $(TOOLS_TOP_DIR)/$(TOOL_NAME)/; \
./configure --host=$(OSDRV_CROSS) CFLAGS="$(OSDRV_CROSS_CFLAGS)" \
LDFLAGS="$(OSDRV_CROSS_CFLAGS)" --prefix=$(TOOLS_TOP_DIR)/$(TOOL_NAME)/$(TOOL_BIN) \
--disable-tls > /dev/null; \
make -j 20 > /dev/null; \
make install > /dev/null; \
cp $(TOOL_BIN)/sbin/mkfs.ext2 $(TOOLS_TOP_DIR)/$(TOOL_BIN) -rf; \
cp $(TOOL_BIN)/sbin/mkfs.ext3 $(TOOLS_TOP_DIR)/$(TOOL_BIN) -rf; \
cp $(TOOL_BIN)/sbin/mkfs.ext4 $(TOOLS_TOP_DIR)/$(TOOL_BIN) -rf; \
cp $(TOOL_BIN)/sbin/mke2fs $(TOOLS_TOP_DIR)/$(TOOL_BIN) -rf; \
popd
.PHONY: clean
-pushd $(TOOLS_TOP_DIR)/$(TOOL_NAME)/ &&\
make -C $(TOOLS_TOP_DIR)/$(TOOL_NAME)/ clean && \
popd
.PHONY: distclean
distclean:
-rm $(TOOLS_TOP_DIR)/$(TOOL_NAME) -rf;
-rm $(TOOLS_TOP_DIR)/$(TOOL_BIN) -rf;
頂層makefile如下:
subdir:=ppp iptables e2fsprogs udev reg-tools bftpd
TOP_DIR:=$(shell pwd)
TOP_BIN:=bin
TOP_ETC:=etc
all:
mkdir -p $(TOP_DIR)/$(TOP_BIN)
mkdir -p $(TOP_DIR)/$(TOP_ETC)
for d in $(subdir); do (make -C $$d); done
cp creat_softlink.sh $(TOP_DIR)/$(TOP_BIN) && chmod a+x $(TOP_DIR)/$(TOP_BIN)/creat_softlink.sh
for d in $(subdir); do (cp $$d/$(TOP_BIN)/* $(TOP_DIR)/$(TOP_BIN) -rf); done
for d in $(subdir); do (cp $$d/$(TOP_ETC)/* $(TOP_DIR)/$(TOP_ETC) -rf); done
.PHONY:clean distclean
clean:
for d in $(subdir); do (make clean -C $$d); done
distclean:
-rm $(shell pwd)/bin -rf;
-rm $(shell pwd)/etc -rf;
for d in $(subdir); do (make distclean -C $$d); done
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。