Commit Graph

73 Commits

Author SHA1 Message Date
openharmony_ci 321018cee0
!765 处理A核编译告警
Merge pull request !765 from yinjiaming/yjm-kernel-20220105
2022-01-13 11:39:28 +00:00
x-xiny 1cdd7307f3 Codex告警清除
【背景】
 Codex扫描告警清除

【修改方案】
 将不可屏蔽告警进行修复

 re #I4PNO3

 Signed-off-by: xuiny <xuxinyu6@huawei.com>

Change-Id: If6f85eb9679d47e6256f24cdc74246df78da579d
2022-01-07 09:49:47 +00:00
yinjiaming 6c4e4b16ab fix: 修复shcmd.h需要用宏包起来的问题
【背景】
当前仓代码存在编译告警需要处理

【修改方案】
在测试用例中屏蔽-Werror
从shell.h中删除了多余的bool定义

【影响】
对现有的产品编译不会有影响。

re #I4N50W

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Id131b8437b471f44d9fe35a384678903216fcfb4
2022-01-07 06:59:40 +00:00
Caoruihong 6e886d4233 feat(build): support gcc toolchain
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I6f2dea19cbd2e5b562bb51e30592205a2bb4fbdb
2021-12-05 02:49:48 +08:00
LiteOS2021 e748fdbe57 feat: L0~L1 支持Lms
1.【需求描述】:
   支持内核态和用户态堆内存非法访问检测,包括:越界访问、double free、释放后使用;支持libc常用高频函数内存检测;支持安全函数内存检测;读写检测可配可裁剪。
2.【方案描述】:
   L0 ~ L1:
   (1).影子内存映射与标记
   (2).编译器使能-fsanitize=kernel-address 自动插桩检测点
   (3).实时校验影子内存的合法性;
   (4).错误访问打印回溯栈

BREAKING CHANGE: 新增支持API:

LOS_LmsCheckPoolAdd使能检测指定内存池
LOS_LmsCheckPoolDel不检测指定内存池
LOS_LmsAddrProtect为指定内存段上锁,不允许访问
LOS_LmsAddrDisableProtect去能指定内存段的访问保护

Close #I4HYAV

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
Change-Id: Id8e5c890656da9edc4a22227e6a3c32205c024ce
2021-11-27 11:13:41 +08:00
openharmony_ci fe4082ca9e !709 A核代码静态告警定期清理
Merge pull request !709 from wangchen/1112_codex
2021-11-16 06:47:22 +00:00
lnlan 9ba725c3d4 fix: A核代码静态告警定期清理
【背景】A核代码静态告警定期清理

【修改方案】
1,根据codex等工具分析结果,进行必要的规范等问题修改

【影响】
对现有的产品编译不会有影响。

re #I4I0O8
Signed-off-by: wangchen <253227059@qq.com>
2021-11-15 02:47:08 +00:00
Caoruihong 5d5df3a5d7 chore: clean "bits/xx.h" includes
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I3dcf576ceba66b0fa447573e997d064026eb8785
2021-11-11 12:03:56 +08:00
kenneth 0f878febb7 chore: 修复社区反馈问题Percpu结构体注释错误
修复社区反馈问题Percpu结构体注释错误,排查下其他拼写错误。

