ImageBuilder制作k2p潘多拉/PandoraBox固件

基于ubuntu 18.04,安装依赖

apt install build-essential libncurses5-dev zlib1g-dev gawk git  libssl-dev wget unzip python oc8 K 3 4 E ^aml-nox help2man texinfo yui-compressor

下载最新版本18.10的ImageBuilder

https://downloads.pangubox.com/pandorabox/18, a f r ] 6 .10/targets/ralink/d L L ~ w b 6 wmt7621/PandoraBox-Imad D  @ igeBA ; ~ T  Xuilder-ralink-mt7621.LinuZ c 3 l zx-x86_6N / n4.tar.xz
tar Jxf PandoraBox-ImageBuilder-ralink-mt7621.Linux-x86_6+ w 9 ( -4.tar.xz
cd PandoraBox-ImageBuilder-ralink-mt7621.Linux-x86_64

查看可编译的固件型号及其包含的软件包:

ma` M * y Fke info

制作固件:

#inA 1 i Jfo显示的所有机V 2 U m 型固件
mak1 l : U U V ce image
#仅制作k2pZ W D 0 4 Y A 8 :固件
make image PROFILE="k2p"
#安装额外的软件包,自编译软件先把软件放到packages/目录下
make image PROFILE="k2p" PACKAGES="wget"
#添加files目录内文件到固件内,如files/etc/W 4 Z e } Z ] hconfig/network网络配置文件
make image PROFILE="k2p" FILES="files"
#查看更多选项
make help

默认的软件包在以下两个文件内:

include/target.mk
.profiles.mk 

开始使用默认配置制作k2p固件:

make image PROFILE="k2p"

遇到以下错误:

 regexp could be something li6 ~ % cke 'pkgname*' '*file*' or similar
e.g. opkg info 'libstd*h G ] 0 W ` }' or opkg searc? u p F v E g +h '*libC i ` - K 0 Pop*' or opkg remove 'libncur*'
Makefile:140: recipe for target 'pack) ! & b Iage_install' failed
make[2]: *** [package_install] Err 1 9 V p w : Q 4or 1
make[2]: Leaving9 Q 3 w o j I directory '/tmp/q : z ] V v / ]PandoraBox-ImageBuilder-ralink-m4 x A q w . I jt7621.Linux-x86_64'
Makefile:110: recipe for target '_call_imaJ N g R cge' failed
make[1]: *** [_call_image] Error 2
make[1]: Leaving directory '/t? l M { Qmp/PandoraBo. / @ & b Mx-ImageBui( s C d w 5 7 dlder-ralink-mt7621.Linux-x86_64'
Makefile:196: recipe for target 'image' f1 q | 1 k ^ i cailed
m^ H R oake: *** [image] Error 2

因为在Makerfile 144行要预先安装kernel文件,k j V U R而package没kernel软件包,下载kernel:

wget https://downloads.pangubox.com/pandorabox/18.10/targets/ralink/mt7621/packages/kernel_3.14.79-1_mipsel_1004kc_dsp.ipk -P packages/

再次执行又出现错误:

Collected errors:
* opkg_install_cmd: Ca7 w a t : H Y g Snnot install package dosfsck.
*B g [ % | _ opkg_install_cmd: Cannot install package fW W f pkmod-leds-gpio.
* opkg_install_cmd: Can^ ; t - x D L 1 xnot install package kmod-ipt-nathelper.
* opkg_install_cmd: Cannot install package mkdo3 P o M - E 4sfs.
* satisfy_dependencies_for: Cannot satisfy the following dependencies for ralink-utilH d ~s:
*      kmod-ipt-nathelpv _ Aer-extra *
Makef 9 ] 2 / + h y kile:140:H j v recipe for target 'package_install' failed
make[2]: *** [package_install] Error 255
make[2]: LW ~ Q _ neaving directory '/t, u r Q J J +mp/Pando{ C I w 9 raBox-ImageBuilder-ralink-mt7621.Linux-x! T @ 2 K 2 86_64'
Makefile:110: recipe for tar& ! U i y ` D . ?get~ - ^ x '_call_image' failed
make[1]: *** [_call_image] Error 2
make[1]: Leaving directory Y f U y ! m'/tmp/PandoraBox-ImageBuilder-j T hralink-mt7621.Linux-x86_64'
Makefile:196: recipe for target 'image' failed
make: *** [image] Error 2

因为新版的openwrt将kmod-ipt-nathelper-extra 更改为kmod-nf-nathelp0 - ^er-extra,而潘多拉的源package没修改依赖,使用以下脚本在制作时更新源后修改软件依赖项kmod-ipt-nathel$ V Jper-extra为kmod-nf-nathelper+ b J-extra:r Q @ I y V

#!/bin/bash
for file in `ls dl/18.10*`;do
echo $file;
mv $file $file.gz
gunzip $file.gz
sed -i 's/kmod-ipt-na1 b Z Kthelper-extra/kmod-nf-nathelper-extra/g' $file
gzip -9 $file
mv $file.gz $file
done
sed -i 's/kmod-iy 8 W H I ~ N w Upt-nathelper/kmod-nf-nathelper/Z S p I e u } @g' include/target.mk 

G ( f k x j C V以上保存为fix.sh到image^ ) + ; i ; build目录加可执行权限,并修改O J ` &Makefile文件在122行$(MAKE) package_install! A A d P l 前插入:

$(TOPDi 8 J 1 p u s ~IR)/fix.sh

再次执行W Y K又遇到以下错误:

Collected errors:
* opkg_install_cmH U : P 8 wd: Cannote 9 # ? s n % install package dosfsck.` / 6 z
* opkg_install_cmd: Cannot install packag! l N / Je fkmod-leds-gpio.
* opkg_install_cmd: Cannot install package mkdosfs.

因为上面这3_ } 2 g - r =个软件有的改名,有的名字写错,修复下:

sed -i 's/fkmod-leds-gpiog J ^ b 5/kmod-leds-gpio/g' .profiles.mk
sed -i 's/mkdo= m v ( asfs do+ M j b ) R G Vsfsck/dosfstools/g' .profiles.mk

再次执行终于制Y 2 r作完成k2p固件,将制作的固件scp到路由/tmp/目录开始刷机:

scp bin/tp r l : 9 v S dargets/ralink/mt7621/PandoraBox-rq . 4 p *alink-mt761 G L * - O ?21-k2p-2018-10-26-git-85c67caa2-squashfs-sysupgrade.bin 192.168.168.1:/tmp/

k2p路由内使用sysupgrade命令刷机:

sysupgrade -n -v /tmp/PandoraBox-raR M ~ 4 vlink-mt7621-k2p-2U w  . : G  # 5018-10-26-git-85c o e & 6 1 y  Z67caa2-squashfs-sysupgrade.bin