Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lenovo Leez P710 申请添加 #1609

Closed
inoeud opened this issue Aug 12, 2023 · 23 comments
Closed

Lenovo Leez P710 申请添加 #1609

inoeud opened this issue Aug 12, 2023 · 23 comments
Labels
documentation Improvements or additions to documentation new box Research Fills in the Blanks support This need is supported

Comments

@inoeud
Copy link

inoeud commented Aug 12, 2023

1、硬件配置
image

Type-C PD 供电,紧贴近当前的主流设计,使用方便。(这玩意是pd?不清楚
带有 RJ45 以太网口,这个传统嵌入式玩家一定非常喜欢,在 u-boot 下可以通过以太网做 tftp升级,在做高版本内核移植的时候,Wifi 的功能如果暂时不可用,以太网 也是很方便的接口,目前以太网功能基本在各个版本的内核中都可以很方便的用起来。
USB 接口丰富,可以接键盘鼠标

4 GB 内存,16GB Emmc这和 RK3399 强悍的性能很配,用来跑重型任务也不怕内存不够用了。
(复制自https://post.smzdm.com/p/akm7dwr9/)

官方仓库:
https://github.com/leezsbc/resources

第三方Armbian固件:
卡启 debian 10桌面, wayland驱动,3D加速正常
链接:https://pan.baidu.com/s/12KJJ5YPulNNd00yZYj6Fdw
提取码:6y0x

据说可以uefi的uboot:
lenovo_leez_p710资料 - 副本.zip
"按地址写入emmc,支持efi启动,支持system ready认证里列出的系统
不知道和官方uboot有啥区别,总之能用"
(引自网友)

@inoeud
Copy link
Author

inoeud commented Aug 12, 2023

@ophub
Copy link
Owner

ophub commented Aug 12, 2023

我根据你提供的镜像文件,复制了其中的u-boot文件。
你到releases里下载测试下是否可以使用,试试6.1.y系列的这个镜像,我看到kernel里从5.4到6.1都自带了这个rk3399-leez-p710.dtb文件,所以理论上各版本都默认支持使用。

@ophub ophub added documentation Improvements or additions to documentation support This need is supported new box Research Fills in the Blanks labels Aug 12, 2023
@inoeud
Copy link
Author

inoeud commented Aug 14, 2023

change freq to 856MHz 1,0
ch 0 ddrconfig = 0x101, ddrsize = 0x40
ch 1 ddrconfig = 0x101, ddrsize = 0x40
pmugrf_os_reg[2] = 0x32C1F2C1, stride = 0xD
OUT
Boot1 Release Time: Jun  2 2020 15:02:17, version: 1.26
CPUId = 0x0
SdmmcInit=2 0
BootCapSize=100000
UserCapSize=14910MB
FwPartOffset=2000 , 100000
##############serialno_str = DHXH1PQW7T
UsbBoot ...73349
powerOn 85620

U-Boot TPL 2020.01-rc4-armbian (Dec 04 2019 - 18:46:41)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
256B stride
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2020.01-rc4-armbian (Dec 04 2019 - 18:46:41 +0800)
Trying to boot from MMC2


U-Boot 2020.01-rc4-armbian (Dec 04 2019 - 18:46:41 +0800)

Model: Leez RK3399 P710
DRAM:  3.9 GiB
PMIC:  RK808 
Cannot find regulator pwm init_voltage
MMC:   dwmmc@fe310000: 2, dwmmc@fe320000: 1, sdhci@fe330000: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial@ff1a0000
Out:   serial@ff1a0000
Err:   serial@ff1a0000
Model: Leez RK3399 P710
rockchip_dnl_key_pressed: adc_channel_single_shot fail!
Net:   
Error: ethernet@fe300000 address not set.
eth-1: ethernet@fe300000
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
3252 bytes read in 15 ms (210.9 KiB/s)
## Executing script at 00500000
Boot script loaded from mmc 0
270 bytes read in 12 ms (21.5 KiB/s)
16850812 bytes read in 1615 ms (9.9 MiB/s)
33853952 bytes read in 3221 ms (10 MiB/s)
76947 bytes read in 29 ms (2.5 MiB/s)
Unknown command 'kaslrseed' - try 'help'
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid
SCRIPT FAILED: continuing...
76947 bytes read in 28 ms (2.6 MiB/s)
Card did not respond to voltage select!
starting USB...
Bus usb@fe380000: USB EHCI 1.00
Bus usb@fe3c0000: USB EHCI 1.00
Bus dwc3: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus dwc3: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... 1 USB Device(s) found
scanning bus usb@fe3c0000 for devices... 2 USB Device(s) found
scanning bus dwc3 for devices... 1 USB Device(s) found
scanning bus dwc3 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

Device 0: unknown device
No ethernet found.
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000
@ophub 

@inoeud
Copy link
Author

inoeud commented Aug 14, 2023

直接写入emmc,提示这个,我好像不能sd卡启动,会提示电压错误。

@ophub
Copy link
Owner

ophub commented Aug 14, 2023

你写入时要使用loader

@inoeud
Copy link
Author

inoeud commented Aug 14, 2023

请问写入sd要咋使用loader?

@ophub
Copy link
Owner

ophub commented Aug 14, 2023

你上面说的意思是你写入emmc不能启动,写rk写盘软件写入emmc时,选择一个loader试试

https://github.com/ophub/amlogic-s9xxx-armbian/blob/main/build-armbian/u-boot/rockchip/king3399/rk3399_loader_v1.27.126.bin

@inoeud
Copy link
Author

inoeud commented Aug 14, 2023

可能我表述不完整,在写入emmc时我附带写入了loader的(基操还是知道的),然后ttl跑的信息就是我上边贴的。

@ophub
Copy link
Owner

ophub commented Aug 17, 2023

由于作者把leez-p710的u-boot和dts源码都在2020年提交到了u-boot和kernel的上游仓库,所以之后的源码里都包含了这些源码,随时可以编译最新的文件,下面是我使用 https://github.com/cm9vdA/build-linux 脚本编译的过程,记录一下。

第一部分:u-boot的源文件来源及编译过程

编译脚本使用的: https://github.com/cm9vdA/build-linux
U-BOOT使用源码: https://github.com/u-boot/u-boot [branch: v2023.01]
rkbin使用源码: https://github.com/rockchip-linux/rkbin

  • 创建编译目录

cd ~/xxx

进入编译目录

mkdir leez
cd leez
  • clone rkbin

https://github.com/rockchip-linux/rkbin

  • clone u-boot 源码

git clone https://github.com/u-boot/u-boot

检出指定版本的 tags(v2023.01)

cd u-boot
git checkout -b v2023.01 v2023.01

查看检出结果正确
git branch -a

返回上级目录继续添加其他
cd ../

  • clone u-boot 编译仓库

git clone https://github.com/cm9vdA/build-linux
cd build-linux

根据 build-linux 仓库的使用方法,把u-boot源码库里带着的leez编译文件复制到这个仓库指定目录里

cp -f ../u-boot/arch/arm/dts/rk3399-leez-p710.dts  boot/dts/rockchip/mainline/
cp -f ../u-boot/arch/arm/dts/rk3399-leez-p710-u-boot.dtsi  boot/dts/rockchip/mainline/
cp -f ../u-boot/configs/leez-rk3399_defconfig   u-boot/rockchip/u-boot-2023.01/
  • 按仓库说明编辑 u-boot 参数设置

vi env/common/build_uboot_aarch64

我的环境:ubuntu22.04 x86_64。如果是在armbian里编译时,因为需要先编译ATF,所以两个工具链都下载
下载需要的工具链,解压缩到你指定的存放路径
修改配置文件,根据自己工具链的路径和名称修改,我修改后的内容如下:

TOOLCHAIN_PATH=/usr/local/toolchain
TOOLCHAIN_NAME=arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-elf
ARM_TOOLCHAIN_NAME=arm-gnu-toolchain-12.2.rel1-aarch64-arm-none-eabi

export ARCH=arm
export CROSS_COMPILE=aarch64-none-elf-

添加u-boot编译模版build_uboot_leez
vi env/build_uboot_leez
内容根据上述u-boot的文件名,填写如下

# Common Config
source ${SCRIPT_PATH}/env/common/build_uboot_aarch64

# Board Info
BOARD_NAME="Leez RK3399"
CPU_INFO="Rockchip RK3399"
DEFCONFIG="leez-rk3399_defconfig"
VENDOR="rockchip"
DT_FILE="rk3399-leez-p710"

# ATF
# git clone https://github.com/ARM-software/arm-trusted-firmware.git
# make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399
ATF_PLAT="rk3399"
export BL31=${SCRIPT_PATH}/u-boot/rockchip/common/rk3399_bl31.elf
  • 创建 u-boot 编译目录

mkdir mkuboot
cd mkuboot
  • 按仓库说明创建编译脚本软连接

ln -sf ../u-boot uboot
ln -sf ../build-linux/mk_uboot.sh build_uboot_leez
  • 编译 u-boot

./build_uboot_leez
1生成配置,再次运行选3开始编译。
如果在armbian里编译,先使用0编译ATF。我在ubuntu_x86_64下编译,直接13即可。
过程中可能报错,看错误提示缺少什么依赖,安装对应的编译依赖包后重试,我遇到缺少python3-dev安装就可以了。

  • 查看编译好的 u-boot:

cd .build_uboot
ls -l

Snip20230817_1

  • 复制出 u-boot 备用

mkdir ../leez-uboot
cp  -f  idbloader.img  ../leez-uboot
cp  -f  u-boot.itb  ../leez-uboot

第二部分:dtb文件的编译

这个dts文件在5.4.y, 5.10.y, 5.15.y, 6.1.y 内核源码库里都自带了,正常编译即可,方法可以参考:
https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel

用到的文件:
https://github.com/unifreq/linux-6.1.y/blob/main/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts

  • 编译dtb

cd ~/xxx

  • 01.在 x86_64 ubuntu下编译的方法:

git clone https://github.com/ophub/amlogic-s9xxx-armbian
cd amlogic-s9xxx-armbian

如果编译完整内核使用这个命令(sudo ./recompile -k 6.1.1)
如果只编译dtb文件使用这个命令(sudo ./recompile -k 6.1.1 -m dtbs)
在这个设备的编译中,内核已经自带dts源码了,如果有微调dts的需要,可以只编译dtb:

sudo ./recompile -k 6.1.1 -m dtbs

先编译一次,需要的依赖及源码等都一键设置好了,并且编译了一次完整的dtb。如果想调整设置,编辑 compile-kernel/kernel/linux-6.1.y/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts 文件后,运行使用本地源码编译dtb命令(添加-a false参数使用本地源码,这样就不会再从服务器再clone内核源码了,避免再次拉取内核源码覆盖了本地已经修改的文件):

sudo ./recompile -k 6.1.46 -m dtbs -a false

编译好的文件可以直接在 compile-kernel/kernel/out/6.1.x.tar.gz
解压,里面有 dtb-rockchip-xxx.tar.gz
解压,找到 rk3399-leez-p710.dtb
上传到当前 armbian 系统覆盖同名文件,路径在 /boot/dtb/rockchip/rk3399-leez-p710.dtb

  • 02. 在armbian下编译的方法

# 第一次编译时,更新配置,编译dtb
armbian-kernel -u
armbian-kernel -k 6.1.1 -m dtbs

# 再次编译时,使用本地源码进行编译的命令(添加`-a false`避免再次从服务器下载内核源码,直接使用本地修改好的内核源码)
armbian-kernel -k 6.1.46 -m dtbs -a false

编译的全部文件都在/opt/kernel目录下,路径和上面x86下的一样。

@ophub
Copy link
Owner

ophub commented Aug 17, 2023

@inoeud
Copy link
Author

inoeud commented Aug 17, 2023

成功开机!感谢

dtb是有点问题的,需要稍微修改一下。
&usbdrd_dwc3_0 {
status = "okay";
dr_mode = "otg";
};

typec被配置成otg模式了,我看你给的教程(第二部分:dtb文件的编译)里面没有提到dtb的编译方法。

@ophub
Copy link
Owner

ophub commented Aug 17, 2023

https://github.com/unifreq/linux-6.1.y/blob/main/arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts

这是源文件,我看到4个usb设备,其中一个已经允许otg。这个主板有几个变种?你确认一下修改方案,我给你编个试试

@inoeud
Copy link
Author

inoeud commented Aug 17, 2023

感谢老哥,主板就一个版型,没有变种。
&usbdrd_dwc3_0 {
status = "okay";
dr_mode = "otg";
};
改成
&usbdrd_dwc3_0 {
status = "okay";
dr_mode = "host";
};
即可

@ophub
Copy link
Owner

ophub commented Aug 17, 2023

你现在的固件可以正常启动?只是usb口有问题?我直接给你个编译好的dtb替换下就可以吧?不用完整编一个固件了吧?

@inoeud
Copy link
Author

inoeud commented Aug 17, 2023

好的,可以正常启动

@ophub
Copy link
Owner

ophub commented Aug 17, 2023

rk3399-leez-p710.dtb.zip

下载解压得到rk3399-leez-p710.dtb,替换/boot/dtb/rockchip目录下的同名文件,重启测试下。

@inoeud
Copy link
Author

inoeud commented Aug 17, 2023

寄,一个都识别不到了(usb3.0),俺寻思没问题呀?
而且,系统只识别到了一个u3,这个dts应该也没问题呀?
改之前:

root@armbian:~# lsusb -t
/:  Bus 08.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 07.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 2: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 2: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 2: Dev 3, If 2, Class=Human Interface Device, Driver=usbhid, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M

改之后:

root@armbian:~# lsusb -t
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 2: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 2: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 2: Dev 3, If 2, Class=Human Interface Device, Driver=usbhid, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M

@ophub
Copy link
Owner

ophub commented Aug 17, 2023

我更新了上面的编译方法,把dtb的部分补充了下,你根据教程试试怎么调整,第一次编译要下载编译工具和安装依赖,看你的网速,一般5分钟内完成。以后每次1分钟不到就编译好dtb了,你调试好了反馈下。

@ophub
Copy link
Owner

ophub commented Aug 17, 2023

rk3399-leez-p710.dtb.zip

试试这个

@inoeud
Copy link
Author

inoeud commented Aug 17, 2023

难过,依然不可以识别

@ophub
Copy link
Owner

ophub commented Aug 18, 2023

内核默认的dtb有什么问题?我看了下kernel.org的内核,5.4至今几十个版本都没变过,一直这么设计的

@inoeud
Copy link
Author

inoeud commented Aug 20, 2023

typec无法识别,一直没有改。除了官方系统,第三方的typec都不能用

@inoeud
Copy link
Author

inoeud commented Aug 20, 2023

我目前也没什么解决思路,按照既往经验,改otg为host也不管用
先暂时搁置吧,搞不明白,应该要反溯dts.

@inoeud inoeud closed this as completed Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation new box Research Fills in the Blanks support This need is supported
Projects
None yet
Development

No branches or pull requests

2 participants