Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mohammedfarrag:kernelsizereduction [2010/07/30 18:24] – MohammedFarragmohammedfarrag:kernelsizereduction [2022/08/15 06:53] (current) – renamed from MohammedFarrag/FreeBSD 8.0 Kernel Size Reduction KubilayKocak
Line 1: Line 1:
 ====== FreeBSD 8.0 Kernel Size Reduction ====== ====== FreeBSD 8.0 Kernel Size Reduction ======
 +
 This document aims to customize the kernel for reducing its size and use additional files to cause the reduction. This document aims to customize the kernel for reducing its size and use additional files to cause the reduction.
  
 ==== Tools ==== ==== Tools ====
 +
 du -cHA, top, perl files to compress the size of /bin and /sbin du -cHA, top, perl files to compress the size of /bin and /sbin
  
Line 14: Line 16:
 | MSDOSFS, UFS_DIRHASH, UFS_GJOURNAL | 143339 KB | 142848 KB | 491 KB | [[https://www.opendrive.com/files/6728797_8zmzz_6ade|Show Kernels Sizes]] | -- | | MSDOSFS, UFS_DIRHASH, UFS_GJOURNAL | 143339 KB | 142848 KB | 491 KB | [[https://www.opendrive.com/files/6728797_8zmzz_6ade|Show Kernels Sizes]] | -- |
 | INET6, SYSVSHM, SYSVMSG, SYSVSEM, KTRACE | 142848 KB | 141177 KB | 1671 KB | [[https://www.opendrive.com/files/6728786_Px3vp_90ef|Show Kernels Sizes]] | -- | | INET6, SYSVSHM, SYSVMSG, SYSVSEM, KTRACE | 142848 KB | 141177 KB | 1671 KB | [[https://www.opendrive.com/files/6728786_Px3vp_90ef|Show Kernels Sizes]] | -- |
-| Using Dynamic Executables and Remove Static Ones | /bin ==> 971 KB & /sbin ==> 3607 KB | /bin ==> 971 KB & /sbin ==> 2978 | 629 KB | [[https://www.opendrive.com/files/6728764_5rv98_763e|1.Size of /bin directory before applying Changes]], [[https://www.opendrive.com/files/6728765_ZN7uj_43be|2.Size of /sbin directory before applying changes]] & [[https://www.opendrive.com/files/6728763_pZURj_9849|3.Show The directories sizes After Applying changes]] | See Section2 |+| Using Dynamic Executables and Remove Static Ones | /bin ==> 971 KB & /sbin ==> 3607 KB | /bin ==> 971 KB & /sbin ==> 2978 | 629 KB | [[https://www.opendrive.com/files/6728764_5rv98_763e|1.Size of /bin directory before applying Changes]]\\  [[https://www.opendrive.com/files/6728765_ZN7uj_43be|2.Size of /sbin directory before applying changes]] \\  [[https://www.opendrive.com/files/6728763_pZURj_9849|3.Show The directories sizes After Applying changes]] | See Section2 |
 | Sysctl maxusers=4 | 1./var ==> 70582 KB \\ 2.Free Available Memory = 445 | 1./var ==> 70556 KB \\ 2. Free Available Memory = 446 | 1. /var ==> 26 KB \\ 2. For Available Memory = 1MB | [[https://www.opendrive.com/files/6728735_1LDXp_8146|Show /var Before Changing maxusers Sizes]] \\  [[https://www.opendrive.com/files/6728735_1LDXp_8146|Show /var Before Changing maxusers Sizes]]\\  [[https://www.opendrive.com/files/6728691_H88Gn_ac0c|Show /var After Changing maxusers Sizes]] \\  [[https://www.opendrive.com/files/6728737_q6emt_eb56|Show Available Memory at maxusers=243]] \\  [[https://www.opendrive.com/files/6728738_jJDlU_02f8|Show /var Available Memory at maxusers=4]] | See Section3 | | Sysctl maxusers=4 | 1./var ==> 70582 KB \\ 2.Free Available Memory = 445 | 1./var ==> 70556 KB \\ 2. Free Available Memory = 446 | 1. /var ==> 26 KB \\ 2. For Available Memory = 1MB | [[https://www.opendrive.com/files/6728735_1LDXp_8146|Show /var Before Changing maxusers Sizes]] \\  [[https://www.opendrive.com/files/6728735_1LDXp_8146|Show /var Before Changing maxusers Sizes]]\\  [[https://www.opendrive.com/files/6728691_H88Gn_ac0c|Show /var After Changing maxusers Sizes]] \\  [[https://www.opendrive.com/files/6728737_q6emt_eb56|Show Available Memory at maxusers=243]] \\  [[https://www.opendrive.com/files/6728738_jJDlU_02f8|Show /var Available Memory at maxusers=4]] | See Section3 |
 +| Using Perl Files | /bin ==> 728 KB | /bin ==> 1367 KB | 639 KB | [[https://www.opendrive.com/files/6728800_kIzJ5_27ac|Show /bin before using the perl file]] \\  [[https://www.opendrive.com/files/6728799_133al_9ab1|Show /bin after using the perl file]] \\   [[http://www.mediafire.com/?acq2iy7nq66ayyc|Download perl files with snapshots]] | See Section4 |
 +| Sysctl net.inet.tcp.msl="5000" | Does not affect kernel size | -- | -- | -- | See Section5 |
  
-| Using Perl Files | /bin ==> 728 KB | /bin ==> 1367 KB | 639 KB | [[https://www.opendrive.com/files/6728800_kIzJ5_27ac|Show /bin before using the perl file]] \\  [[https://www.opendrive.com/files/6728799_133al_9ab1|Show /bin after using the perl file]] \\   [[http://www.mediafire.com/?acq2iy7nq66ayyc|Download perl files with snapshots]] \\  | See Section4 |+==== Section1 ====
  
-| Sysctl net.inet.tcp.msl="5000" | Doesn't affect kernel size | -- | -- | -- | See Section5 | 
- 
-=== Section1 === 
 There were three different machines loaded in the kernel configuration file and minimized to only the exact machine type.Be Careful, if you don't know your machine type, you may get a kernel crash. There were three different machines loaded in the kernel configuration file and minimized to only the exact machine type.Be Careful, if you don't know your machine type, you may get a kernel crash.
  
-=== Section2 ===+==== Section2 ====
  
-1.Steps : # cd /usr/src \\  +  - Steps : # cd /usr/src \\  # make buildworld \\  # make buildkernel \\  # make installkernel \\  # shutdown -r now \\  
-# make buildworld \\  +    - Notice that if you get any problem with your current binaries, you won't be able to retrieve the ones. 
-# make buildkernel \\  + 
-# make installkernel \\  +==== Section3 ====
-# shutdown -r now \\  +
-  - Notice that if you get any problem with your current binaries, you won't be able to retrieve the original ones.+
  
-=== Section3 === 
   - You will face a problem in Kernel Building or compilation if you set maxusers to 2 & you were running X Windows System \\    - You will face a problem in Kernel Building or compilation if you set maxusers to 2 & you were running X Windows System \\ 
   - To use this at each boot process ==> I. recompile it inside the configuration file. or II. put it inside /etc/sysctl.conf   - To use this at each boot process ==> I. recompile it inside the configuration file. or II. put it inside /etc/sysctl.conf
  
-=== Section4 === +==== Section4 ====
-%%<%%td>1. Steps : # use names.files to include all the binaries you need \\  +
-# run loadbin.pl \\  +
-# you can use this command at startup by running it from load.conf file \\  +
-# don't forget to use the termination.pl to compress all the files again and you can run it combined with the shutdown process\\  +
-# see snapshots for more details about how to run the document. \\  +
-# This process reduces the directory approximately half the size.\\  +
-  - The same process can be done for /sbin directory but don't forget to include the the sbins needed in the names.files file. \\ +
  
-=== Section5 === +  - Steps : # use names.files to include all the binaries you need \\  # run loadbin.pl \\  # you can use this command at startup by running it from load.conf file \\  # don't forget to use the termination.pl to compress all the files again and you can run it combined with the shutdown process\\  # see snapshots for more details about how to run the document. \\  # This process reduces the directory size for half the size approximately.\\  
-Lessen max segment life to conserve resources ==> ACK waiting time in miliseconds to 5000+  - The same process can be done for /sbin directory but don't forget to include the the sbins needed in the names.files file 
 + 
 +==== Section5 ==== 
 + 
 +Lessen max segment life to conserve resources ==> ACK waiting time in milliseconds to 5000
  
 ===== Important Notes ===== ===== Important Notes =====
  
-1. You can use extra kernel size reduction by using the options MUTEX_NOINLINE, RWLOCK_NOINLINE & SX_NOINLINE which reduce the kernel text segment. \\  +  - You can use extra kernel size reduction by using the options MUTEX_NOINLINE, RWLOCK_NOINLINE & SX_NOINLINE which reduce the kernel text segment. 
-2. Don't use any debug options when you recompile the kernel. \\  +  - Don't use any debug options when you recompile the kernel. 
-3. Don't try to remove any configurations used to mount root at kernel compilation process or you will face a problem during your next boot \\  +  - Don't try to remove any configurations used to mount root at kernel compilation process or you will face a problem during your next boot Some of these processes are FFS, GEOM_GPT, ..etc 
-Some of these processes are FFS, GEOM_GPT, ..etc \\  +  - You can perform only one executable for all bins using crunchgen(). 
-4. You can perform only one executable for all bins using crunchgen(). \\  +  - Using -O3 debug option for CFLAGS or COPTFLAGS doesn't guarantee producing unbroken kernel so its better to avoid it.
-5. Using -O3 debug option for CFLAGS or COPTFLAGS is not guaranteed to produce unbroken kernel so its better to avoid it. \\ +
  
 ===== Resources ===== ===== Resources =====
Line 63: Line 57:
  
 ===== Comments and Suggestions ===== ===== Comments and Suggestions =====
-You can send your comments and suggestions to mailto:mfarrag@freebsd.org \\  
  
-Submitted by : Mohammed Farrag \\  +You can send your comments and suggestions to <mfarrag@FreeBSD.org> 
-reviewed by  : Warner Losh \\ + 
 +  * Published by: [[/MohammedFarrag|MohammedFarrag]] 
 +  * Reviewed by: [[/WarnerLosh|WarnerLosh]]
  
  • mohammedfarrag/kernelsizereduction.1280514245.txt.gz
  • Last modified: 2010/07/30 18:24
  • by MohammedFarrag