summaryrefslogblamecommitdiff
path: root/system/easy-kernel/APKBUILD
blob: c840c960e7c5af5acf4cf0208962716232c9edbd (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                  
                                                                        

                                                        
           
                              
            
        
                                      


                                                         
                                       
                      
          
                                                               
                                                 
                                                    

                                                           
                              


                                                                                           
                                                                                                
                    
                  
                     
                   
                      

                      
                               
                
                        
         
                                      

           
                                                                             

                                     
                       
 
                    

                                                    


                                                                         


         
                       

                              
                                             
                                       




                                                                                                      


           



                                            


                                              
                                                                                  


                                              
                                                                                  

          

                                                 
                                                                                     




                                                                        
 
                                                              
                                                                                             



                                                          
                                                                 
                                                                       

                                                  





                                                                                   

 















                                                                                 

                                                                                

 
       
                                                             
                                                             
                                     
                                                                                        
 
 

                                                                                                                                                              






                                                                                                                                                
                                                                                                                                                         

                                                                                                                                                   
# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: Adelie Platform Group <adelie-devel@lists.adelielinux.org>
# KEEP THIS IN SYNC with the other easy-kernel packages.
_kflavour=""
_patchver=0
_pkgname=easy-kernel$_kflavour
pkgver=5.4.5
pkgrel=2
pkgname=$_pkgname-$pkgver-mc$_patchver
pkgdesc="The Linux kernel, packaged for your convenience"
url="https://kernel.org/"
arch="all"
options="!check !dbg !strip !tracedeps"
license="GPL-2.0-only"
depends=""
makedepends="bc bison flex gzip kmod lzop openssl-dev rsync xz"
provides="easy-kernel$_kflavour=$pkgver-r$pkgrel"
replaces="easy-kernel-power8 easy-kernel-power8-64k"
subpackages="$_pkgname-modules-$pkgver-mc$_patchver:modules
	$_pkgname-src-$pkgver-mc$_patchver:src
	linux-headers:headers"
_pkgmajver=${pkgver%%.*}
_pkgminver=${pkgver%.*}
source="https://cdn.kernel.org/pub/linux/kernel/v${_pkgmajver}.x/linux-${_pkgminver}.tar.xz
	https://distfiles.adelielinux.org/source/linux-${_pkgminver}-mc$_patchver-patches.tar.xz
	config-ppc64
	config-ppc
	config-x86_64
	config-pmmx
	config-aarch64
	config-sparc64
	config-m68k
	asound-syntax-fix.patch
	kernel.h
	uapi-iphdr.patch
	"
builddir="$srcdir/linux-${_pkgminver}"

prepare() {
	for patch in "$srcdir/linux-${_pkgminver}-mc$_patchver-patches"/*; do
		patch -p1 -i "$patch"
	done
	default_prepare

	cd "$srcdir"
	cp config-$CARCH linux-${_pkgminver}/.config
	cp -pr linux-${_pkgminver} linux-src
	if [ -f $HOME/kernel_key.pem ]; then
		cp $HOME/kernel_key.pem "$builddir"/certs/signing_key.pem
	fi
}

build() {
	make LDFLAGS=""

	cd "$srcdir/linux-src"
	make LDFLAGS="" modules_prepare clean
	cp "$builddir/Module.symvers" .

	# Kernel bug: crtsavres.o is required to build modules, but modules_prepare doesn't create it.
	if [ $CARCH = ppc ]; then
		cp "$builddir/arch/powerpc/lib/crtsavres.o" arch/powerpc/lib/
	fi
}

package() {
	mkdir -p "$pkgdir"/boot
	make INSTALL_PATH="$pkgdir"/boot \
		INSTALL_MOD_PATH="$pkgdir" \
		install modules_install

	if [ -f "$pkgdir"/boot/vmlinuz ]; then
		mv "$pkgdir"/boot/vmlinuz \
			"$pkgdir"/boot/vmlinuz-$pkgver-mc$_patchver-easy$_kflavour
	fi
	if [ -f "$pkgdir"/boot/vmlinux ]; then
		mv "$pkgdir"/boot/vmlinux \
			"$pkgdir"/boot/vmlinux-$pkgver-mc$_patchver-easy$_kflavour
	fi

	if [ -f "$pkgdir"/boot/System.map ]; then
		mv "$pkgdir"/boot/System.map \
			"$pkgdir"/boot/System.map-$pkgver-mc$_patchver-easy$_kflavour
	fi

	case $CARCH in
	aarch64|arm*)	make INSTALL_PATH="$pkgdir"/boot dtbs_install ;;
	esac

	install -D "$builddir"/include/config/kernel.release \
		"$pkgdir"/usr/share/kernel/easy-$pkgver-mc$_patchver$_kflavour/kernel.release
}

modules() {
	pkgdesc="Modules / device drivers for easy-kernel"
	provides="easy-kernel$_kflavour-modules=$pkgver-r$pkgrel"
	autodeps=0  # modules should not depend on src just for symlink
	mkdir -p "$subpkgdir"/lib
	mv "$pkgdir"/lib/modules "$subpkgdir"/lib/
	rm "$subpkgdir"/lib/modules/$pkgver-mc$_patchver-easy$_kflavour/build
	rm "$subpkgdir"/lib/modules/$pkgver-mc$_patchver-easy$_kflavour/source
	ln -s "../../../usr/src/linux-$pkgver-mc$_patchver$_kflavour" \
		"$subpkgdir"/lib/modules/$pkgver-mc$_patchver-easy$_kflavour/build
	ln -s "../../../usr/src/linux-$pkgver-mc$_patchver$_kflavour" \
		"$subpkgdir"/lib/modules/$pkgver-mc$_patchver-easy$_kflavour/source
}

headers() {
	pkgdesc="System headers provided by the Linux kernel"
	cd "$builddir"

	mkdir -p "$subpkgdir"/usr
	make headers_install INSTALL_HDR_PATH="$subpkgdir/usr"

	find "$subpkgdir/usr" \( -name .install -o -name ..install.cmd \) -exec \
		rm -f {} \;

	# provided by libdrm
	rm -rf "$subpkgdir"/usr/include/drm

	# needed for spl, VMware on x86, etc
	install -D -m644 "$builddir"/include/generated/utsrelease.h \
		"$subpkgdir"/usr/include/linux/utsrelease.h

	install -m644 "$srcdir"/kernel.h "$subpkgdir"/usr/include/linux/kernel.h
}

src() {
	pkgdesc="Kernel source code used to build the kernel"
	provides="easy-kernel$_kflavour-src=$pkgver-r$pkgrel"
	mkdir -p "$subpkgdir"/usr/src
	mv "$srcdir"/linux-src "$subpkgdir"/usr/src/linux-$pkgver-mc$_patchver$_kflavour
}

sha512sums="9f60f77e8ab972b9438ac648bed17551c8491d6585a5e85f694b2eaa4c623fbc61eb18419b2656b6795eac5deec0edaa04547fc6723fbda52256bd7f3486898f  linux-5.4.tar.xz
37c85fcec3bd54d586523f74cfb56db6158152cfbb407469f0da12b24e5de01cbe273ad4e59d41df75011c163922dadf2fe5e919cb6b16f74872e80c28bba1b1  linux-5.4-mc0-patches.tar.xz
8278765408dbeb860f2b125207f4e47f52c323d7b1596da426510af8a8acdf36decde26d581a902496042b8b7834f5377c4327458b2038f6a10eb653ce7208df  config-ppc64
89b7e2055586a3a71674ebe41cb3f6302b318cc24d8794a970150a1dfe236df4838c8126d6e43b951bbab2680a83b391b03b74317aa794b0371e91426c198008  config-ppc
072143e5cfb4ba60b2af8de923e5ab8c71224ffee4a97ce6f3a35223afd83e8d86faa15f1d86219d3f8cc4c1b9c2eb4bdc5b0421be7501e5b00916bf63aa0763  config-x86_64
c699a9499058a2df0692272bd15d7398745459458eb62c99813e0b4de28f359117c6c727be77d75ae08db23cb1824a3bf1f045aaadf88bc53b8267b2c0f6992f  config-pmmx
9d5ae66c32060c90074d2e217ade8dc700262bb737a46e5d7242cb24bb98b54c3d27eb19685fcef1875fbb6bd2283f2a8fda8c37940ea49fa58e891524893046  config-aarch64
67d61164e5cfebb4127ba3ef265339bfce834f9b8bca1f82d4acdd5cefb673fdb456a837c090667fd6659a28fe7a9480dbbfceac6550e24245c260561cdc6070  config-sparc64
7b240485f3adc7da4f08612d11c3001e40ab7b50cfdf492eb23aed335bcbf742c92afa39aa1764d8f85599d009a07c8dca77a1e19676d4729d232410bdd36905  config-m68k
4b2cd7dd0010aaec617c756e7587be7fad6ff0ab3dbc1ed038e3dc72c9308fc9e347c6e5296c30711d914e286aa254600586e2ad954a5da226e6e4c1522b75b5  asound-syntax-fix.patch
61dcd633d72876566b7738dd08856b26850c935b4a81ab2364711335fe01c397083160f530b3382bbc239c6a8135be6a032e93039083ec2cefdae2902429a2e0  kernel.h
6f309a18c65c991240265afd200cc79a706f5d9e5d072838a9a641ab3676a5e4c32033f9767fc723ff4c45ee462169a0f77bd7dfe63b547d521dadd073f827a7  uapi-iphdr.patch"