close #I4GMLH

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-11-10 10:20:33 +08:00
huangshan cc6e11281e fix: shell支持exit退出,完善帮助信息,特殊处理不可见字符
Change-Id: Ia6dbff0faed4ec73fcf35691676f1acb2b8df78d
Signed-off-by: huangshan <huangshan9@huawei.com>
2021-11-08 18:13:38 +08:00
openharmony_ci 3b8083815c !701 按照门禁要求对所有BUILD.gn脚本进行格式化
Merge pull request !701 from Caoruihong/gnformat
2021-11-06 04:48:29 +00:00
Caoruihong a2fed9a56c chore(build): format all BUILD.gn files
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ifd3bf13f53a27e0a0bbd051cf35662e7409e6ed0
2021-11-06 11:55:58 +08:00
huangshan cdc0877f16 修复Ctrl+C会终止所有进程的问题
Signed-off-by: huangshan <huangshan9@huawei.com>
Change-Id: I5861569c63fd6c1adf8c702797e4d79eba76211f
2021-11-04 12:23:20 +08:00
uhamc bd0c0835fc fix: implicit declaration of function 'syscall' in apps/shell
Change-Id: Id3f56ac53ec5a3c86b04bcb7a4611f2eb77f4b80
Signed-off-by: uhamc <uhamc@foxmail.com>
2021-10-25 17:12:08 +08:00
LiteOS2021 6e0a3f10bb feat: L0-L1 支持Perf
1.【需求描述】:
         L0-L1 支持Perf,提供2种模式的配置, 及3大类型的事件配置:
         2种模式:计数模式(仅统计事件发生次数)、采样模式(收集上下文如任务ID、pc、backtrace等)。
         3种事件类型:CPU硬件事件(cycle、branch、icache、dcache等)、OS软件事件(task switch、mux pend、irq等)、高精度周期事件(cpu          clock)。
    2.【方案描述】:
         L0:
         基于事件采样原理,以性能事件为基础,当事件发生时,相应的事件计数器溢出发生中断,在中断处理函数中记录事件信息,包括当前的pc、当前运         行的任务ID以及调用栈等信息。
         L1:
         新增perf字符设备,位于“dev/perf”,通过对设备节点的read\ioctl,实现用户态perf

    BREAKING CHANGE:
    1.新增一系列perf的对外API,位于los_perf.h中.
    LOS_PerfInit配置采样数据缓冲区
    LOS_PerfStart开启Perf采样
    LOS_PerfStop停止Perf采样
    LOS_PerfConfig配置Perf采样事件
    LOS_PerfDataRead读取采样数据
    LOS_PerfNotifyHookReg 注册采样数据缓冲区的钩子函数
    LOS_PerfFlushHookReg 注册缓冲区刷cache的钩子

    2. 用户态新增perf命令
  【Usage】:
./perf [start] /[start id] Start perf.
./perf [stop] Stop perf.
./perf [read nBytes] Read nBytes raw data from perf buffer and print out.
./perf [list] List events to be used in -e.
./perf [stat] or [record] <option> <command>
         -e, event selector. use './perf list' to list available events.
         -p, event period.
         -o, perf data output filename.
         -t, taskId filter(whiltelist), if not set perf will sample all tasks.
         -s, type of data to sample defined in PerfSampleType los_perf.h.
         -P, processId filter(whiltelist), if not set perf will sample all processes.
         -d, whether to prescaler (once every 64 counts), which only take effect on cpu cycle hardware event.

    Close #I47I9A

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
Change-Id: Ieb9b7483c85d1495df7c55bc0027f4309dff9814
2021-09-28 19:28:34 +08:00
arvinzzz b3d96d166c refactor: 清理Makefile冗余项
清理Makefile冗余项,各模块Makefile里不需要再次引用公共路径,只需引用私有头文件路径

close: #I49MOO

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I2dd7189c866498896461f78bfed5444ae1d86876
2021-09-13 18:14:15 +08:00
Caoruihong a627cdba0c chore(make): simplify build scripts
remove redundant script codes

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I67695a69cccefc220ede55add9372bce0c59d7f5
2021-09-09 18:56:47 +08:00
LiteOS2021 dc9ec6856f feat: L0-L1 支持Trace
1.【需求描述】
            L0~L1 支持Trace,提供两种工作模式:在线模式、离线缓存模式, 用于按时间线追踪系统事件,如任务切换、中断、ipc等。
        2.【方案描述】
            L0:
            (1).在内核模块预置静态代码桩
            (2).触发桩后,收集系统上下文信息
            (3).离线模式则写入内存,用户可通过dump导出;
            (4).在线模式通过pipeline对接IDE进行可视化解析和展示;
            L1:
            新增trace字符设备,位于"/dev/trace",通过对设备节点的read\write\ioctl,实现用户态trace;

        BREAKING CHANGE:
        1.新增一系列trace的对外API,位于los_trace.h中.
        LOS_TRACE_EASY简易插桩
        LOS_TRACE标准插桩
        LOS_TraceInit配置Trace缓冲区的地址和大小
        LOS_TraceStart开启事件记录
        LOS_TraceStop停止事件记录
        LOS_TraceRecordDump输出Trace缓冲区数据
        LOS_TraceRecordGet获取Trace缓冲区的首地址
        LOS_TraceReset清除Trace缓冲区中的事件
        LOS_TraceEventMaskSet设置事件掩码,仅记录某些模块的事件
        LOS_TraceHwiFilterHookReg注册过滤特定中断号事件的钩子函数

        Close #I46WA0

    Signed-off-by: LiteOS2021 <dinglu@huawei.com>

