Skip to content

Size optimization improvements #14

@SuperMaxusa

Description

@SuperMaxusa

Hi, I found a few improvements for kernel size, currently it shaves about 96k.

// left: bzImage size, right: vmlinux size

	- Generic setup
		- Configure standard kernel features (expert users)
			- untick Enable support for printk (-49k, -552k [4])
		- Support initial ramdisk/ramfs compressed using LZMA (-4k, -9k [6])
	- Processor type and features
		- Supported processor vendors
			- untick Hygon, Centaur, Transmeta, UMC, Zhaoxin, Vortex processors (-4k, -14k [7])
	- Device Drivers
		- Input device support
			- Generic input layer
				- untick Mice (-20k, -60k [1])
		- Character devices
			- untick Unix98 and Legacy (BSD) PTY support (-4k, -10k [2])
	- Memory Management options
		- untick Support for paging of anonymous memory (-12k, -30k [3])
	- Enable the block layer
		- Partition Types
			- untick EFI GUID Partition support (-4k, -9k [6])
		- IO Schedulers
			- untick Kyber I/O scheduler (-4k, -1k [5])
	- Library routines
		- untick XZ decompression support (-4k, -9k [6])

Notes:

After step 6, compress your initramfs to LZMA:

find . | cpio -H newc -o | xz --format=lzma --check=crc32 --lzma1=dict=512KiB -e > ../rootfs.cpio.lzma

...and change syslinux.cfg:

INITRD rootfs.cpio.lzma

If you test on real hardware, be careful with step 7, test any changes here with Enable support for printk (see step 4).


Step bzImage vmlinux
0 (original) 885248 3146912
1 864768 3086424
2 860672 3076152
3 848384 3045692
4 799232 2492808
5 795136 2491676
6 791040 2482396
7 786944 2468308

GCC version: gcc (Debian 14.2.0-19) 14.2.0
Linux config: linux-config7.txt

Thanks @mikebdp2 for the tips, see floppinux-amd64net.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions