利用OpenWRT的Image Builder生成am335x的根文件系统

本人需要在am335x上移植python3,找了很多教程都没有成功,好不容易移植成功了之后,也没有python模块,用起来很不方便。
openWRT自带了很多的软件,通过imgeBuilder定制,可以根据需要删减或增加自己需要的软件,使用imgeBuilder能快速创建指定硬件的系统映像文件,并生成可以直接烧写的系统映像文件。下面就按步骤来生成一个映像文件吧。
1、环境介绍。一个运行64位Linux的虚拟机(我用的ubuntu1604),预装gcc,make等开发工具。我的硬件是 arm工控机linux迷你A8嵌入式V2电脑主机低功耗工业计算机 am335,am3352的CPU,购买链接:https://item.taobao.com/item.htm?spm=a1z10.5-c-s.w4002-22340047314.13.5addb35ee4moLf&id=610623797062。
先安装和更新软件
sudo apt-get install gcc make git-core unzip gawk libncurses5-dev build-essential libssl-dev libz-dev bzip2 binutils subversion

2、从 https://downloads.openwrt.org/ 下载对应的imagebuilder软件包,我的包为openwrt-imagebuilder-19.07.4-omap.Linux-x86_64.tar.xz 相应地址为https://downloads.openwrt.org/releases/19.07.4/targets/omap/generic/
由于上面网址下载速度太慢,可使用国内清华镜像 下载相应的imagebuilder软件包,https://mirrors.tuna.tsinghua.edu.cn/openwrt/

3、使用虚拟机提供的宿主机和虚拟机间共享文件夹或scp方式,将下载的文件拷贝到Linux中。

4、解压缩,释放文件到默认目录。
tar -zxvf openwrt-imagebuilder-19.07.4-omap.Linux-x86_64.tar.xz

5、进入imageBuilder目录,编辑文件repositories.conf,修改下载位置为国内镜像网站并保存。
cd openwrt-imagebuilder-19.07.4-omap.Linux-x86_64
vi repositories.conf
我更喜欢用gedit作为文本编译器

src/gz openwrt_core https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/19.07.4/targets/omap/generic/packages/
src/gz openwrt_base https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/19.07.4/packages/arm_cortex-a8_vfpv3/base
src/gz openwrt_luci https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/19.07.4/packages/arm_cortex-a8_vfpv3/luci
src/gz openwrt_packages https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/19.07.4/packages/arm_cortex-a8_vfpv3/packages
src/gz openwrt_routing https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/19.07.4/packages/arm_cortex-a8_vfpv3/routing
src/gz openwrt_telephony https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/19.07.4/packages/arm_cortex-a8_vfpv3/telephony

6、试着创建一下
在这里插入图片描述
使用make info查看所支持的项目名

make image PROFILE=ti_am335x-evm FILES=files/ PACKAGES=“python3 luci luci-i18n-base-zh-cn luci-i18n-firewall-zh-cn luci-app-upnp luci-i18n-upnp-zh-cn python3-pip python3-openssl python3-cffi python3-jsonpath-ng python3-lxml python3-paho-mqtt python3-pyserial python3-pytz python3-yaml python3-simplejson python3-requests python3-flask mac-telnet-server mac-telnet-ping mac-telnet-discover openssh-sftp-server”

PROFILE=ti_am335x-evm 表示使用ti_am335x-evm这个项目进行编译
FILES=files/ 表示编译完成之后,将此文件夹下的内容复制到根目录相应文件夹下覆盖生成的文件,可用于给定出厂默认设置。
PAKAGES后面罗列出需要添加到固件中的额外的包,不填写的话只包含预定义的需要的最少的包,如果前面以"-"符号开头的表示不不含这个包,比如说:PACKAGES=“luci luci-i18n-chinese -pppox”

而我们希望耍好的固件默认安装luci并开启相关服务以便我们刷机或者重置后直接通过网页访问luci界面配置路由等等 此时我们可以添加以下几个包,有其他需求可自己添加比如说DDNS SAMBA等等:
luci
luci-i18n-chinese # 中文支持
luci-sgi-uhttpd # 默认开启utttpd,刷机后可直接网页访问luci
luci-app-qos # QOS
luci-app-upnp # UPNP
luci-proto-ipv6 # 向luci添加ipv6相关协议的完整支持

编译的过程,会从网上下载需要的软件包,因为是从国内镜像下载,所以速度还是很快的,当然也可以自己下载,拷贝到dl目录,编译过程自动下载的文件也在这个目录下。

新创建的映像文件在这个目录下 ./openwrt-imagebuilder-19.07.4-omap.Linux-x86_64/bin/targets/omap/generic/ 目录下,如是其他架构,文件夹名称可能不一样。

openwrt-19.07.4-omap-device-ti-am335x-bone-black-rootfs.tar.gz 为根文件系统

通过工具将根文件系统烧录到nand中,启动启动,可以看到已经直接python3

参考文档:
https://blog.csdn.net/liuzhuchen/article/details/25377817
https://blog.csdn.net/sun_sky1/article/details/107968657

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值