summaryrefslogblamecommitdiff
path: root/system/easy-kernel/APKBUILD
blob: 3d16a701aeba0f705b9ec739a06f1064fd34e42a (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=1
_pkgname=easy-kernel$_kflavour
pkgver=5.4.66
pkgrel=0
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="kernel-boot"
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-aarch64
	config-armv7
	config-m68k
	config-pmmx
	config-ppc
	config-ppc64
	config-sparc64
	config-x86_64
	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
e6a7a5933dbe638be42a1308fd64895e53fe38be1238016a560985127106356570e6ea6ba94e6fbfb5924e24728232487c91ff1affcc79af1d724b8c813f5036  linux-5.4-mc1-patches.tar.xz
8a56bb92d82d5dd734b3d68997e5dc8b916916a502626109043bb36a3b23e67f1b11d6c1954a0a12d23f4b309c34ab06cca222915237cd873e4e66be77631dee  config-aarch64
7885134ad764882a7a1a4f3893f7b4dc192c83d72b4134c1b4fa60d1c1c58c3bf27259a3c71923a774734bfc6eaa40baddb4f56090fb55e4f4f78b9c2856b44c  config-armv7
71b0d00612f9fc1c68d2f5ec5223d795ad29b9e5fe2400d4c84f7cc59cfb84027c767d2c0cce4543245267ae1666baf7e3843e42fc801100f3d465525ba0ab50  config-m68k
90f0d2327cdcddfe26f8770342a94254f2bcbba5c0999dad7531ac8214317cffe3d135198c30e3d4a706c6c1621db64864339afcb77cf4d6a25031bcf38675ba  config-pmmx
969a501bb3a16c91cd0bf1e042907f475b83e9d14a6473f1ad2507f7975130f96a2cc5832e6b60d3566f1604b2c9b968c5990044791de605ea94dd11cdcd708c  config-ppc
621328eac7d6b207c67c65915c63a3d62208e811cd3235d5f49e2dca0f53db0d0d66440e3c4e5fa22f2d2e7a240be22c9ed6238a8e8a22303f97f83b8fe5fdca  config-ppc64
c1bc6227c56d55105a97ca92db1d755caca50afe132857e5d85ac95c398c8d51fe59c65071a36c4e8a7308d6f84ffe95931da21a4f64c10fbed1c4b058d5017c  config-sparc64
297e95cb59a6a4fab2fa5038c69bb7d5af09ebccc25fc6cb3b5eb26c02bd9ea5acf43224f3237ef6efda76bb53246feaccc5bd911d5d0fe36b7f85a60edf4b9b  config-x86_64
61dcd633d72876566b7738dd08856b26850c935b4a81ab2364711335fe01c397083160f530b3382bbc239c6a8135be6a032e93039083ec2cefdae2902429a2e0  kernel.h
6f309a18c65c991240265afd200cc79a706f5d9e5d072838a9a641ab3676a5e4c32033f9767fc723ff4c45ee462169a0f77bd7dfe63b547d521dadd073f827a7  uapi-iphdr.patch"