找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 2807|回复: 8

【已解决】自己编译openwrt,对dts的疑问,附ttl信息

[复制链接]
发表于 2022-9-18 17:56 | 显示全部楼层 |阅读模式
本帖最后由 gently 于 2022-9-19 23:47 编辑

是这样的。本菜最近对openwrt甚是感兴趣,当然,在此之前也刷过数次的路由器,这次正好手边有一台4g的路由器,可以插手机卡上网,带两个RJ45网口,双频Wi-Fi,出差外地的时候还是很有用的。

经过一番摸索,发现系统是openwrt的,拆机后获得一些硬件信息:

SoC 是 MTK的MT7628AN
wifi芯片 mt7613ben (是不是wifi芯片?)

内存 128M
flash 64M




令人激动的是TTL排针竟然还保留在板子上,一顿乱试后,获得了正确的接线顺序,可以观察到输出信息。

我找了mt7628an同芯片,内存128M的固件,强制刷入后,可以成功启动,有个普遍的问题是只有2.4G的Wi-Fi,5G不支持。

我这台路由器的官方固件是lede 17.01的,本菜的想法有点过于简单,导出原固件的dts,然后修改openwrt相关文件(主要参考的这篇 https://www.daimajiaoliu.com/daima/479ac5b519003e0 ),编译了一个最新的22版固件,用binwalk查看格式好像一切正常
  1. DECIMAL       HEXADECIMAL     DESCRIPTION
  2. --------------------------------------------------------------------------------
  3. 0             0x0             uImage header, header size: 64 bytes, header CRC: 0x1898422F, created: 2022-09-16 16:50:46, image size: 2189034 bytes, Data Address: 0x80000000, Entry Point: 0x80000000, data CRC: 0xDA52C1EF, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: "MIPS OpenWrt Linux-5.10.138"
  4. 64            0x40            LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: 7351243 bytes
  5. 2189098       0x21672A        Squashfs filesystem, little endian, version 4.0, compression:xz, size: 4706888 bytes, 1748 inodes, blocksize: 262144 bytes, created: 2022-09-16 16:50:46
复制代码


信心百倍的给刷进去了,然后就无限重启,一开始我以为是刷的不对,又重置出厂设置再刷了一次,仍然是这样的。。。终于想起来ttl打印信息,接上后如下
  1. console [ttyS0] enabled
  2. [    0.814477] printk: console [ttyS0] enabled
  3. [    0.822867] printk: bootconsole [early0] disabled
  4. [    0.822867] printk: bootconsole [early0] disabled
  5. [    0.833761] spi-mt7621 10000b00.spi: there is not valid maps for state default
  6. [    0.841178] spi-mt7621 10000b00.spi: sys_freq: 191666666
  7. [    0.856684] spi-nor spi0.0: gd25q128 (16384 Kbytes)
  8. [    0.861804] 6 fixed-partitions partitions found on MTD device spi0.0
  9. [    0.868335] Creating 6 MTD partitions on "spi0.0":
  10. [    0.873201] 0x000000000000-0x000000030000 : "u-boot"
  11. [    0.880873] 0x000000030000-0x000000040000 : "kpanic"
  12. [    0.887288] 0x000000040000-0x000000050000 : "factory"
  13. [    0.895654] 0x000000050000-0x000000fe0000 : "firmware"
  14. [    0.902143] 0x000000fe0000-0x000000ff0000 : "bdinfo"
  15. [    0.910341] 0x000000ff0000-0x000001000000 : "reserve"
  16. [    0.971467] rt3050-esw 10110000.esw: port 1 link up
  17. [    0.976490] rt3050-esw 10110000.esw: mediatek esw at 0xb0110000, irq 25 initialized
  18. [    0.984384] mtk_soc_eth 10100000.ethernet: generated random MAC address 62:93:1d:3a:c9:3d
  19. [    0.993402] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
  20. [    1.003056] NET: Registered protocol family 10
  21. [    1.011661] Segment Routing with IPv6
  22. [    1.015613] NET: Registered protocol family 17
  23. [    1.020230] 8021q: 802.1Q VLAN Support v1.8
  24. [    1.027258] /dev/root: Can't open blockdev
  25. [    1.031438] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
  26. [    1.039093] Please append a correct "root=" boot option; here are the available partitions:
  27. [    1.047602] 1f00             192 mtdblock0
  28. [    1.047607]  (driver?)
  29. [    1.054253] 1f01              64 mtdblock1
  30. [    1.054256]  (driver?)
  31. [    1.060881] 1f02              64 mtdblock2
  32. [    1.060884]  (driver?)
  33. [    1.067527] 1f03           15936 mtdblock3
  34. [    1.067531]  (driver?)
  35. [    1.074176] 1f04              64 mtdblock4
  36. [    1.074180]  (driver?)
  37. [    1.080804] 1f05              64 mtdblock5
  38. [    1.080808]  (driver?)
  39. [    1.087448] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
  40. [    1.095829] Rebooting in 1 seconds..
复制代码


正常的启动信息如下:
  1. [    0.663345] console [ttyS0] enabled
  2. [    0.663345] console [ttyS0] enabled
  3. [    0.670333] bootconsole [early0] disabled
  4. [    0.670333] bootconsole [early0] disabled
  5. [    0.679178] ralink_priv_init
  6. [    0.682728] spi-mt7621 10000b00.spi: sys_freq: 191666666
  7. [    0.692698] m25p80 spi32766.0: using chunked io (size=32)
  8. [    0.698256] m25p80 spi32766.0: gd25q128 (16384 Kbytes)
  9. [    0.703500] 6 ofpart partitions found on MTD device spi32766.0
  10. [    0.709422] Creating 6 MTD partitions on "spi32766.0":
  11. [    0.714636] 0x000000000000-0x000000030000 : "u-boot"
  12. [    0.721486] 0x000000030000-0x000000040000 : "kpanic"
  13. [    0.728467] 0x000000040000-0x000000050000 : "factory"
  14. [    0.735430] 0x000000050000-0x000000fe0000 : "firmware"
  15. [    0.792451] 2 uimage-fw partitions found on MTD device firmware
  16. [    0.798497] 0x000000050000-0x000000190000 : "kernel"
  17. [    0.805190] 0x000000190000-0x000000fe0000 : "rootfs"
  18. [    0.812153] mtd: device 5 (rootfs) set to be root filesystem
  19. [    0.818064] 1 squashfs-split partitions found on MTD device rootfs
  20. [    0.824337] 0x000000e30000-0x000000fe0000 : "rootfs_data"
  21. [    0.831738] 0x000000fe0000-0x000000ff0000 : "bdinfo"
  22. [    0.913572] 0x000000ff0000-0x000001000000 : "reserve"
  23. [    0.930324] rt3050-esw 10110000.esw: link changed 0x00
  24. [    0.936133] mt7621_wdt 10000120.watchdog: Initialized
  25. [    0.942691] NET: Registered protocol family 10
  26. [    0.950951] NET: Registered protocol family 17
  27. [    0.955551] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
  28. [    0.968410] 8021q: 802.1Q VLAN Support v1.8
  29. [    0.976127] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
  30. [    0.994682] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
  31. [    1.002833] Freeing unused kernel memory: 168K
  32. [    2.847880] init: Console is alive
  33. [    2.851548] init: - watchdog -
  34. ......
  35. ......
复制代码

看意思是分区表错误了,我搜索了很多资料,然后不知道该如何继续了,特来请教。还望路过的大大指导一二

我的疑惑是 编译op的时候,添加了一个新硬件,除了dts要注意之外,还有哪些需要修改的地方?或者我这个dts导出来根本就是错误的?

附件我放上dts文件



望各位路过的大大不吝赐教,特别感谢!

我自己研究了很长时间了,对openwrt也是非常感兴趣,目前仍然不得其解,再次感谢






本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
发表于 2022-9-18 18:50 | 显示全部楼层
版本不同,dts文件也不一样

点评

原来如此啊 那么我该怎么修改dts呢?这个硬件是没有开源的 还有就是,用原u-boot是否是可以的?因为我尝试过刷同方案的其他路由器开源固件,可以启动起来,就是没有5g Wi-Fi等 所以,u-boot可以继续沿用?  详情 回复 发表于 2022-9-18 19:09
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-9-18 19:09 | 显示全部楼层
wxy1981s 发表于 2022-9-18 18:50
版本不同,dts文件也不一样

原来如此啊

那么我该怎么修改dts呢?这个硬件是没有开源的

还有就是,用原u-boot是否是可以的?因为我尝试过刷同方案的其他路由器开源固件,可以启动起来,就是没有5g Wi-Fi等

所以,u-boot可以继续沿用?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-9-19 00:21 | 显示全部楼层
有很关键的一句

  1. [    0.792451] 2 uimage-fw partitions found on MTD device firmware
复制代码


此后,uboot找到了正确的内核入口,而我自己编译的始终没有出现这句话,导致找不到rootfs,无法启动
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-9-19 01:33 | 显示全部楼层
兴奋!!兴奋!!问题解决了,哈哈哈~

一通搜索,https://www.jianshu.com/p/9ee28ed6b9e6 ,这篇文章,我的问题和他不一样,因为我的uboot大小是对的。无意间看到下面有个大神的回复

亲,注意一下:make kernel_menuconfig ----> -> Device Drivers -> Memory Technology Device (MTD) support (MTD [=y])
-> OpenWrt specific MTD options
->Automatically split firmware partition for kernel+rootfs

选上了没有:smile:


就是这个问题!!!重新编译,刷入,已经OK了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
回复 支持 反对

使用道具 举报

发表于 2022-9-20 21:55 | 显示全部楼层
你这个是 什么牌子,那个型号的 4g的路由器 ??
回复 支持 反对

使用道具 举报

发表于 2022-9-21 20:22 | 显示全部楼层
分享硬件,分享软件
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-9-22 23:41 | 显示全部楼层


型号410,看官网固件有450的,但似乎已停产



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
回复 支持 反对

使用道具 举报

发表于 2023-6-26 11:28 | 显示全部楼层
无意中搜到这个贴子,我用的是另一个方法,在 DTS 中对 firmware 分区的定义里加上这一行:compatible = "denx,uimage";
比如:
partition@50000 {
                                compatible = "denx,uimage";
                                label = "firmware";
                                reg = <0x050000 0xfb0000>;
                                read-only;
                        };

就会自动识别出两个分区了。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-6-3 01:04

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表