The first attempt at linux Luban cat code [compile image] [modify the root file system and recompile] [modify the device tree and change the screen to MIPI] [modify the screen and TP direction]

compile image

Official Baidu cloud disk information: https://doc.embedfire.com/linux/rk356x/quick_start/zh/latest/quick_start/baidu_cloud/baidu_cloud.html
insert image description here
Unzip the virtual machine compression package: "Luban cat\8-SDK source code compression package\ The development environment virtual machine image \ubuntu20.04.7z" can be opened with VMware. After opening, you can see that there is a ready-made SDK, as follows:
insert image description here

According to: https://doc.embedfire.com/linux/rk356x/build_and_deploy/zh/latest/building_image/debian_rootfs/debian_rootfs.html#id13
article, enter the following command to generate an image with one click:

# 一键编译
./build.sh

After successful operation, "update.img" is generated in the "rockdev" directory as the image file. This file can be downloaded to the chip for operation through the instructions in the following article: 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$ 

insert image description here
Copy this file to the window and download it through the tool to download and run:
insert image description here
insert image description here

Modify the root file system and recompile

Here I want to remove the pattern of the clock in the picture above. According to research, we know that this pattern is in the root file system. Modify the content of the overlay/etc/update-motd.d/00-header file according to the prompts in the following article: https://doc
. embedfire.com/linux/rk356x/build_and_deploy/zh/latest/building_image/debian_rootfs/debian_rootfs.html#id8
insert image description here
The content of the modified file is as follows and saved:
insert image description here
Follow the prompts to enter the following command in the Debian directory to recompile:

#构建完整的根文件系统镜像
./mk-buster-rootfs.sh

insert image description here
It takes a long time to compile successfully:
insert image description here
Compile successfully and return to the upper layer (SDK). Follow the above steps and enter the "./build.sh" command to compile and generate an image with one click:

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$ 

insert image description here
Next, after a long wait, copy the image to the window, download it, run it and log in, you can see the interface as follows:

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$ 

insert image description here
You can see that it is indeed running according to your own ideas, indicating that the whole set of modifications and compilations is normal!

Modify the device tree and change the screen to MIPI

The default code uses the HDMI screen, but I finally use the MIPI screen, the first step here is to modify the screen, follow the official instructions of Luban cat to modify the following main device tree file, and then recompile the image (./build The .sh command will compile the kernel at the same time) After burning, the screen does become a MIPI screen:
insert image description here

Modify the device tree to change the default screen to MIPI


In fact, you can also modify the device tree plug-in to change the screen to MIPI. The modification method is to release the MIPI code of the following file:
The file is: Kernel/arch/arm64/boot/dts/rockchip/uEnv/uEnvLubanCat1.txt
insert image description here
After modification, recompile and download After the effect is the same as above, it is also switched to MIPI

Modify screen and TP orientation

Modify "/boot/uEnv/uEnv.txt" and "/etc/X11/xorg.conf.d/20- modesetting.conf" file to modify the direction of TP and screen, but the above method is realized by directly changing the files on the board, which is not a normal and authentic method, so here we still need to modify the files in the code Then compile it. For the "20-modesetting.conf" file, the modified file here is "/home/lubancat/LubanCat_SDK/debian/overlay/etc/X11/xorg.conf.d/20-modesetting.conf", after modification The content is as follows:

Section "Device"
    Identifier  "Rockchip Graphics"
    Driver      "modesetting"

### Use Rockchip RGA 2D HW accel
#    Option      "AccelMethod"    "exa"

### Use GPU HW accel
    Option      "AccelMethod"    "glamor"

    Option      "DRI"            "2"

### Set to "always" to avoid tearing, could lead to up 50% performance loss
    Option      "FlipFB"         "none"

### Limit flip rate and drop frames for "FlipFB" to reduce performance lost
#    Option      "MaxFlipRate"    "25"

    Option      "NoEDID"         "true"
EndSection

Section	"Screen"
    Identifier	"Default Screen"
    Device	"Rockchip Graphics"
    Monitor	"Default Monitor"
EndSection

### Valid values for rotation are "normal", "left", "right"
Section	"Monitor"
    Identifier	"Default Monitor"
    Option	"Rotate" "left"
EndSection

Section "InputClass"
         Identifier "Goodix Capacitive TouchScreen"
         MatchProduct "Goodix Capacitive TouchScreen"
         Option "TransformationMatrix" " 0 -1 1 1 0 0 0 0 1 
EndSection

Mainly modify the two fields "Monitor" and "InputClass". The file "uEnv.txt" has no specific files. Here, modify the device tree file "/home/lubancat/LubanCat_SDK/kernel/arch/arm64/boot/dts/ rockchip/uEnv/uEnvLubanCat1.txt", the modified file is as follows:

uname_r=4.19.232
size=0x1000000
bootargs=console=ttyFIQ0 console=tty1 fbcon=rotate:3
#dtb=rk3566-lubancat1.dtb

enable_uboot_overlays=1
#overlay_start

#40pin
#dtoverlay=/dtb/overlay/rk356x-lubancat-i2c3-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-i2c5-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm8-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm9-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm10-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm11-ir-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm12-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm13-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm13-m1-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm14-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm14-m1-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm15-ir-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm15-ir-m1-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-spi3-m1-gpio-cs-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-spi3-m1-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-uart3-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-uart3-m1-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-uart4-m1-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-uart5-m1-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-uart7-m1-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-uart9-m1-overlay.dtbo
#mini-pcie 5G modules
#dtoverlay=/dtb/overlay/rk356x-lubancat-pcie2x1-disabled-overlay.dtbo
#display
#dtoverlay=/dtb/overlay/rk3566-lubancat-dsi0-720p-overlay.dtbo
#dtoverlay=/dtb/overlay/rk3566-lubancat-dsi0-1080p-overlay.dtbo
#dtoverlay=/dtb/overlay/rk3566-lubancat-dsi0-rpi-overlay.dtbo

#overlay_end


Here is to add "fbcon=rotate:3" content, and then use the following command to compile the kernel and image:

sudo -i  //进入root账号
cd ./debian/   //进入内核目录
./mk-buster-rootfs.sh  //重新编译内核

cd ..
cd /home/lubancat/LubanCat_SDK
./build.sh  //编译镜像

After burning, the screen status is as follows:

VID_20230814_202326

Guess you like

Origin blog.csdn.net/chengdong1314/article/details/132221691
Recommended