Change-Id: I6a8e64794c4852f2c2980993a06180e09ec6ee0d
2021-08-31 20:29:45 +08:00
Caoruihong df35eb513d chore(make): optimize build scripts
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ibb4223ef2d032a03950263b766414ca1c021e69a
2021-08-30 17:18:21 +08:00
Caoruihong 682ae82158 chore: enable make of mksh and toybox
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ie152b0ad21af5dc8e8c31c71f236500e5726e1c4
2021-08-25 01:46:41 +08:00
Caoruihong 0e260949c9 feat(make): optimize makefiles and remove some unused files
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ie2dfa7334417ccd55bd56a19a7882a982ce49cab
2021-08-22 04:23:40 +08:00
Caoruihong e1b9a6b185 chore(make): update Makefile
remove some unused Makefile code and optimize some code

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I1c31d07481bb6aee47b0c51d63d6b68316c38c88
2021-08-17 21:34:01 +08:00
openharmony_ci fb5df47b6c !541 feat: 自研shell命令回补
Merge pull request !541 from Kiita/shell_cmd_0812
2021-08-13 07:44:49 +00:00
Kiita 7bc68f454f feat: 自研shell命令回补
【背景】liteos_a需要支持toybox缺失的自研shell命令

【修改方案】
新增自研shell命令的入口判断场景,使得mksh可以执行自研shell的命令

re #I44U0H

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: Idf08cb6df456bd6c89fe8fe505317f1c0ca61eda
2021-08-12 21:34:50 +08:00
Guangyao Ma 77dcef4bc0 fix: clang相关编译选项隔离
liteos_a在apps/mksh和apps/toybox编译中,clang相关编译选项未进行隔离。之后支持
其他类似gcc编译时,可能存在编译问题。
其中 --target=$(LLVM_TARGET) $(LLVM_SYSROOT) 是clang编译特有的编译选项,需要被
隔离。

close #I444AV

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: Ib11453aa0b3ee6bcdf3104d13d166c65f2202527
2021-08-09 10:32:14 +08:00
openharmony_ci 343b92661d !488 保留未strip的mksh和toybox用于调试
Merge pull request !488 from Caoruihong/unstripped_mksh_toybox
2021-08-03 03:07:32 +00:00
openharmony_ci 79982895ec !479 fix: 去掉冗余的strip操作
Merge pull request !479 from MGY917/toybox_strip_twice
2021-08-03 03:01:04 +00:00
Caoruihong 8de96bba65 chore: also copy unstripped version of mksh and toybox
stripped version used to pack rootfs image, unstripped
used for debug.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I07673238772d6995426ec8b1cff43f1abfea7049
2021-08-03 00:10:37 +08:00
Guangyao Ma 7819d15b36 fix: 去掉冗余的strip操作
toybox源码编译时,默认会进行strip操作,如下步骤:

//third_party/toybox/scripts/make.sh:340:
! do_loudly ${CROSS_COMPILE}${STRIP} "$UNSTRIPPED" -o "$OUTNAME"

因此在打包的Makefile中再进行STRIP操作是冗余的。

close #I43767

Change-Id: I10a9861b682eb8e556b7af7519c9109eef0b3a94
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-07-30 16:58:53 +08:00
Caoruihong c54bfa16e3 feat: enable gn build for toybox and mksh
toybox and mksh are built by gn now, and make build
for toybox and mksh are disabled now.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I46810ab418344d9841ec55cb9f1ad2dc2d15b008
2021-07-30 10:11:02 +08:00
Kiita 76f45b3fb2 fix: toybox命令升级
【背景】liteos_a toybox 命令升级升级

【修改方案】
1、help命令列表不支持命令删除。
2、cp命令和mv命令拷贝文件失败和文件损坏等问题修复。
3、修复du命令统计nfs文件大小为0问题修复。
4、修复ls命令nfs文件时间打印信息有误问题。
5、更新命令不支持入参列表。

re #I41N2A

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I5f5b82e33ba9193ae06e9547182d5b7bac0a3b44
2021-07-22 23:40:40 +08:00
openharmony_ci fa056ce246 !445 toybox支持reboot命令
Merge pull request !445 from Kiita/toybox_cmd_reboot
2021-07-22 08:44:53 +00:00
openharmony_ci 8755dc9d35 !443 从Make编译切换到GN编译
Merge pull request !443 from Caoruihong/build_gn
2021-07-22 01:50:19 +00:00
Caoruihong a8805a65aa feat: add support for gn build system
add BUILD.gn for all kernel modules

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I018446427bf64615f2596d47862b219659b58b34
2021-07-21 15:52:40 +08:00
Guangyao Ma 51a50c95b4 feat: support .mkshrc
close #I3Y5KE

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: Iea3cfe4da572b1a4e250f90cea24efa2c27ceddb
2021-07-20 14:37:30 +08:00
Guangyao Ma cacb4f0103 feat: active mksh & toybox
Close #I3VEOG

