当前位置:   article > 正文

radxa Rock 5B rk3588 buildroot 编译

rk3588 buildroot

rockchip RK3588 Rock 5B 开发板-启动

硬件:RK3588 Rock 5B
软件: Rock 5B U-Boot 2017.09, linux 5.10.110-gd29d8a1f1f33-dirty
问题
硬件: 散热小风扇 2W, Rock 5B 16G-RAM, 256G 固态硬盘, 65W DP 充电器, 诱骗稳压器(正点原子 DP100)

1.重启问题

	我使用小米的67W充电器 Type-A(5V 3A),多数时间启动过程中重启,且一直循环。
    官方信息:USB Type‑C™ PD Version 2.0 with 9V/2A, 12V/2A, 15V/2A and 20V/2A.
  • 1
  • 2

• Power adapter with fixed voltage in 5V to 20V range on the USB Type‑C port
• 5V Power applied to the GPIO PIN 2 & 4
The recommended power source should be able to produce, at least, 24W without a M.2 SSD or 30W
with a M.2 SSD.
注意: 我这边使用方案为普通 DP电源 65W(5V 3A, 9V 3A, 12V 3A, 15V 3A, 20V 3.25A) + DP100(正点原子)诱骗到20V 然后降压到12V 使用。看电影功耗在7W(12v, 0.6a) ~12.5W(12v, 1.2),跟网络关系很大,在使用浏览器时功耗较高。

2.buildroot 问题

	A. 使用在buildroot 中指定 Rock 5B 的uboot, kernel. 后出现打包 idbloader.img 失败。 
	 原因:使用,buildroot 编译出的uboot-tools(mkimage) 不支持 rk3588,需要使用 rock 5b uboot 下的 /tools/mkimage 做打包
	B. ubuntu22.04 编译打包 BL31 时调用python 失败(该错误不会导致编译失败,需要谨慎)
	 原因:ubuntu 22.04 默认安装的是 python3(python3.10 需要降级到 python3.8), uboot 内部打包 BL31 的python 脚本指定是 python。需要将python 链接到python3
  • 1
  • 2
  • 3
  • 4

3.NVME 盘启动问题

	A. uboot 通过 ctrl+c ,进入命令行(如果无法进入,请在uboot 内部将 stdin disable 关闭 CONFIG_DISABLE_CONSOLE ),然后首先输入 pci enum 查找到设备。然后再进行 nvme scan, nvme info 扫描
  • 1

4.WIFI 网卡无法启动问题

我是用的是 rtl8852be ,但是网卡无法扫描到设备, 蓝牙不能使用
  • 1

该版本中有wifi rtl8852be 驱动错误
/kernel-linux-5.10-gen-rkr3.4/drivers/net/wireless/rockchip_wlan/rtl8852be/phl/phl_cmd_ser.c 修改如下即可

_phl_ser_mdl_init
	pq_init(drv, &cser->stslist); # 添加 修复bug
_phl_ser_mdl_deinit
	pq_deinit(drv, &cser->stslist); # 添加 修复bug
  • 1
  • 2
  • 3
  • 4

5. RK3588 U-Boot编译报错

U-Boot 2017.09 编译时,需要使用到python, 但 ubuntu 默认安装python3 (python3.10 降级到 python3.8)需要 ,需要ln -s [python3] [python]链接。
U-Boot 编译产生 u-boot.itb, u-boot-spl.bin 两个文件,在后面要用到(需要通过u-boot-spl.bin 合成 idbloader.img), rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.08.bin 文件由官方SDK 提供(注意: mkimage必须使用RK 提供的uboot/tools下的工具)

U-Boot-2017.09/tools/mkimage -n rk3588 -T rksd -d board/radxa/rock-5b/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.08.bin:$BINARIES_DIR/u-boot-spl.bin $BINARIES_DIR/idbloader.img
  • 1

6. 编译U-Boot/Kernel 时出现错误

原因Ubuntu22.04 安装gcc 版本为 gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1)
解决方式: 降级 gcc 版本到 gcc9

/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
  • 1

出现某些dts文件编译报错直接修改u-boot/arch/arm/dts/Makefile将报错的dts 删除

  DTC     arch/arm/dts/rk3036-sdk.dtb
  DTC     arch/arm/dts/rk3066a-mk808.dtb
  DTC     arch/arm/dts/rk3126-evb.dtb
  DTC     arch/arm/dts/rk3128-evb.dtb
  DTC     arch/arm/dts/rk3188-radxarock.dtb
  DTC     arch/arm/dts/rk3288-evb.dtb
  DTC     arch/arm/dts/rk3288-fennec.dtb
  DTC     arch/arm/dts/rk3288-firefly.dtb
  DTC     arch/arm/dts/rk3288-miqi.dtb
  DTC     arch/arm/dts/rk3288-phycore-rdk.dtb
