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

	no-autoload-fb.conf
	"
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

	mkdir -p "$subpkgdir"/etc/modprobe.d
	install -m644 "$srcdir"/no-autoload-fb.conf \
		"$subpkgdir"/etc/modprobe.d/no-autoload-fb.conf
}

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
1559875f5abc07d478d7deb9a2b1eccbb2e1a37b300ed6e41b28787f3653a18d92fbff4fad74df300cf7d6c027ba4c98a65050e60ce6da8f2a48e01bbf56dee8  config-aarch64
9f5279d20fc6eaad78ab27b7fb86553e310369c8a68a2ff60c7cd9895febd3002cae748ad3a8b4fddbb62c6e829104138fc2bbca939e1c88c0bfcf7aa42809bf  config-armv7
93ca6d54fc377db12dfa7cf230d362f82d635cd05166815389ef4fb2b065f8b2bba1a78d234bd6a7445dd9b475f2c0ca01e3d4528881cfd2c10040dab174cf6a  config-m68k
5945f918daf441e1f92012b608d560b693f09d8fa36eb6c7ecb9935dec6163c5e64e04d7345b3b9c958a15d62878f33ac88a4e24d5fcc60381455842636bd1c7  config-pmmx
18841b9837ab78e5baddb3fb0c05c1fab6ef8ca99e2fa52da283b78a8c38e314039a26bcb44857c8d40c411e0825033cf094a4c3b8bcbcca084922a9f5ef9b0e  config-ppc
c61fa4613d0d75a5387d12c2f72dc8ba1e6635cc47cc9fb46253095c6417241ef59639ddf9ad220947804ef0dca921de7df5057b1d02d156bf955b213851aaff  config-ppc64
f43ae12574c81f6e0161c547eff93d70ff4686e6ec1654edbdea10447e424218a33b81c664828f82617e4ef522128f2e0460da0c9523538724048174b53a7313  config-sparc64
557db84d1f45c91ed3e3ab5d0e7100766060507ae98632b735580813974e136343500f9683bb51dc3994277716651821523b476bc5143e636ebde14aa5e67f48  config-x86_64
61dcd633d72876566b7738dd08856b26850c935b4a81ab2364711335fe01c397083160f530b3382bbc239c6a8135be6a032e93039083ec2cefdae2902429a2e0  kernel.h
6f309a18c65c991240265afd200cc79a706f5d9e5d072838a9a641ab3676a5e4c32033f9767fc723ff4c45ee462169a0f77bd7dfe63b547d521dadd073f827a7  uapi-iphdr.patch
7bb07eb22002cc48caf0cd55d17ce4097aa583e0ca4048c11c92e1519761b2ae982ffe98311543d4b0dfc991c8bc411b2e1c7be9488b6c6f19ffaa08e69e2f47  no-autoload-fb.conf"