鸿蒙内核liteos_a移植补丁-支持rk3126c rk3288 rv1126 精华

发布于 2020-10-26 16:18
浏览
2收藏

给大家分享瑞芯微三款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=y

#
# Compat
#
LOSCFG_COMPAT_POSIX=y
LOSCFG_COMPAT_BSD=y

#
# FileSystem
#
LOSCFG_FS_VFS=y
LOSCFG_FS_VFS_BLOCK_DEVICE=y
LOSCFG_FILE_MODE=y
LOSCFG_FS_FAT=y
LOSCFG_FS_FAT_CACHE=y
LOSCFG_FS_FAT_CACHE_SYNC_THREAD=y
LOSCFG_FS_FAT_CHINESE=y
LOSCFG_FS_FAT_VIRTUAL_PARTITION=y
LOSCFG_FS_FAT_VOLUMES=16
LOSCFG_FS_FAT_DISK=y
LOSCFG_FS_RAMFS=y
LOSCFG_FS_NFS=y
LOSCFG_FS_PROC=y
# LOSCFG_FS_JFFS is not set

#
# Net
#
LOSCFG_NET_LWIP_SACK=y
LOSCFG_NET_LWIP_SACK_2_1=y

#
# Debug
#
# LOSCFG_COMPILE_DEBUG is not set
LOSCFG_PLATFORM_ADAPT=y
LOSCFG_ENABLE_OOM_LOOP_TASK=y
LOSCFG_ENABLE_MAGICKEY=y
# LOSCFG_THUMB is not set
LOSCFG_DEBUG_VERSION=y
LOSCFG_DEBUG_KERNEL=y
LOSCFG_DEBUG_QUEUE=y
LOSCFG_DEBUG_DEADLOCK=y
LOSCFG_DEBUG_SEMAPHORE=y
LOSCFG_SHELL=y

#
# Functionality of Shell
#
LOSCFG_SHELL_LK=y
# LOSCFG_SHELL_DMESG is not set
# LOSCFG_SHELL_EXCINFO is not set
# LOSCFG_NET_LWIP_SACK_TFTP is not set
# LOSCFG_NET_TELNET is not set
# LOSCFG_EXC_INTERACTION is not set
LOSCFG_USER_INIT_DEBUG=y
LOSCFG_SHELL_CMD_DEBUG=y
# LOSCFG_MEM_DEBUG is not set
LOSCFG_PLATFORM_UART_WITHOUT_VFS=y
# LOSCFG_PLATFORM_NO_UART is not set

#
# Driver
#
LOSCFG_DRIVERS=y
# LOSCFG_DRIVERS_USB is not set
LOSCFG_DRIVERS_HDF=y
LOSCFG_DRIVERS_HDF_PLATFORM=y
LOSCFG_DRIVERS_HDF_PLATFORM_I2C=y
# LOSCFG_DRIVERS_HDF_PLATFORM_SPI is not set
# LOSCFG_DRIVERS_HDF_PLATFORM_GPIO is not set
# LOSCFG_DRIVERS_HDF_PLATFORM_WATCHDOG is not set
# LOSCFG_DRIVERS_HDF_PLATFORM_SDIO is not set
# LOSCFG_DRIVERS_HDF_PLATFORM_RTC is not set
# LOSCFG_DRIVERS_HDF_PLATFORM_HISI_SDK is not set
# LOSCFG_DRIVERS_HDF_WIFI is not set
# LOSCFG_DRIVERS_HDF_INPUT is not set
# LOSCFG_DRIVERS_HDF_LCD is not set
# LOSCFG_DRIVERS_HDF_USB is not set
# LOSCFG_DRIVERS_NETDEV is not set
LOSCFG_DRIVERS_MEM=y
# LOSCFG_DRIVERS_MTD is not set
# LOSCFG_DRIVERS_RANDOM is not set
LOSCFG_DRIVERS_VIDEO=y
LOSCFG_DRIVERS_HIEVENT=y

#
# Security
#
LOSCFG_SECURITY=y
LOSCFG_SECURITY_CAPABILITY=y
LOSCFG_SECURITY_VID=y
# LOSCFG_SECURITY_BOOT is not set

