alicelinux

A lightweight musl + clang/llvm + libressl + busybox distro
git clone https://codeberg.org/emmett1/alicelinux
Log | Files | Refs | README | LICENSE

abuild (2306B)


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