Change-Id: Ibc73aacf68c65e64b88084edfd3549b3137dde07
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-07-09 17:07:06 +08:00
openharmony_ci b29d9d88ab !412 fix: mksh compile bug fix
Merge pull request !412 from MGY917/fix_waitpid
2021-07-08 03:25:08 +00:00
Guangyao Ma d8263b1e91 fix: mksh compile bug fix
编译框架整改,需要所有交叉编译指定sysroot以及arch相关的编译选项,用来在编译链
接过程中在指定的sysroot路径下,寻找符合arch要求的依赖库。往往,sysroot选项和
arch选项需要同时出现在编译链接选项中。

close #I3ZMR7

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: If2249721e0e35615b95f5525e57241aae910c212
2021-07-08 10:48:39 +08:00
Caoruihong ac8c2c6d5b fix: minimal compile
fix compile errors in minimal compilation

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I48f4f7b27c684e2c747c1949776c5c4f9e383dec
2021-07-07 00:26:33 +08:00
Kiita e567a10d02 feat: 新增toybox reboot命令
【背景】liteos_a测试套需要reboot命令

【修改方案】
在third_party/toybox/porting新增reboot.c文件,并作自定义修改。
新增reboot命令的支持说明。

re #I3YQ7S

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I686a535adbad78935eee04fc283a837a4a7f13f6
2021-07-01 21:12:31 +08:00
Caoruihong d7672d47f2 chore: make liteos_a can be built alone
in the liteos_a directory, we used to use `make clean all` command
to build liteos_a kernel for test.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I5ca689c1c44052f7de937d7faa9e4d3534d97380
2021-06-30 18:44:46 +08:00
Caoruihong 9e45086d19 chore: pass sysroot and arch related cflags by BUILD.gn
sysroot and arch related cflags are pass by BUILD.gn now.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ia6000dd7ed8a8a37e935ace49d8460a919a16566
2021-06-28 16:31:02 +08:00
Guangyao Ma eca711bb64 fix: avoid compile warning ignored
Close #I3VOAO

Change-Id: I42103e0e7061e50f8d63df98ea9f5cecd49fe6f4
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-06-15 19:56:21 +08:00
Guangyao Ma 561831928b feat: support toybox in qemu
Close #I3V17D

Change-Id: Idfe47eedd4b7c84cc2d15b5f3365d90a5b79232e
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-06-09 16:11:21 +08:00
openharmony_ci 1f8e5424f3 !306 refactor(mksh): reduce the mksh size by Oz
Merge pull request !306 from MGY917/mksh_size_reduce
2021-06-09 13:43:38 +08:00
Guangyao Ma 565b2e85cd refactor(mksh): reduce the mksh size by Oz
clang不支持“-flto,-Oz”作为链接选项,但是可以作为编译选项,且作为编译选项时,有更好的size减少效果。这里为了使用这种
编译选项组合,且为了不影响链接过程(Build.sh链接时也会使用CFLAGS),在链接选项生效的-O选项中,重置其为O2。
最终size可以从300+k,缩减为不到180k。

Close #I3UVEV

Change-Id: If29ac4a058bcd40c4c36deb484c9468c93bcd1ec
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-06-08 21:57:27 +08:00
openharmony_ci 1a3f3f54e7 !302 fix: Codex告警清零
Merge pull request !302 from Far/master
2021-06-08 08:48:48 +08:00
Kiita 09756fe55b refactor: 对toybox侵入式修改进行分离
【背景】当前liteos_a支持的toybox命令与linux存在差别,需要特别实现,为
避免侵入式修改,采用porting的方式将修改分离。

【修改方案】
在third_party/toybox下新增porting目录,以达到分离修改的目的。本次修改
基于porting目录且只涉及liteos目前支持的命令文件。

re #I3UQCK

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I15d5835e25d5b5de6e0a6f888c87264c2f886cdf
2021-06-07 21:54:12 +08:00
Far b5370af822 fix: codex clean
1. 修复可能对NULL指针解引用的场景
2. 将不修改内容的指针入参修改为const
3. 对getpgrp的返回值进行校验后再使用
4. 修复了局部变量未初始化的问题

Close #I3UOFN

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-06-07 17:08:02 +08:00
openharmony_ci 9b364500ad !252 删除冗余宏定义OFFSET_OF_FIELD
Merge pull request !252 from JerryH/list
2021-05-21 09:54:18 +08:00