瑞芯微Rockchip开发者社区
直播中

山中老虎

8年用户 882经验值
擅长:制造/封装
私信 关注
[问答]

RK3399在Android7.1中使用ll命令发现无法使用怎么解决?

RK3399在Android7.1中使用ll命令发现无法使用怎么解决?

回帖(1)

曹光辉

2022-3-7 11:01:28
描述
在使用android 5.1 时,在adb shell 下,可以使用ls 和 ll 命令,但在Android7.1中,发现 ll 命令无法使用:
/system/bin/sh: ll: not found

但在Android10中,
Microsoft Windows [版本 10.0.18363.1500]
(c) 2019 Microsoft Corporation。保留所有权利。

C:UsersDELL>adb shell
rk3399_firefly_aio_lvds:/ $ ll
/system/bin/sh: ll: inaccessible or not found
127|rk3399_firefly_aio_lvds:/ $
127|rk3399_firefly_aio_lvds:/ $
图片




分析
在linux下, ll 命令的是由alias产生的, 它的宿主是ls:
alias ll=‘ls -l’

在android 中应该也是这样的, 在搜索5.1系统文件内容时, 找到了文件: /system/etc/mkshrc
基中对ll 的定义如下:

# Copyright (c) 2010, 2012, 2013, 2014
#    Thorsten Glaser <tg@mirbsd.org>
# This file is provided under the same terms as mksh.
#-
# Minimal /system/etc/mkshrc for Android
#
# Support: https://launchpad.net/mksh

...
alias l='ls'
alias la='l -a'
alias ll='l -l'
alias lo='l -a -l'


mkshrc文件存放于external目录下:
$ ls external/mksh/
Android.mk Makefrag.inc mkmf.sh mkshrc MODULE_LICENSE_BSD_LIKE NOTICE src

而在Android10中的mkshrc中, 并没有找到 ll 命令相关的定义。

解决方法:
只需要把相应的 ll 定义加到 mkshrc中即可.
# Copyright (c) 2010, 2012, 2013, 2014
#    Thorsten Glaser <tg@mirbsd.org>
# This file is provided under the same terms as mksh.
#-
# Minimal /system/etc/mkshrc for Android
#
# Support: https://launchpad.net/mksh

set +o nohup

if (( USER_ID )); then PS1='$'; else PS1='#'; fi
PS4='[$EPOCHREALTIME] '; PS1='${|
    local e=$?

    (( e )) &&

    return $e
}$HOSTNAME:${PWD:-?} '"$PS1 "

#add-start
alias l='ls'
alias la='l -a'
alias ll='l -l'
alias lo='l -a -l'
#alias find='busybox find'
#add-end

图片




find命令在Android10使用自带,就不用加了!


图片



Microsoft Windows [版本 10.0.18363.1500]
(c) 2019 Microsoft Corporation。保留所有权利。

C:UsersDELL>adb shell
rk3399_firefly_aio_lvds:/ $
rk3399_firefly_aio_lvds:/ $ ll
total 148
dr-xr-xr-x  48 root   root       0 2021-04-30 07:08 acct
drwxr-xr-x  14 root   root     280 2021-04-30 07:08 apex
lrw-r--r--   1 root   root      11 2021-04-30 06:44 bin -> /system/bin
lrw-r--r--   1 root   root      50 2021-04-30 06:44 bugreports -> /data/user_de/0/com.android.shell/files/bugreports
drwxrwx---   6 system cache   4096 2021-04-30 07:08 cache
lrw-r--r--   1 root   root      19 2021-04-30 06:44 charger -> /system/bin/charger
drwxr-xr-x   4 root   root       0 1970-01-01 00:00 config
lrw-r--r--   1 root   root      17 2021-04-30 06:44 d -> /sys/kernel/debug
drwxrwx--x  45 system system  4096 2021-04-30 07:09 data
drwxr-xr-x   2 root   root    4096 2021-04-30 04:49 debug_ramdisk
lrw-------   1 root   root      23 2021-04-30 06:44 default.prop -> system/etc/prop.default
drwxr-xr-x  20 root   root    2220 2021-04-30 07:08 dev
lrw-r--r--   1 root   root      11 2021-04-30 06:44 etc -> /system/etc
lrwxr-x---   1 root   shell     16 2021-04-30 06:44 init -> /system/bin/init
-rwxr-x---   1 root   shell   1653 2021-04-30 04:49 init.environ.rc
-rwxr-x---   1 root   shell  33984 2021-04-30 06:18 init.rc
-rwxr-x---   1 root   shell   8565 2021-04-30 06:08 init.u***.configfs.rc
-rwxr-x---   1 root   shell   5649 2021-04-30 06:08 init.u***.rc
-rwxr-x---   1 root   shell    563 2021-04-30 06:08 init.zygote32.rc
-rwxr-x---   1 root   shell    981 2021-04-30 06:08 init.zygote64_32.rc
drwxr-xr-x   3 root   root    4096 2021-04-30 04:49 lib
drwx------   2 root   root   16384 2021-04-30 06:44 lost+found
drwxr-xr-x   8 root   root    4096 2021-04-30 07:08 metadata
drwxr-xr-x  13 root   system   280 2021-04-30 07:08 mnt
drwxr-xr-x   4 root   root    4096 2021-04-30 04:49 odm
drwxr-xr-x   3 root   root    4096 1970-01-01 00:00 oem
dr-xr-xr-x 260 root   root       0 1970-01-01 00:00 proc
drwxr-xr-x   9 root   root    4096 2021-04-30 06:43 product
lrw-r--r--   1 root   root      24 2021-04-30 06:44 product_services -> /system/product_services
drwxr-xr-x   3 root   root    4096 2021-04-30 06:18 res
drwxr-x---   2 root   shell   4096 2021-04-30 06:18 ***in
lrw-r--r--   1 root   root      21 2021-04-30 06:44 sdcard -> /storage/self/primary
drwxr-xr-x   4 root   root      80 2021-04-30 07:09 storage
dr-xr-xr-x  16 root   root       0 2021-04-30 07:08 sys
drwxr-xr-x  13 root   root    4096 2021-04-30 06:44 system
-rw-r--r--   1 root   root    2657 2021-04-30 04:49 ueventd.rc
drwxr-xr-x  10 root   root    4096 2021-04-30 06:44 vendor
rk3399_firefly_aio_lvds:/ $
rk3399_firefly_aio_lvds:/ $




























举报

更多回帖

发帖
×
20
完善资料,
赚取积分