summaryrefslogblamecommitdiff
path: root/system/easy-kernel/APKBUILD
blob: 5700057b04e785ed9ad94bda843bf613c586f94b (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
48e0a55cf5b91d0a7e91f950b60afeedc624d7c063b481ce8a13b6362db717171daaeabfaa2de4d9e47b22ef808a6a095b240a61f2b790738d4f6b08aaac9738  linux-4.14-mc14.patch.xz
e41d9111219342ad13367902242444ecdd847a93575c3f9709d6c6a075bc650f4a15be9db1a8798435fc0a0b56d41705829bfe0d2c2d88f8d1c28931e27ef5be  ast-endianness.patch
5566ca7a3070183650688b02a52ba7d72f835929ec273cb5c38fd37671c0c8d08f96ac3b59a994b94078498fb421fca3f5c069168812d1d6cf0e0c79b6232d39  config-ppc64
e959b84a16af211e2c2e91d098ba8132e11204ae8a3f6d0823b0df169f955865dbe804fe0a6e9ed22b3079ac5e6e3609f90fea84450f405dbb704d016d70519d  config-ppc
f95ec4f3ebe937eee264f725d39a3982f44c3ae41ee5009ace0d80700444b1b02887f376389813ace170d75df248fb42bc2af414838aec431e6934dd96dd6cf7  config-x86_64
b12e4604ea4c13014e6a20e1b6c3d239be1fc19b67fc8fee3c8c48d84f18692a9469dd264ce6fad72c1c415f88c49f9836ee62e7e832c4bc22fc5d0563b8cb15  config-pmmx
ee290df60001fc4b66d2b61e51e23f9e975fa6c777c4ae701cc5803398c01e0143ee326d558c4f0da334817ee26ee100e0b0ece4dc595881c2c2dc856bcc4686  config-aarch64
e18f7818b67b9aa5acfcfc5a59836c5b115bf56f7e003bedd425403574276ad17613e8a6518f011c956c46fa71331c662eea9746a6f014c4c9c6b8f3487f3460  config-sparc64
6594f07d9d741c37ced99ce1bd9a9c10f0fb2f1a44e64da318d9350a8f6bb69b004382bd66e1a08baf8e581e7eeffb37488cfb6002ab61b0e7c8474afcae1a29  config-m68k
fdd94b9de7b374f1812dec0f9971c05f5e52177ca4a16c8071daa620c18265b38f656f528e7045a24f30af01f05e53e54546fb0a9e93773cf191866e87de505d  kernel.h"