summaryrefslogblamecommitdiff
path: root/system/easy-kernel/APKBUILD
blob: ac5c1fff8f8ede957182633c69cc2de5fbe171f3 (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.138
pkgrel=15
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-patches.tar.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() {
	for patch in "$srcdir/linux-${_pkgminver}-mc$pkgrel-patches"/*; do
		patch -p1 -i "$patch"
	done
	default_prepare

	cd "$srcdir"
	cp config-$CARCH linux-${_pkgminver}/.config
	cp -pr linux-${_pkgminver} linux-src
}

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$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
f81ad5ed82bc1141b97be22c3767d3c1984bed50ff847f3596609bdece05a70ba8e73fb7d5aa3163898b7e77c8b5eb4d8be4f2e9f84f17579f8b70c96f465317  linux-4.14-mc15-patches.tar.xz
e41d9111219342ad13367902242444ecdd847a93575c3f9709d6c6a075bc650f4a15be9db1a8798435fc0a0b56d41705829bfe0d2c2d88f8d1c28931e27ef5be  ast-endianness.patch
55f0e4007f255670fc7a462c311020d45ea33d479776015dd824134be1bf5d96bd6c95ec663126a368388df6a8c52cb2c477487b18899e90d6b85c0639ecf0ab  config-ppc64
8fd86dd4c753ce21a28f7ac58728e55eccc3bdf7cc9d5249053cf095e75337dcc031837256af28260a1a507140a3e13e0fa0b4131864e127d5ed2700c04c683a  config-ppc
6ae5ebd56e5743c9fc081023d89d732b13f26ef5db33de5754fea0c4f76234f5bbf62e67b8a9913c966e3d6d8972e9f303539324642907b82e91a8aa19fa38c3  config-x86_64
4d9796985ee7e031bffb4d35260e21c1cfee3f49da1afe6587cfd4f9b70b7ba2e7ac148b98640277afb062c650e39b26d04cd200601c99787ec40470d7432dd5  config-pmmx
378120b61b6809a44a5bde9049b2f90345df8fe93caf2091887a5278bcd7bf002ba57565b73ec618e6029543f251d12136ef5094b594a78be652a2273ecc31b3  config-aarch64
93456f06225ac67edd697dfa46e4ec38293e8da4dd67fe6cd3f4a7f961956fe35e27d506ef3481f2a49ad73f2b736a88b37ceaa17e9e8c94f99346268bc1ea9d  config-sparc64
9be2ec1b09cf233c4259fb1dd1a9afa89b873ebc51bea9f15443180cba1968a905c6333cb2ed5a7976120a67e1b9848cd0aaaf7596a88f2c388328c48a487134  config-m68k
fdd94b9de7b374f1812dec0f9971c05f5e52177ca4a16c8071daa620c18265b38f656f528e7045a24f30af01f05e53e54546fb0a9e93773cf191866e87de505d  kernel.h"