点击蓝字 ╳ 关注我们
陆道
诚迈科技高级技术专家
简介
如何添加新的开发板进行编译
{
"product_name": "hongzos_rk3568",
"device_company": "rockchip",
"device_build_path": "device/board/archermind/rk3568",
"target_cpu": "arm",
"type": "standard",
"version": "3.0",
"board":"rk3568",
U-Boot移植
gitclonehttps://github.com/rockchip-linux/u-boot.git
RKBIN_TOOLS=rkbin/tools
#include "boot_rkimg.h"
#define BLK_CNT(_num_bytes, _block_size)
((_num_bytes + _block_size - 1) / _block_size)
static char* load_ramdisk_from_partition(void *buffer)
{
struct blk_desc *desc = rockchip_get_bootdev();
disk_partition_t part_ramdisk_boot;
static char initrd_str[28];
long blk_cnt = 0, blks_read = 0;
long blk_start = 0;
if (part_get_info_by_name(desc, "ramdisk", &part_ramdisk_boot) < 0) {
printf("No ramdisk partition
");
return NULL;
}
blk_cnt = part_ramdisk_boot.size;
blk_start = part_ramdisk_boot.start;
printf("Load from partition ' ramdisk ' to address 0x%p, count: %ld total block(s) by ludao
", buffer, blk_cnt);
blks_read = blk_dread(desc, blk_start, blk_cnt, buffer);
if (blks_read != blk_cnt) {
return NULL;
}
printf("Read from partition ' ramdisk ' done, from 0x%lx total block(s) 0x%lx
", blk_start, blk_cnt);
sprintf(initrd_str, "0x%p:0x%lx", buffer, blk_cnt*(part_ramdisk_boot.blksz));
printf("Openharmony ramdisk_addr_r = %s
", initrd_str);
return initrd_str;
}
static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
if (label->initrd) {
if (get_relfile_envaddr(cmdtp, label->initrd, "ramdisk_addr_r") < 0) {
printf("Skipping %s for failure retrieving initrd
",
label->name);
return 1;
}
bootm_argv[2] = initrd_str;
strncpy(bootm_argv[2], env_get("ramdisk_addr_r"), 18);
strcat(bootm_argv[2], ":");
strncat(bootm_argv[2], env_get("filesize"), 9);
}else{
void *buffer = (void *)env_get_ulong("ramdisk_addr_r", 16, 0);
bootm_argv[2] = load_ramdisk_from_partition(buffer);
if(bootm_argv[2]){
printk("initrd = %s
", bootm_argv[2]);
}
}
./make.shCROSS_COMPILE=aarch64-linux-gnu-rk3568
Linux-5.10移植
先进入kernel/linux/linux-5.10目录
patch -p1 < kernel/linux/patches/linux-5.10/rk3568_patch/kernel.patch
修改device/board/hihope/rk3568/kernel/build_kernel.sh
注释掉
//patch-p1< ${KERNEL_PATCH}
把设备树放到kernel/linux/linux-5.10/arch/arm64/boot/dts/rockchip/目录
修改kernel/linux/linux-5.10/ make-ohos.sh
model_list=(
"TB-RK3568X0 arm64 0xfe660000 rk3568-toybrick-x0-linux Image rockchip_linux_defconfig"
"TB-RK3568X10 arm64 0xfe660000 rk3568-toybrick-x10-linux Image rockchip_linux_defconfig"
)
CONFIG_DRM_PANEL_SIMPLE = y
kernel/linux/linux-5.10/drivers/gpu/drm/panel/panel-simple.c
注释掉
//intpanel_simple_loader_protect(structdrm_panel*panel)
cmdline="appendearlycon=uart8250,mmio32,${uart}root=PARTUUID=614e0000-0000-4b53-8000-1d28000054a9rwrootwaitrootfstype=ext4
分区表
FIRMWARE_VER:11.0
MACHINE_MODEL:rk3568_r
MACHINE_ID:007
MANUFACTURER: rockchip
MAGIC: 0x5041524B
ATAG: 0x00200800
MACHINE: rk3568_r
CHECK_MASK: 0x80
PWR_HLD: 0,0,A,0,1
TYPE: GPT
CMDLINE:mtdparts=rk29xxnand:0x00002000@0x00002000(uboot),0x00002000@0x00004000(misc),0x00003000@0x00006000(resource),0x00030000@0x00009000(boot_linux:bootable),0x00002000@0x00039000(ramdisk),0x00400000@0x0003B000(system),0x00200000@0x0043B000(vendor),0x00019000@0x0063B000(sys-prod),0x00019000@0x00654000(chip-prod),0x00010000@0x0066D000(updater),-@0x0067D000(userdata:grow)
uuid:system=614e0000-0000-4b53-8000-1d28000054a9
uuid:boot_linux=a2d37d82-51e0-420d-83f5-470db993dd35
# fstab file.
#
/dev/block/platform/fe310000.sdhci/by-name/system /usr ext4 ro,barrier=1 wait,required
/dev/block/platform/fe310000.sdhci/by-name/vendor /vendor ext4 ro,barrier=1 wait,required
/dev/block/platform/fe310000.sdhci/by-name/sys-prod /sys_prod ext4 ro,barrier=1 wait
/dev/block/platform/fe310000.sdhci/by-name/chip-prod /chip_prod ext4 ro,barrier=1 wait
/dev/block/platform/fe310000.sdhci/by-name/userdata /data f2fs discard,noatime,nosuid,nodev,fscrypt=2aes-256-xts wait,check,fileencryption=software,quota
/dev/block/platform/fe310000.sdhci/by-name/misc/miscnonenonewait,required
根文件系统
image_list += [
"ramdisk",
"updater_ramdisk",
]
显示模块适配
&dsi1 {
status = "okay";
//rockchip,lane-rate = <200>;
dsi1_panel: panel@0 {
status = "okay";
compatible = "simple-panel-dsi";
reg = <0>;
backlight = <&backlight>;
reset-delay-ms = <60>;
enable-delay-ms = <60>;
prepare-delay-ms = <60>;
unprepare-delay-ms = <60>;
disable-delay-ms = <60>;
dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
dsi,format = ;
dsi,lanes = <4>;
panel-init-sequence = [
05 78 01 11
05 14 01 29
];
panel-exit-sequence = [
05 00 01 28
05 00 01 10
];
disp_timings1: display-timings {
native-mode = <&dsi1_timing0>;
dsi1_timing0: timing0 {
clock-frequency = <150000000>;
hactive = <1200>;
vactive = <1920>;
hback-porch = <120>;
hfront-porch = <10>;
vback-porch = <10>;
&hdmi {
status = "okay";
rockchip,phy-table =
<92812500 0x8009 0x0000 0x0270>,
<165000000 0x800b 0x0000 0x026d>,
<185625000 0x800b 0x0000 0x01ed>,
<297000000 0x800b 0x0000 0x01ad>,
<594000000 0x8029 0x0000 0x0088>,
<000000000 0x0000 0x0000 0x0000>;
};
CONFIG_DRM_PANEL_SIMPLE=y
CONFIG_DRM_ANALOGIX_DP=y
CONFIG_DRM_DW_HDMI=y
CONFIG_DRM_DW_HDMI_I2S_AUDIO=y
CONFIG_DRM_DW_HDMI_CEC=y
CONFIG_DRM_DW_MIPI_DSI=y
std::shared_ptr DrmDevice::Create()
{
DISPLAY_DEBUGLOG();
if (mDrmFd == nullptr) {
const std::string name("rockchip");
int drmFd = open("/dev/dri/card0", O_RDWR | O_CLOEXEC); // drmOpen(name.c_str(), nullptr);
}
int32_t DrmDisplay::Init()
{
...
...
ret = preComp->Init(); // gfx初始化,这里需要跳过
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("can not init HdiGfxComposition")); // 或者不判断返回值
}
int32_t HdiGfxComposition::vector &layers, HdiLayer &clientLayer)
{
#if 0 // CPU合成
layer->SetDeviceSelect(COMPOSITION_CLIENT);
#else
if ((layer->GetCompositionType() != COMPOSITION_VIDEO) &&
(layer->GetCompositionType() != COMPOSITION_CURSOR)) {
layer->SetDeviceSelect(COMPOSITION_DEVICE);
} else {
layer->SetDeviceSelect(layer->GetCompositionType());
}
#endif
}
constchar*g_drmFileNode="/dev/dri/card0";
gt9xx: gt911@14 {
compatible = "goodix,gt9xx";
reg = <0x14>;
pinctrl-names = "default";
pinctrl-0 = <&tp_gpio>;
goodix_irq_gpio = <&gpio3 RK_PB4 IRQ_TYPE_LEVEL_LOW>;
goodix_rst_gpio = <&gpio3 RK_PB3 GPIO_ACTIVE_HIGH>;
/*touchscreen-inverted-x;*/
status = "okay";
};
//input_set_abs_params(ts->input_dev,ABS_MT_WIDTH_MAJOR,0,255,0,0);
USB调试适配
"setparamsys.usb.controllerfcc00000.dwc3"
总结
参考链接
https://gitee.com/harchermindy/vendor_archermind
https://gitee.com/harchermindy/device_board_archermind
https://gitee.com/harchermindy/uboot-rk-openharmony
https://gitee.com/harchermindy/linux-5.10
原文标题:开发板如何适配OpenHarmony 3.2
文章出处:【微信公众号:OpenAtom OpenHarmony】欢迎添加关注!文章转载请注明出处。
-
鸿蒙
+关注
关注
57文章
2306浏览量
42735 -
OpenHarmony
+关注
关注
25文章
3658浏览量
16132
原文标题:开发板如何适配OpenHarmony 3.2
文章出处:【微信号:gh_e4f28cfa3159,微信公众号:OpenAtom OpenHarmony】欢迎添加关注!文章转载请注明出处。
发布评论请先 登录
相关推荐
评论