openwrt移植mt7620并定制个性版.doc_第1页
openwrt移植mt7620并定制个性版.doc_第2页
openwrt移植mt7620并定制个性版.doc_第3页
openwrt移植mt7620并定制个性版.doc_第4页
openwrt移植mt7620并定制个性版.doc_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

一、 openwrt普及及一般操作1. Openwrt源码 /wiki/GetSourcea) trunk 开发快照 git clone git://openwrt.gitb) branch(基于backfire的分支)attitude adjustment 内核更新至3.3git clone git://12.09/openwrt.gitbarrier breaker 内核更新至3.10 (本次实验使用版本)git clone git://14.07/openwrt.gitchaos calmer 最新git clone git://15.05/openwrt.git2. openwrt源码目录include 存放.mk文件,makefile中使用bin 生成的目标固件build_dir/host 建立工具链时临时文件build_dir/toolchain-* 对应硬件的工具链的目录staging_dir/toolchain-* 对应硬件工具链安装目录target/linux/ 目录对应各平台arch相关代码target/linux/config* 文件就是配置文件dl 就是下载的文件build_dir/ 目录下进行解压,编译和打补丁package/ 目录里保护所有配置文件中设定的编译好的软件包feeds/packages 执行feeds install后安装的包3. 源码下载、配置编译1) 创建用户Openwrt不能以root用户编译,需要创建一个非root用户useradd openwrt & passwd openwort & su openwrt2) 源码下载git clone git://14.07/openwrt.git./scripts/feeds update a & ./scripts/feeds install a3) 配置make menuconfigTarget System Ralink RT288x/RT3xxxSubtarget-MT7620a based boardsLuCI-Collections-luci -Translations-luci-i18n-chinese4) 编译make V=995) 烧写实验bin/rampis/ openwrt-ramips-mt7620a-MZK-squashfs-sysupgrade.bin 发现可以启动,但是波特率有问题,uboot和内核的不一样 修改target/linux/ramips/dts/mt7620a.dtsi bootargs = “console=ttyS0,57600” 重新编译,烧写。发现启动无异常二、 定制sxfg openwrt1. dts文件修改 cd target/linux/ramips/dts/ & cp MZK-750DHP.dts FENGGUANG.dts修改FENGGUANG.dtsa. 修改设备名称module = “sxfg” (L7)b. 修改flash分区由于我们的flash是16M的,修改firmware分区大小为0xfb0000(L45)(firmware)+(factory)+(uboot-env)+(uboot)=flash(kernel)+(rootfs)=firmware(squashfs(ro)+(jffs2(rw,rootfs_data)=rootfs2. 修改Makefile使其生成定制镜像cd target/linux/ramips/image/ 在MT7620A Profiles下面增加变量 Image/Build/Profile/FENGGUANG=$(call BuildFirmware/Default16M/$(1),$(1),sxfg,FENGGUANG) 在Image/Build/Profile/Default宏中增加 $(call Image/Build/Profile/FENGGUANG,$(1) 这样就可以生成*sxfg*的镜像,为了不生成无关的,在宏中删除掉其他的就好3. 解决mtd分区没有对齐问题考虑到openwrt是自动分离内核跟文件系统,因此考虑解决办法是固定内核大小,给内核padding空数据cd target/linux/ramips/image/修改Makefile中宏PatchKernelLzmaDtb在压缩内核调用后增加调用$(call KernelPadding,$(KDIR)/vmlinux-$(1)$(3).bin.lzma)在宏PatchKernelLzmaDtb上增加宏及变量kernel_sizekernel_size=目标大小-64k的uImage的头,这里是0x180000-64k4. 增加mt7620a wifi驱动方法一、将驱动直接加入build_dir/target-mipsel_24kec+dsp_uClibc-/linux-ramips_mt7620a/linux-3.10.49,按照一般驱动方法添加方法二、基于方法一,只是将驱动做成patch,将patch放于target/linux/ramips/patches-3.10方法三、将驱动做成一个包,在package中方法一优点简单,粗暴,确点是make dirclean 后所做修改就丢失了,不够正规方法二解决了方法一的问题,但是在实验过程中添加目录等没有成功最终采取方法三我的方法是直接下载/qdk0901/openwrt-mt7620 openwrt-mt7620-master.zip将其package/rt2860v2 拷贝过来 配置WiFi至此WiFi驱动添加完成5. vlan划分方法一、自动生成/home/openwrt/openwrt/target/linux/ramips/base-files/lib/rampise.shrampis_board_detech函数中增加 * sxfg)name=sxfg/home/openwrt/openwrt/target/linux/ramips/base-files/etc/uci-defaults/02_network rampis_setup_interfaces函数中增加 sxfg) ucidef_set_sxfg ucidef_add_switch./home/openwrt/openwrt/package/base-files/files/lib/functions/uci-defaults.sh 增加ucidef_set_interfaces_sxfg函数此方法实验后发现数据写入不完全,/etc/config/network没有达到预期效果,即使达到网络也不通方法二、直接写死在系统中package/base-files/files/etc/config/network,内容为如图:6. ssid在package/rt2860v2/files/rt2860v2.sh最后面加入/etc/config/wireless需要写入内容,发现这种方法能写入,但需要多次启动,ra0,ra1才会出现直接写文件wirelesspackage/base-files/files/etc/config/wireless内容为 这样烧写后发现openwrt_lan1是连接不上的,原因是没有配置dhcp内容为三、 openwrt镜像制作过程mipsel-openwrt-linux-uclibc-objcopy -O binary linux-ramips_mt7620a/linux-3.10.49/vmlinux linux-ramips_mt7620a/vmlinuxmipsel-openwrt-linux-uclibc-objcopy linux-ramips_mt7620a/linux-3.10.49/vmlinux linux-ramips_mt7620a/vmlinux.elfcp linux-ramips_mt7620a/linux-3.10.49/vmlinux linux-ramips_mt7620a/vmlinux.debug=target/linux/ramips/image/Makefile Image/BuildKernelcp linux-ramips_mt7620a/vmlinux.elf ramips/openwrt-ramips-mt7620a-vmlinux.elfcp linux-ramips_mt7620a/vmlinux ramips/openwrt-ramips-mt7620a-vmlinux.binlzma e linux-ramips_mt7620a/vmlinux linux-ramips_mt7620a/vmlinux.bin.lzmamkimage -A mips -O linux -T kernel -a 0x80000000 -e 0x80000000 -d linux-ramips_mt7620a/vmlinux.bin.lzma linux-ramips_mt7620a/uImage.lzmacp linux-ramips_mt7620a/uImage.lzma ramips/openwrt-ramips-mt7620a-uImage.bin=target/linux/ramips/image/Makefile Image/Buildmksquashfs4 root-ramips linux-ramips_mt7620a/root.squashfs -b 256k -p -processors 1dd if=linux-ramips_mt7620a/root.squashfs of=ramips/openwrt-ramips-mt7620a-root.squashfs bs=128k conv=sync=target/linux/ramips/image/Makefile MkImageLzmaDtbcp linux-ramips_mt7620a/vmlinux linux-ramips_mt7620a/vmlinux-sxfgscripts/dtc/dtc linux-ramips_mt7620a/FENGGUANG.dtb ./dts/FENGGUANG.dtspatch-dtb linux-ramips_mt7620a/vmlinux-sxfg linux-ramips_mt7620a/FENGGUANG.dtblzma e linux-ramips_mt7620a/vmlinux-sxfg linux-ramips_mt7620a/vmlinux-sxfg.bin.lzma=target/linux/ramips/image/Makefile MkImageSysupgrade/squashfsmkimage -A mips -O linux -T kernel -C lzma -n -d linux-ramips_mt7620a/vmlinux-sxfg.bin.lzma linux-ramips_mt7620a/vmlinux-sxfg.uImagecat linux-ramips_mt7620a/vmlinux-sxfg.uImage linux-ramips_mt7620a/root.squashfs linux-ramips_mt7620a/openwrt-r

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论