summaryrefslogtreecommitdiff
path: root/schulung_tools/notes
diff options
context:
space:
mode:
Diffstat (limited to 'schulung_tools/notes')
-rw-r--r--schulung_tools/notes/fastboot.txt81
1 files changed, 81 insertions, 0 deletions
diff --git a/schulung_tools/notes/fastboot.txt b/schulung_tools/notes/fastboot.txt
new file mode 100644
index 0000000..8763939
--- /dev/null
+++ b/schulung_tools/notes/fastboot.txt
@@ -0,0 +1,81 @@
+This is a general procedure for improving Linux boot times. It only deals
+with Linux drivers and userspace.
+
+NOTE: Everything before Linux (hardware, bootloader) have very important
+ roles also. They also must be considered for a complete fast boot
+ concept.
+
+1. Add "poweroff -f" to the beginning of the boot script /etc/init.d/rcS
+ - this allows us to measure time with "time ./start-vm.sh"
+
+2. Do not enable audio in qemu: QEMU_AUDIO_DRV=none
+ - this reduces qemu startup time (we want to measure Linux, not qemu)
+
+3. Switch from NFS-Root to initramfs.
+ - this avoids ethernet setup and DHCP at boot
+ - this avoids network latencies during filesystem interaction
+ - initramfs uses /init as default start program, so we add a soft link
+ from /init to bin/busybox in the root filesystem
+ - removed "ip=dhcp root=... nfsroot=..." from kernel arguments
+
+4. Strip all libraries and binaries.
+ - this makes the initramfs *much* smaller
+ - smaller initramfs means faster "populate rootfs" on boot
+
+5. Remove libm dependency from busybox.
+ - the busybox features using libm are not needed for fast boot requirements
+ - removing libm means smaller initramfs
+ - less dependencies means faster busybox start time
+
+6. Add "printk.time=1 loglevel=8" to kernel arguments.
+ - ./start-vm.sh > boot.log
+ - browse boot.log to find any errors, unused features, slow non-important
+ features.
+ - disable or compile the drivers/features as modules
+
+7. Add "initcall_debug" to kernel arguments.
+ - now we can see the time consumed by each driver's init function
+ - if the device is in the device-tree, this time will also include
+ the device's probe time
+ - ./start-vm.sh > boot.log
+ - cat boot.log | linux-4.6/scripts/bootgraph.pl > boot.svg
+
+8. Remove (or change to modules) drivers not needed for fast boot requirements
+ - search kernel code to find init function
+ - look at the Makefile in that directory to see the corresponding
+ kernel config option
+ - remove amba_clcdfd_init (as example)
+ - change smsc911x_init to module (as example)
+
+9. Remove initcall_debug, consoles and set loglevel=0.
+ - we are done evaluating individual driver times
+ - the console is slow, so don't output anything to it
+ - maybe even disable the console in the kernel config
+
+10. Pre-configure loops per jiffy calibration.
+ - ./start-vm.sh | grep lpj=
+ - add lpj=xyz to kernel parameters
+
+11. Choose optimal kernel compression
+ - General setup -> Kernel compression mode
+ - set kernel compression to LZO
+
+12. Create fastpoweroff script to run instead of busybox-init.
+ - add kernel parameter "rdinit=/bin/fastpoweroff"
+ - now init is not started (since init did much more than just
+ run /etc/init.d/rcS)
+
+13. Create binary to run instead of script or busybox-init.
+ - change kernel parameter to "rdinit=/bin/poweroff"
+ - (busybox was hacked so "poweroff" automatically uses "-f")
+ - in #12 first a shell is loaded, then the script is parsed,
+ then poweroff is called
+ - now poweroff is directly called by kernel
+
+14. Add ld.so.cache for initramfs libraries.
+ - the dynamic loader now does not search for dependencies
+
+15. For systemd-based userspace, use systemd tools.
+ - systemd-analyze blame
+ - systemd-analyze plot > systemd.svg
+ - systemd-analyze critcal-chain app-qt