hi,欢迎访问本站!
当前位置: 首页学习笔记正文

[ROC-RK3568-PC] 手把手教你在Linux下解包与打包Ubuntu系统固件

用户投稿 学习笔记 20阅读

🍇 博主主页:Systemcall小酒屋 🍇 博主简介:Neutionwei,C站嵌入式领域新星创作者之一,一枚热爱开源技术、喜欢分享技术心得的极客,注重简约风格,热衷于用简单的案例讲述复杂的技术,“假传万卷书,真传一案例”,这是厦大一位教数学的院士说过的一句话,另外“成就是最好的老师”,技术既要沉淀,也得分享,成就感的正反馈是支持我持续耕耘的动力! 🍇 专栏目录:Firefly-RK356x板卡 🍇 专栏说明:本专栏主要基于Firefly旗下的RK356x板卡进行入门篇讲述,欢迎订阅,博主会持续更新!

在前面我带领大家如何主要讲述如何在Windows系统下对Ubuntu固件进行解包,但是假设我想在Linux系统下解包,那怎么办?别急,这篇给大家揭晓!

文章目录 1、准备工具2、Ubuntu固件下载3、使用firefly-linux-repack工具解包与打包

1、准备工具

工欲善其事,必先利其器,为了尽可能避免发生奇怪的错误,我在这里列举一下大家需要用到的工具:

PC机:Ubuntu 18.04系统解包与打包工具:firefly-linux-repack

firefly-linux-repack可以到Firefly官方进行下载,链接如下:

https://www.t-firefly.com/doc/download/107.html

大家点击以下图片中指向的地方进行下载:

2、Ubuntu固件下载

依然是之前的Firefly官方下载页面:https://www.t-firefly.com/doc/download/107.html

Firefly官方提供了两个版本的Ubuntu系统,大家可以各取所需~~~ 假如大家点击了Ubuntu 20.04,继续点击一般系统(第二项的RTLinux是实时系统,一般场合我们用不到): 点击7z文件进行下载(第一项的md5是校验文件):

3、使用firefly-linux-repack工具解包与打包

(1)安装环境依赖;

sudo apt-get install lib32stdc++6

(2)查看使用方法;

neutionwei@x:~/Downloads/firefly-linux-repack$ lsbin pack.sh Readme_en.md Readme.md unpack.sh update.imgneutionwei@x:~/Downloads/firefly-linux-repack$ cat Readme.md1. 解包 把官方发布的固件拷贝到当前目录,重命名为update.img , 执行unpack.sh 解包完成后,生成的文件在output目录下.2. 合包 保持当前目录结构,文件名等不变,用客户自己的文件替换output/下同名的文件 执行pack.sh, 执行完后,生成new_update.img,即为打包好的固件rootfs文件名必须为rootfs.imgparameter.txt文件名必须为parameter.txt注意:合包过程中,如果rootfs分区不是最后一个分区,那么程序会根据rootfs文件的大小,自动修改parameter.txt中rootfs分区的大小。如果用户自己有改动parameter.txt,请留意整个合包的流程。

(3)解压并移动Ubuntu固件到firefly-linux-repack目录并重命名为update.img;

neutionwei@x:~/Downloads$ 7z x ROC-RK3568-PC-UBUNTU20.04-GPT-20211012-1436.7zneutionwei@x:~/Downloads$ mv ROC-RK3568-PC-UBUNTU20.04-GPT-20211012-1436.img firefly-linux-repack/update.img

(4)解包update.img;

neutionwei@x:~/Downloads/firefly-linux-repack$ ./unpack.sh start to unpack update.img...********RKImageMaker ver 1.67********Unpacking image, please wait...Exporting boot.binExporting firmware.imgUnpacking image success.Android Firmware Package Tool v1.67Check file... OK------- UNPACK ------package-file0x00000000000008000x000000000000011AImage/MiniLoaderAll.bin0x00000000000010000x00000000000679C0Image/parameter.txt0x00000000000690000x00000000000001CDImage/uboot.img0x00000000000698000x0000000000400000Image/misc.img0x00000000004698000x000000000000C000Image/boot.img0x00000000004758000x0000000001F7F000Image/recovery.img0x00000000023F48000x0000000001F0C600Image/rootfs.img0x00000000043010000x0000000000400000Unpack firmware OK!------ OK ------Unpacking update.img OK.Press any key to quit:

(5)查看各个分区文件;

neutionwei@x:~/Downloads/firefly-linux-repack$ tree output/output/├── Image│ ├── boot.img│ ├── misc.img│ ├── recovery.img│ ├── rootfs.img│ └── uboot.img├── MiniLoaderAll.bin├── package-file└── parameter.txt1 directory, 8 files

(6)自行替换某个分区文件;

(7)打包新的Ubuntu固件;

neutionwei@x:~/Downloads/firefly-linux-repack$ ./pack.sh start to make update.img...Resize rootfs partitiondumpe2fs 1.44.1 (24-Mar-2018)Android Firmware Package Tool v1.67------ PACKAGE ------Add file: ./package-filepackage-file,Add file: ./package-file done,offset=0x800,size=0x11a,userspace=0x1Add file: ./Image/MiniLoaderAll.binbootloader,Add file: ./Image/MiniLoaderAll.bin done,offset=0x1000,size=0x679c0,userspace=0xd0Add file: ./Image/parameter.txtparameter,Add file: ./Image/parameter.txt done,offset=0x69000,size=0x1d9,userspace=0x1Add file: ./Image/uboot.imguboot,Add file: ./Image/uboot.img done,offset=0x69800,size=0x400000,userspace=0x800Add file: ./Image/misc.imgmisc,Add file: ./Image/misc.img done,offset=0x469800,size=0xc000,userspace=0x18Add file: ./Image/boot.imgboot,Add file: ./Image/boot.img done,offset=0x475800,size=0x1f7f000,userspace=0x3efeAdd file: ./Image/recovery.imgrecovery,Add file: ./Image/recovery.img done,offset=0x23f4800,size=0x1f0c600,userspace=0x3e19Add file: ./Image/rootfs.imgrootfs,Add file: ./Image/rootfs.img done,offset=0x4301000,size=0x400000,userspace=0x800Add CRC...Make firmware OK!------ OK ------********RKImageMaker ver 1.67********Generating new image, please wait...Writing head info...Writing boot file...Writing firmware...Generating MD5 data...MD5 data generated successfully!New image generated successfully!Making update.img OK./home/neutionwei/Downloads/firefly-linux-repackPress any key to quit:neutionwei@x:~/Downloads/firefly-linux-repack$ lsbin new_update.img output pack.sh Readme_en.md Readme.md unpack.sh update.img

(8)new_update.img就是新的Ubuntu固件。

标签:
声明:无特别说明,转载请标明本文来源!
发布评论
正文 取消