【无标题】

3.3、源码编译

3.1准备源码

1.创建工作目录

mkdir -p ~/rk3568

2.拷贝源码

3.解压源码

tar -xvf OK3568-linux-source.tar.bz2

耐心等待完成即可,解压时间有点久。

4.进入源码

cd ~/rk3568/OK3568-linux-source

1、目录结构

$ tree -L 1
bruceou@ubuntu:~/rk3568/OK3568-linux-source$ tree -L 1
.
├── app
├── buildroot  # Buildroot 根文件系统编译目录
├── build.sh -> device/rockchip/common/build.sh   # 编译脚本
├── debian  # Debian 根文件系统编译目录
├── device  # 编译相关配置文件
├── docs
├── envsetup.sh -> buildroot/build/envsetup.sh
├── external
├── kernel
├── Makefile -> buildroot/build/Makefile
├── mkfirmware.sh -> device/rockchip/common/mkfirmware.sh  # 链接脚本
├── prebuilts
├── rkbin
├── rkflash.sh -> device/rockchip/common/rkflash.sh  # 烧写脚本
├── tools   #工具目录
├── u-boot   # u-boot目录
└── yocto

3.2编译SDK

1.编译前配置
在 device/rockchip/ok3568/目录下,有不同板型的配置文件,选择配置文件:

$./build.sh BoardConfig-ok3568.mk

相关配置介绍:

#!/bin/bash

# Target arch
export RK_ARCH=arm64 # 64位 ARM 架构
# Uboot defconfig
export RK_UBOOT_DEFCONFIG=OK3568-C # u-boot 配置文件
# Uboot image format type: fit(flattened image tree)
export RK_UBOOT_FORMAT_TYPE=fit
# Kernel defconfig
export RK_KERNEL_DEFCONFIG=OK3568-C-linux_defconfig# kernel 配置文件
# Kernel defconfig fragment
export RK_KERNEL_DEFCONFIG_FRAGMENT=
# Kernel dts
export RK_KERNEL_DTS=OK3568-C-linux# dts 文件
# boot image type
export RK_BOOT_IMG=boot.img
# kernel image path
export RK_KERNEL_IMG=kernel/arch/arm64/boot/Image
# kernel image format type: fit(flattened image tree)
export RK_KERNEL_FIT_ITS=boot.its
# parameter for GPT table
export RK_PARAMETER=parameter-buildroot-fit.txt# 分区表
# Buildroot config
export RK_CFG_BUILDROOT=OK3568# Buildroot 配置
# Recovery config
export RK_CFG_RECOVERY=OK3568-recovery # recovery 配置
# Recovery image format type: fit(flattened image tree)
export RK_RECOVERY_FIT_ITS=boot4recovery.its
# ramboot config
export RK_CFG_RAMBOOT=
# Pcba config
export RK_CFG_PCBA=
# Build jobs
export RK_JOBS=40
# target chip
export RK_TARGET_PRODUCT=ok3568
# Set rootfs type, including ext2 ext4 squashfs
export RK_ROOTFS_TYPE=ext4
# yocto machine
export RK_YOCTO_MACHINE=rockchip-rk3568-evb
# rootfs image path
export RK_ROOTFS_IMG=rockdev/rootfs.${RK_ROOTFS_TYPE}
# Set ramboot image type
export RK_RAMBOOT_TYPE=
# Set oem partition type, including ext2 squashfs
export RK_OEM_FS_TYPE=ext2
# Set userdata partition type, including ext2, fat
export RK_USERDATA_FS_TYPE=ext2
#OEM config
export RK_OEM_DIR=oem_normal
# OEM build on buildroot
#export RK_OEM_BUILDIN_BUILDROOT=YES
#userdata config
export RK_USERDATA_DIR=userdata_normal
#misc image
export RK_MISC=wipe_all-misc.img
#choose enable distro module
export RK_DISTRO_MODULE=
# Define pre-build script for this board
export RK_BOARD_PRE_BUILD_SCRIPT=app-build.sh

2.编译

可以选择整体的编译

./build.sh all

在这里插入图片描述

全自动编译会执行上述编译、打包操作,生成完整固件。

编译u-boot

./build.sh uboot

在这里插入图片描述
编译kernel

./build.sh kernel

在这里插入图片描述
在这里插入图片描述

编译recovery

./build.sh recovery

在这里插入图片描述
在这里插入图片描述

编译 Buildroot 根文件系统

./build.sh buildroot

在这里插入图片描述
在这里插入图片描述

3.3打包镜像

更新各部分镜像链接到 rockdev/目录:

./mkfirmware.sh

在这里插入图片描述
在这里插入图片描述

打包固件,生成的完整固件会保存到 rockdev/目录。

./build.sh updateimg

在这里插入图片描述
在这里插入图片描述

成功后,会在rockdev的目录下生成update.img的镜像文件。

  • 8
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值