| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision |
| docs:guide-user:additional-software:saving_space [2020/11/07 09:21] – [Modifying build configuration variables] Some menus in the list are only accessible via make kernel_menuconfig, this is NOT stated and was removed for some reason. freezeheat | docs:guide-user:additional-software:saving_space [2021/03/03 07:12] – header levels vgaetera |
|---|
| ====== Saving firmware space ====== | ====== Saving firmware space and RAM ====== |
| ===== Excluding packages ===== | ===== Excluding packages ===== |
| Flash space is scarce on devices with only 4MB flash. | Flash space is scarce on devices with only 4MB flash. |
| :!: Do not use zram-swap for 4MB flash devices as it //increases// the amount of firmware space used. | :!: Do not use zram-swap for 4MB flash devices as it //increases// the amount of firmware space used. |
| It is listed here as it is helpful on machines with very little RAM memory. | It is listed here as it is helpful on machines with very little RAM memory. |
| | |
| | :?: The minus ''-PACKAGE_NAME'' prefix removes a package, no prefix adds one. |
| |
| ==== Build image for devices with only 4MB flash ==== | ==== Build image for devices with only 4MB flash ==== |
| * [[https://forum.openwrt.org/t/tp-link-tl-mr-3420-v3-build/855/8]] | * [[https://forum.openwrt.org/t/tp-link-tl-mr-3420-v3-build/855/8]] |
| * [[https://forum.openwrt.org/t/possible-ppp-removal-from-base-image/42024/3]] | * [[https://forum.openwrt.org/t/possible-ppp-removal-from-base-image/42024/3]] |
| | * Talk [[https://youtu.be/M3yUjHKvde8?t=846|Fight for the bytes! Fun with Four Megabytes Flash]] |
| |
| ==== Build image for devices with only 16/32MB RAM ==== | ==== Build image for devices with only 16/32MB RAM ==== |
| In addition to the ones mentioned here you can save a tiny bit of space by disabling commands in busybox. | In addition to the ones mentioned here you can save a tiny bit of space by disabling commands in busybox. |
| |
| === Saving space === | ==== Saving space ==== |
| ^ Config variable ^ Menu path ^ Comments ^ | ^ Config variable\\ (''n'' = disable, ''y'' = enable) ^ Menu path ^ Comments ^ |
| | ''CONFIG_KERNEL_PRINTK=n'' | Global build settings / Kernel build options / Enable support for printk | | | ''CONFIG_KERNEL_PRINTK=n'' | Global build settings / Kernel build options / Enable support for printk | |
| | ''CONFIG_KERNEL_CRASHLOG=n'' | Global build settings / Kernel build options / Crash logging | | | ''CONFIG_KERNEL_CRASHLOG=n'' | Global build settings / Kernel build options / Crash logging | |
| | ''CONFIG_STRIP_KERNEL_EXPORTS=y'' | Global build settings / Strip unnecessary exports from the kernel image | | | ''CONFIG_STRIP_KERNEL_EXPORTS=y'' | Global build settings / Strip unnecessary exports from the kernel image | |
| | ''CONFIG_USE_MKLIBS=y'' | Global build settings / Strip unnecessary functions from libraries | | | ''CONFIG_USE_MKLIBS=y'' | Global build settings / Strip unnecessary functions from libraries | |
| | ''CONFIG_SERIAL_8250'' | Device Drivers / Character devices / Serial drivers / 8250/16550 and compatible serial support | This will also save RAM by preventing /sbin/askfirst from running. However, this will break sysupgrade. This menu is available only via ''make kernel_menuconfig'' | | | ''CONFIG_SERIAL_8250=n'' | Device Drivers / Character devices / Serial drivers / 8250/16550 and compatible serial support | This will also save RAM by preventing /sbin/askfirst from running. However, this will break sysupgrade. This menu is available only via ''make kernel_menuconfig'' | |
| | ''CONFIG_EARLY_PRINTK'' | Kernel hacking / Early printk | This menu is available only via ''make kernel_menuconfig'' | | | ''CONFIG_EARLY_PRINTK=n'' | Kernel hacking / Early printk | This menu is available only via ''make kernel_menuconfig'' | |
| | ''KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE'' | Global build settings / Kernel build options / Number of squashfs fragments cached | Reduce the number of cached blocks | | | ''KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE'' :!:| Global build settings / Kernel build options / Number of squashfs fragments cached | Reduce the number of cached blocks. This menu is available only via ''make kernel_menuconfig'' | |
| | ''TARGET_SQUASHFS_BLOCK_SIZE'' | Target Images / squashfs / Block size | Increase block size from the default 256 KB to improve compression | | | ''TARGET_SQUASHFS_BLOCK_SIZE'' :!:| Target Images / squashfs / Block size | Increase block size from the default 256 KB to improve compression | |
| |
| :!: Block size must be a power of 2, between 4096 bytes and 1 Megabyte. By default, 3 blocks will be cached so this will also make the router use more RAM (if 3 blocks are cached, and a block size of 1024 KB is used, this will use 2,304 KB more RAM (3 * 1024 KB - 3 * 256 KB)). It may also make the router use more CPU to decompress the larger blocks. | :!: Block size must be a power of 2, between 4096 bytes and 1 Megabyte. By default, 3 blocks will be cached so this will also make the router use more RAM (if 3 blocks are cached, and a block size of 1024 KB is used, this will use 2,304 KB more RAM (3 * 1024 KB - 3 * 256 KB)). It may also make the router use more CPU to decompress the larger blocks. |
| [[https://forum.openwrt.org/t/building-a-smaller-kernel-for-a-specific-device/30370/8|This can save some disk space and RAM]]. | [[https://forum.openwrt.org/t/building-a-smaller-kernel-for-a-specific-device/30370/8|This can save some disk space and RAM]]. |
| |
| === Saving RAM === | ==== Saving RAM ==== |
| ^ Config variable ^ Menu path ^ | ^ Config variable\\ (''n'' = disable, ''y'' = enable) ^ Menu path ^ |
| | ''CONFIG_PACKAGE_zram-swap=y'' | Base system / zram-swap | | | ''CONFIG_PACKAGE_zram-swap=y'' | Base system / zram-swap | |
| | ''CONFIG_PROCD_ZRAM_TMPFS=y'' | Base system / procd Configuration / Mount ///tmp// using zram | | | ''CONFIG_PROCD_ZRAM_TMPFS=y'' | Base system / procd Configuration / Mount ///tmp// using zram | |
| | | ''CONFIG_KERNEL_SWAP=y'' | Global build settings / Kernel build options / Support for paging of anonymous memory (swap) | |
| |
| ===== Replace LuCI icons with a blank pixel ===== | ===== Replace LuCI icons with a blank pixel ===== |