米尔STMYDT开发板1系统分析
本次的开发板上核心板型号是MYC-YA151C-256N256D-65-I-T,所以从系统中可以看到NAND的分区情况
dev: size erasesize name mtd0: 00200000 00020000 "fsbl" mtd1: 00200000 00020000 "ssbl1" mtd2: 00200000 00020000 "ssbl2" mtd3: 0fa00000 00020000 "UBI"
前面三个是FSBL和两个SSBL,那么就能确定,kernel, dtb, rootfs应该都在UBI分区里面。
接下来看下UBI分区里的信息
ubi0 Volumes count: 4 Logical eraseblock size: 126976 bytes, 124.0 KiB Total amount of logical eraseblocks: 1996 (253444096 bytes, 241.7 MiB) Amount of available logical eraseblocks: 0 (0 bytes) Maximum count of volumes 128 Count of bad physical eraseblocks: 4 Count of reserved physical eraseblocks: 36 Current maximum erase counter value: 2 Minimum input/output unit size: 2048 bytes Character device major/minor: 241:0 Present volumes: 0, 1, 2, 3
可以看出有四个volume,分别是0,1,2,3。那就依次看下这几个卷 Volume ID: 0 (on ubi0) Type: dynamic Alignment: 1 Size: 3 LEBs (380928 bytes, 372.0 KiB) State: OK Name: uboot_config Character device major/minor: 241:1
可以看出来,vol2是boot,vol3是rootfs。
所以从mount命令也可以看出来 root@myir-ya151c-t:~# mount ubi0:rootfs on / type ubifs (rw,relatime,assert=read-only,ubi=0,vol=3) devtmpfs on /dev type devtmpfs (rw,relatime,size=54648k,nr_inodes=13662,mode=755) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,relatime) securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755) tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755) cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate) cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd) pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime) none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700) cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct) cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio) cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio) cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory) cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime) debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev) fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime) configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime) /dev/ubi0_2 on /boot type ubifs (rw,relatime,assert=read-only,ubi=0,vol=2) tmpfs on /var/volatile type tmpfs (rw,relatime) tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=24136k,mode=700)
至于0和1,后面来分析。
当前配置是nand 256MB的,看下系统还剩下多少空间可以使用 root@myir-ya151c-t:~# df -h Filesystem Size Used Avail Use% Mounted on ubi0:rootfs 201M 177M 25M 88% / devtmpfs 54M 0 54M 0% /dev tmpfs 118M 64K 118M 1% /dev/shm tmpfs 118M 8.8M 110M 8% /run tmpfs 118M 0 118M 0% /sys/fs/cgroup tmpfs 118M 0 118M 0% /tmp /dev/ubi0_2 15M 11M 3.4M 77% /boot tmpfs 118M 136K 118M 1% /var/volatile tmpfs 24M 0 24M 0% /run/user/0
已经被使用了88%,所以只有25MB可以使用,也运行不了多少应用了。对于使用nand来作为产品开发,还需要更深度的对系统优化,后面有时间可以做这方面看看。
再看看ram的使用情况 root@myir-ya151c-t:~# free total used free shared buff/cache available Mem: 241392 55156 129216 9120 57020 171316 Swap: 0 0 0
总共256MB,系统占用后,剩余可以使用的只有130MB左右。那就再看下当前系统默认运行了哪些应用 root@myir-ya151c-t:~# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 15:50 ? 00:00:05 /sbin/init root 2 0 0 15:50 ? 00:00:00 [kthreadd] root 3 2 0 15:50 ? 00:00:00 [rcu_gp] root 4 2 0 15:50 ? 00:00:00 [rcu_par_gp] root 6 2 0 15:50 ? 00:00:00 [kworker/0:0H-events_highpri] root 7 2 0 15:50 ? 00:00:00 [kworker/u2:0-events_unbound] root 8 2 0 15:50 ? 00:00:00 [mm_percpu_wq] root 9 2 0 15:50 ? 00:00:01 [ksoftirqd/0] root 10 2 0 15:50 ? 00:00:00 [rcu_preempt] root 11 2 0 15:50 ? 00:00:00 [migration/0] root 12 2 0 15:50 ? 00:00:00 [cpuhp/0] root 13 2 0 15:50 ? 00:00:00 [kdevtmpfs] root 14 2 0 15:50 ? 00:00:00 [netns] root 15 2 0 15:50 ? 00:00:00 [rcu_tasks_kthre] root 16 2 0 15:50 ? 00:00:06 [kworker/0:1-pm] root 17 2 0 15:50 ? 00:00:00 [oom_reaper] root 18 2 0 15:50 ? 00:00:00 [writeback] root 19 2 0 15:50 ? 00:00:00 [kcompactd0] root 87 2 0 15:50 ? 00:00:00 [kblockd] root 88 2 0 15:50 ? 00:00:00 [blkcg_punt_bio] root 89 2 0 15:50 ? 00:00:00 [ata_sff] root 90 2 0 15:50 ? 00:00:00 [edac-poller] root 91 2 0 15:50 ? 00:00:00 [devfreq_wq] root 92 2 0 15:50 ? 00:00:00 [watchdogd] root 93 2 0 15:50 ? 00:00:00 [rpciod] root 94 2 0 15:50 ? 00:00:00 [kworker/u3:0-hci0] root 95 2 0 15:50 ? 00:00:00 [xprtiod] root 96 2 0 15:50 ? 00:00:00 [kswapd0] root 97 2 0 15:50 ? 00:00:00 [nfsiod] root 98 2 0 15:50 ? 00:00:00 [cifsiod] root 99 2 0 15:50 ? 00:00:00 [smb3decryptd] root 100 2 0 15:50 ? 00:00:00 [cifsfileinfoput] root 101 2 0 15:50 ? 00:00:00 [cifsoplockd] root 106 2 0 15:50 ? 00:00:00 [krfcommd] root 107 2 0 15:50 ? 00:00:00 [kstrp] root 118 2 0 15:50 ? 00:00:00 [hwrng] root 119 2 0 15:50 ? 00:00:00 [irq/45-stm_ther] root 124 2 0 15:50 ? 00:00:00 [irq/46-54002000] root 125 2 0 15:50 ? 00:00:00 [54002000.hash-e] root 143 2 0 15:50 ? 00:00:00 [irq/59-5c004000] root 144 2 0 15:50 ? 00:00:00 [irq/60-40013000] root 145 2 0 15:50 ? 00:00:00 [irq/65-5c002000] root 146 2 0 15:50 ? 00:00:00 [irq/67-pmic_irq] root 150 2 0 15:50 ? 00:00:00 [irq/77-4c001000] root 151 2 0 15:50 ? 00:00:00 [irq/78-4c001000] root 152 2 0 15:50 ? 00:00:00 [mlahb:m4@100000] root 154 2 0 15:50 ? 00:00:00 [irq/80-48003000] root 155 2 0 15:50 ? 00:00:00 [irq/81-48003000] root 156 2 0 15:50 ? 00:00:00 [stmmac_wq] root 158 2 0 15:51 ? 00:00:00 [irq/63-0-0028] root 159 2 0 15:51 ? 00:00:00 [ubi_bgt0d] root 161 2 0 15:51 ? 00:00:00 [ubifs_bgt0_3] root 162 2 0 15:51 ? 00:00:00 [ipv6_addrconf] root 618 1 2 15:51 ? 00:00:35 /usr/sbin/rngd -f -r /dev/hwrng rpc 622 1 0 15:51 ? 00:00:00 /usr/sbin/rpcbind -w -f root 629 1 0 15:51 ? 00:00:00 /lib/systemd/systemd-journald root 638 2 0 15:51 ? 00:00:00 [ubifs_bgt0_2] root 652 1 0 15:51 ? 00:00:00 /lib/systemd/systemd-udevd systemd+ 656 1 0 15:51 ? 00:00:01 /lib/systemd/systemd-timesyncd root 670 2 0 15:51 ? 00:00:00 [irq/22-44009000] root 671 2 0 15:51 ? 00:00:00 [spi0] root 688 1 0 15:51 ? 00:00:00 /sbin/klogd -n root 692 1 0 15:51 ? 00:00:00 /sbin/syslogd -n message+ 698 1 0 15:51 ? 00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only root 725 2 0 15:51 ? 00:00:00 [irq/42-4c006000] root 726 2 0 15:51 ? 00:00:00 [irq/57-5c000000] root 727 2 0 15:51 ? 00:00:00 [kworker/u2:2-events_unbound] root 730 2 0 15:51 ? 00:00:00 [kworker/u3:2-hci0] root 769 1 0 15:51 ? 00:00:00 /lib/systemd/systemd-logind root 770 1 0 15:51 ? 00:00:00 /usr/libexec/bluetooth/bluetoothd systemd+ 771 1 0 15:51 ? 00:00:01 /lib/systemd/systemd-networkd root 773 1 1 15:51 ? 00:00:17 /usr/sbin/netdata -D -u root systemd+ 778 1 0 15:51 ? 00:00:00 /lib/systemd/systemd-resolved avahi 779 1 0 15:51 ? 00:00:00 avahi-daemon: running [myir-ya151c-t.local] root 780 1 0 15:51 ? 00:00:00 /usr/sbin/iiod 64371 781 1 0 15:51 ? 00:00:00 /sbin/ninfod -d avahi 782 779 0 15:51 ? 00:00:00 avahi-daemon: chroot helper pulse 784 1 0 15:51 ? 00:00:00 /usr/bin/pulseaudio --system --realtime --disallow-exit --daemonize=no 61563 785 1 0 15:51 ? 00:00:00 /sbin/rdisc -f -t root 787 1 0 15:51 ? 00:00:00 /usr/sbin/vsftpd root 790 1 0 15:51 tty1 00:00:00 /sbin/agetty -o -p -- u --noclear tty1 linux root 791 1 0 15:51 ttySTM0 00:00:00 /bin/login -f root 794 2 0 15:51 ? 00:00:00 [irq/55-40010000] root 796 1 0 15:51 ? 00:00:00 /lib/systemd/systemd --user root 797 796 0 15:51 ? 00:00:00 (sd-pam) root 802 791 0 15:51 ttySTM0 00:00:00 -sh root 807 1 0 15:51 ? 00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session root 815 1 0 15:51 ? 00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session root 823 1 0 15:51 ? 00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session root 839 2 0 15:51 ? 00:00:00 [kworker/0:1H] root 869 773 2 15:51 ? 00:00:31 /usr/libexec/netdata/plugins.d/apps.plugin 2 root 871 773 0 15:51 ? 00:00:08 bash /usr/libexec/netdata/plugins.d/charts.d.plugin 2 root 873 773 0 15:51 ? 00:00:05 /usr/bin/python3 /usr/libexec/netdata/plugins.d/python.d.plugin 2 root 1043 2 0 15:52 ? 00:00:00 [cfg80211] root 1547 2 0 15:57 ? 00:00:10 [kworker/0:0+events_freezable] root 2057 2 0 16:05 ? 00:00:02 [kworker/0:2-events] root 2379 2 0 16:10 ? 00:00:02 [kworker/0:3-events] root 2688 2 0 16:15 ? 00:00:00 [kworker/0:4-events]
看到有个netdata的python应用在运行,可以关闭看看能节省多少ram出来,其他的bluetooth,ftp不需要的也可以关闭,毕竟板上也没有这些硬件外设。 root@myir-ya151c-t:~# systemctl stop netdata root@myir-ya151c-t:~# systemctl stop bluetooth
关闭后有20MB,还是有一些优化的空间。