~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/xz_wrap.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/xz_wrap.sh (Version linux-6.12-rc7) and /scripts/xz_wrap.sh (Version linux-2.6.32.71)


  1 #!/bin/sh                                         
  2 # SPDX-License-Identifier: 0BSD                   
  3 #                                                 
  4 # This is a wrapper for xz to compress the ker    
  5 # compression options depending on the archite    
  6 #                                                 
  7 # Author: Lasse Collin <lasse.collin@tukaani.or    
  8                                                   
  9 # This has specialized settings for the follow    
 10 # XZ-compressed kernel isn't currently support    
 11 #                                                 
 12 #   Arch        Align   Notes                     
 13 #   arm          2/4    ARM and ARM-Thumb2        
 14 #   arm64         4                               
 15 #   csky          2                               
 16 #   loongarch     4                               
 17 #   mips         2/4    MicroMIPS is 2-byte al    
 18 #   parisc        4                               
 19 #   powerpc       4     Uses its own wrapper f    
 20 #   riscv        2/4                              
 21 #   s390          2                               
 22 #   sh            2                               
 23 #   sparc         4                               
 24 #   x86           1                               
 25                                                   
 26 # A few archs use 2-byte or 4-byte aligned ins    
 27 # the kernel config. This function is used to     
 28 # config option is set to "y".                    
 29 is_enabled()                                      
 30 {                                                 
 31         grep -q "^$1=y$" include/config/auto.c    
 32 }                                                 
 33                                                   
 34 # XZ_VERSION is needed to disable features tha    
 35 # old XZ Utils versions.                          
 36 XZ_VERSION=$($XZ --robot --version) || exit       
 37 XZ_VERSION=$(printf '%s\n' "$XZ_VERSION" | sed    
 38                                                   
 39 # Assume that no BCJ filter is available.         
 40 BCJ=                                              
 41                                                   
 42 # Set the instruction alignment to 1, 2, or 4     
 43 #                                                 
 44 # Set the BCJ filter if one is available.         
 45 # It must match the #ifdef usage in lib/decomp    
 46 case $SRCARCH in                                  
 47         arm)                                      
 48                 if is_enabled CONFIG_THUMB2_KE    
 49                         ALIGN=2                   
 50                         BCJ=--armthumb            
 51                 else                              
 52                         ALIGN=4                   
 53                         BCJ=--arm                 
 54                 fi                                
 55                 ;;                                
 56                                                   
 57         arm64)                                    
 58                 ALIGN=4                           
 59                                                   
 60                 # ARM64 filter was added in XZ    
 61                 if [ "$XZ_VERSION" -ge 5004000    
 62                         BCJ=--arm64               
 63                 else                              
 64                         echo "$0: Upgrading to    
 65                                 "would enable     
 66                                 "for better co    
 67                 fi                                
 68                 ;;                                
 69                                                   
 70         csky)                                     
 71                 ALIGN=2                           
 72                 ;;                                
 73                                                   
 74         loongarch)                                
 75                 ALIGN=4                           
 76                 ;;                                
 77                                                   
 78         mips)                                     
 79                 if is_enabled CONFIG_CPU_MICRO    
 80                         ALIGN=2                   
 81                 else                              
 82                         ALIGN=4                   
 83                 fi                                
 84                 ;;                                
 85                                                   
 86         parisc)                                   
 87                 ALIGN=4                           
 88                 ;;                                
 89                                                   
 90         powerpc)                                  
 91                 ALIGN=4                           
 92                                                   
 93                 # The filter is only for big e    
 94                 if is_enabled CONFIG_CPU_BIG_E    
 95                         BCJ=--powerpc             
 96                 fi                                
 97                 ;;                                
 98                                                   
 99         riscv)                                    
100                 if is_enabled CONFIG_RISCV_ISA    
101                         ALIGN=2                   
102                 else                              
103                         ALIGN=4                   
104                 fi                                
105                                                   
106                 # RISC-V filter was added in X    
107                 if [ "$XZ_VERSION" -ge 5006000    
108                         BCJ=--riscv               
109                 else                              
110                         echo "$0: Upgrading to    
111                                 "would enable     
112                                 "for better co    
113                 fi                                
114                 ;;                                
115                                                   
116         s390)                                     
117                 ALIGN=2                           
118                 ;;                                
119                                                   
120         sh)                                       
121                 ALIGN=2                           
122                 ;;                                
123                                                   
124         sparc)                                    
125                 ALIGN=4                           
126                 BCJ=--sparc                       
127                 ;;                                
128                                                   
129         x86)                                      
130                 ALIGN=1                           
131                 BCJ=--x86                         
132                 ;;                                
133                                                   
134         *)                                        
135                 echo "$0: Arch-specific tuning    
136                                                   
137                 # Guess 2-byte-aligned instruc    
138                 # should hurt less than guessi    
139                 ALIGN=2                           
140                 ;;                                
141 esac                                              
142                                                   
143 # Select the LZMA2 options matching the instru    
144 case $ALIGN in                                    
145         1)  LZMA2OPTS= ;;                         
146         2)  LZMA2OPTS=lp=1 ;;                     
147         4)  LZMA2OPTS=lp=2,lc=2 ;;                
148         *)  echo "$0: ALIGN wrong or missing"     
149 esac                                              
150                                                   
151 # Use single-threaded mode because it compress    
152 # (and uses less RAM) than multithreaded mode.    
153 #                                                 
154 # For the best compression, the dictionary siz    
155 # smaller than the uncompressed kernel. 128 Mi    
156 # needs less than 1400 MiB of RAM in single-th    
157 #                                                 
158 # On the archs that use this script to compres    
159 # decompression in the preboot code is done in    
160 # Thus the dictionary size doesn't affect the     
161 # of the preboot decompressor at all.             
162 exec $XZ --check=crc32 --threads=1 $BCJ --lzma    
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php