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
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
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
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'
29 hook_add prepatch 5 linux_prepatch
33 moduledir="$root/lib/modules/${lx_kernelrelease}"
35 hook_add preconf 5 linux_preconf
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
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
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}
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' ;;
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'"
75 hook_add premake 5 linux_premake
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
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
95 : # cp -vf arch/${lx_cpu}/boot/images/uImage $root/boot/uImage-${lx_kernelrelease}
98 cp -vf arch/${lx_cpu}/boot/zImage $root/boot/vmlinuz-${lx_kernelrelease}
99 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
102 cp -vf arch/${lx_cpu}/boot/zImage $root/boot/vmlinuz-${lx_kernelrelease}
103 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
106 cp -vf arch/${lx_cpu}/boot/Image.gz $root/boot/vmlinuz-${lx_kernelrelease}
107 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
110 cp -vf arch/${lx_cpu}/boot/Image $root/boot/vmlinuz-${lx_kernelrelease}
111 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
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
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
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##*/}
132 cp -vf arch/${lx_cpu}/boot/zImage $root/boot/vmlinuz-${lx_kernelrelease}
133 ln -sfv vmlinux-${lx_kernelrelease} $root/boot/vmlinuz
136 cp -vf arch/${lx_cpu}/boot/image $root/boot/vmlinuz-${lx_kernelrelease}
137 ln -sfv vmlinuz-${lx_kernelrelease} $root/boot/vmlinuz
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/
147 # iterate over the packages that provide 3rd party linux kernel modules
148 if grep -q "CONFIG_MODULES=y" .config; then
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 ..."
154 # ugly, bash does not abort properly when we have this in a if
155 # and without it the return 1 aborts immediatly ... :-(
157 build_package $x postlinux.conf
160 if [ $error -ne 0 ]; then
161 echo_warning "Failed building $x"
164 echo "Done building $x"
169 if ! atstage rebuild && [ $module_error = 1 ]; then
170 abort "At least one of the 3rd party kernel modules failed!"
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
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
198 hook_add postmake 5 linux_install
201 hook_add postmake 7 "cp -arv Documentation/{*.txt,fb,networking,power} $root$docdir/"