#
# Stack Smashing Protector (SSP) Compiler Feature
#
# LOSCFG_CC_NO_STACKPROTECTOR is not set
# LOSCFG_CC_STACKPROTECTOR is not set
LOSCFG_CC_STACKPROTECTOR_STRONG=y
# LOSCFG_CC_STACKPROTECTOR_ALL is not set

kernel/liteos_a/Kconfig

添加LOSCFG_PLATFORM_RK3126C宏判断,指定rk3126c支持"clang-llvm"编译器,并且注释屏蔽海思芯片相关的Kconfig

diff --git a/Kconfig b/Kconfig
index 522800b..4e0f99f 100755
--- a/Kconfig
+++ b/Kconfig
@@ -42,11 +42,11 @@ choice
 
 config COMPILER_HIMIX_32
     bool "arm-linux-ohoseabi"
-    depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300
+    depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_RV1126 || PLATFORM_RK3126C || PLATFORM_RK3288
 
 config COMPILER_CLANG_LLVM
     bool "clang-llvm"
-        depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300
+        depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_RV1126 || PLATFORM_RK3126C || PLATFORM_RK3288
 
 endchoice
 endmenu
@@ -274,7 +274,7 @@ config VM_OVERLAP_CHECK
 config NULL_ADDRESS_PROTECT
     bool "Enable NULL Address protect"
     default n
-    depends on (PLATFORM_HI3518EV200 || PLATFORM_HI3516CV300 || PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300) && DEBUG_VERSION
+    depends on (PLATFORM_HI3518EV200 || PLATFORM_HI3516CV300 || PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_RV1126) && DEBUG_VERSION
     help
       Answer Y to set mem address 0~1M prohibit to access, read or write will trigger exception.
 
@@ -284,7 +284,7 @@ choice
     help
       Enable simple uart (without vfs) only for litekernel.
       Enable general uart (with vfs) for full code.
-source "../../vendor/hisi/hi35xx/platform/uart/Kconfig"
+##source "../../vendor/hisi/hi35xx/platform/uart/Kconfig"
 config PLATFORM_UART_WITHOUT_VFS
     bool "Simple Uart"
 config PLATFORM_NO_UART
@@ -301,7 +301,7 @@ config DRIVERS
     help
       Answer Y to enable LiteOS support driver.
 
-source "../../vendor/hisi/hi35xx/platform/hiedmac/Kconfig"
+#source "../../vendor/hisi/hi35xx/platform/hiedmac/Kconfig"
 source "../../kernel/liteos_a/bsd/dev/usb/Kconfig"
 source "../../drivers/hdf/lite/Kconfig"
 
@@ -319,11 +319,11 @@ choice
     help
       Enable higmac for hi3516a hi3519 hi3559a_cortex-a53_aarch64.
       Enable hieth-sf for hi3516cv300 hi3516ev200 and hi3518ev200.
-source "../../vendor/hisi/hi35xx/platform/hieth-sf/Kconfig"
+#source "../../vendor/hisi/hi35xx/platform/hieth-sf/Kconfig"
 endchoice
 
 source "../../drivers/liteos/mem/Kconfig"
-source "../../vendor/hisi/hi35xx/platform/mmc/Kconfig"
+#source "../../vendor/hisi/hi35xx/platform/mmc/Kconfig"
 
 
 config DRIVERS_MTD
@@ -333,7 +333,7 @@ config DRIVERS_MTD
     help
       Answer Y to enable LiteOS support jffs2 multipartion.
 
-source "../../vendor/hisi/hi35xx/platform/mtd/spi_nor/Kconfig"
+#source "../../vendor/hisi/hi35xx/platform/mtd/spi_nor/Kconfig"
 source "../../drivers/liteos/random/Kconfig"
 source "../../drivers/liteos/tzdriver/Kconfig"
 source "../../drivers/liteos/video/Kconfig"

kernel/liteos_a/Makefile 修改Makefile,指定FSTYPE = vfat执行make rootfs时默认编译vfat格式root.img,指定rk3126c和其他芯片所包含的的BOARD_INCLUDE_DIR目录

