From 1ecda9c0331cf9fc133be43778719d9df9a023e4 Mon Sep 17 00:00:00 2001 From: Hongjin Li Date: Wed, 12 Jan 2022 10:49:30 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20kernel=E9=83=A8=E4=BB=B6=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、添加HPM包描述文件bundle.json 2、依赖的三方开源软件,由直接引用路径,改为import对应的gni文件,引用变量 Signed-off-by: Hongjin Li Change-Id: Ice783c19a477626d422a37faf3d420c4965f8ea6 --- apps/mksh/BUILD.gn | 3 +- apps/toybox/BUILD.gn | 3 +- bundle.json | 68 +++++++++++++++++++++++++++++++++ drivers/char/bch/BUILD.gn | 13 +------ drivers/char/video/BUILD.gn | 5 ++- fs/fat/BUILD.gn | 10 ++--- fs/jffs2/BUILD.gn | 31 ++------------- fs/nfs/BUILD.gn | 7 +--- fs/ramfs/BUILD.gn | 3 +- fs/romfs/BUILD.gn | 6 +-- fs/vfs/BUILD.gn | 70 ++++++---------------------------- kernel/extended/pipes/BUILD.gn | 9 ++--- lib/libc/BUILD.gn | 10 +---- lib/libscrew/BUILD.gn | 3 +- 14 files changed, 107 insertions(+), 134 deletions(-) create mode 100644 bundle.json diff --git a/apps/mksh/BUILD.gn b/apps/mksh/BUILD.gn index 30f2fb39..379d78f0 100644 --- a/apps/mksh/BUILD.gn +++ b/apps/mksh/BUILD.gn @@ -29,13 +29,14 @@ import("//build/lite/config/component/lite_component.gni") import("//kernel/liteos_a/liteos.gni") +import("//third_party/mksh/mksh.gni") group("mksh") { deps = [ ":build_mksh" ] } copy("copy_mksh_src") { - sources = [ "$LITEOSTHIRDPARTY/mksh" ] + sources = MKSH_SRC_DIR outputs = [ "$target_out_dir/mksh_build" ] } diff --git a/apps/toybox/BUILD.gn b/apps/toybox/BUILD.gn index c7b2f06f..a6d74a10 100644 --- a/apps/toybox/BUILD.gn +++ b/apps/toybox/BUILD.gn @@ -29,13 +29,14 @@ import("//build/lite/config/component/lite_component.gni") import("//kernel/liteos_a/liteos.gni") +import("//third_party/toybox/toybox.gni") group("toybox") { deps = [ ":build_toybox" ] } copy("copy_toybox_src") { - sources = [ "$LITEOSTHIRDPARTY/toybox" ] + sources = TOYBOX_SRC_DIR outputs = [ "$target_out_dir/toybox_build" ] } diff --git a/bundle.json b/bundle.json new file mode 100644 index 00000000..9c37f6aa --- /dev/null +++ b/bundle.json @@ -0,0 +1,68 @@ +{ + "name": "@ohos/liteos_a", + "version": "3.1.0", + "description": "liteos-a kernel", + "homePage": "https://gitee.com/openharmony", + "license": "BSD 3-clause", + "repository": "https://gitee.com/openharmony/kernel_liteos_a", + "domain": "os", + "language": "", + "publishAs": "code-segment", + "private": false, + "scripts": {}, + "tags": [ + "kernel" + ], + "keywords": [ + "kernel", + "liteos-a" + ], + "envs": [], + "dirs": [], + "author": {}, + "contributors": [], + "segment": { + "destPath": "kernel/liteos_a" + }, + "component": { + "name": "liteos_a", + "subsystem": "kernel", + "syscap": [ + "SystemCapability.Kernel.liteos-a" + ], + "features": [], + "adated_system_type": [ + "small" + ], + "rom": "1.5MB", + "ram": "2MB", + "deps": { + "components": [ + ], + "third_party": [ + "bounds_checking_function", + "toybox", + "NuttX", + "Linux_Kernel", + "FatFs", + "mksh", + "musl", + "mbedtls", + "FreeBSD", + "zlib", + "lwip", + "optimized-routines", + "googletest" + ] + }, + "build": { + "sub_component": [ + "//kernel/liteos_a:liteos_a" + ], + "inner_kits": [], + "test": [ + "//kernel/liteos_a/testsuites:testsuites" + ] + } + } +} \ No newline at end of file diff --git a/drivers/char/bch/BUILD.gn b/drivers/char/bch/BUILD.gn index cc684575..634b1e7c 100644 --- a/drivers/char/bch/BUILD.gn +++ b/drivers/char/bch/BUILD.gn @@ -28,21 +28,12 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_a/liteos.gni") +import("//third_party/NuttX/NuttX.gni") module_switch = defined(LOSCFG_FS_VFS_BLOCK_DEVICE) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { - sources = [ - "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchdev_driver.c", - "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchdev_register.c", - "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchdev_unregister.c", - "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_cache.c", - "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_read.c", - "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_sem.c", - "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_setup.c", - "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_teardown.c", - "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_write.c", - ] + sources = NUTTX_DRIVERS_BCH_SRC_FILES public_configs = [ ":public" ] } diff --git a/drivers/char/video/BUILD.gn b/drivers/char/video/BUILD.gn index 1470983e..a7fcc3f9 100644 --- a/drivers/char/video/BUILD.gn +++ b/drivers/char/video/BUILD.gn @@ -28,15 +28,16 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_a/liteos.gni") +import("//third_party/NuttX/NuttX.gni") module_switch = defined(LOSCFG_DRIVERS_VIDEO) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { - sources = [ "$LITEOSTHIRDPARTY/NuttX/drivers/video/fb.c" ] + sources = NUTTX_DRIVERS_VIDEO_SRC_FILES public_configs = [ ":public" ] } config("public") { - include_dirs = [ "$LITEOSTHIRDPARTY/NuttX/include/nuttx/video" ] + include_dirs = NUTTX_DRIVERS_VIDEO_INCLUDE_DIRS } diff --git a/fs/fat/BUILD.gn b/fs/fat/BUILD.gn index 34abc034..921f9ea6 100644 --- a/fs/fat/BUILD.gn +++ b/fs/fat/BUILD.gn @@ -28,6 +28,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_a/liteos.gni") +import("//third_party/FatFs/FatFs.gni") module_switch = defined(LOSCFG_FS_FAT) module_name = get_path_info(rebase_path("."), "name") @@ -38,12 +39,7 @@ kernel_module(module_name) { "os_adapt/format.c", ] - sources += [ - "$LITEOSTHIRDPARTY/FatFs/source/diskio.c", - "$LITEOSTHIRDPARTY/FatFs/source/ff.c", - "$LITEOSTHIRDPARTY/FatFs/source/ffsystem.c", - "$LITEOSTHIRDPARTY/FatFs/source/ffunicode.c", - ] + sources += FATFS_SRC_FILES include_dirs = [ "os_adapt" ] @@ -51,5 +47,5 @@ kernel_module(module_name) { } config("public") { - include_dirs = [ "$LITEOSTHIRDPARTY/FatFs/source" ] + include_dirs = FATFS_INCLUDE_DIRS } diff --git a/fs/jffs2/BUILD.gn b/fs/jffs2/BUILD.gn index bf5eecc1..e90e0e28 100644 --- a/fs/jffs2/BUILD.gn +++ b/fs/jffs2/BUILD.gn @@ -28,6 +28,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_a/liteos.gni") +import("//third_party/Linux_Kernel/Linux_Kernel.gni") module_switch = defined(LOSCFG_FS_JFFS) module_name = get_path_info(rebase_path("."), "name") @@ -37,35 +38,9 @@ kernel_module(module_name) { "src/vfs_jffs2.c", ] - sources += [ - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/background.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/build.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr_rtime.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr_rubin.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr_zlib.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/debug.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/dir.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/erase.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/file.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/fs.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/gc.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/malloc.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/nodelist.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/nodemgmt.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/read.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/readinode.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/scan.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/summary.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/super.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/write.c", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/writev.c", - ] + sources += LINUX_KERNEL_FS_JFFS2_SRC_FILES - include_dirs = [ - "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2", - "$LITEOSTHIRDPARTY/Linux_Kernel/fs", - ] + include_dirs = LINUX_KERNEL_FS_JFFS2_INCLUDE_DIRS public_configs = [ ":public" ] } diff --git a/fs/nfs/BUILD.gn b/fs/nfs/BUILD.gn index 8f987f9d..4a5c8cf4 100644 --- a/fs/nfs/BUILD.gn +++ b/fs/nfs/BUILD.gn @@ -28,13 +28,10 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_a/liteos.gni") +import("//third_party/NuttX/NuttX.gni") module_switch = defined(LOSCFG_FS_NFS) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { - sources = [ - "$LITEOSTHIRDPARTY/NuttX/fs/nfs/nfs_adapter.c", - "$LITEOSTHIRDPARTY/NuttX/fs/nfs/nfs_util.c", - "$LITEOSTHIRDPARTY/NuttX/fs/nfs/rpc_clnt.c", - ] + sources = NUTTX_FS_NFS_SRC_FILES } diff --git a/fs/ramfs/BUILD.gn b/fs/ramfs/BUILD.gn index 5b593f83..716f4c3a 100644 --- a/fs/ramfs/BUILD.gn +++ b/fs/ramfs/BUILD.gn @@ -28,9 +28,10 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_a/liteos.gni") +import("//third_party/NuttX/NuttX.gni") module_switch = defined(LOSCFG_FS_RAMFS) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { - sources = [ "$LITEOSTHIRDPARTY/NuttX/fs/tmpfs/fs_tmpfs.c" ] + sources = NUTTX_FS_TMPFS_SRC_FILES } diff --git a/fs/romfs/BUILD.gn b/fs/romfs/BUILD.gn index eef06c08..4e371f7d 100644 --- a/fs/romfs/BUILD.gn +++ b/fs/romfs/BUILD.gn @@ -28,12 +28,10 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_a/liteos.gni") +import("//third_party/NuttX/NuttX.gni") module_switch = defined(LOSCFG_FS_ROMFS) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { - sources = [ - "$LITEOSTHIRDPARTY/NuttX/fs/romfs/fs_romfs.c", - "$LITEOSTHIRDPARTY/NuttX/fs/romfs/fs_romfsutil.c", - ] + sources = NUTTX_FS_ROMFS_SRC_FILES } diff --git a/fs/vfs/BUILD.gn b/fs/vfs/BUILD.gn index 5f128d49..b04eddfb 100644 --- a/fs/vfs/BUILD.gn +++ b/fs/vfs/BUILD.gn @@ -28,11 +28,17 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_a/liteos.gni") +import("//third_party/NuttX/NuttX.gni") module_switch = defined(LOSCFG_FS_VFS) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ + "$LITEOSTOPDIR/fs/vfs/epoll/fs_epoll.c", + "$LITEOSTOPDIR/fs/vfs/mount.c", + "$LITEOSTOPDIR/fs/vfs/path_cache.c", + "$LITEOSTOPDIR/fs/vfs/vnode.c", + "$LITEOSTOPDIR/fs/vfs/vnode_hash.c", "operation/fullpath.c", "operation/vfs_chattr.c", "operation/vfs_check.c", @@ -51,65 +57,11 @@ kernel_module(module_name) { "operation/vfs_writev.c", "vfs_cmd/vfs_shellcmd.c", ] - - sources += [ - "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_closedir.c", - "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_opendir.c", - "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_readdir.c", - "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_rewinddir.c", - "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_seekdir.c", - "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_telldir.c", - "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_blockproxy.c", - "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_closeblockdriver.c", - "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_findblockdriver.c", - "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_openblockdriver.c", - "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_registerblockdriver.c", - "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_registerdriver.c", - "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_unregisterblockdriver.c", - "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_unregisterdriver.c", - "$LITEOSTHIRDPARTY/NuttX/fs/inode/fs_files.c", - "$LITEOSTHIRDPARTY/NuttX/fs/mount/fs_foreachmountpoint.c", - "$LITEOSTHIRDPARTY/NuttX/fs/mount/fs_mount.c", - "$LITEOSTHIRDPARTY/NuttX/fs/mount/fs_sync.c", - "$LITEOSTHIRDPARTY/NuttX/fs/mount/fs_umount.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_close.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dup.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dup2.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dupfd.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dupfd2.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_fcntl.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_fsync.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_getfilep.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_ioctl.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_link.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_lseek.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_lseek64.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_mkdir.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_open.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_poll.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pread.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pread64.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pwrite.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pwrite64.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_read.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_readlink.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_rename.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_rmdir.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_select.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_sendfile.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_stat.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_statfs.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_symlink.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_truncate.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_truncate64.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_unlink.c", - "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_write.c", - "$LITEOSTOPDIR/fs/vfs/epoll/fs_epoll.c", - "$LITEOSTOPDIR/fs/vfs/mount.c", - "$LITEOSTOPDIR/fs/vfs/path_cache.c", - "$LITEOSTOPDIR/fs/vfs/vnode.c", - "$LITEOSTOPDIR/fs/vfs/vnode_hash.c", - ] + sources += NUTTX_FS_DIRENT_SRC_FILES + sources += NUTTX_FS_DRIVER_SRC_FILES + sources += NUTTX_FS_INODE_SRC_FILES + sources += NUTTX_FS_MOUNT_SRC_FILES + sources += NUTTX_FS_VFS_SRC_FILES include_dirs = [ "$LITEOSTOPDIR/syscall", diff --git a/kernel/extended/pipes/BUILD.gn b/kernel/extended/pipes/BUILD.gn index 85058ea0..5d589735 100644 --- a/kernel/extended/pipes/BUILD.gn +++ b/kernel/extended/pipes/BUILD.gn @@ -28,19 +28,16 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_a/liteos.gni") +import("//third_party/NuttX/NuttX.gni") module_switch = defined(LOSCFG_KERNEL_PIPE) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { - sources = [ - "//third_party/NuttX/drivers/pipes/fifo.c", - "//third_party/NuttX/drivers/pipes/pipe.c", - "//third_party/NuttX/drivers/pipes/pipe_common.c", - ] + sources = NUTTX_DRIVERS_PIPES_SRC_FILES public_configs = [ ":public" ] } config("public") { - include_dirs = [ "//third_party/NuttX/drivers/pipes" ] + include_dirs = NUTTX_DRIVERS_PIPES_INCLUDE_DIRS } diff --git a/lib/libc/BUILD.gn b/lib/libc/BUILD.gn index c5beae17..6df2221c 100644 --- a/lib/libc/BUILD.gn +++ b/lib/libc/BUILD.gn @@ -30,8 +30,8 @@ import("//kernel/liteos_a/liteos.gni") MUSLDIR = "$LITEOSTHIRDPARTY/musl" -OPTRTDIR = "$LITEOSTHIRDPARTY/optimized-routines" +import("//third_party/optimized-routines/optimized-routines.gni") import("$MUSLDIR/porting/liteos_a/kernel/musl.gni") module_switch = defined(LOSCFG_LIB_LIBC) @@ -54,13 +54,7 @@ kernel_module(module_name) { "$MUSLPORTINGDIR/src/string/strcpy.c", "$MUSLPORTINGDIR/src/string/strlen.c", ] - sources += [ - "$OPTRTDIR/string/arm/memchr.S", - "$OPTRTDIR/string/arm/memcpy.S", - "$OPTRTDIR/string/arm/strcmp.S", - "$OPTRTDIR/string/arm/strcpy.c", - "$OPTRTDIR/string/arm/strlen-armv6t2.S", - ] + sources += OPTRT_STRING_ARM_SRC_FILES asmflags = [ "-D__strlen_armv6t2=strlen", "-D__strcmp_arm=strcmp", diff --git a/lib/libscrew/BUILD.gn b/lib/libscrew/BUILD.gn index 227fced9..e3cb2647 100644 --- a/lib/libscrew/BUILD.gn +++ b/lib/libscrew/BUILD.gn @@ -28,6 +28,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//kernel/liteos_a/liteos.gni") +import("//third_party/FreeBSD/FreeBSD.gni") module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { @@ -38,7 +39,7 @@ kernel_module(module_name) { "src/los_seq_buf.c", ] - sources += [ "$LITEOSTHIRDPARTY/FreeBSD/sys/libkern/crc32.c" ] + sources += FREEBSD_SYS_LIBKERN_SRC_FILES public_configs = [ ":public" ] } -- GitLab