首页 > 系统相关 >在AMD PetaLinux中添加命令pstree

在AMD PetaLinux中添加命令pstree

时间:2023-08-07 15:55:19浏览次数:58  
标签:busybox peta k26 AMD psmisc PetaLinux cms pstree

命令pstree将相关进程以树状图显示,方便查看进程间的关系。由于调试需要,需要在Linux里使用命令pstree。但是PetaLinux产生的Linux映像,默认不带命令pstree。

在rootfs里查找pstree

首先使用命令“petalinux-config -c rootfs ”尝试在rootfs里查找pstree。没有找到pstree。

在psmisc里查找pstree

在Debian里,软件包psmisc包含pstree。

This package contains miscellaneous utilities that use the proc FS:

  • fuser: identifies processes that are using files or sockets.
  • killall: kills processes by name (e.g. "killall -HUP named").
  • peekfd: shows the data traveling over a file descriptor.
  • pstree: shows currently running processes as a tree.
  • prtstat: print the contents of /proc//stat

在PetaLinux工程里能找到对应的bb文件。


hankf@XSZGS4:k26-cms-peta-0118$ find -name "*psmisc*.bb*"
./components/yocto/layers/core/meta/recipes-extended/psmisc/psmisc_23.4.bb

hankf@XSZGS4:k26-cms-peta-0118$ ls -l ./components/yocto/layers/core/meta/recipes-extended/psmisc/psmisc_23.4.bb 
-rw-r--r-- 1 hankf hankf 343 May 22 18:19 ./components/yocto/layers/core/meta/recipes-extended/psmisc/psmisc_23.4.bb

hankf@XSZGS4:k26-cms-peta-0118$ cat ./components/yocto/layers/core/meta/recipes-extended/psmisc/psmisc_23.4.bb
require psmisc.inc
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"

SRC_URI = "git://gitlab.com/psmisc/psmisc.git;protocol=https;branch=master \
           file://0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch \
           "
SRCREV = "5fab6b7ab385080f1db725d6803136ec1841a15f"
S = "${WORKDIR}/git"

配置对应的模块, 却失败。

hankf@XSZGS4:k26-cms-peta-0118$ petalinux-config -c psmisc
[INFO] Sourcing buildtools
[INFO] Silentconfig project
......
Warning: Root password set to 'root', It is highly recommended to change Root password.
[INFO] Generating workspace directory
[INFO] Configuring: psmisc
[INFO] bitbake psmisc -c menuconfig
NOTE: Started PRServer with DBfile: proj/hankf/kv260/v221/k26-cms-peta-0118/build/cache/prserv.sqlite3, Address: 127.0.0.1:35651, PID: 9607
Loading cache: 100% |##########################################################################################################################################################| Time: 0:00:02
Loaded 5398 entries from dependency cache.
Parsing recipes: 100% |########################################################################################################################################################| Time: 0:00:03
Parsing of 3601 .bb files complete (3596 cached, 5 parsed). 5403 targets, 507 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
ERROR: Task do_menuconfig does not exist for target psmisc (proj/hankf/kv260/v221/k26-cms-peta-0118/components/yocto/layers/core/meta/recipes-extended/psmisc/psmisc_23.4.bb:do_menuconfig). Close matches:
  do_configure
