4

RK 纯开源代码构建

 2 years ago
source link: https://www.taterli.com/7979/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

RK 纯开源代码构建

  • TaterLi
  • 2021年6月19日2021年6月19日

之前说过如果使用MiniLoader这种方式,虽然比较传统,但是却不可避免涉及闭源成分,但是其实RK有另一个种启动方法.

即右边红色的路线,这样几乎所有源码都受我们控制(除了GPU等少部分哪里都没办法搞到的代码之外.)

  • u-boot-tpl.bin => 三阶段启动文件,也是从U-Boot产生,因为RK的BOOTROM太小了,因此没有办法塞整个SPL,所以又搞了个TPL.
  • u-boot-spl.bin => 用来引导真正的U-Boot,可以做的事情比TPL多,比U-Boot少.
  • u-boot-nodtb.bin => 长多大都无所谓,反正已经是真实功能了.
  • fit image:
    • bl31.elf / bl32.bin / tee.bin => https://github.com/ARM-software/arm-trusted-firmware
    • u-boot.dtb => 由U-Boot提供.
  • boot image:
    • 内核文件 => 内核源码
    • 内核DTB => 内核源码
  • rootfs.img => https://github.com/rockchip-linux/rk-rootfs-build

这样,就全部受我们控制了,当然BOOTROM还是会搞点小动作,但是已经不是我们关心的范畴了,如果还不满意只能换一些国外厂CPU了,国内厂基本都有这个限制.

具体烧写部分也少了很多.

rkdeveloptool db rkxx_loader_vx.xx.bin
rkdeveloptool wl 0x40 idbloader.img
rkdeveloptool wl 0x4000 u-boot.itb
rkdeveloptool wl 0x8000 boot.img
rkdeveloptool wl 0x40000 rootfs.img
rkdeveloptool rd

idbloader.img制作方法:

tools/mkimage -n px30 -T rksd -d tpl/u-boot-tpl.bin idbloader.img
cat spl/u-boot-spl.bin >> idbloader.img

u-boot.itb制作方法:

make u-boot.itb

内核和具体镜像制作我看不用说了吧,这里有更多资源:http://opensource.rock-chips.com/

最终系统就是U-Boot + 内核 + 系统,是不是很干净,不过我还是推荐用官方MiniLoader,毕竟稳定可靠,看出货这么多山寨平板没出事就知道了.

再最后补充,如果真的想研究的话,有很多更方便开发,资料更丰富的平台研究具体的内容,不过PX30是最近练手设计的一个板子,逐步调通吧.

发表评论 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

评论

显示名称 *

电子邮箱地址 *

网站地址


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK