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


                                                        

               
                                   


                                                         
                                       
                      
          
                                              
                                                 
                                                        

                                           



                                                                                           
                            
                    
                  
                     
                   
                      

                      
                
         
                                      

           
                    
                                                                                                
                                                                      
                       
                    

                                                    



                      
                       

                              
                                             
                                       




                                                                                                      







                                            


                                              
                                                                               


                                              
                                                                               

          







                                                                                  
 
                                                              
                                                                                          



                                                          
                                                                 
                                                                       

                                                  





                                                                                

 


                                                             
                                                           












                                                                                 

                                                             

 
       
                                                             
                                                             
                                     
                                                                                     
 
 
                                                                                                                                                               
                                                                                                                                                          
                                                                                                                                                      

                                                                                                                                              


                                                                                                                                                


                                                                                                                                                
# 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=""
_pkgname=easy-kernel$_kflavour
pkgver=4.14.127
pkgrel=14
pkgname=$_pkgname-$pkgver-mc$pkgrel
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 gzip kmod lzop openssl-dev xz"
provides="easy-kernel$_kflavour=$pkgver-r$pkgrel"
subpackages="$_pkgname-modules-$pkgver-mc$pkgrel:modules
	$_pkgname-src-$pkgver-mc$pkgrel: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$pkgrel.patch.xz
	ast-endianness.patch
	config-ppc64
	config-ppc
	config-x86_64
	config-pmmx
	config-aarch64
	config-sparc64
	config-m68k
	kernel.h
	"
builddir="$srcdir/linux-${_pkgminver}"

prepare() {
	cd "$srcdir"
	cat linux-${_pkgminver}-mc$pkgrel.patch.xz | unxz -> linux-${_pkgminver}-mc$pkgrel.patch
	patch -Np1 -d "$builddir" <linux-${_pkgminver}-mc$pkgrel.patch
	default_prepare
	cd "$srcdir"
	cp config-$CARCH linux-${_pkgminver}/.config
	cp -pr linux-${_pkgminver} linux-src
}

build() {
	cd "$builddir"
	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() {
	cd "$builddir"
	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$pkgrel-easy$_kflavour
	fi
	if [ -f "$pkgdir"/boot/vmlinux ]; then
		mv "$pkgdir"/boot/vmlinux \
			"$pkgdir"/boot/vmlinux-$pkgver-mc$pkgrel-easy$_kflavour
	fi

	if [ -f "$pkgdir"/boot/System.map ]; then
		mv "$pkgdir"/boot/System.map \
			"$pkgdir"/boot/System.map-$pkgver-mc$pkgrel-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$pkgrel$_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$pkgrel-easy$_kflavour/build
	rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source
	ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \
		"$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build
	ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \
		"$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source
}

headers() {
	pkgdesc="System headers provided by the Linux kernel"
	cd "$builddir"
	patch -Np1 -i "$srcdir"/../revert-broken-uapi.patch

	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

	cp "$srcdir"/kernel.h "$subpkgdir"/usr/include/linux/
}

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$pkgrel$_kflavour
}

sha512sums="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8  linux-4.14.tar.xz
61eda169a4bd195202f1cf82a6d7c8ff10e420cfa1ad67ab8346ed868e154196e9c13002bf4849d6afe6d7115bcd139c6bb395791446ec2f69aa2adebfdf675f  linux-4.14-mc14.patch.xz
e41d9111219342ad13367902242444ecdd847a93575c3f9709d6c6a075bc650f4a15be9db1a8798435fc0a0b56d41705829bfe0d2c2d88f8d1c28931e27ef5be  ast-endianness.patch
5566ca7a3070183650688b02a52ba7d72f835929ec273cb5c38fd37671c0c8d08f96ac3b59a994b94078498fb421fca3f5c069168812d1d6cf0e0c79b6232d39  config-ppc64
e959b84a16af211e2c2e91d098ba8132e11204ae8a3f6d0823b0df169f955865dbe804fe0a6e9ed22b3079ac5e6e3609f90fea84450f405dbb704d016d70519d  config-ppc
9cb39964bbeadd2406e8d25b76f9dccede048a73f79164fdd3d235625932b71f826d568c7532ebb6a3dd8724e514b9be97ed070b261a78dd9ce9311def76e622  config-x86_64
db716a4ffa6d33cddfef43fb882009f44c5e08188576a7ee8893b6402eb1d29a0694d561634f119fe66b9db3047b4b1f53cd6c05835217f4aef33ddb729dbafb  config-pmmx
39539f67496ab23397e46f6c8ff618d2fe5e057bd17b577fc59c60061cda6b71c5ddbef293287d00a8c37994f7c20e532b69a7493ee3fb3e13a4b8f1874b2c1f  config-aarch64
e18f7818b67b9aa5acfcfc5a59836c5b115bf56f7e003bedd425403574276ad17613e8a6518f011c956c46fa71331c662eea9746a6f014c4c9c6b8f3487f3460  config-sparc64
6594f07d9d741c37ced99ce1bd9a9c10f0fb2f1a44e64da318d9350a8f6bb69b004382bd66e1a08baf8e581e7eeffb37488cfb6002ab61b0e7c8474afcae1a29  config-m68k
fdd94b9de7b374f1812dec0f9971c05f5e52177ca4a16c8071daa620c18265b38f656f528e7045a24f30af01f05e53e54546fb0a9e93773cf191866e87de505d  kernel.h"