|
【技术讨论】
基于官方debian10重新打包到私有固件后再刷入至板子,启动后不正常进入initramfs模式
发表于 2022-6-22 15:07:01
浏览:14352
|
回复:12
打印
只看该作者
[复制链接]
楼主
问题描述及复现步骤:
本帖最后由 music1913 于 2022-6-22 15:24 编辑
在 firefly 的官方云盘中,可供下载的debian 10的文件包内容如下:
AIO-RV1126(1109)-JD4\Debian10\debian10_2021_0429_1902\debian10\
我将上述文件与路径 AIO-RV1126(1109)-JD4\Buildroot\AIO-RV1126_RV1109-JD4_IPC_2021_1206_1919\ 下的固件包先进行了合并,然后再通过RK_Dev_tool整体刷入主板的,所以最终的刷入主板的官方固件包结构是这样:
刷入后,主板系统启动后一切运行正常。在主板系统启动后,安装包括python的一些package, 各类配置文件等,通过pip install ... 和拷贝等方式,安装至系统中。
到手一个 32G 的U盘,插入windows pc, 下载 DiskGenius 将其 format 成 ext4 格式:
插入U盘至rv1126主板,并加载(映射)U盘至本地文件夹:
- sudo mount /dev/sda1 /media/usb_drive
复制代码
2.导出当前固件
用工具 ff_export_rootfs 进行 export:
firefly@firefly:~/Download/ff_export_rootfs_buildroot$ sudo ./ff_export_rootfs /media/usb_drive/
MEDIA FREE SPACE SIZE 55975 MBytes
EXPORT IMAGE SIZE 8568 MBytes
find: '/proc/896/task/896/net': Invalid argument
find: '/proc/896/net': Invalid argument
find: '/proc/936/task/936/net': Invalid argument
find: '/proc/936/net': Invalid argument
find: '/proc/1139/task/1139/net': Invalid argument
find: '/proc/1139/net': Invalid argument
BLOCK_COUNT 9290489
INODE_COUNT 169877
sync...
sync finish
Export rootfs to /media/usb_drive//Firefly_ext4_202206170232.img Success
可见生成的文件Firefly_ext4_202206170232.img有file size达到9G。
压缩镜像文件:
- firefly@firefly:/media/usb_drive$ sudo /sbin/e2fsck -p -f Firefly_ext4_202206170232.img
复制代码
到7G。
3.unpack官方固件
官方的未解离的固件文件存在于: AIO-RV1126(1109)-JD4\Debian10\shao_merge\pack\AIO-RV1126-JD4-BE-45-GPT-20211206-1919.img 将此文件重新命名为 update.img,并拷贝至一台安装了firefly-rk3399-linux-repack 工具的 Ubuntu PC机上,并运行
,可以看到运行结果:
shawn@DESKTOP-9NG0VFK:~/Downloads/firefly-rk3399-linux-repack$ sudo ./unpack.sh
start to unpack update.img...
********RKImageMaker ver 1.66********
Unpacking image, please wait...
Exporting boot.bin
Exporting firmware.img
Unpacking image success.
Android Firmware Package Tool v1.65
Check file... OK
------- UNPACK ------
package-file 0x0000000000000800 0x000000000000032C
Image/MiniLoaderAll.bin 0x0000000000001000 0x000000000003F94E
Image/parameter.txt 0x0000000000041000 0x0000000000000205
Image/uboot.img 0x0000000000041800 0x0000000000400000
Image/misc.img 0x0000000000441800 0x000000000000C000
Image/boot.img 0x000000000044D800 0x000000000101EC00
Image/recovery.img 0x000000000146C800 0x0000000000F97A00
Image/rootfs.img 0x0000000002404800 0x000000001EA58000
Image/oem.img 0x0000000020E5C800 0x000000000AB00000
Image/userdata.img 0x000000002B95C800 0x0000000000500000
Unpack firmware OK!
------ OK ------
Unpacking update.img OK.
Press any key to quit:
在此 Ubuntu PC 上,可以看到 unpack后的文件夹位于: xxxx\Downloads\firefly-rk3399-linux-repack\output\Image\ 其中的文件结构如下:
将之前私有定制后export出来的Firefly_ext4_202206170232.img 重新命名为 rootfs.img 并覆盖替换上图中的同样文件(size 490.34M),所以现在文件夹结构为(其实仅一个文件被更换了):
回到 Ubuntu PC 命令行中,进行重新(repack)打包:
shawn@DESKTOP-9NG0VFK:~/Downloads/firefly-rk3399-linux-repack$ sudo ./pack.sh
start to make update.img...
Resize rootfs partition
dumpe2fs 1.45.5 (07-Jan-2020)
Android Firmware Package Tool v1.65
------ PACKAGE ------
Add file: ./package-file
Add file: ./Image/MiniLoaderAll.bin
Add file: ./Image/parameter.txt
Add file: ./Image/uboot.img
Add file: ./Image/misc.img
Add file: ./Image/boot.img
Add file: ./Image/recovery.img
Add file: ./Image/rootfs.img
Add file: ./Image/oem.img
Add file: ./Image/userdata.img
Add CRC...
Make firmware OK!
------ OK ------
********RKImageMaker ver 1.66********
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/shawn/Downloads/firefly-rk3399-linux-repack
Press any key to quit:
得到了一个新文件 new_update.img:
重新命名new_update.img 到 udpate.img,再次运行 unpack.sh:
shawn@DESKTOP-9NG0VFK:~/Downloads/firefly-rk3399-linux-repack$ sudo ./unpack.sh
start to unpack update.img...
********RKImageMaker ver 1.66********
Unpacking image, please wait...
Exporting boot.bin
Exporting firmware.img
Unpacking image success.
Android Firmware Package Tool v1.65
Check file... OK
------- UNPACK ------
package-file 0x0000000000000800 0x000000000000032C
Image/MiniLoaderAll.bin 0x0000000000001000 0x000000000003F94E
Image/parameter.txt 0x0000000000041000 0x0000000000000201
Image/uboot.img 0x0000000000041800 0x0000000000400000
Image/misc.img 0x0000000000441800 0x000000000000C000
Image/boot.img 0x000000000044D800 0x000000000101EC00
Image/recovery.img 0x000000000146C800 0x0000000000F97A00
Image/rootfs.img 0x0000000002404800 0x00000001D61E2C00
Image/oem.img 0x00000001D85E7800 0x000000000AB00000
Image/userdata.img 0x00000001E30E7800 0x0000000000500000
Unpack firmware OK!
------ OK ------
Unpacking update.img OK.
Press any key to quit:
得到文件结构:
将上述文件包刷入板子中:
因rootfs.img较大,此次写入需要10几分钟,完成后,通过串口连进去板子,看到如下错误,且系统进入了initramfs模式:
...
...
...
/scripts/init-top/console_setup: line 1: can't open /dev/tty5: No such device or address
/scripts/init-top/console_setup: line 1: can't create /dev/tty6: No such device or address
/scripts/init-top/console_setup: line 1: can't open /dev/tty6: No such device or address
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
Warning: fsck not present, so skipping root file system
[ 3.656794] EXT4-fs (mmcblk0p6): mounted filesystem without journal. Opts: (null)
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... Warning: overlayroot: configuring overlayroot with driver=overlay mode=device opts='dev=PARTLABEL=userdata,fstype=ext4,mkfs=1' per kernel cmdline
[ 3.801313] EXT4-fs (mmcblk0p8): warning: mounting unchecked fs, running e2fsck is recommended
[ 3.803943] EXT4-fs (mmcblk0p8): mounted filesystem without journal. Opts: (null)
[ 3.836820] EXT4-fs error (device mmcblk0p6): ext4_lookup:1706: inode #2: comm overlayroot: deleted inode referenced: 58673
[ 3.840096] EXT4-fs error (device mmcblk0p6): ext4_lookup:1706: inode #2: comm overlayroot: deleted inode referenced: 58673
mkdir: can't create directory '/root/userdata': Structure needs cleaning
[ 3.847199] EXT4-fs error (device mmcblk0p6): ext4_lookup:1706: inode #2: comm exe: deleted inode referenced: 58673
mount: mounting /userdata on /root/userdata failed: Structure needs cleaning
Failure: overlayroot: failed to move /userdata to /root/userdata
Warning: Something odd, no /lib/modules/4.19.111 in initramfs.
done.
[ 3.925953] EXT4-fs error (device mmcblk0p6): ext4_lookup:1706: inode #2: comm run-init: deleted inode referenced: 49097
run-init: /sbin/init: Structure needs cleaning
Target filesystem doesn't have requested /sbin/init.
[ 3.929671] EXT4-fs error (device mmcblk0p6): ext4_lookup:1706: inode #2: comm run-init: deleted inode referenced: 49097
run-init: /sbin/init: Structure needs cleaning
run-init: /etc/init: No such file or directory
[ 3.939371] EXT4-fs error (device mmcblk0p6): ext4_lookup:1706: inode #2: comm run-init: deleted inode referenced: 46969
run-init: /bin/init: Structure needs cleaning
[ 3.943189] EXT4-fs error (device mmcblk0p6): ext4_lookup:1706: inode #2: comm run-init: deleted inode referenced: 46969
run-init: /bin/sh: Structure needs cleaning
run-init: : No such file or directory
chvt: can't open console
No init found. Try passing init= bootarg.
Couldn't get a file descriptor referring to the console
/scripts/panic/console_setup: line 133: can't create /dev/tty1: No such device or address
/scripts/panic/console_setup: line 1: can't open /dev/tty1: No such device or address
/scripts/panic/console_setup: line 1: can't create /dev/tty2: No such device or address
/scripts/panic/console_setup: line 1: can't open /dev/tty2: No such device or address
/scripts/panic/console_setup: line 1: can't create /dev/tty3: No such device or address
/scripts/panic/console_setup: line 1: can't open /dev/tty3: No such device or address
/scripts/panic/console_setup: line 1: can't create /dev/tty4: No such device or address
/scripts/panic/console_setup: line 1: can't open /dev/tty4: No such device or address
/scripts/panic/console_setup: line 1: can't create /dev/tty5: No such device or address
/scripts/panic/console_setup: line 1: can't open /dev/tty5: No such device or address
/scripts/panic/console_setup: line 1: can't create /dev/tty6: No such device or address
/scripts/panic/console_setup: line 1: can't open /dev/tty6: No such device or address
BusyBox v1.27.2 (Ubuntu 1:1.27.2-2ubuntu3.2) built-in shell (ash)
Enter 'help' for a list of built-in commands.
(initramfs)
请问上述步骤是有哪里不对吗?
|
-
-
none.zip
154 Bytes, 下载次数: 0, 下载积分: 灯泡 -1 , 经验 -1
|