给大家分享瑞芯微三款A7芯片liteos_a内核补丁,打上附件补丁编译可进入鸿蒙内核。
补丁主要涉及四个目录:
build/lite/
kernel/liteos_a/
drivers/hdf/lite/
vendor/rockchip/
1.build/lite/
该目录修改添加新的product 的编译支持,修改和添加下列文件文件:
project build/lite/
-m build.py
-- config/boards/rk3126c.gni
-- config/boards/rk3288.gni
-- config/boards/rv1126.gni
-m gen_rootfs.py
-- product/rk3126c.json
-- product/rk3288.json
-- product/rv1126.json
修改build.py和gen_rootfs.py两处修改用于支持build.py rk3126c编译命令和生成vfat格式的rootfs.img。
diff --git a/build.py b/build.py
index 003e7e4..76386ce 100755
--- a/build.py
+++ b/build.py
@@ -26,6 +26,9 @@ import os
def usage():
msg = "\n python build.py ipcamera_hi3516dv300\n "\
"python build.py ipcamera_hi3518ev300\n "\
+ "python build.py rv1126\n "\
+ "python build.py rk3126c\n "\
+ "python build.py rk3288\n "\
"python build.py wifiiot\n"\
"\n Quickstart: https://device.harmonyos.com/cn/docs/start/"\
"introduce/oem_start_guide-0000001054913231\n"
diff --git a/gen_rootfs.py b/gen_rootfs.py
index ff8d49e..6227435 100755
--- a/gen_rootfs.py
+++ b/gen_rootfs.py
@@ -312,10 +312,7 @@ def main():
return -1
if args.board:
- if args.board == 'hi3516dv300':
fstype = 'vfat'
- else:
- fstype = 'jffs2'
else:
return -1
build/lite/product/rk3126c.json 用于指定编译rk3126c固件含哪些模块,这里删除了foundation相关仓库,保留hdf驱动以及liteos_a内核模块。
{
"ohos_version": "OpenHarmony 1.0",
"board": "rk3126c",
"kernel": "liteos_a",
"compiler": "clang",
"subsystem": [
{
"name": "kernel",
"component": [
{ "name": "liteos_a", "dir": "//kernel/liteos_a:kernel", "features":[] }
]
},
{
"name": "hdf",
"component": [
{ "name": "posix", "dir": "//drivers/hdf/lite/posix:hdf_posix", "features":[] },
{ "name": "manager", "dir": "//drivers/hdf/lite/manager:hdf_manager", "features":[] }
]
},
{
"name": "utils",
"component": [
{ "name": "kv_store", "dir": "//utils/native/lite/kv_store:kv_store", "features":[] }
]
}
],
"vendor_adapter_dir": "//vendor/hisi/hi35xx/hi3518ev300/hi3518ev300_adapter",
"third_party_dir": "//third_party",
"ohos_product_type":"",
"ohos_manufacture":"",
"ohos_brand":"",
"ohos_market_name":"",
"ohos_product_series":"",
"ohos_product_model":"",
"ohos_software_model":"",
"ohos_hardware_model":"",
"ohos_hardware_profile":"",
"ohos_serial":"",
"ohos_bootloader_version":"",
"ohos_secure_patch_level":"",
"ohos_abi_list":""
}
build/lite/config/boards/rk3126c.gni指定芯片对应指令集rk3126c对应cortex-a7
board_arch = "armv7-a"
board_cpu = "cortex-a7"
2.kernel/liteos_a
主要添加芯片对应的内核配置文件如:rk3126c_clang_release.config,添加修改文件如下:
project kernel/liteos_a/
-m Kconfig
-m Makefile
-m arch/arm/arm/src/startup/reset_vector_up.S
-m fs/vfs/vfs_cmd/vfs_shellcmd.c
-m kernel/base/include/los_vm_zone.h
-m kernel/base/misc/los_stackinfo.c
-m kernel/common/los_config.c
-m kernel/common/los_config.h
-m kernel/common/los_exc_interaction.c
-m kernel/common/los_excinfo.c
-m kernel/common/los_rootfs.c
-m kernel/extended/trace/los_trace.c
-m platform/Kconfig
-m platform/Makefile
-m platform/bsp.mk
-m shell/full/src/base/shcmd.c
-m shell/full/src/base/shmsg.c
-m shell/full/src/base/show.c
-m shell/full/src/cmds/dmesg.c
-- tools/build/config/debug/rv1126.config
-- tools/build/config/debug/rv1126_clang.config
-- tools/build/config/rk3126c_clang_release.config
-- tools/build/config/rk3288_clang_release.config
-- tools/build/config/rv1126_clang_release.config
-m tools/build/mk/los_config.mk
新增编译内核的config配置文件tools/build/config/rk3126c_clang_release.config, 添加宏LOSCFG_PLATFORM_RK3126C=y和LOSCFG_PLATFORM="rk3126c"支持区分新的芯片编译
#
# Automatically generated file; DO NOT EDIT.
# Huawei LiteOS Configuration
#
#
# Compiler
#
# LOSCFG_COMPILER_HIMIX_32 is not set
LOSCFG_COMPILER_CLANG_LLVM=y
#
# Platform
#
LOSCFG_PLATFORM="rk3126c"
# LOSCFG_PLATFORM_HI3516DV300 is not set
# LOSCFG_PLATFORM_HI3518EV300 is not set
# LOSCFG_PLATFORM_RV1126 is not set
LOSCFG_PLATFORM_RK3126C=y
# LOSCFG_PLATFORM_RK3288 is not set
LOSCFG_PLATFORM_BSP_GIC_V2=y
LOSCFG_ARCH_ARM=y
LOSCFG_ARCH_ARM_AARCH32=y
LOSCFG_ARCH_ARM_V7A=y
LOSCFG_ARCH_ARM_VER="armv7-a"
LOSCFG_ARCH_FPU_VFP_V4=y
LOSCFG_ARCH_FPU_VFP_D32=y
LOSCFG_ARCH_FPU_VFP_NEON=y
LOSCFG_ARCH_FPU="neon-vfpv4"
LOSCFG_ARCH_CORTEX_A7=y
LOSCFG_ARCH_CPU="cortex-a7"
#
# Extra Configurations
#
# LOSCFG_ARCH_FPU_DISABLE is not set
LOSCFG_IRQ_USE_STANDALONE_STACK=y
LOSCFG_PLATFORM_ROOTFS=y
#
# Kernel
#
# LOSCFG_KERNEL_SMP is not set
LOSCFG_KERNEL_EXTKERNEL=y
LOSCFG_KERNEL_CPPSUPPORT=y
LOSCFG_KERNEL_CPUP=y
LOSCFG_CPUP_INCLUDE_IRQ=y
LOSCFG_KERNEL_DYNLOAD=y
LOSCFG_KERNEL_VDSO=y
# LOSCFG_KERNEL_TICKLESS is not set
LOSCFG_KERNEL_TRACE=y
LOSCFG_KERNEL_LITEIPC=y
LOSCFG_KERNEL_PIPE=y
LOSCFG_BASE_CORE_HILOG=y
#
# Lib
#
LOSCFG_LIB_LIBC=y
LOSCFG_LIB_ZLIB