STB内核裁剪

内核使用的版本是2.6.37

裁剪前,先确定你的板子对应的default config

一般进入kernel目录下,输入make help就会出现

类似结果如下

  fuloong2e_defconfig      - Build for fuloong2e
  gpr_defconfig            - Build for gpr
  ip22_defconfig           - Build for ip22
  ip27_defconfig           - Build for ip27
  ip28_defconfig           - Build for ip28
  ip32_defconfig           - Build for ip32
  jazz_defconfig           - Build for jazz
  jmr3927_defconfig        - Build for jmr3927
  lasat_defconfig          - Build for lasat
  lemote2f_defconfig       - Build for lemote2f
  malta_defconfig          - Build for malta
  markeins_defconfig       - Build for markeins
  mipssim_defconfig        - Build for mipssim
  mpc30x_defconfig         - Build for mpc30x
  msp71xx_defconfig        - Build for msp71xx
  mtx1_defconfig           - Build for mtx1
  pb1100_defconfig         - Build for pb1100
  pb1200_defconfig         - Build for pb1200
  pb1500_defconfig         - Build for pb1500
  pb1550_defconfig         - Build for pb1550
  pnx8335-stb225_defconfig - Build for pnx8335-stb225
  pnx8550-jbs_defconfig    - Build for pnx8550-jbs
  pnx8550-stb810_defconfig - Build for pnx8550-stb810
  powertv_defconfig        - Build for powertv
  rb532_defconfig          - Build for rb532
  rbtx49xx_defconfig       - Build for rbtx49xx
  rm200_defconfig          - Build for rm200
  sb1250-swarm_defconfig   - Build for sb1250-swarm
  tb0219_defconfig         - Build for tb0219
  tb0226_defconfig         - Build for tb0226
  tb0287_defconfig         - Build for tb0287
  workpad_defconfig        - Build for workpad
  wrppmc_defconfig         - Build for wrppmc
  yosemite_defconfig       - Build for yosemite

  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build
  make V=2   [targets] 2 => give reason for rebuild of target
  make O=dir [targets] Locate all output files in "dir", including .config
  make C=1   [targets] Check all c source with $CHECK (sparse by default)
  make C=2   [targets] Force check of all c source with $CHECK


然后输入对应的板子型号

make xxx_defconfig

然后copy覆盖.config文件

之后就make,然后等待结果

这样就生成了板子所需的kernel image

看一下镜像大小

-rwxr-xr-x  1 root root   7430757 vmlinux


居然有7MB那么多,如果对空间有要求,那就要裁剪下

 

 

 

首先输入make menuconfig,进入配置界面

STB内核裁剪_第1张图片

然后进入每个选项,进行配置

这里我说下我的选项

[Power management options]
Power Management support   no

[General setup]
Enable VM event counters for /proc/vmstat
Enable PCI quirk workarounds
Configure standard kernel features (for small systems)
Optimize for size

[Bus options (PCI, PCMCIA, EISA, ISA, TC)]
Support for PCI controller 

[Device Drivers]
Misc devices

[File systems]
JBD2 (ext4) debugging support
Network File Systems [test for open]
	[Miscellaneous filesystems]
	Journalling Flash File System v2 (JFFS2) support
	SquashFS 4.0 - Squashed file system support  

[Kernel hacking]
Debug Filesystem
Early printk


其中General Setup->Optimize For size这个要勾上

就是优化大小的

最后生成的kernel大小

-rwxr-xr-x  1 root root   5982184  vmlinux


缩了1.5MB左右

UBOOT加载kernel的时候还可以用支持解压缩来load kernel

当然还可以这里再进行深度裁剪,不过对于我目前的开发要求,已经符合要求了,再缩就没多少意义了

你可能感兴趣的:(STB内核裁剪)