--- a/Makefile
+++ b/Makefile
@@ -59,6 +59,16 @@ endif
 ifeq ($(LOSCFG_PLATFORM_HI3516DV300), y)
 FSTYPE = vfat
 endif
+ifeq ($(LOSCFG_PLATFORM_RV1126), y)
+FSTYPE = vfat
+endif
+ifeq ($(LOSCFG_PLATFORM_RK3126C), y)
+FSTYPE = vfat
+endif
+ifeq ($(LOSCFG_PLATFORM_RK3288), y)
+FSTYPE = vfat
+endif
+
 ROOTFS_DIR = $(OUT)/rootfs
 ROOTFS_ZIP = $(OUT)/rootfs.zip
 VERSION =
@@ -101,9 +111,19 @@ endif
 ##### make lib #####
 $(__LIBS): $(OUT) $(CXX_INCLUDE)

+ifeq ($(LOSCFG_PLATFORM_RV1126), y)
+BOARD_INCLUDE_DIR := $(LITEOSTOPDIR)/../../vendor/rockchip/rv1126/board
+else ifeq ($(LOSCFG_PLATFORM_RK3126C), y)
+BOARD_INCLUDE_DIR := $(LITEOSTOPDIR)/../../vendor/rockchip/rk3126c/board
+else ifeq ($(LOSCFG_PLATFORM_RK3288), y)
+BOARD_INCLUDE_DIR := $(LITEOSTOPDIR)/../../vendor/rockchip/rk3288/board
+else
+BOARD_INCLUDE_DIR := $(LITEOSTOPDIR)/../../vendor/hisi/hi35xx/$(LITEOS_PLATFORM)/config/board
+endif
+
 $(OUT): $(LITEOS_MENUCONFIG_H)
        $(HIDE)mkdir -p $(OUT)/lib
-       $(HIDE)$(CC) -I$(LITEOS_PLATFORM_BASE)/include -I$(LITEOSTOPDIR)/../../vendor/hisi/hi35xx/$(LITEOS_PLATFORM)/config/board \
+       $(HIDE)$(CC) -I$(LITEOS_PLATFORM_BASE)/include -I$(BOARD_INCLUDE_DIR) \
                -E $(LITEOS_PLATFORM_BASE)/board.ld.S \
                -o $(LITEOS_PLATFORM_BASE)/board.ld -P

platform目录修改:关联board platform新增rk3126c所需要编译的timer,以及include目录

diff --git a/platform/Kconfig b/platform/Kconfig
index 2b34a8d..3deefbc 100755
--- a/platform/Kconfig
+++ b/platform/Kconfig
@@ -2,6 +2,9 @@ config PLATFORM
     string
     default "hi3516dv300"     if PLATFORM_HI3516DV300
     default "hi3518ev300"     if PLATFORM_HI3518EV300
+    default "rv1126"         if PLATFORM_RV1126
+    default "rk3126c"         if PLATFORM_RK3126C
+    default "rk3288"         if PLATFORM_RK3288
 
 choice
     prompt "Board"
@@ -19,6 +22,18 @@ config PLATFORM_HI3518EV300
     bool "hi3518ev300"
     select ARCH_CORTEX_A7
 
+config PLATFORM_RV1126
+    bool "rv1126"
+    select ARCH_CORTEX_A7
+
+config PLATFORM_RK3126C
+    bool "rk3126c"
+    select ARCH_CORTEX_A7
+
+config PLATFORM_RK3288
+    bool "rk3288"
+    select ARCH_CORTEX_A7
+
 endchoice
 
 config TEE_ENABLE
