crux-musl

Unnamed repository; edit this file 'description' to name the repository.
git clone https://codeberg.org/emmett1/crux-musl
Log | Files | Refs | README | LICENSE

Pkgfile (2142B)


      1 # Description : The Linux kernel and modules
      2 # URL         : https://kernel.org
      3 # Maintainer  : KRAK3N Team
      4 # Depends on  : elfutils bison flex perl mkinitrd
      5 
      6 name=linux
      7 version=6.12.39
      8 release=1
      9 source=(https://cdn.kernel.org/pub/${name}/kernel/v6.x/${name}-${version}.tar.xz
     10 	dotconfig)
     11 
     12 build() {
     13 	cd linux-${version}
     14 	
     15 	cp $SRC/dotconfig .config
     16 	
     17 	sed '/^CONFIG_LOCALVERSION=/d' -i .config
     18 	echo 'CONFIG_LOCALVERSION="-CRUX"' >> .config
     19 	sed '/^CONFIG_IKHEADERS=/d' -i .config
     20 	echo '# CONFIG_IKHEADERS is not set' >> .config
     21 	sed '/^# CONFIG_MODULE_COMPRESS_XZ/d' -i .config
     22 	echo 'CONFIG_MODULE_COMPRESS_XZ=y' >> .config
     23 	
     24 	make olddefconfig
     25 	
     26 	kernver=${version}$(grep CONFIG_LOCALVERSION= .config | cut -d '"' -f2)
     27 	
     28 	#make menuconfig
     29 	
     30 	make bzImage modules
     31 	make INSTALL_MOD_PATH=$PKG INSTALL_MOD_STRIP=1 modules_install
     32 	
     33 	mkdir -p $PKG/boot
     34 	
     35 	cp arch/x86/boot/bzImage $PKG/boot/vmlinuz-crux
     36 
     37 	touch $PKG/lib/modules/$kernver/current
     38 	
     39 	make clean
     40 	make prepare
     41 	
     42 	rm -rf $PKG/lib/firmware
     43 	
     44 	for file in $(ls arch); do
     45 		case $file in
     46 			x86|Kconfig) continue ;;
     47 			*) rm -fr arch/$file ;;
     48 		esac
     49 	done
     50 	
     51 	# strip down sources
     52 	# don't package the kernel in the sources directory
     53 	find . -name "*Image" -exec rm "{}" \;
     54 	find . -name "*.cmd" -exec rm -f "{}" \; 
     55 	rm -f .*.d
     56 	
     57 	rm -fr firmware ipc .config.old .version .cocciconfig \
     58 		.get_maintainer.ignore .gitattributes .gitignore .mailmap \
     59 		COPYING CREDITS MAINTAINERS README Documentation
     60 	find . -name ".gitignore" -exec rm "{}" \;
     61 	for dir in block certs crypto drivers fs init kernel lib mm net samples security sound usr virt; do
     62 		find $dir -type f \( -name "*.c" -o -name "*.h" \) -exec rm "{}" \;
     63 	done
     64 	for i in $(ls tools); do
     65 		[ "$i" = "objtool" ] || rm -fr tools/$i
     66 	done
     67 	for i in $(ls tools/objtool); do
     68 		[ "$i" = "objtool" ] || rm -fr tools/objtool/$i
     69 	done
     70 	
     71 	rm $PKG/lib/modules/$kernver/build \
     72 	   $PKG/lib/modules/$kernver/source || true
     73 	mv $SRC/linux-${version%.0} $PKG/lib/modules/$kernver/build
     74 	ln -sv build $PKG/lib/modules/$kernver/source
     75 	
     76 	# remove now broken symlinks
     77 	find -L $PKG/lib/modules/$kernver/build -type l -exec rm -f "{}" \;
     78 }