summaryrefslogblamecommitdiff
path: root/system/easy-kernel/APKBUILD
blob: f073533f5c76c0faa8e32c2034d57495184478c3 (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=0
_pkgname=easy-kernel$_kflavour
pkgver=5.4.5
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=""
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$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$_patchver-patches.tar.xz
	config-ppc64
	config-ppc
	config-x86_64
	config-pmmx
	config-aarch64
	config-sparc64
	config-m68k
	"
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
}

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"

	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
}

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="9f60f77e8ab972b9438ac648bed17551c8491d6585a5e85f694b2eaa4c623fbc61eb18419b2656b6795eac5deec0edaa04547fc6723fbda52256bd7f3486898f  linux-5.4.tar.xz
37c85fcec3bd54d586523f74cfb56db6158152cfbb407469f0da12b24e5de01cbe273ad4e59d41df75011c163922dadf2fe5e919cb6b16f74872e80c28bba1b1  linux-5.4-mc0-patches.tar.xz
2fc58bb455ba099b98d02362446947110e1cb6a17cceaff3c47ec444ed737db5b74829bf5d6d6647cb2ae266a41c24a23222823fc89b7e36c639f2af867ec44b  config-ppc64
0c6f32f9b6c16cfaa89906b9d929bd69994c9a3b4c426105c9152a41ed6e41b56157705eaacc32468e9e5d9ff81516b2ac59979aa1cb8d9d41ea8a230bfb0cb1  config-ppc
1934d9a0ccd34032e63c29e65657feb3119e5f53c92e4829932b6c1f2be4cb3809866dd1041f8209b72deae6fa3a3048dd148ec98d40403d23f4468a936be5da  config-x86_64
86250017ec548637459aa762b2c5008869e8e8f27cd39406908fa9d5bb4a30d17970fbff2d525dcd634db99d75c6de6fc8f5c2b9077c491923c46c2cea67f0fd  config-pmmx
b05add19803d183e150d717e9da418316a0c5848bef556a23ba0638618b9996df4d4f6756ce298cb0a79c8137c8b89ce627b8de005e3205a9214be30bee3d22f  config-aarch64
d818e6461392bbc125d93d7b249a597c4fe4bef13a9516a34ba0b6177af06ca72dfe6c7fccddfbbab0c9f108c03e74d3f9617062df9348b891459f5958329da6  config-sparc64
4ba479db8d6e25e9cec4aa24c86e66831d84d73bb805e367d4ef91d172264eb0bf1ec2143a3c648fb72466741c0f0256fecc0d08b5f4a6d9f7cfe4f6f0580193  config-m68k"