* updated maddy (0.7.1 -> 0.8.1), untested
[t2sde.git] / package / kernel / linux / linux.conf
blobe03d30ba040a03ec00353cda4b2fe9f651685540
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/linux/linux.conf
3 # Copyright (C) 2004 - 2025 The T2 SDE Project
4 # Copyright (C) 1998 - 2003 ROCK Linux Project
5
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
8
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2.
11 # --- T2-COPYRIGHT-NOTE-END ---
13 . $base/package/*/linux*/linux-conf.in
15 autopatch=0
17 [ "$SDECFG_DEBUG" = 1 ] && export STRIP_WRAPPER_BYPASS=1
18 var_append CC_WRAPPER_APPEND ' ' 'crypto/jitterentropy.c?-O0:'
19 var_append KCC_WRAPPER_APPEND ' ' 'crypto/jitterentropy.c?-O0:'
20 var_append KCC_WRAPPER_APPEND ' ' '*/vdso/*?-O2:'
22 if [ "$SDECFG_DEFAULT_KCC" = clang -a "$SDECFG_LTO" = 1 ]; then
23         var_append makeopt ' ' 'LD=ld.lld AR=llvm-ar NM=llvm-nm'
26 linux_prepatch() {
27         lx_patch
29 hook_add prepatch 5 linux_prepatch
31 linux_preconf() {
32         lx_config
33         moduledir="$root/lib/modules/${lx_kernelrelease}"
35 hook_add preconf 5 linux_preconf
37 linux_premake() {
38         # we need to rerun the oldconfig since the used .config
39         # might not match the one used in the last oldconfig run
40         # (e.g. the nomods is run last - and normally the module
41         # one is used)
42         yes '' | eval $MAKE $makeopt oldconfig > /dev/null
44         echo "Cleanup kernel ..."
45         eval $MAKE $makeopt clean > /dev/null
47         if [ "$SDECFG_PKG_LINUX_T2_LOGO" = 1 ]; then
48                 cp -vf $base/package/*/linux/t2logo_mono.pbm drivers/video/logo/logo_linux_mono.pbm
49                 cp -vf $base/package/*/linux/t2logo_vga16.ppm drivers/video/logo/logo_linux_vga16.ppm
50                 cp -vf $base/package/*/linux/t2logo.ppm drivers/video/logo/logo_linux_clut224.ppm
51         fi
53         if [ $SDECFG_PKG_LINUX_KEEP_SRC = 1 ]; then
54                 echo "Copying kernel source ..."
55                 rm -rf $root/usr/src/linux-${lx_kernelrelease}
56                 mkdir -p $root/usr/src/linux-${lx_kernelrelease}
57                 cp -ar . $root/usr/src/linux-${lx_kernelrelease}
58         fi
60         case "$lx_cpu" in
61         avr32)  var_append makeopt ' ' 'vmlinux' ;; # TODO: ideally uImage, too
62         mips)   var_append makeopt ' ' 'vmlinux vmlinux.ecoff' ;;
63         nios2)  var_append makeopt ' ' 'vmlinux zImage' ;;
64         parisc) var_append makeopt ' ' 'vmlinux bzImage' ;;
65         esac
67         if grep -q "CONFIG_MODULES=y" .config; then
68                 [ "${makeopt% vmlinux*}" != "$makeopt" ] && var_append makeopt ' ' 'modules'
69                 var_append makeinstopt ' ' "INSTALL_MOD_PATH=$root DEPMOD=/bin/true modules_install"
70                 #var_append makeinstopt ' ' "mod_compress_cmd='zstd -f --rm -18'"
71         else
72                 makeinstopt=
73         fi
75 hook_add premake 5 linux_premake
77 linux_install() {
78         echo "Installing the kernel ..."
79         cp -vf System.map $root/boot/System.map-${lx_kernelrelease}
80         ln -sfv System.map-${lx_kernelrelease} $root/boot/System.map
82         cp -vf .config $root/boot/kconfig-${lx_kernelrelease}
83         ln -sfv kconfig-${lx_kernelrelease} $root/boot/kconfig
85         # for debugging with oprofile, also used to boot on some arches
86         cp -vf vmlinux $root/boot/vmlinux-${lx_kernelrelease}
87         ln -sfv vmlinux-${lx_kernelrelease} $root/boot/vmlinux
89         case "$lx_cpu" in
90           x86|x86_64|parisc|s390)
91                 cp -vf arch/${lx_cpu}/boot/bzImage $root/boot/vmlinuz-${lx_kernelrelease}
92                 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
93                 ;;
94           avr32)
95                 : # cp -vf arch/${lx_cpu}/boot/images/uImage $root/boot/uImage-${lx_kernelrelease}
96                 ;;
97           nios2)
98                 cp -vf arch/${lx_cpu}/boot/zImage $root/boot/vmlinuz-${lx_kernelrelease}
99                 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
100                 ;;
101           arm)
102                 cp -vf arch/${lx_cpu}/boot/zImage $root/boot/vmlinuz-${lx_kernelrelease}
103                 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
104                 ;;
105           arm64)
106                 cp -vf arch/${lx_cpu}/boot/Image.gz $root/boot/vmlinuz-${lx_kernelrelease}
107                 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
108                 ;;
109           riscv)
110                 cp -vf arch/${lx_cpu}/boot/Image $root/boot/vmlinuz-${lx_kernelrelease}
111                 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
112                 ;;
113           alpha|ia64)
114                 [ $arch = ia64 ] &&
115                         cp -vf vmlinux.gz $root/boot/vmlinuz-${lx_kernelrelease} ||
116                         cp -vf arch/${lx_cpu}/boot/vmlinux.gz $root/boot/vmlinuz-${lx_kernelrelease}
117                 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
118                 ;;
119           mips)
120                 cp -vf arch/${lx_cpu}/boot/vmlinux.ecoff $root/boot/vmlinux-${lx_kernelrelease}.ecoff
121                 ln -sfv vmlinux-${lx_kernelrelease}.ecoff $root/boot/vmlinux.ecoff
122                 ;;
123           powerpc)
124                 for i in arch/${lx_cpu}/boot/*Image*; do
125                   if [[ $i != *lds* ]]; then
126                         cp -v $i $root/boot/${i##*/}-${lx_kernelrelease}
127                         ln -sfv ${i##*/}-${lx_kernelrelease} $root/boot/${i##*/}
128                   fi
129                 done
130                 ;;
131           sh)
132                 cp -vf arch/${lx_cpu}/boot/zImage $root/boot/vmlinuz-${lx_kernelrelease}
133                 ln -sfv vmlinux-${lx_kernelrelease} $root/boot/vmlinuz
134                 ;;
135           sparc)
136                 cp -vf arch/${lx_cpu}/boot/image $root/boot/vmlinuz-${lx_kernelrelease}
137                 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
138                 ;;
139         esac
141         echo "Copying DTB ..."
142         find arch/$lx_cpu -name "*.dtb" | while read f; do
143                 mkdir -p $root/boot/dtb
144                 cp -vf $f $root/boot/dtb/
145         done
147         # iterate over the packages that provide 3rd party linux kernel modules
148         if grep -q "CONFIG_MODULES=y" .config; then
149                 module_error=0
150                 echo "Building registered 3rd party module packages ..."
151                 for x in $lx_3rd_party_modules; do
152                   echo "Sub-building 3rd party module package $x ..."
153                   pushd $builddir
154                   # ugly, bash does not abort properly when we have this in a if
155                   # and without it the return 1 aborts immediatly ... :-(
156                   set +e
157                   build_package $x postlinux.conf
158                   error=$?
159                   set -e
160                   if [ $error -ne 0 ]; then
161                         echo_warning "Failed building $x"
162                         module_error=1
163                   fi
164                   echo "Done building $x"
165                   popd
166                 done
168                 # maybe fail hard
169                 if ! atstage rebuild && [ $module_error = 1 ]; then
170                         abort "At least one of the 3rd party kernel modules failed!"
171                 fi
173                 local depmod="depmod"
174                 atstage native || depmod="${archprefix}depmod"
175                 echo "Running $depmod -a -b $root/ ..."
176                 $depmod -a -b $root/ -F $root/boot/System.map-${lx_kernelrelease} ${lx_kernelrelease}
178                 # due "mostly" static depmod :-(
179                 for x in $moduledir/modules.*
180                 do [ -f $x ] && add_flist $x; done
182                 echo "Fixing /lib/modules/${ver}/{build,source} symlink ..."
183                 rm -f $root/lib/modules/${lx_kernelrelease}/{build,source}
184                 ln -sf ../../../usr/src/linux-${lx_kernelrelease} $root/lib/modules/${lx_kernelrelease}/build
185                 ln -sf ../../../usr/src/linux-${lx_kernelrelease} $root/lib/modules/${lx_kernelrelease}/source
186         fi
188         local initrdopts=
189         atstage native || initrdopts="-R $root -a $archprefix"
190         if [ -e $root/sbin/mkinitrd ]; then
191                 $root/sbin/mkinitrd $initrdopts ${lx_kernelrelease}
192                 ln -sfv initrd-${lx_kernelrelease} $root/boot/initrd
193                 $root/sbin/mkinitrd $initrdopts --minimal --network \
194                         -o $root/boot/minird-${lx_kernelrelease} ${lx_kernelrelease}
195                 ln -sfv minird-${lx_kernelrelease} $root/boot/minird
196         fi
198 hook_add postmake 5 linux_install
200 # copy useful docs
201 hook_add postmake 7 "cp -arv Documentation/{*.txt,fb,networking,power} $root$docdir/"