summaryrefslogblamecommitdiff
path: root/system/easy-kernel/APKBUILD
blob: d6eeb5c475068f46f781ce0b5e90a1c5966a8bca (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}"

# secfixes: linux_kernel
#   4.14.0-r0:
#     - CVE-2017-1000410
#   4.14.8-r2:
#     - CVE-2018-14619
#     - CVE-2017-1000407
#   4.14.33-r6:
#     - CVE-2018-1068
#     - CVE-2018-1130
#     - CVE-2018-8781
#   4.14.48-r8:
#     - CVE-2018-1120
#     - CVE-2018-10021
#     - CVE-2018-10940
#     - CVE-2018-11508
#     - CVE-2018-1000204
#   4.14.56-r9:
#     - CVE-2018-1118
#     - CVE-2018-10853
#     - CVE-2018-10878
#     - CVE-2018-10879
#     - CVE-2018-10880
#     - CVE-2018-10881
#     - CVE-2018-11412
#     - CVE-2018-12904
#     - CVE-2018-13406
#     - CVE-2018-16276
#     - CVE-2018-20856
#   4.14.76-r11:
#     - CVE-2017-18216
#     - CVE-2017-18224
#     - CVE-2018-5390
#     - CVE-2018-5391
#     - CVE-2018-6554
#     - CVE-2018-6555
#     - CVE-2018-15572
#     - CVE-2018-15594
#     - CVE-2018-16658
#     - CVE-2018-16871
#     - CVE-2018-18021
#     - CVE-2018-20511
#   4.14.127-r14:
#     - CVE-2018-18281
#     - CVE-2018-18397
#     - CVE-2018-18690
#     - CVE-2018-19854
#     - CVE-2018-20169
#     - CVE-2018-20784
#     - CVE-2018-20836
#     - CVE-2018-1000026
#     - CVE-2019-6974
#     - CVE-2019-10638
#     - CVE-2019-10639
#     - CVE-2019-11486
#     - CVE-2019-11599
#     - CVE-2019-11810
#     - CVE-2019-11815
#     - CVE-2019-11884
#     - CVE-2019-12818
#     - CVE-2019-12819
#   4.14.138-mc15:
#     - CVE-2018-20855
#     - CVE-2019-1125
#     - CVE-2019-3900
#     - CVE-2019-13272
#     - CVE-2019-13631
#     - CVE-2019-13648
#     - CVE-2019-14283
#     - CVE-2019-14284

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 "$startdir"/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
169bfc8cf7463e22e67477907ba2f02593178db8a04d1d0f4f52d834087cbd3d504328960849e90532e95d16dc7f29fdbcc55d231696dcd6dbb0df4b0a337ce6  config-ppc64
d939115ee69713efd4ac47fa75e30536fbefe90dcfdfcba38ec31ed97afe53a4cdacb4750946bf2841ddd5d8d1fa34ec2c6c0207a9efef5110a23cae67ff34c8  config-ppc
dbda29dd1dba54713d27e73e25b67fcd54ca9af1e18b50fd174628dccf15af7a8a604bf795d8da381f9c299889ce5cfb8fd3cefddf7cbbbaad78fb028c04facb  config-x86_64
85aef081cefb13ab319e5fbccc47b90a439dbb7be00895681569420339dc34c55e42278c471ca15144e84e6fc8a57a3a0899c2caee7e00dab9e369a5dea90e3b  config-pmmx
378120b61b6809a44a5bde9049b2f90345df8fe93caf2091887a5278bcd7bf002ba57565b73ec618e6029543f251d12136ef5094b594a78be652a2273ecc31b3  config-aarch64
93456f06225ac67edd697dfa46e4ec38293e8da4dd67fe6cd3f4a7f961956fe35e27d506ef3481f2a49ad73f2b736a88b37ceaa17e9e8c94f99346268bc1ea9d  config-sparc64
9be2ec1b09cf233c4259fb1dd1a9afa89b873ebc51bea9f15443180cba1968a905c6333cb2ed5a7976120a67e1b9848cd0aaaf7596a88f2c388328c48a487134  config-m68k
fdd94b9de7b374f1812dec0f9971c05f5e52177ca4a16c8071daa620c18265b38f656f528e7045a24f30af01f05e53e54546fb0a9e93773cf191866e87de505d  kernel.h"