Bug 6939

Summary: microLinux: Add support for configuring out char devices
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: Tom Zanussi <tom.zanussi>
Component: meta-yoctoAssignee: Tom Zanussi <tom.zanussi>
Status: RESOLVED OBSOLETE QA Contact:
Severity: normal    
Priority: Undecided CC: bluelightning, poky.bs.watcher, poky.watcher
Version: 1.8   
Target Milestone: 1.8 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Tom Zanussi 2014-11-07 18:02:52 UTC
Even with our bare-bones microLinux configuration, we see some character devices that we really don't need, and which correspond to things that can't be configured out:

root@galileo:/dev# ls -al
drwxr-xr-x    4 root     root             0 Jan  1 00:00 .
drwxr-xr-x   17 root     root             0 Jan  1 00:00 ..
crw-------    1 root     root        5,   1 Jan  1 00:00 console
crw-------    1 root     root       10,  63 Jan  1 00:00 cpu_dma_latency
crw-rw-rw-    1 root     root        1,   7 Jan  1 00:00 full
prw-------    1 root     root             0 Jan  1 00:00 initctl
crw-------    1 root     root        1,   1 Jan  1 00:00 mem
drwxrwxrwt    2 root     root             0 Jan  1 00:00 mqueue
lrwxrwxrwx    1 root     root            12 Jan  1 00:00 mtab -> /proc/mounts
crw-------    1 root     root       10,  62 Jan  1 00:00 network_latency
crw-------    1 root     root       10,  61 Jan  1 00:00 network_throughput
crw-rw-rw-    1 root     root        1,   3 Jan  1 00:00 null
crw-------    1 root     root        1,   4 Jan  1 00:00 port
crw-rw-rw-    1 root     root        5,   2 Jan  1 00:01 ptmx
crw-------    1 root     root      253,   0 Jan  1 00:00 ptp0
drwxr-xr-x    2 root     root             0 Jan  1 00:00 pts
crw-rw-rw-    1 root     root        1,   8 Jan  1 00:00 random
crw-rw-rw-    1 root     root        5,   0 Jan  1 00:00 tty
crw-------    1 root     root        4,  64 Jan  1 00:00 ttyS0
crw-------    1 root     tty         4,  65 Jan  1 14:09 ttyS1
crw-rw-rw-    1 root     root        1,   9 Jan  1 00:00 urandom
crw-rw-rw-    1 root     root        1,   5 Jan  1 00:00 zero

One example is /dev/mem.  We don't need it, yet there's no config option for it.
Adding a CONFIG_DEVMEM saves about 4k text:

add/remove: 0/31 grow/shrink: 1/0 up/down: 151/-4880 (-4729)
function                                     old     new   delta
phys_mem_access_prot_allowed                  39     190    +151
mem_class                                      8       -      -8
__initcall_chr_dev_init5                       8       -      -8
read_null                                     13       -     -13
aio_read_null                                 13       -     -13
write_null                                    14       -     -14
pipe_to_null                                  14       -     -14
write_full                                    18       -     -18
null_lseek                                    21       -     -21
splice_write_null                             23       -     -23
open_port                                     29       -     -29
mmap_zero                                     30       -     -30
mem_devnode                                   48       -     -48
aio_write_null                                52       -     -52
mmap_mem_ops                                  88       -     -88
memory_lseek                                 130       -    -130
memory_open                                  134       -    -134
read_port                                    151       -    -151
write_port                                   152       -    -152
read_iter_zero                               173       -    -173
chr_dev_init                                 193       -    -193
zero_fops                                    232       -    -232
port_fops                                    232       -    -232
null_fops                                    232       -    -232
memory_fops                                  232       -    -232
mem_fops                                     232       -    -232
full_fops                                    232       -    -232
mmap_mem                                     288       -    -288
devlist                                      384       -    -384
read_mem                                     407       -    -407
write_mem                                    425       -    -425
zero_bdi                                     672       -    -672

At minimum, we should do the same for any char device we don't need, and it may be better to just add a CONFIG_CHAR to turn them all off, but that seems like it may be a much bigger job.
Comment 1 Paul Eggleton 2015-05-18 14:05:08 UTC
Tom is tracking this internally now.