参考:https://www.freesion.com/article/1911209178/#LinuxBootChart_41
我为大家准备了两个工具的安装包:
https://download.csdn.net/download/qq_36813351/20359920
一.安装编译嵌入式Linux系统下的bootchart-lite
1.使用gcc交叉编译bootchart-lite安装包下src文件夹下的bootchart-lite,
路径:bootchart使用方法\开发板\bootchart-lite-master.zip\bootchart-lite-master\src
2.将得到的可执行文件放到嵌入式设备的/sbin文件夹
3.新版本的Linux内核需要自己写system下的服务/etc/systemed/system
4.systemctl enable rc-local.service 使能服务
文件名:rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
这部分参考:http://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-part-two.html
在/etc文件夹下建立rc.local文件
#!/bin/bash
#癡HIS FILE IS 酓DED餏OR COMPATIBILITY xURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to xarallel execution during boot
# this script will NOT be run after all other services.
#
# that this script will be executed during boot.
echo "Now begain bootchart-lite"
/sbin/bootchart-lite
echo "Hello World!"
这一步执行完就可以在Linux内核启动时启动bootchart-lite文件,bootchart-lite在执行时会在/etc/bootchart-lite文件夹下生成。但是文件夹bootchart-lite不会自动生成需要你手动写一个文件夹出来。再给这几个文件全都加上权限chmod 777 XXX.然后等着结果出来就行了。
二.安装Ubuntu下的bootchart分析工具
1.安装Linux的java环境,并配置环境变量
2.安装ant,sudo apt-get install ant
3.安装bootchart,先将代码解压,执行安装脚本sudo ./install.sh,自动编译java文件,生成bootchart.jar工具
4.将截取的三个log压缩,tar czf bootchart.tgz *.log
5.调用java生成的bootchart工具去生成照片。前边是工具路径,后边是压缩文件路径。java -jar /usr/bootchart-0.9/bootchart.jar /usr/bootchart.tgz