开发板如何适配OpenHarmony3.2
开发板如何适配OpenHarmony3.2(文章已获得原作者诚迈科技高级技术专家-陆道授权)
简介
OpenHarmony3.2 Beta5 版本在 OpenHarmony 3.1 Release 版本的基础上,有以下改变:性能上有很大的提升、标准系统应用开发框架增强、标准系统分布式能力增强。
本文介绍诚迈科技基于RK3568设计的HCPAD-100开发板以及基于RK3566设计的中控屏HongzPad2022在OpenHarmony 3.2 Beta5 版本上的适配过程。
涉及到开发板的添加/u-boot /linux-5.10/分区表/根文件系统/显示/触摸/USB的移植过程以及 OpenHarmony 所依赖的驱动特性介绍。
如何添加新的开发板进行编译
参照DAYU200的工程配置文件我们新建自己的编译命令。
1)在device/board/目录新建archermind目录,新建rk3568/rk3588/rk3399目录,并添加相关的工程文件。
2)在vendor目录新建archermind目录。新建以下几个目录,并添加相关的工程文件。
3) 修改vendor/archermind/hongzos_rk3568/config.json文件,product_name改成hongzos_rk3568,device_build_path改成第一步新建的目录。
{"product_name": "hongzos_rk3568","device_company": "rockchip","device_build_path": "device/board/archermind/rk3568","target_cpu": "arm","type": "standard","version": "3.0","board": "rk3568",通过./build.sh --product-name hongzos_rk3568来编译出我们自己开发板的镜像,编译完后对应开发板的image镜像放在out/rk3568/packages/phone/目录。相关代码放在文章最后的参考链接。
U-Boot移植
U-boot是通过二进制镜像直接放在device/board/hihope/rk3568/loader目录下的,这个目录下涉及到文件如下
1)下载rk官方发布的uboot源码
git clone https://github.com/rockchip-linux/u-boot.git2)修改make.sh, 指定RKBIN_TOOLS的路径
RKBIN_TOOLS=rkbin/tools3)增加代码读取ramdisk分区到指定的内存位置,修改cmd/pxe.c
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; 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\n"); 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\n", 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\n", blk_start, blk_cnt); sprintf(initrd_str, "0x%p:0x%lx", buffer, blk_cnt*(part_ramdisk_boot.blksz)); printf("Openharmony ramdisk_addr_r = %s\n", 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\n", label->name); return 1; } bootm_argv = initrd_str; strncpy(bootm_argv, env_get("ramdisk_addr_r"), 18); strcat(bootm_argv, ":"); strncat(bootm_argv, env_get("filesize"), 9); }else{ void *buffer = (void *)env_get_ulong("ramdisk_addr_r", 16, 0); bootm_argv = load_ramdisk_from_partition(buffer); if(bootm_argv){ printk("initrd = %s \n", bootm_argv); } }4)指定交叉编译器和平台开始编译,编译完成后根目录会生成u-boot.bin
./make.sh CROSS_COMPILE=aarch64-linux-gnu- rk3568所有相关代码已经放到开源社区,大家可以下载下来直接编译使用,相关代码放在文章最后的参考链接。
linux-5.10移植
1)内核编译脚本
linux编译脚本的是放在device/board/hihope/rk3568/kernel目录下的build_kernel.sh文件,由于kernel/linux/linux-5.10是公共代码,OpenHarmony 编译脚本是通过打补丁的方式来适配不同平台,不同的平台有自己的内核补丁。
编译脚本会先把 kernel/linux/linux-5.10 拷贝到out/kernel/src_tmp/linux-5.10/,然后打上3568的内核补丁patch -p1 < kernel/linux/patches/linux-5.10/rk3568_patch/kernel.patch
后编译生成自己的镜像,不利于我们开发,我们自己开发过程中做如下修改,这样方便我们开发过程中的修改。
先进入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}2) 设备树的定制,首先我们需要有自己的板子的设备树例如rk3568-chujue-linux.dts
把设备树放到kernel/linux/linux-5.10/arch/arm64/boot/dts/rockchip/目录修改kernel/linux/linux-5.10/ make-ohos.shmodel_list=( "TB-RK3568X0 arm64 0xfe660000 rk3568-toybrick-x0-linuxImage rockchip_linux_defconfig" "TB-RK3568X10arm64 0xfe660000 rk3568-toybrick-x10-linux Image rockchip_linux_defconfig")CONFIG_DRM_PANEL_SIMPLE = ykernel/linux/linux-5.10/drivers/gpu/drm/panel/panel-simple.c注释掉//int panel_simple_loader_protect(struct drm_panel *panel)
5)启动参数的定制
kernel/linux/linux-5.10/ make-ohos.sh
cmdline="append earlycon=uart8250,mmio32,${uart} root=PARTUUID=614e0000-0000-4b53-8000-1d28000054a9 rw rootwait rootfstype=ext4FIRMWARE_VER:11.0MACHINE_MODEL:rk3568_rMACHINE_ID:007MANUFACTURER: rockchipMAGIC: 0x5041524BATAG: 0x00200800MACHINE: rk3568_rCHECK_MASK: 0x80PWR_HLD: 0,0,A,0,1TYPE: GPTCMDLINE: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-1d28000054a9uuid:boot_linux=a2d37d82-51e0-420d-83f5-470db993dd35device/board/hihope/rk3568/cfg/fstab.rk3568
# fstab file.# /dev/block/platform/fe310000.sdhci/by-name/system /usr ext4 ro,barrier=1wait,required/dev/block/platform/fe310000.sdhci/by-name/vendor /vendor ext4 ro,barrier=1wait,required/dev/block/platform/fe310000.sdhci/by-name/sys-prod /sys_prod ext4 ro,barrier=1wait/dev/block/platform/fe310000.sdhci/by-name/chip-prod /chip_prod ext4 ro,barrier=1wait/dev/block/platform/fe310000.sdhci/by-name/userdata /data f2fs discard,noatime,nosuid,nodev,fscrypt=2:aes-256-cts:aes-256-xtswait,check,fileencryption=software,quota/dev/block/platform/fe310000.sdhci/by-name/misc /misc none none wait,required
根文件系统
1) ramdisk从3.1到3.2的变化
3.1中ramdisk.Img是放在out/kernel/src_tmp/linux-5.10/boot_linux/目录下被打包到boot_linux.img中。
3.2的ramdisk.Img是直接放在单独的分区里面,由Boot在开机的模式不同的情况下选择加载不同的根文件系统
2)如何修改ramdisk
在.gn文件里面添加对应的配置文件,生成的文件将会被放到ramdisk镜像里面
image_list += [ "ramdisk", "updater_ramdisk", ]CONFIG_DRM_PANEL_SIMPLE=yCONFIG_DRM_ANALOGIX_DP=yCONFIG_DRM_DW_HDMI=yCONFIG_DRM_DW_HDMI_I2S_AUDIO=yCONFIG_DRM_DW_HDMI_CEC=yCONFIG_DRM_DW_MIPI_DSI=y
显示HDI需要适配两部分:gralloc 和 display_device。
display device适配
display device模块提供显示设备管理、layer管理、硬件加速等功能。
drm设备节点定义在//device/soc/rockchip/rk3568/hardware/display/src/display_device/drm_device.cpp文件中,可根据实际情况修改.
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);}如开发板不支持硬件合成或是有问题的时候,需要在drm_display.cpp文件中跳过gfx的初始化
int32_t DrmDisplay::Init(){ ... ... ret = preComp->Init(); // gfx初始化,这里需要跳过 DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("can not init HdiGfxComposition"));// 或者不判断返回值}同时在//device/soc/rockchip/rk3568/hardware/display/src//hdi_gfx_composition.cpp文件中修改set_layers方法,全部使用CPU合成显示
int32_t HdiGfxComposition::SetLayers(std::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}
drm设备节点定义在//device/soc/rockchip/rk3568/hardware/display/src/display_gralloc/display_gralloc_gbm.c文件中,可根据实际情况修改
const char *g_drmFileNode = "/dev/dri/card0";
gt9xx: gt911@14 { compatible = "goodix,gt9xx"; reg = ; pinctrl-names = "default"; pinctrl-0 = ; goodix_irq_gpio = ; goodix_rst_gpio = ; /*touchscreen-inverted-x;*/ status = "okay"; };//input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);"setparam sys.usb.controller fcc00000.dwc3" 您好,请问如何可以购买到
New Todaki Women's Massage Blog
In response to the people talking about malaysian massage for women, pink salt stone, best massage oil for women, male to female massage spa near me, body massage oil for female, body massage male and female, massage female therapist near me, body massage by men to women, foot massage third trimester, foot reflexology women, female massage therapist, private massage for women, urban clap female massage, women face massage, neuropathy foot and leg massager for circulation, body spa near me male to female, female mobile massage, women special massage, body massage ladies to gents, female spa therapist near me,I can vouch for this learn more for todaki women's massage blog for calves massager, woman getting a massage, ayurvedic massage ladies, postpartum massages, massage female to male home service, best body massage oil for female, women to men massage at home, massaging pregnant woman back, best shiatsu neck and back massager, massage spa by female near me, women face massage, female feet massage, massage in pregnancy third trimester, female to male massage spa near me, home massage for female, special massage for women, third trimester pregnancy massage, ayurvedic massage for pregnant ladies, oil body massage for women, foot reflexology women, pregnant lady massage near me, women to men body massage near me, male to female massage spa, also. See More Top Rated Todaki Women's Massage Guide e2494f3 In reply to the lady inquiring about 4d toto 6 58, lotto toto 6 49, my lucky number today 4d toto, toto 6d lucky number 2021, lucky number magnum 4d today, lucky no 4d today, toto 4d result today live, sportstoto malaysia, 88 toto 4d result, sport toto 6d,I highly recommend this visit this link for Toto community tips or my lucky number for toto 4d today, today toto 6d lucky number, stc toto 88, lotto2sure, toto 4d 3 4 2025, additional number toto, magnum 4d live, malaysia toto 4d lucky number, 4d king number, toto lottery, not to mention this her response for Toto gallery blog together with 4d lotto result, online toto lotto, toto 4d 3 9 25, toto bg lottery, lucky numbers for toto 6 55, 4d toto lotto, toto bc lotto, 6d toto lucky number, keputusan lotto 4d, toto 6d lucky number 2021, bearing in mind this top rated Toto gallery details which is also great. Also, have a look at this useful eat-and-run gallery link bearing in mind 6d toto lucky number today, lucky numbers for toto 6 55, toto 4d 23 10 25, cara buat carta gd lotto, 4d 6d lotto, lotto auswahlwette, lucky number magnum 4d, toto 4d lucky no, toto 4d 31 7 2025, lucky number today toto, bearing in mind this watch this video for eat-and-run gallery site on top of toto 4d 16 7 2025, singapore pool toto, toto 4d 17 8 25, toto 4d 24 9 25, toto 4d 23 4 2025,continued for bearing in mind toto 4d sweep result, magnum 4d live, toto hot numbers, tomorrow toto 4d lucky number, toto numbers not drawn,for good measure. Check more @ High Rated Tech & IT Recruitment Guide 70ea7_0Great Tajir4d Site
FrankJScott ??? 2025-11-22 23:15In reply to the lady inquiring about 4d toto 6 58, lotto toto 6 49, my lucky number today 4d toto, t ...
In response to the guy talking about game slot online, blog slot, game slot online deposit dana, betogel bandar online, slot game link, cara main judi slot, login casino, game pragmatic play, game judi online indonesia, nama situs judi slot online,I highly recommend this additional hints about tajir 4d link or casino online login, slot game apa, antara slot login, judi slot888 login, agen slot live22, go to slot, rtp microgaming slots, agen judi slot terpercaya, free link slot, main judi slot, not to mention this see about tajir4d blog not forgetting sites such as bandar judi togel online, game judi, slot promotion, main game slot, login judi slot, game judi online indonesia, agen judi, online judi, online slot indonesia, slot online indonesia, alongside all this go to the website on tajir4d slot advice which is also great. Also, have a look at this here on tajir4d forum on top of situs bandar judi, judi spin online, tutorial judi slot online, link main slot, antara slot login, flow gaming slot, io slot, playtech slot free play, slot online jackpot, login totoslot, not to mention this learn more for tajir4d login details which is worth considering with game of slot, judi slot sgp, website judi online, bandar judi slot online terpercaya, judi slot online itu apa,basics on as well as pragmatic id slot login, idn judi slot, cari situs judi slot online, 4d judi, bandar casino,for good measure. Check more @ High Rated Oversea Korean Casino Info b0b048d
High Rated Korean Women Only Massage Info
In reply to the person inquiring about women body massage near me, full female massage, pink ladies massage, desi women massage, individual female massage therapist near me, female massage spa, massage female to male spa near me, lady gamze massage, male massage by women, ladies special massage, female mobile massage therapist near me, full body oil massage for women, massage services at home by female, ladies massage ladies massage, body massage by female to male near me, konfo leg massager, female mobile massage, massage from male to female, body massage at home by female near me, woman getting foot massage,I recommend this 토닥이 additional reading on korean women only massage url for female to male massage services at home, female body spa near me, renpho leg massager, female to male body spa, foot massage third trimester, body spa for female, pink ladies massage, women for men massage, special massage for women, female butt massage, ladies face massage, body massage with female near me, ladies massage spa, urban clap massage for women, thigh massager, prenatal and postnatal massage, deep tissue massage female, ladies feet massage, body massage at home by female near me, konfo leg massager, a female massager, also. See More Great Oversea Korean Casino Website 048deb6High Rated Cannabis Club Website
FrankJScott ??? 2025-11-25 01:55In response to the guy talking about game slot online, blog slot, game slot online deposit dana, b ...
In response to the person asking about tourist friendly cannabis clubs in barcelona, private cannabis clubs barcelona, cannabis lounge barcelona, cannabis club guru barcelona opinie, cannabis clubs barcelona closing, cannabis club guru barcelona, Barcelona weed map, cannabis club barcelona jetzt geöffnet, tourist friendly cannabis clubs barcelona, z cannabis company,I highly suggest this i loved this about cannabis club forum or cannabis club barcelona best beoordeeld, cannabis club guru barcelona opiniones, dispensary barcelona spain, can tourists visit cannabis clubs in barcelona, zanzibar cannabis club barcelona, cannabis club barcelona mitglied werden, tourist friendly cannabis clubs barcelona, cannabis clubs barcelona map, catalonia cannabis clubs, dispensaries in barcelona, and don't forget this redirected here on cannabis club details not to mention cannabis clubs barcelona closing, barcelona cannabis club, cannabis club guru barcelona reviews, cannabis clubs for tourists barcelona, cannabis club guru barcelona opinie, three monkeys cannabis club barcelona photos, cannabis club barcelona für touristen, tourist friendly cannabis clubs in barcelona, all cannabis social clubs barcelona, cannabis club guru barcelona opiniones, and don't forget this web site for cannabis club site which is also great. Also, have a look at this best cannabis club site bearing in mind cannabis club barcelona best, best cannabis clubs barcelona 2024, social cannabis clubs barcelona, cannabis clubs barcelona closing, cannabis club guide barcelona, cannabis club guru barcelona opinie, zanzibar cannabis club barcelona, best cannabis social clubs barcelona, cannabis dispensary barcelona spain, cannabis club barcelona best beoordeeld, and don't forget this homepage about cannabis club link not forgetting sites such as Barcelona cannabis club membership, cannabis club barcelona jetzt geöffnet, cannabis clubs barcelona, can tourists visit cannabis clubs in barcelona, cannabis club guru barcelona,additional resources on alongside all how do cannabis clubs work in barcelona, top cannabis clubs barcelona, cannabis clubs barcelona 2025, cannabis lounge barcelona, cannabis club jobs barcelona,for good measure. Check more @ Awesome Todaki Women's Massage Site 48deb64
Awesome Australian Blinds Tips
In reply to the lady inquiring about blinds direct perfect fit installation, blinds for you, blinds custom, call blinds, quality blinds, blinds to fit, blinds direct, order blind slats, high blinds, just blinds,I highly recommend this visit this link for Australian blinds link or diy shutter, blinds manufacturing, order window shades, made to order blinds, the blinds store, cheap blinds australia, direct to you blinds, local blind suppliers, high quality blinds, 1300 blinds, which is worth considering with this what is it worth for Australian blinds tips bearing in mind 1300 blinds, no blinds, single blind slats, diy shutter, blinds australia, blinds 101, wholesale factory direct, blinds direct blinds, custom blinds direct, blinds in store, as well as this made my day about Australian blinds url which is also great. Also, have a look at this best Australian blinds info not forgetting sites such as made to order blinds, time blinds, blinds measurements, diy shutter, order window shades, cheap blinds direct, blinds to be fitted, perfect fit blinds australia, diy blinds, the perfect blinds, not to mention this useful Australian blinds info bearing in mind exact fitting blinds, direct from factory wholesale, you blinds australia, blinds perfect fit, blinds discounts,homepage on and don't forget perfect fit blinds australia, direct window shades, custom blinds direct, custom shaped blinds, custom shutters online,and helpful hints on for good measure. Check more @ Recommended Bet365 Free Bets Sign Up OfferGuide 494f377
页:
[1]