linux kernel tinification
play

Linux Kernel Tinification Josh Triplett josh@joshtriplett.org - PowerPoint PPT Presentation

Linux Kernel Tinification Josh Triplett josh@joshtriplett.org Linux Plumbers Conference 2014 boot-floppies two floppies and an Internet connection 2.2.19 - 977k compressed debian-installer one floppy and an Internet connection 2.4.27 -


  1. Linux Kernel Tinification Josh Triplett josh@joshtriplett.org Linux Plumbers Conference 2014

  2. boot-floppies

  3. two floppies and an Internet connection

  4. 2.2.19 - 977k compressed

  5. debian-installer

  6. one floppy and an Internet connection

  7. 2.4.27 - 797k compressed

  8. 2.4.27 - 797k compressed 2.6.8 - 1073k compressed

  9. “Linux runs on everything from cell phones to supercomputers”

  10. This is not an embedded system anymore 2GB RAM 16GB storage

  11. Original motivation ◮ Size-constrained bootloaders (why use GRUB?) ◮ x86 boot track: 32256 bytes

  12. Embedded systems ◮ Tiny flash part (1-8MB or smaller) for kernel and userspace ◮ CPU with onboard SRAM ( < 1024kB)

  13. Compression ◮ vmlinuz is compressed ◮ Decompression stub for self-extraction

  14. Execute in place ◮ Don’t load kernel into memory ◮ Run directly from flash ◮ Code and read-only data read from flash ◮ Read-write data in memory

  15. Execute in place ◮ Don’t load kernel into memory ◮ Run directly from flash ◮ Code and read-only data read from flash ◮ Read-write data in memory ◮ Minimizes memory usage

  16. Execute in place ◮ Don’t load kernel into memory ◮ Run directly from flash ◮ Code and read-only data read from flash ◮ Read-write data in memory ◮ Minimizes memory usage ◮ Precludes compression

  17. Configuring a minimal kernel Configuration Compressed Uncompressed make defconfig 5706k 16532k

  18. Configuring a minimal kernel Configuration Compressed Uncompressed make defconfig 5706k 16532k 503k 1269k make allnoconfig

  19. Configuring a minimal kernel Configuration Compressed Uncompressed make defconfig 5706k 16532k 503k 1269k make allnoconfig ◮ 3.15-rc1: allnoconfig automatically disables options behind EXPERT and EMBEDDED

  20. Configuring a minimal kernel Configuration Compressed Uncompressed make defconfig 5706k 16532k 503k 1269k make allnoconfig ◮ 3.15-rc1: allnoconfig automatically disables options behind EXPERT and EMBEDDED ◮ 3.17-rc1: tinyconfig : enable CC_OPTIMIZE_FOR_SIZE , OPTIMIZE_INLINING , KERNEL_XZ , SLOB , NOHIGHMEM ,

  21. Configuring a minimal kernel Configuration Compressed Uncompressed make defconfig 5706k 16532k 503k 1269k make allnoconfig make tinyconfig 346k 1048k ◮ 3.15-rc1: allnoconfig automatically disables options behind EXPERT and EMBEDDED ◮ 3.17-rc1: tinyconfig : enable CC_OPTIMIZE_FOR_SIZE , OPTIMIZE_INLINING , KERNEL_XZ , SLOB , NOHIGHMEM ,

  22. Configuring a minimal kernel Configuration Compressed Uncompressed make defconfig 5706k 16532k 503k 1269k make allnoconfig make tinyconfig 346k 1048k ◮ 3.15-rc1: allnoconfig automatically disables options behind EXPERT and EMBEDDED ◮ 3.17-rc1: tinyconfig : enable CC_OPTIMIZE_FOR_SIZE , OPTIMIZE_INLINING , KERNEL_XZ , SLOB , NOHIGHMEM , ◮ Manually simulated ”tinyconfig” on older kernels for size comparisons

  23. Configuring a minimal useful kernel Configuration Compressed Uncompressed 346k 1048k make tinyconfig

  24. Configuring a minimal useful kernel Configuration Compressed Uncompressed 346k 1048k make tinyconfig + ELF support +2k +4k

  25. Configuring a minimal useful kernel Configuration Compressed Uncompressed 346k 1048k make tinyconfig + ELF support +2k +4k + modules +18k +53k

  26. Configuring a minimal useful kernel Configuration Compressed Uncompressed 346k 1048k make tinyconfig + ELF support +2k +4k + modules +18k +53k + initramfs +32k +37k

  27. Configuring a minimal useful kernel Configuration Compressed Uncompressed 346k 1048k make tinyconfig + ELF support +2k +4k + modules +18k +53k + initramfs +32k +37k + flash storage + filesystem + networking . . .

  28. minimum kernel size (kB) by kernel version 1 , 060 1 , 040 1 , 020 1 , 000 980 960 940 920 900 880 860 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.103.113.123.133.143.153.163.17

  29. minimum kernel size (kB) by kernel version 1 , 060 1 , 040 1 , 020 1 , 000 980 960 CONFIG_TTY 940 920 900 880 860 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.103.113.123.133.143.153.163.17

  30. Shrinking further ◮ Let’s not give up and let ”tiny” mean ”proprietary RTOS” ◮ Linux could still go an order of magnitude smaller, at least

  31. Shrinking further ◮ Let’s not give up and let ”tiny” mean ”proprietary RTOS” ◮ Linux could still go an order of magnitude smaller, at least ◮ Let’s make the core as small as possible ◮ Leave maximum room for useful functionality

  32. nm --size-sort vmlinux ◮ Find large symbols for potential removal 00001000 d raw_data 00001000 d raw_data 00001210 r intel_tlb_table 00002000 D init_thread_union 00002000 r nhm_lbr_sel_map 00002000 r snb_lbr_sel_map 00002180 D init_tss 00003094 T real_mode_blob 00006000 b .brk.early_pgt_alloc 00100000 b .brk.pagetables ◮ ’r’ is read-only, ’b’ is bss, ’d’ is data, ’t’ is text ◮ For memory usage, look at writable data and bss ◮ For compiled size, ignore bss

  33. nm --size-sort vmlinux ◮ Find large symbols for potential removal VDSO 00001000 d raw_data 00001000 d raw_data 00001210 r intel_tlb_table 00002000 D init_thread_union 00002000 r nhm_lbr_sel_map 00002000 r snb_lbr_sel_map 00002180 D init_tss 00003094 T real_mode_blob 00006000 b .brk.early_pgt_alloc 00100000 b .brk.pagetables ◮ ’r’ is read-only, ’b’ is bss, ’d’ is data, ’t’ is text ◮ For memory usage, look at writable data and bss ◮ For compiled size, ignore bss

  34. nm --size-sort vmlinux ◮ Find large symbols for potential removal VDSO 00001000 d raw_data Another VDSO 00001000 d raw_data 00001210 r intel_tlb_table 00002000 D init_thread_union 00002000 r nhm_lbr_sel_map 00002000 r snb_lbr_sel_map 00002180 D init_tss 00003094 T real_mode_blob 00006000 b .brk.early_pgt_alloc 00100000 b .brk.pagetables ◮ ’r’ is read-only, ’b’ is bss, ’d’ is data, ’t’ is text ◮ For memory usage, look at writable data and bss ◮ For compiled size, ignore bss

  35. nm --size-sort vmlinux ◮ Find large symbols for potential removal VDSO 00001000 d raw_data Another VDSO 00001000 d raw_data 00001210 r intel_tlb_table initial thread and stack 00002000 D init_thread_union 00002000 r nhm_lbr_sel_map 00002000 r snb_lbr_sel_map 00002180 D init_tss 00003094 T real_mode_blob 00006000 b .brk.early_pgt_alloc 00100000 b .brk.pagetables ◮ ’r’ is read-only, ’b’ is bss, ’d’ is data, ’t’ is text ◮ For memory usage, look at writable data and bss ◮ For compiled size, ignore bss

  36. nm --size-sort vmlinux ◮ Find large symbols for potential removal VDSO 00001000 d raw_data Another VDSO 00001000 d raw_data 00001210 r intel_tlb_table initial thread and stack 00002000 D init_thread_union 00002000 r nhm_lbr_sel_map tiny/disable-perf (-147k) tiny/disable-perf 00002000 r snb_lbr_sel_map 00002180 D init_tss 00003094 T real_mode_blob 00006000 b .brk.early_pgt_alloc 00100000 b .brk.pagetables ◮ ’r’ is read-only, ’b’ is bss, ’d’ is data, ’t’ is text ◮ For memory usage, look at writable data and bss ◮ For compiled size, ignore bss

  37. nm --size-sort vmlinux ◮ Find large symbols for potential removal VDSO 00001000 d raw_data Another VDSO 00001000 d raw_data 00001210 r intel_tlb_table initial thread and stack 00002000 D init_thread_union 00002000 r nhm_lbr_sel_map tiny/disable-perf (-147k) tiny/disable-perf 00002000 r snb_lbr_sel_map 00002180 D init_tss tiny/no-io (-9k) 00003094 T real_mode_blob 00006000 b .brk.early_pgt_alloc 00100000 b .brk.pagetables ◮ ’r’ is read-only, ’b’ is bss, ’d’ is data, ’t’ is text ◮ For memory usage, look at writable data and bss ◮ For compiled size, ignore bss

  38. nm --size-sort vmlinux ◮ Find large symbols for potential removal VDSO 00001000 d raw_data Another VDSO 00001000 d raw_data 00001210 r intel_tlb_table initial thread and stack 00002000 D init_thread_union 00002000 r nhm_lbr_sel_map tiny/disable-perf (-147k) tiny/disable-perf 00002000 r snb_lbr_sel_map 00002180 D init_tss tiny/no-io (-9k) copied to low mem 00003094 T real_mode_blob 00006000 b .brk.early_pgt_alloc 00100000 b .brk.pagetables ◮ ’r’ is read-only, ’b’ is bss, ’d’ is data, ’t’ is text ◮ For memory usage, look at writable data and bss ◮ For compiled size, ignore bss

  39. nm --size-sort vmlinux ◮ Find large symbols for potential removal VDSO 00001000 d raw_data Another VDSO 00001000 d raw_data 00001210 r intel_tlb_table initial thread and stack 00002000 D init_thread_union 00002000 r nhm_lbr_sel_map tiny/disable-perf (-147k) tiny/disable-perf 00002000 r snb_lbr_sel_map 00002180 D init_tss tiny/no-io (-9k) copied to low mem 00003094 T real_mode_blob 00006000 b .brk.early_pgt_alloc .bss .bss 00100000 b .brk.pagetables ◮ ’r’ is read-only, ’b’ is bss, ’d’ is data, ’t’ is text ◮ For memory usage, look at writable data and bss ◮ For compiled size, ignore bss

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend