Openwrt编译:root.squashfs-64k is too big (Max=6488064 , Current=xxxx)

来源:互联网 发布:监控工程宝软件 编辑:程序博客网 时间:2024/05/17 06:51

搞了一段时间openwrt编译,由于之前没有路由器的经验,很蛋疼,各种问题。

Question

折腾好几天,终于把环境配好了,包括软件源、依赖库、版本,以及make menuconfig选择打到固件里面的package。最后编译的时候,却出现了root.squashfs-64k is too big的问题。心中万马奔腾,顿时崩溃了!

部分日志摘抄如下:

......此处省略很长很长日志......LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03mkimage -A mips -O linux -T multi -a 0x80060000 -C lzma  -e 0x80060000 -n 'MIPS OpenWrt Linux-3.3.8' -d /home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/tmp/vmlinux-ap136.bin.lzma /home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/tmp/vmlinux-ap136.uImageImage Name:   MIPS OpenWrt Linux-3.3.8Created:      Tue Jan  5 23:21:28 2016Image Type:   MIPS Linux Multi-File Image (lzma compressed)Data Size:    1071725 Bytes = 1046.61 kB = 1.02 MBLoad Address: 80060000Entry Point:  80060000Contents:   Image 0: 1071717 Bytes = 1046.60 kB = 1.02 MBif [ `stat -c%s "/home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/root.squashfs-64k"` -gt 6488064 ]; then echo "Error: /home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/root.squashfs-64k is too big (Max=6488064 Current=`stat -c%s "/home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/root.squashfs-64k"`)"; exit 1; else if [ `stat -c%s /home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/tmp/vmlinux-ap136.uImage` -gt 1507328 ]; then echo "Error: /home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/tmp/vmlinux-ap136.uImage is too big (Max=1507328 Current=`stat -c%s "/home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/tmp/vmlinux-ap136.uImage"`)"; exit 1; else ( dd if=/home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/root.squashfs-64k bs=6488064 conv=sync; dd if=/home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/tmp/vmlinux-ap136.uImage ) > /home/huqian/qca/qsdk/bin/ar71xx/openwrt-ar71xx-generic-ap136-squashfs-sysupgrade.bin; fi; fiError: /home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/root.squashfs-64k is too big (Max=6488064 Current=8257540)make[5]: *** [install] Error 1make[5]: Leaving directory `/home/huqian/qca/qsdk/target/linux/ar71xx/image'make[4]: *** [install] Error 2make[4]: Leaving directory `/home/huqian/qca/qsdk/target/linux/ar71xx'make[3]: *** [install] Error 2make[3]: Leaving directory `/home/huqian/qca/qsdk/target/linux'make[2]: *** [target/linux/install] Error 2make[2]: Leaving directory `/home/huqian/qca/qsdk'make[1]: *** [/home/huqian/qca/qsdk/staging_dir/target-mips_r2_uClibc-0.9.33.2/stamp/.target_install] Error 2make[1]: Leaving directory `/home/huqian/qca/qsdk'make: *** [world] Error 2

Solution

然而问题终究还是要解决的。又经过一段累得吐血的折腾,大概摸索出了一些思路。

上面的日志中,注意第14行的Error提示信息:

Error: /home/huqian/qca/qsdk/build_dir/linux-ar71xx_generic/root.squashfs-64k is too big (Max=6488064 Current=8257540)

意思是说,root.squashfs-64k最大为6488064,但是当前已经达到了8257540B。

另外,第13行,打印出了产生Error的命令,可以从中分析出Error发生的场景,例如在生成哪个硬件型号的固件时出现问题。

文件大小限制(Max=6488064)是在target/linux/ar71xx/image/Makefile中,下面是一部分配置:

#$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP135,ap135,AP135,ttyS0,115200,$$(ap135_mtdlayout),1507328,14876672,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP135DUAL,ap135-dual,AP135-DUAL,ttyS0,115200,$$(ap135dual_mtdlayout),1507328,14876672,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_128k),AP135NAND,ap135-nand,AP135-DUAL,ttyS0,115200,$$(ap135nand_mtdlayout),12582912,31457280,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP136,ap136,AP136,ttyS0,115200,$$(ap136_mtdlayout),1507328,6488064,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP143_8M,ap143-8M,AP143,ttyS0,115200,$$(ap143_mtdlayout_8M),1441792,6488064,RKuImage))$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP143_16M,ap143-16M,AP143,ttyS0,115200,$$(ap143_mtdlayout_16M),1507328,14876672,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP147_8M,ap147-8M,AP147,ttyS0,115200,$$(ap147_mtdlayout_8M),1441792,6488064,RKuImage))$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP147_16M,ap147-16M,AP147,ttyS0,115200,$$(ap147_mtdlayout_16M),1507328,14876672,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP151_8M,ap151-8M,AP151,ttyS0,115200,$$(ap151_mtdlayout_8M),1507328,6488064,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP151_16M,ap151-16M,AP151,ttyS0,115200,$$(ap151_mtdlayout_16M),1507328,14876672,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP152_8M,ap152-8M,AP152,ttyS0,115200,$$(ap152_mtdlayout_8M),1507328,6488064,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_64k),AP152_16M,ap152-16M,AP152,ttyS0,115200,$$(ap152_mtdlayout_16M),1507328,14876672,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_64k),RUBBERDUCK,rubberduck,RUBBERDUCK,ttyS0,115200,$$(rubberduck_mtdlayout),1507328,14876672,RKuImage))#$(eval $(call SingleProfile,AthLzma,$(fs_64k),CAP4200AG,cap4200ag,CAP4200AG,ttyS0,115200,$$(cap4200ag_mtdlayout),1572864,12386304,KRuImage))

解决办法回归到了Makefile文件,需要修改编译选项。

有两个地方需要变动:

  • Makefile当中的类似配置条目非常多,这主要是针对不同硬件型号的板子,编译出不同的固件。为了减少编译固件中的各类问题,建议把除了目标板子外的其他条目全部注释掉。例如,我需要的ap143和ap147的文件,因而,只保留了ap143-16M和ap147-16M这两条(第6行和第8行,其他均注释掉)。

  • Max=6488064即出自于该文件,其中的限制6488064即是某个条目的配置。搜索该数字,或者直接找你的硬件对应的型号,去修改该参数。即可解决root.squashfs-64k is too big的问题,当然,继续编译的时候,你可能还会发现其他各种文件too big的问题。类似方法解决。

Final

编译openwrt其实并不麻烦,但如果你对系统定制程度较高,需要安装较多的软件,则相当棘手。

至此,也仅仅是解决了固件的问题。

接下来,需要编译镜像,添加自己的各种程序,然后让它们work!

这才是更令人崩溃的!

任重道远!

0 0
原创粉丝点击