diff --git a/platform/Makefile b/platform/Makefile
index e7ced6b..5101bfc 100755
--- a/platform/Makefile
+++ b/platform/Makefile
@@ -40,7 +40,7 @@ LOCAL_SRCS = $(wildcard $(HWI_SRC)/*.c) \
 LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/compat/posix/src \
                  -I $(LITEOSTOPDIR)/bsd/dev/random
 
-ifeq ($(findstring y, $(LOSCFG_PLATFORM_HI3518EV300)$(LOSCFG_PLATFORM_HI3516DV300)), y)
+ifeq ($(findstring y, $(LOSCFG_PLATFORM_HI3518EV300)$(LOSCFG_PLATFORM_HI3516DV300)$(LOSCFG_PLATFORM_RV1126)$(LOSCFG_PLATFORM_RK3126C))$(LOSCFG_PLATFORM_RK3288), y)
 LOCAL_SRCS += $(wildcard ../kernel/common/*.c)
 LOCAL_SRCS := $(filter-out ../kernel/common/los_rootfs.c, $(LOCAL_SRCS))
 ifneq ($(LOSCFG_FS_VFS), y)
diff --git a/platform/bsp.mk b/platform/bsp.mk
index 7714dbf..07f71ba 100755
--- a/platform/bsp.mk
+++ b/platform/bsp.mk
@@ -55,7 +55,15 @@ else ifeq ($(LOSCFG_PLATFORM_HI3518EV300), y)
     UART_TYPE    := amba_pl011
     USB_TYPE     := usb3.0_hi3518ev300
     LITEOS_CMACRO_TEST += -DTEST3518EV300
-
+else ifeq ($(LOSCFG_PLATFORM_RV1126), y)
+    HWI_TYPE     := arm/interrupt/gic
+    TIMER_TYPE   := arm/timer/arm_generic
+else ifeq ($(LOSCFG_PLATFORM_RK3126C), y)
+    HWI_TYPE     := arm/interrupt/gic
+    TIMER_TYPE   := arm/timer/arm_generic
+else ifeq ($(LOSCFG_PLATFORM_RK3288), y)
+    HWI_TYPE     := arm/interrupt/gic
+    TIMER_TYPE   := arm/timer/arm_generic
 endif
 
 HWI_SRC     := hw/$(HWI_TYPE)
@@ -80,7 +88,14 @@ PLATFORM_INCLUDE := -I $(LITEOSTOPDIR)/../../vendor/hisi/hi35xx/$(LITEOS_PLATFOR
 
 ifeq ($(findstring y, $(LOSCFG_PLATFORM_HI3518EV300)$(LOSCFG_PLATFORM_HI3516DV300)), y)
     PLATFORM_INCLUDE += -I $(LITEOSTOPDIR)/../../vendor/hisi/hi35xx/$(LITEOS_PLATFORM)/config/board/include/hisoc
+else ifeq ($(LOSCFG_PLATFORM_RV1126),y)
+    PLATFORM_INCLUDE += -I $(LITEOSTOPDIR)/../../vendor/rockchip/rv1126/board/include
+else ifeq ($(LOSCFG_PLATFORM_RK3126C),y)
+    PLATFORM_INCLUDE += -I $(LITEOSTOPDIR)/../../vendor/rockchip/rk3126c/board/include
+else ifeq ($(LOSCFG_PLATFORM_RK3288),y)
+    PLATFORM_INCLUDE += -I $(LITEOSTOPDIR)/../../vendor/rockchip/rk3288/board/include
 endif
+
 #
 #-include $(LITEOSTOPDIR)/platform/bsp/board/$(LITEOS_PLATFORM)/board.mk
 #

kernel/liteos_a/arch/arm/arm/src/startup/reset_vector_up ,添加uart打印显示debug信息,注释enable fpu+neon 的指令 //MCR    p15, 0, r0, c1, c1, 2,不注释会卡在这。

diff --git a/arch/arm/arm/src/startup/reset_vector_up b/arch/arm/arm/src/startup/reset_vector_up
index d7de477..8cddab8 100755
--- a/arch/arm/arm/src/startup/reset_vector_up.S
+++ b/arch/arm/arm/src/startup/reset_vector_up.S
@@ -113,11 +113,36 @@ __exception_handlers:
     .global reset_vector
     .type   reset_vector,function
 reset_vector:
+    ldr sp,=0x75000000    
+
+#if 0
     /* do some early cpu setup: i/d cache disable, mmu disabled */
     mrc     p15, 0, r0, c1, c0, 0
     bic     r0, #(1<<12)
     bic     r0, #(1<<2 | 1<<0)
     mcr     p15, 0, r0, c1, c0, 0
+#endif
+
+#if 0
+	/*
+	 * disable interrupts (FIQ and IRQ), also set the cpu to SVC32 mode,
+	 * except if in HYP mode already
+	 */
+	mrs	r0, cpsr
+	and	r1, r0, #0x1f		@ mask mode bits
+	teq	r1, #0x1a		@ test for HYP mode
+	bicne	r0, r0, #0x1f		@ clear all mode bits
+	orrne	r0, r0, #0x13		@ set SVC mode
+	orr	r0, r0, #0xc0		@ disable FIQ and IRQ
+	msr	cpsr,r0
+
+	/*
+	 * If I-cache is enabled invalidate it
+	 */
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
 
     /* r11: delta of physical address and virtual address */
     adr     r11, pa_va_offset
@@ -150,8 +175,11 @@ reloc_img_to_bottom_done:
     add     r4, r4, r11
     bl      page_table_clear
 
-    PAGE_TABLE_SET SYS_MEM_BASE, KERNEL_VMM_BASE, KERNEL_VMM_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
+    
+    
     PAGE_TABLE_SET SYS_MEM_BASE, UNCACHED_VMM_BASE, UNCACHED_VMM_SIZE, MMU_INITIAL_MAP_STRONGLY_ORDERED
+    PAGE_TABLE_SET DDR_RAMFS_ADDR, DDR_RAMFS_VBASE, DDR_RAMFS_SIZE, MMU_INITIAL_MAP_DEVICE
+    PAGE_TABLE_SET SYS_MEM_BASE, KERNEL_VMM_BASE, KERNEL_VMM_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
     PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_DEVICE_BASE, PERIPH_DEVICE_SIZE, MMU_INITIAL_MAP_DEVICE
     PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_CACHED_BASE, PERIPH_CACHED_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
     PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_UNCACHED_BASE, PERIPH_UNCACHED_SIZE, MMU_INITIAL_MAP_STRONGLY_ORDERED
@@ -173,8 +201,12 @@ reloc_img_to_bottom_done:
     rsb     r7, r11, r6, lsl #20                /* r7: va */
     str     r12, [r4, r7, lsr #(20 - 2)]        /* jumpTable[vaIndex] = pt entry */
 
+    mov r0,#'V'
+    bl uart_imp_putc_phy
     bl      mmu_setup                           /* set up the mmu */
 
+    mov r0,#'C'
+    bl uart_imp_putc
     /* get cpuid and keep it in r11 */
     mrc     p15, 0, r11, c0, c0, 5
     and     r11, r11, #MPIDR_CPUID_MASK
@@ -196,6 +228,8 @@ excstatck_loop:
 
 excstatck_loop_done:
 warm_reset:
+mov r0,#'D'
+    bl uart_imp_putc
     /* initialize interrupt/exception environments */
     mov    r0, #(CPSR_IRQ_DISABLE |CPSR_FIQ_DISABLE|CPSR_IRQ_MODE)
     msr    cpsr, r0
@@ -219,20 +253,23 @@ warm_reset:
 
     /* Note: some functions in LIBGCC1 will cause a "restore from SPSR"!! */
     msr    spsr, r0
-
+mov r0,#'E'
+    bl uart_imp_putc
     /* set svc stack, every cpu has OS_EXC_SVC_STACK_SIZE stack */
     ldr    r0, =__svc_stack_top
     mov    r2, #OS_EXC_SVC_STACK_SIZE
     mul    r2, r2, r11
     sub    r0, r0, r2
     mov    sp, r0
-
+mov r0,#'F'
+    bl uart_imp_putc
     /* enable fpu+neon */
     MRC    p15, 0, r0, c1, c1, 2
     ORR    r0, r0, #0xC00
     BIC    r0, r0, #0xC000
-    MCR    p15, 0, r0, c1, c1, 2
-
+    //MCR    p15, 0, r0, c1, c1, 2
+mov r0,#'G'
+    bl uart_imp_putc    
     LDR    r0, =(0xF << 20)
     MCR    p15, 0, r0, c1, c0, 2
 
@@ -266,7 +303,8 @@ bss_loop:
     bl     GDB_START
     .word  0xe7ffdeff
 #endif
-
+mov r0,#'M'
+    bl uart_imp_putc
     bl     main
 
 _start_hang:

3.drivers/hdf/lite

修改hdf_driver.mk根据芯片选择编译的hdf脚本vendor/rockchip/hdf/hdf_vendor.mk

diff --git a/Makefile b/Makefile
index 635e1fe..8db4e6c 100755
--- a/Makefile
+++ b/Makefile
@@ -94,6 +94,6 @@ ifeq ($(LOSCFG_DRIVERS_HDF_WIFI), y)
               LOCAL_SRCS += $(HDF_ADAPTER)/network/src/net_device_adapter.c
 endif

-LOCAL_FLAGS += $(LITEOS_GCOV_OPTS)
+LOCAL_FLAGS += $(LITEOS_GCOV_OPTS) -Wno-error

 include $(HDF_DRIVER)
diff --git a/hdf_driver.mk b/hdf_driver.mk
index 469387e..8710688 100755
--- a/hdf_driver.mk
+++ b/hdf_driver.mk
@@ -20,8 +20,12 @@ HCGEN_PATH := win-x86/bin/hc-gen.exe
 endif

 ifeq ($(LOCAL_HCS_ROOT),)
+ifeq ($(findstring y, $(LOSCFG_PLATFORM_RV1126)$(LOSCFG_PLATFORM_RK3126C)$(LOSCFG_PLATFORM_RK3288)), y)
+LOCAL_HCS_ROOT := vendor/rockchip
+else
 LOCAL_HCS_ROOT := vendor/hisi/hi35xx
 endif
+endif

 HC_GEN := hc-gen
 BUILD_IN_HC_GEN := $(LITEOSTOPDIR)/../../prebuilts/build-tools/$(HCGEN_PATH)
diff --git a/hdf_lite.mk b/hdf_lite.mk
index d6d21d7..46d7940 100755
--- a/hdf_lite.mk
+++ b/hdf_lite.mk
@@ -36,7 +36,13 @@ ifeq ($(LOSCFG_DRIVERS_HDF_USB), y)
 endif

 # vendor lib
+ifeq ($(findstring y, $(LOSCFG_PLATFORM_HI3518EV300)$(LOSCFG_PLATFORM_HI3516DV300)), y)
 include $(LITEOSTOPDIR)/../../vendor/huawei/hdf/hdf_vendor.mk
+endif
+
+ifeq ($(findstring y, $(LOSCFG_PLATFORM_RV1126)$(LOSCFG_PLATFORM_RK3126C)$(LOSCFG_PLATFORM_RK3288)), y)
+include $(LITEOSTOPDIR)/../../vendor/rockchip/hdf/hdf_vendor.mk
+endif

     LITEOS_BASELIB += --no-whole-archive
 endif

4.vendor/rockchip

添加rockchip和rk3126c,rk3288,rv1126子目录存放芯片差异相关的board.c和配置文件

 rk3288/board/Makefile                        |   9 +
 rk3288/board/board.c                         | 109 +++++
 rk3288/board/bsd_board.c                     |  82 ++++
 rk3288/board/include/asm/hal_platform_ints.h | 115 +++++
 rk3288/board/include/asm/platform.h          | 149 +++++++
 rk3288/board/include/board.h                 |  53 +++
 rk3288/board/include/clock.h                 |  42 ++
 rk3288/board/include/platform_config.h       |  37 ++
 rk3288/board/include/reset_shell.h           |  48 ++
 rk3288/board/include/spinor.h                | 121 +++++
 rk3288/board/include/uart.h                  | 129 ++++++
 rk3288/config/Makefile                       |   9 +
 rk3288/config/device_info/device_info.hcs    |  27 ++
 rk3288/config/hdf.hcs                        |   6 +
 rk3288/config/i2c/i2c_config.hcs             |  21 +
 rk3288/driver/ramdisk/Makefile               |   7 +
 rk3288/driver/ramdisk/ramdisk.c              | 137 ++++++
 rk3288/driver/rv1126-fb/Makefile             |   7 +
 rk3288/driver/rv1126-fb/imx6ull_lcd.c        |  85 ++++
 rk3288/driver/rv1126-fb/imx6ull_lcd.h        |  58 +++
 rk3288/driver/rv1126-fb/imx6ull_lcdc.c       | 581 ++++++++++++++++++++++++
 rk3288/driver/rv1126-fb/imx6ull_lcdc.h       | 313 +++++++++++++
 rk3288/driver/rv1126-i2c/Makefile            |  19 +
 rk3288/driver/rv1126-i2c/i2c_dev.c           | 466 ++++++++++++++++++++
 rk3288/driver/rv1126-i2c/i2c_dev.h           |  58 +++
 rk3288/driver/rv1126-i2c/i2c_imx6ull.c       | 634 +++++++++++++++++++++++++++
 rk3288/driver/rv1126-uart/Makefile           |   8 +
 rk3288/driver/rv1126-uart/uart_core.c        | 158 +++++++
 rk3288/driver/rv1126-uart/uart_dev.c         | 364 +++++++++++++++
 rk3288/driver/rv1126-uart/uart_dev.h         | 245 +++++++++++
 rk3288/driver/rv1126-uart/uart_rv1126.c      | 441 +++++++++++++++++++
 rk3288/driver/rv1126-uart/uart_rv1126.h      | 272 ++++++++++++
 rk3288/rk3288.mk                             |  16 +
 rk3126c/board/include/asm/hal_platform_ints.h |  6 +++---
 rk3126c/board/include/asm/platform.h          | 16 ++++++++--------
 rk3126c/board/include/board.h                 |  6 +++---
 rk3126c/driver/rv1126-uart/uart_rv1126.c      |  4 ++--
 rk3126c/rk3126c.mk                            |  2 +-
 hdf/hdf_vendor.mk                             |  32 ++
 rk3126c/board/Makefile                        |   9 +
 rk3126c/board/board.c                         | 109 +++++
 rk3126c/board/bsd_board.c                     |  82 ++++
 rk3126c/board/include/asm/hal_platform_ints.h | 115 +++++
 rk3126c/board/include/asm/platform.h          | 149 ++++++
 rk3126c/board/include/board.h                 |  53 +++
 rk3126c/board/include/clock.h                 |  42 ++
 rk3126c/board/include/platform_config.h       |  37 ++
 rk3126c/board/include/reset_shell.h           |  48 ++
 rk3126c/board/include/spinor.h                | 121 +++++
 rk3126c/board/include/uart.h                  | 129 ++++++
 rk3126c/config/Makefile                       |   9 +
 rk3126c/config/device_info/device_info.hcs    |  27 ++
 rk3126c/config/hdf.hcs                        |   6 +
 rk3126c/config/i2c/i2c_config.hcs             |  21 +
 rk3126c/driver/ramdisk/Makefile               |   7 +
 rk3126c/driver/ramdisk/ramdisk.c              | 137 ++++++
 rk3126c/driver/rv1126-fb/Makefile             |   7 +
 rk3126c/driver/rv1126-fb/imx6ull_lcd.c        |  85 ++++
 rk3126c/driver/rv1126-fb/imx6ull_lcd.h        |  58 +++
 rk3126c/driver/rv1126-fb/imx6ull_lcdc.c       | 581 +++++++++++++++++++++++
 rk3126c/driver/rv1126-fb/imx6ull_lcdc.h       | 313 +++++++++++++
 rk3126c/driver/rv1126-i2c/Makefile            |  19 +
 rk3126c/driver/rv1126-i2c/i2c_dev.c           | 466 +++++++++++++++++++
 rk3126c/driver/rv1126-i2c/i2c_dev.h           |  58 +++
 rk3126c/driver/rv1126-i2c/i2c_imx6ull.c       | 634 ++++++++++++++++++++++++++
 rk3126c/driver/rv1126-uart/Makefile           |   8 +
 rk3126c/driver/rv1126-uart/uart_core.c        | 158 +++++++
 rk3126c/driver/rv1126-uart/uart_dev.c         | 364 +++++++++++++++
 rk3126c/driver/rv1126-uart/uart_dev.h         | 245 ++++++++++
 rk3126c/driver/rv1126-uart/uart_rv1126.c      | 441 ++++++++++++++++++
 rk3126c/driver/rv1126-uart/uart_rv1126.h      | 272 +++++++++++
 rk3126c/rk3126c.mk                            |  16 +
 rv1126/board/Makefile                         |   9 +
 rv1126/board/board.c                          | 109 +++++
 rv1126/board/bsd_board.c                      |  82 ++++
 rv1126/board/include/asm/hal_platform_ints.h  | 115 +++++
 rv1126/board/include/asm/platform.h           | 149 ++++++
 rv1126/board/include/board.h                  |  53 +++
 rv1126/board/include/clock.h                  |  42 ++
 rv1126/board/include/platform_config.h        |  37 ++
 rv1126/board/include/reset_shell.h            |  48 ++
 rv1126/board/include/spinor.h                 | 121 +++++
 rv1126/board/include/uart.h                   | 129 ++++++
 rv1126/config/Makefile                        |   9 +
 rv1126/config/device_info/device_info.hcs     |  27 ++
 rv1126/config/hdf.hcs                         |   6 +
 rv1126/config/i2c/i2c_config.hcs              |  21 +
 rv1126/driver/ramdisk/Makefile                |   7 +
 rv1126/driver/ramdisk/ramdisk.c               | 137 ++++++
 rv1126/driver/rv1126-fb/Makefile              |   7 +
 rv1126/driver/rv1126-fb/imx6ull_lcd.c         |  85 ++++
 rv1126/driver/rv1126-fb/imx6ull_lcd.h         |  58 +++
 rv1126/driver/rv1126-fb/imx6ull_lcdc.c        | 581 +++++++++++++++++++++++
 rv1126/driver/rv1126-fb/imx6ull_lcdc.h        | 313 +++++++++++++
 rv1126/driver/rv1126-i2c/Makefile             |  19 +
 rv1126/driver/rv1126-i2c/i2c_dev.c            | 466 +++++++++++++++++++
 rv1126/driver/rv1126-i2c/i2c_dev.h            |  58 +++
 rv1126/driver/rv1126-i2c/i2c_imx6ull.c        | 634 ++++++++++++++++++++++++++
 rv1126/driver/rv1126-uart/Makefile            |   8 +
 rv1126/driver/rv1126-uart/uart_core.c         | 158 +++++++
 rv1126/driver/rv1126-uart/uart_dev.c          | 364 +++++++++++++++
 rv1126/driver/rv1126-uart/uart_dev.h          | 245 ++++++++++
 rv1126/driver/rv1126-uart/uart_rv1126.c       | 441 ++++++++++++++++++
 rv1126/driver/rv1126-uart/uart_rv1126.h       | 272 +++++++++++
 rv1126/rv1126.mk                              |  16 +

 

补丁打完后可通过build.py进行编译鸿蒙内核liteos_a移植补丁-支持rk3126c rk3288 rv1126-开源基础软件社区

 build.py rk3126c

鸿蒙内核liteos_a移植补丁-支持rk3126c rk3288 rv1126-开源基础软件社区

编译得到文件用于烧写:

out/rk3126c/liteos.bin

out/rk3126c/rootfs.img

鸿蒙内核liteos_a移植补丁-支持rk3126c rk3288 rv1126-开源基础软件社区

重启设备进入liteos内核:

鸿蒙内核liteos_a移植补丁-支持rk3126c rk3288 rv1126-开源基础软件社区

完整补丁上传到附件。

uboot补丁参考:https://harmonyos.51cto.com/posts/1318

 

 

patch-hmos.rar 161.46K 151次下载
已于2020-10-26 16:24:01修改
3
收藏 2
回复
举报
回复
添加资源
添加资源将有机会获得更多曝光,你也可以直接关联已上传资源 去关联
    相关推荐