|
本帖最后由 muziling 于 2016-4-6 21:03 编辑
1. 下载代码:git clone git://git.openwrt.org/openwrt.git
2. 下载rt-n56u的代码
3. 进入rt-n56u目录,cp rt-n56u/trunk/configs/templates/ac54u_base.config rt-n56u/trunk/.config
编辑 rt-n56u/trunk/build_firmware, 注释掉最后几行的make dep和make 命令
./build_firmware 这样目录下的3.4.x就是带无线驱动,hwnat的7620内核
4.重命名3.4.x为3.4.111,tar再xz得到linux-3.4.111.tar.xz
5.移动linux-3.4.111.tar.xz到openwrt的dl目录下
6. trunk/openwrt/target/linux/ramips/Makefile 里的版本号改成3.4
trunk/include/kernel-version.mk 里添加
LINUX_VERSION-3.4 = .111
7. trunk/toolchain/kernel-headers/Makefile
$(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
$(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
$(if $(call _ge,3.15.0),$(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h) \ 修改这一行
$(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
8. 实际路径修改成自己的
cp /home/muziling/data/rt-n56u/rt-n56u/trunk/linux-3.4.x/.config /home/muziling/data/openwrt/trunk/openwrt/target/linux/generic/config-3.4
/home/muziling/data/openwrt/trunk/openwrt/target/linux/ramips/mt7620/ 放入config-3.4,内容如下
CONFIG_CMDLINE=""
CONFIG_CMDLINE_BOOL=y
# CONFIG_CMDLINE_OVERRIDE is not set
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_OVERLAYFS_FS=y
CONFIG_MIPS_FPU_EMU=y
CONFIG_MTD_ROOTFS_ROOT_DEV=y
CONFIG_MTD_ROOTFS_SPLIT=y
CONFIG_JFFS2_LZMA=y
CONFIG_NET_SCH_ESFQ_NFCT=y
CONFIG_SWCONFIG=y
CONFIG_MDIO_BOARDINFO=y
CONFIG_ETHERNET_PACKET_MANGLE=y
CONFIG_CRASHLOG=y
# CONFIG_L2TP_DEBUGFS is not set
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_BOOT_RAW=y
# CONFIG_GCOV_KERNEL is not set
# CONFIG_PCI_DEBUG is not set
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
# CONFIG_DEBUG_DRIVER is not set
# CONFIG_DEBUG_DEVRES is not set
# CONFIG_PSB6970_PHY is not set
# CONFIG_JBD2_DEBUG is not set
# CONFIG_DEBUG_SHIRQ is not set
# CONFIG_LOCKUP_DETECTOR is not set
# CONFIG_DETECT_HUNG_TASK is not set
# CONFIG_SCHED_DEBUG is not set
# CONFIG_SCHEDSTATS is not set
# CONFIG_TIMER_STATS is not set
# CONFIG_DEBUG_OBJECTS is not set
# CONFIG_DEBUG_SLAB is not set
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_RT_MUTEX_TESTER is not set
# CONFIG_DEBUG_SPINLOCK is not set
# CONFIG_DEBUG_MUTEXES is not set
# CONFIG_DEBUG_LOCK_ALLOC is not set
# CONFIG_LOCK_STAT is not set
# CONFIG_DEBUG_ATOMIC_SLEEP is not set
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_INFO_REDUCED=y
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_WRITECOUNT is not set
# CONFIG_DEBUG_LIST is not set
# CONFIG_TEST_LIST_SORT is not set
# CONFIG_DEBUG_SG is not set
# CONFIG_DEBUG_NOTIFIERS is not set
# CONFIG_DEBUG_CREDENTIALS is not set
# CONFIG_BOOT_PRINTK_DELAY is not set
# CONFIG_RCU_TORTURE_TEST is not set
# CONFIG_RCU_TRACE is not set
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
# CONFIG_LKDTM is not set
# CONFIG_FAULT_INJECTION is not set
# CONFIG_DEBUG_PAGEALLOC is not set
# CONFIG_DEBUG_STACKOVERFLOW is not set
# CONFIG_RUNTIME_DEBUG is not set
# CONFIG_SPINLOCK_TEST is not set
# CONFIG_CRYPTO_XZ is not set
9. 建一个patch-3.4目录,trunk/openwrt/target/linux/ramips/patches-3.4/,把附件解压进去。
ralink-flash-map.h里的分区也改成openwrt的了
10. make menuconfig 选newifi y1或其它机型
kernel module->other->gpio button hotplug 去掉不选 (因为华硕内核在ralink里实现了,不需要OP的hot plug)
kernel module->wireless device 都去掉不选
make kernel_menuconfig
networking support -> networking options -> layer two tunneling protocol (L2TP) 整个去掉吧
去掉 networking support -> networking options -> network packet filtering framework -> ip: netfilter configuration -> ip tables support -> full nat -> REDIRECT target support
enable the block layer -> io schedulers -> defaule I/O scheduler 选中,选成内置
11.
trunk/openwrt/target/linux/ramips/image/Makefile 删掉两行
define PatchKernelLzmaDtb
cp $(KDIR)/vmlinux$(3) $(KDIR)/vmlinux-$(1)$(3)
$(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts 删掉
$(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3) $(KDIR)/$(2).dtb 删掉
$(call CompressLzma,$(KDIR)/vmlinux-$(1)$(3),$(KDIR)/vmlinux-$(1)$(3).bin.lzma)
endef
12.
make
13.
刷入失败,引导不起来,可能是mkimage的引导地址不正确,
参考rt-n56u里的/trunk/vendors/Ralink/MT7620/Makefile 修改引导地址也不行,郁闷
还有一个可能是我做的补丁999-MIPS-fix-build-with-binutils-2.24.51.patch有问题。
编译的时候如果碰到:
1. SKF_AD_VLAN_TAG_PRESENT找不到
参考https://github.com/the-tcpdump-g ... d034d2/pcap-linux.c
把两处ifdef SO_BPF_EXTENSIONS 改成 #if defined(SO_BPF_EXTENSIONS) && defined(SKF_AD_VLAN_TAG_PRESENT) 即可
2. linux-3.4.110/include/uapi/linux/atm*.h': No such file or directory
https://dev.openwrt.org/changeset/34715
Index: /trunk/include/kernel.mk
===================================================================
--- /trunk/include/kernel.mk (revision 34714)
+++ /trunk/include/kernel.mk (revision 34715)
@@ -36,6 +36,7 @@
KERNEL_BUILD_DIR ?= $(BUILD_DIR)/linux-$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET))
LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
- LINUX_UAPI_DIR=$(firstword $(wildcard $(LINUX_DIR)/include/uapi $(LINUX_DIR)/include))
-
+ ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,3.7.0)),1)
+ LINUX_UAPI_DIR=uapi/
+ endif
LINUX_VERMAGIC:=$(strip $(shell cat $(LINUX_DIR)/.vermagic 2>/dev/null))
LINUX_VERMAGIC:=$(if $(LINUX_VERMAGIC),$(LINUX_VERMAGIC),unknown)
Index: /trunk/package/network/services/ppp/Makefile
===================================================================
--- /trunk/package/network/services/ppp/Makefile (revision 34714)
+++ /trunk/package/network/services/ppp/Makefile (revision 34715)
@@ -159,5 +159,5 @@
cp \
$(LINUX_DIR)/include/linux/compiler.h \
- $(LINUX_UAPI_DIR)/linux/atm*.h \
+ $(LINUX_DIR)/include/$(LINUX_UAPI_DIR)linux/atm*.h \
$(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/
endef
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|