编译镜像
官方百度云盘资料:https://doc.embedfire.com/linux/rk356x/quick_start/zh/latest/quick_start/baidu_cloud/baidu_cloud.html
解压虚拟机压缩包:"鲁班猫\8-SDK源码压缩包\开发环境虚拟机镜像\ubuntu20.04.7z"后既可以用VMware打开,打开后可以看到已经有了现成的SDK,如下:
按照:https://doc.embedfire.com/linux/rk356x/build_and_deploy/zh/latest/building_image/debian_rootfs/debian_rootfs.html#id13
文章的说法输入如下命令一键生成镜像:
# 一键编译
./build.sh
运行成功后在"rockdev"目录生成"update.img"即为镜像文件,该文件可以通过如下文章的说明下载到芯片中运行:https://chengdong.blog.csdn.net/article/details/132035193
Running build_firmware succeeded.
Make update.img
start to make update.img...
Android Firmware Package Tool v2.0
------ PACKAGE ------
Add file: ./package-file
package-file,Add file: ./package-file done,offset=0x800,size=0xa0,userspace=0x1
Add file: ./Image/MiniLoaderAll.bin
bootloader,Add file: ./Image/MiniLoaderAll.bin done,offset=0x1000,size=0x729c0,userspace=0xe6
Add file: ./Image/parameter.txt
parameter,Add file: ./Image/parameter.txt done,offset=0x74000,size=0x168,userspace=0x1
Add file: ./Image/uboot.img
uboot,Add file: ./Image/uboot.img done,offset=0x74800,size=0x400000,userspace=0x800
Add file: ./Image/boot.img
boot,Add file: ./Image/boot.img done,offset=0x474800,size=0x8000000,userspace=0x10000
Add file: ./Image/rootfs.img
rootfs,Add file: ./Image/rootfs.img done,offset=0x8474800,size=0xacb00000,userspace=0x159600
Add CRC...
Make firmware OK!
------ OK ------
********rkImageMaker ver 2.0********
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 ./Image/update.img OK.
Running build_updateimg succeeded.
Running build_allsave succeeded.
lubancat@lubancat-vm:~/LubanCat_SDK$
把这个文件拷贝到window中通过工具下载既可以下载运行:
修改根文件系统重编译
这里想去掉上图钟的图案,根据研究可知这个图案是在根文件系统里面,根据如下文章的提示修改overlay/etc/update-motd.d/00-header文件的内容:
https://doc.embedfire.com/linux/rk356x/build_and_deploy/zh/latest/building_image/debian_rootfs/debian_rootfs.html#id8
修改后文件的内容如下并保存:
按照如下提示到Debian目录下输入如下命令重新编译:
#构建完整的根文件系统镜像
./mk-buster-rootfs.sh
时间很久过去才能够编译成功:
编译成功返回到上一层(SDK)按照上面的步骤输入"./build.sh"命令一键编译生成镜像:
root@lubancat-vm:/usr/lib/aarch64-linux-gnu/dri# rm -rf /home/lubancat
root@lubancat-vm:/usr/lib/aarch64-linux-gnu/dri# rm -rf /var/lib/apt/lists/*
root@lubancat-vm:/usr/lib/aarch64-linux-gnu/dri# rm -rf /var/cache/
root@lubancat-vm:/usr/lib/aarch64-linux-gnu/dri# rm -rf /packages
root@lubancat-vm:/usr/lib/aarch64-linux-gnu/dri#
root@lubancat-vm:/usr/lib/aarch64-linux-gnu/dri# exit
Making rootfs!
Executing post-build.sh...
Adding build-info to /etc/os-release...
Fixing up /etc/fstab...
Fixing up rootfs type: auto
Adding dirs and links...
记录了0+0 的读入
记录了0+0 的写出
0字节已复制,0.0309057 s,0.0 kB/s
mke2fs 1.45.5 (07-Jan-2020)
丢弃设备块: 完成
创建含有 707328 个块(每块 4k)和 177056 个 inode 的文件系统
文件系统 UUID:a1e9a681-744c-4613-97b7-70cc87a5b12e
超级块的备份存储于下列块:
32768, 98304, 163840, 229376, 294912
正在分配组表: 完成
正在写入 inode表: 完成
创建日志(16384 个块): 完成
将文件复制到设备: 完成
写入超级块和文件系统账户统计信息: 已完成
Rootfs Image: linaro-xfce-rootfs.img
lubancat@lubancat-vm:~/LubanCat_SDK/debian$
lubancat@lubancat-vm:~/LubanCat_SDK/debian$
接下来又是漫长的等待后拷贝镜像到window后下载运行登录可以看到界面如下:
Running build_firmware succeeded.
Make update.img
start to make update.img...
Android Firmware Package Tool v2.0
------ PACKAGE ------
Add file: ./package-file
package-file,Add file: ./package-file done,offset=0x800,size=0xa0,userspace=0x1
Add file: ./Image/MiniLoaderAll.bin
bootloader,Add file: ./Image/MiniLoaderAll.bin done,offset=0x1000,size=0x729c0,userspace=0xe6
Add file: ./Image/parameter.txt
parameter,Add file: ./Image/parameter.txt done,offset=0x74000,size=0x168,userspace=0x1
Add file: ./Image/uboot.img
uboot,Add file: ./Image/uboot.img done,offset=0x74800,size=0x400000,userspace=0x800
Add file: ./Image/boot.img
boot,Add file: ./Image/boot.img done,offset=0x474800,size=0x8000000,userspace=0x10000
Add file: ./Image/rootfs.img
rootfs,Add file: ./Image/rootfs.img done,offset=0x8474800,size=0xacb00000,userspace=0x159600
Add CRC...
Make firmware OK!
------ OK ------
********rkImageMaker ver 2.0********
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 ./Image/update.img OK.
Running build_updateimg succeeded.
Running build_allsave succeeded.
lubancat@lubancat-vm:~/LubanCat_SDK$
可以看到确实按照自己的想法运行了,说明整套修改和编译是正常的!
修改设备树改屏幕为MIPI
默认的代码使用的是HDMI的屏幕,但是我最终使用的是MIPI的屏幕,这里第一步就要修改屏幕,按照鲁班猫官方的提示修改如下主设备树文件,然后从新编译镜像(./build.sh命令,会同时会编译内核)烧录后屏幕确实变成了MIPI的屏幕了:
修改设备树使默认屏幕变成MIPI
其实也可以修改设备树插件让屏幕变成MIPI,修改方式是放开如下文件的MIPI的代码:
文件是:Kernel/arch/arm64/boot/dts/rockchip/uEnv/uEnvLubanCat1.txt
修改后从新编译下载后效果和上面的一样也切换成了MIPI