找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 635|回复: 4

openwrt编译报错,dd的bs参数没了

[复制链接]
发表于 2022-5-15 15:17 | 显示全部楼层 |阅读模式
  1. dd if=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin of=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin.new bs= conv=sync
  2. dd: invalid number: ''
  3. make[5]: *** [Makefile:208: /opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin] Error 1
  4. make[5]: Leaving directory '/opt/tsxor/openwrt/openwrt/target/linux/ramips/image'
  5. make[4]: *** [Makefile:23: install] Error 2
  6. make[4]: Leaving directory '/opt/tsxor/openwrt/openwrt/target/linux/ramips'
  7. make[3]: *** [Makefile:11: install] Error 2
  8. make[3]: Leaving directory '/opt/tsxor/openwrt/openwrt/target/linux'
  9. time: target/linux/install#87.20#25.25#106.18
  10.     ERROR: target/linux failed to build.
  11. make[2]: *** [target/Makefile:25: target/linux/install] Error 1
  12. make[2]: Leaving directory '/opt/tsxor/openwrt/openwrt'
  13. make[1]: *** [target/Makefile:19: /opt/tsxor/openwrt/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.target_install] Error 2
  14. make[1]: Leaving directory '/opt/tsxor/openwrt/openwrt'
  15. make: *** [/opt/tsxor/openwrt/openwrt/include/toplevel.mk:230:world] 错误 2
复制代码
我认为问题在
  1. dd
  2. if=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin

  3. of=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin.new
  4. bs= conv=sync
  5. dd: invalid number: ''
复制代码
如上,dd的bs参数没了,可能是这个参数通过变量定义,然后变量错误了,然而我也不知道这个dd是在哪个脚本里执行的,有什么头绪吗




我的恩山、我的无线 The best wifi forum is right here.
 楼主| 发表于 2022-5-15 15:36 | 显示全部楼层
地方找到了,可是给我整不会了:
是include/image.mk的:
  1. define Image/pad-to
  2.         dd if=$(1) of=$(1).new bs=$(2) conv=sync
  3.         mv $(1).new $(1)
  4. endef
复制代码
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2022-5-15 16:21 | 显示全部楼层
本帖最后由 23Xor 于 2022-5-15 16:24 编辑

用了一个小trick过了这个错误,把上一楼提到的代码的bs参数去掉
百度了一下发现bs只影响dd写入速度,应该不会影响写入结果
  1. define Image/pad-to
  2.         #dd if=$(1) of=$(1).new bs=$(2) conv=sync
  3.         dd if=$(1) of=$(1).new conv=sync && echo $(2)
  4.         mv $(1).new $(1)
  5. endef
复制代码

于是过了:
  1. #dd if=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin of=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin.new bs= conv=sync
  2. dd if=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin of=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin.new conv=sync && echo
  3. 4477+1 records in
  4. 4478+0 records out
  5. 4585472 bytes (4.6 MB, 4.4 MiB) copied, 0.0268627 s, 171 MB/s
  6. tar: Option --mtime: Treating date '@1650113974' as 2022-04-16 12:59:34
  7. sysupgrade-zte_e8820s/
  8. sysupgrade-zte_e8820s/CONTROL
  9. sysupgrade-zte_e8820s/kernel
  10. sysupgrade-zte_e8820s/root
  11. 4744+1 records in
  12. 4745+0 records out
  13. 2429440 bytes (2.4 MB, 2.3 MiB) copied, 0.0200686 s, 121 MB/s
复制代码
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2022-5-15 16:21 | 显示全部楼层
本帖最后由 23Xor 于 2022-5-15 16:26 编辑

这样应该是过编译了吧?
  1. Signing package index...
  2. make[2]: Leaving directory '/opt/tsxor/openwrt/openwrt'
  3. export MAKEFLAGS= ;make -w -r json_overview_image_info
  4. make[2]: Entering directory '/opt/tsxor/openwrt/openwrt'
  5. make[2]: Nothing to be done for 'json_overview_image_info'.
  6. make[2]: Leaving directory '/opt/tsxor/openwrt/openwrt'
  7. export MAKEFLAGS= ;make -w -r checksum
  8. make[2]: Entering directory '/opt/tsxor/openwrt/openwrt'
  9. make[2]: Leaving directory '/opt/tsxor/openwrt/openwrt'
  10. make[1]: Leaving directory '/opt/tsxor/openwrt/openwrt'
复制代码



我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2022-5-15 16:39 | 显示全部楼层
本帖最后由 23Xor 于 2022-5-15 16:45 编辑

讲一下找到include/image.mk的过程,水个经验
看发生错误的命令:
  1. dd if=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin of=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin.new bs= conv=sync
复制代码
分析一下,原命令应该长这样:(这是伪代码
  1. dd if=[path1] of=[path2] bs=[variable] conv=sync
复制代码
虽然我也怀疑conv=sync中的sync也是变量定义,但是我还是姑且猜他是被写死的
于是在openwrt的github repo中搜索带conv=sync的code
target/linux/mpc85xx/image/p1020.mk,target/linux/apm821xx/image/Makefile等文件有这段,但是我直接排除,因为我编的是mt7621
剩下的文件中,进行人工筛选,看conv=sync前面是否有bs=[variable]
然后剩下俩:
scripts/combined-image.sh
  1. # Make sure provided images are 64k aligned.
  2. kern="${IMAGE}.kernel"
  3. root="${IMAGE}.rootfs"
  4. dd if="$1" of="$kern" bs=$BLKSZ conv=sync 2>/dev/null
  5. dd if="$2" of="$root" bs=$BLKSZ conv=sync 2>/dev/null
复制代码
以及2楼那段。
再看看出错的命令的if和of选项:
  1. if=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin
  2. of=/opt/tsxor/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/tmp/openwrt-ramips-mt7621-zte_e8820s-squashfs-factory.bin.new
复制代码
发现就差一个.new
再看看2楼那段的if和of选项:
  1. if=$(1)
  2. of=$(1).new
复制代码
实锤了,就是它!(2楼那段的if和of选项的意思就是of比if多个.new)
然后就开改

怎么样,逆向思维,很神奇吧

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-26 04:15

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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