Error: arch/arm/dts/.rk3036-sdk.dtb.pre.tmp:77.1-10 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.lib:319: arch/arm/dts/rk3036-sdk.dtb] Error 1
make[2]: *** Waiting for unfinished jobs....
  DTC     arch/arm/dts/rk3288-popmetal.dtb
Error: arch/arm/dts/.rk3188-radxarock.dtb.pre.tmp:383.1-10 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.lib:319: arch/arm/dts/rk3188-radxarock.dtb] Error 1
make[1]: *** [dts/Makefile:101: arch-dtbs] Error 2
make: *** [Makefile:882: dts/dt.dtb] Error 2
ERROR: Running build_uboot failed!
ERROR: exit code 2 from line 245:

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

7.Buildroot 配置文件 rock_5b_defconfig

# Architecture
BR2_aarch64=y
BR2_cortex_a76_a55=y

# Linux headers same as kernel, a 5.10 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y

# Bootloader
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="rock5b-2017.09"
BR2_TARGET_UBOOT_VERSION="rock5b-2017.09"
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rock-5b-rk3588"
BR2_TARGET_UBOOT_NEEDS_DTC=y
BR2_TARGET_UBOOT_NEEDS_PYTHON3=y
BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
# BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
# BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF=y
BR2_TARGET_UBOOT_FORMAT_DTB=y
BR2_TARGET_UBOOT_FORMAT_ITB=y
BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin"
BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="BL31=$(TOPDIR)/board/radxa/rock-5b/rk35/rk3588_bl31_v1.28.elf"

# Kernel
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="rock5b-5.10.110"
BR2_LINUX_KERNEL_USE_DEFCONFIG=y
BR2_LINUX_KERNEL_DEFCONFIG="rockchip_linux"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="rockchip/rk3588-rock-5b"
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y

# system
BR2_DL_DIR="$(TOPDIR)/../dl"
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_ROOTFS_OVERLAY="../configs/rootfs"
BR2_TARGET_GENERIC_ROOT_PASSWD="root"

# toolchain
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_PATH="../gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu"
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-none-linux-gnu"
BR2_TOOLCHAIN_EXTERNAL_GCC_10=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_20=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
BR2_TOOLCHAIN_EXTERNAL_WCHAR=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
BR2_TOOLCHAIN_EXTERNAL_INET_RPC=n

# Filesystem
BR2_TARGET_GENERIC_HOSTNAME="rock-5b"
BR2_TARGET_GENERIC_ISSUE="Welcome to ROCK-5B"
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="160M"
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_CPIO_LZO=y
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_HOST_UBOOT_TOOLS=y
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/radxa/rock-5b/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/radxa/rock-5b/genimage.cfg"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/radxa/rock-5b/post-build.sh"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70

合成脚本 genimage.sh

output/build/uboot-rock5b-2017.09/tools/mkimage -n rk3588 -T rksd -d board/radxa/rock-5b/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.08.bin:$BINARIES_DIR/u-boot-spl.bin $BINARIES_DIR/idbloader.img
  • 1

配置genimage.cfg

image boot.vfat {
	vfat {
		files = {
			"Image",
			"rootfs.cpio.lzo",
			"rk3588-rock-5b.dtb",
			"extlinux"
		}
	}
	size = 112M
}

image norflash.img {
	hdimage {
	}
	partition loader1 {
		in-partition-table = "no"
		image = "idbloader.img"
		offset = 32K
	}
	partition loader2 {
		in-partition-table = "no"
		image = "u-boot.itb"
		offset = 8M
	}
}

image sdcard.img {
	hdimage {
		partition-table-type = "gpt"
		# default GPT location conflicts with spl, move it after
		gpt-location = 1M
	}

	partition loader1 {
		in-partition-table = "no"
		image = "idbloader.img"
		offset = 32K
	}

	partition loader2 {
		in-partition-table = "no"
		image = "u-boot.itb"
		offset = 8M
	}

	partition boot {
		partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
		bootable = "true"
		image = "boot.vfat"
		offset = 16M
	}
	partition rootfs {
		partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
		image = "rootfs.ext4"
	}
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58

extlinux.conf

label RK3588_ROCK_5B linux
  kernel /Image
  initrd /rootfs.cpio.lzo
  devicetree /rk3588-rock-5b.dtb
  append earlycon=uart8250,mmio32,0xff1a0000 root=/dev/ram0 rw rootwait
  • 1
  • 2
  • 3
  • 4
  • 5
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/1016523
推荐阅读
  

闽ICP备14008679号