ERROR: Command execution failed: 1

Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
ERROR: bitbake failed to configure psmisc
ERROR: Failed to config psmisc. Check the proj/hankf/kv260/v221/k26-cms-peta-0118/build/config.log file for more details...```

在busybox里查找pstree

单板上已经有psmisc里的killall。检查killall,它来自于busybox。

root@k26-cms-xsa-temp-peta:~# which killall
/usr/bin/killall

root@k26-cms-xsa-temp-peta:~# ls -l /usr/bin/killall
lrwxrwxrwx 1 root root 12 Mar  9  2018 /usr/bin/killall -> /bin/busybox

root@k26-cms-xsa-temp-peta:~# ls -l /bin/busybox
-rwsr-xr-x 1 root root 1736016 Mar  9  2018 /bin/busybox

root@k26-cms-xsa-temp-peta:~# ls -l -h /bin/busybox
-rwsr-xr-x 1 root root 1.7M Mar  9  2018 /bin/busybox

于是使用命令“petalinux-config -c busybox”,尝试在busybox里配置pstree。有对应的命令和界面,选择使能pstree和其它模块。

hankf@XSZGS4:k26-cms-peta-0118$ petalinux-config -c busybox 
[INFO] Sourcing buildtools
[INFO] Silentconfig project
[INFO] Sourcing build environment
..............
Loaded 0 entries from dependency cache.
Parsing recipes: 100% |########################################################################################################################################################| Time: 0:00:23
Parsing of 3601 .bb files complete (0 cached, 3601 parsed). 5403 targets, 507 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#####################################################################################################################################################| Time: 0:00:12
Sstate summary: Wanted 50 Local 0 Network 50 Missed 0 Current 47 (100% match, 100% complete)
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 432 tasks of which 426 didn't need to be rerun and all succeeded.
[INFO] bitbake busybox -c diffconfig
......
generate_bbappend /proj/hankf/kv260/v221/k26-cms-peta-0118/build/tmp/work/cortexa72-cortexa53-xilinx-linux/busybox/1.34.1-r0/user_2023-08-07-04-25-00.cfg proj/hankf/kv260/v221/k26-cms-peta-0118/project-spec/meta-user/
[INFO] recipetool appendsrcfile -wW proj/hankf/kv260/v221/k26-cms-peta-0118/project-spec/meta-user/ busybox /proj/hankf/kv260/v221/k26-cms-peta-0118/build/tmp/work/cortexa72-cortexa53-xilinx-linux/busybox/1.34.1-r0/user_2023-08-07-04-25-00.cfg
NOTE: Starting bitbake server...
NOTE: Started PRServer with DBfile: /proj/hankf/kv260/v221/k26-cms-peta-0118/build/cache/prserv.sqlite3, Address: 127.0.0.1:46587, PID: 7626
Loading cache...done.

在生成的文件里,看到“CONFIG_PSTREE”被使能。

hankf@XSZGS4:k26-cms-peta-0118$ cd project-spec/

hankf@XSZGS4:project-spec$ find -name "*busybox*bb*"
./meta-user/recipes-core/busybox/busybox_%.bbappend

hankf@XSZGS4:k26-cms-peta-0118$ cat   project-spec/meta-user/recipes-core/busybox/busybox/user_2023-08-07-04-25-00.cfg   
# Thu Sep 30 20:27:40 2021
CONFIG_IOSTAT=y
CONFIG_KILLALL5=y
CONFIG_LSOF=y
CONFIG_MPSTAT=y
CONFIG_NMETER=y
CONFIG_PSTREE=y
CONFIG_SMEMCAP=y
CONFIG_FEATURE_SHOW_THREADS=y

验证

编译PetaLinux工程后,再启动单板,单板上有pstree命令。

root@k26-cms-xsa-temp-peta:~# which pstree
/usr/bin/pstree

root@k26-cms-xsa-temp-peta:~# ls -l /usr/bin/pstree
lrwxrwxrwx 1 root root 12 Mar  9  2018 /usr/bin/pstree -> /bin/busybox

root@k26-cms-xsa-temp-peta:~# ls -l -h /usr/bin/pstree
lrwxrwxrwx 1 root root 12 Mar  9  2018 /usr/bin/pstree -> /bin/busybox

标签:busybox,peta,k26,AMD,psmisc,PetaLinux,cms,pstree
From: https://www.cnblogs.com/hankfu/p/17611660.html

相关文章

  • AMD cpus在VM虚拟机安装macOS10.15和12教程一
    本教程采用软件为vmwareworkstation17pro,操作系统win10,CPU为5600G,macOS10.15或者macOS12VM虚拟机的下载和安装这里不阐述,大家可以百度一下macos13在上述环境下安装后会提示错误,macOS14beta暂时不支持安装,所以13-14可以暂时放弃macOS的下载请百度一下就有了~记得下载带引导......
  • 官方实锤!AMD真的已经有了大小核:不搞Intel那一套
    Intel12代酷睿开始引入大小核混合架构,多核跑分提升立竿见影,在游戏、渲染等场景中也有很好的辅助作用,但因为大核心、小核心基于完全不同的架构,需要复杂的系统、软件调度配合,也直接导致失去了AVX-512指令集。AMD也早就确认在开发自己的大小核,并强调两种核心会是完全相同的架构、IP......
  • 骚操作之——lamda表达式
    Lambda表达式是一种用于简化函数定义的语法结构,它可以将一个匿名函数作为参数传递给其他函数或方法。以下是一些常见的Lambda表达式的用法,以及一个例子:1.列表排序:List<Integer>numbers=Arrays.asList(5,2,1,3,4);numbers.sort((a,b)->a.compareTo(b));```2.......
  • ubuntu “vt-x/amd-v hardware acceleration virtualbox" 错误
    BeforechangingBIOSsettingswemaywanttoseeifhardwarevirtualization(VT-xforIntel,AMD-VforAMDprocessors)wasalreadyenabled. Fromaterminalissuegrep--colorvmx/proc/cpuinfo##foranIntelprocessorgrep--colorsvm/proc/cpuinfo##f......
  • AMD 驱动安装 error 192解决问题
    AMD驱动安装error192解决问题环境:win10专业版、自动更新已禁止、硬件安装设置【是】(window自动下载驱动)【以下环境均在安全模式下进行(win+rmsconfig,安全引导)】问题复现:使用ddu卸载旧版驱动后,安装官网下载的驱动,安装途中报错192不同版本的驱动均发生以上情况解决......
  • 【.Net Core】生成项目处理器架构MSIL与目标项目架构 "AMD64" 不一致
    修复方法在当前项目的项目文件中<PropertyGroup>标签中添加架构(按照需要,可以只需要保留一个):<PropertyGroup><Platforms>AnyCpu;x64</Platforms></PropertyGroup>在编译配置中,修改当前项目(或者目标项目)的编译架构:注意,Debug和Release都需要修改......
  • 66.ES6模块与CommonJS模块、AMD、CMD的差异
    66.ES6模块与CommonJS模块、AMD、CMD的差异。1.CommonJS模块输出的是一个值的拷贝,ES6模块输出的是值的引用。CommonJS模块输出的是值的拷贝,也就是说,一旦输出一个值,模块内部的变化就影响不到这个值。ES6模块的运行机制与CommonJS不一样。JS引擎对脚本静态分析的时候......
  • Buildroot创建ramdisk、ext4、ubifs镜像,以及mkfs.ext4/mkfs.ubifs/cpio的使用
    通过mkfs.ext4和mkfs.ubifs可以生成ext4和ubi格式的文件系统文件。Buildroot中创建文件系统文件即借助这两个命令。1.mkfs.ext4mkfs.ext4以及mkfs.ext2/mkfs.ext3都指向mke2fs,用于创建ext4格式的文件系统。Usage:mkfs.ext4[-c|-lfilename][-bblock-size][-Ccluster-si......
  • apple sicion M2 mac docekr for mac 使用 x86-64 amd64
    使用环境变量指定dockerformac适用RosettaDOCKER_DEFAULT_PLATFORM=linux/amd64指定后dockerformac使用Rosetta2version:'3'services:mule-application:environment:-DOCKER_DEFAULT_PLATFORM=linux/amd64container_name:mule-3.9.0-ap......
  • AMD ZCU106 U-Boot 2023.1 Open Source Flow 编译的缺少“gnutls/gnutls.h”错误
    AMDZCU106U-Boot2023.1OpenSourceFlow编译的缺少“gnutls/gnutls.h”错误获取代码以下列命令获取U-Boot代码petalinux-devtoolmodifyu-boot-xlnx在目录components/yocto/workspace/sources/u-boot-xlnx下应该有u-boot-xlnx的源代码。获取配置文件查找u-boot的配......