Pablo Greco 7d1daf
%global commit_firmware_long 56e23d83c456bf36eb798fcd7c7271675e082f1b
d3adfb
#%global commit_firmware_short %(c=%{commit_firmware_long}; echo ${c:0:7})
Pablo Greco 7d1daf
%global commit_linux_long 20565c94ca877a099a3c9c5fa39a0380f3d16491
d3adfb
#%global commit_linux_short %(c=%{commit_linux_long}; echo ${c:0:7})
17e114
Pablo Greco f57fec
%bcond_without rpi4
Pablo Greco a72f47
17e114
%define Arch arm
Pablo Greco a72f47
%if %{with rpi4}
Pablo Greco a72f47
%define local_version v7l
Pablo Greco a72f47
%define bcmmodel 2711
Pablo Greco a72f47
%define ksuffix 4
Pablo Greco a72f47
%else
17e114
%define local_version v7
Pablo Greco a72f47
%define bcmmodel 2709
Pablo Greco a72f47
%endif
17e114
%define extra_version 1
17e114
17e114
Name:           raspberrypi2
Pablo Greco 7d1daf
Version:        4.19.61
17e114
Release:        %{local_version}.%{extra_version}%{?dist}
17e114
Summary:        Specific kernel and bootcode for Raspberry Pi
17e114
17e114
License:        GPLv2
17e114
URL:            https://github.com/raspberrypi/linux
d3adfb
Source0:        https://github.com/raspberrypi/linux/archive/%{commit_linux_long}.tar.gz
d3adfb
Source1:        https://github.com/raspberrypi/firmware/archive/%{commit_firmware_long}.tar.gz
Pablo Greco 9bd237
Pablo Greco 7d1daf
Patch61:        patch-4.19.60-61.xz
Pablo Greco 9bd237
17e114
BuildRequires: kmod, patch, bash, sh-utils, tar
17e114
BuildRequires: bzip2, xz, findutils, gzip, m4, perl, perl-Carp, make, diffutils, gawk
17e114
BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc
17e114
BuildRequires: net-tools, hostname, bc
17e114
BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) bison flex xz-devel
17e114
BuildRequires: audit-libs-devel
17e114
BuildRequires: pciutils-devel gettext ncurses-devel
d3adfb
BuildRequires: openssl-devel
17e114
17e114
# Compile with SELinux but disable per default
17e114
Patch0:         bcm2709_selinux_config.patch
Pablo Greco a72f47
Patch1:         bcm2711_selinux_config.patch
17e114
17e114
%description
17e114
Specific kernel and bootcode for Raspberry Pi
17e114
Pablo Greco a72f47
%package kernel%{?ksuffix}
17e114
Group:          System Environment/Kernel
17e114
Summary:        The Linux kernel
17e114
Provides:       kernel = %{version}-%{release}
17e114
Requires:	coreutils
17e114
#Requires:	dracut
17e114
Pablo Greco a72f47
%description kernel%{?ksuffix}
17e114
The kernel package contains the Linux kernel (vmlinuz), the core of any
17e114
Linux operating system.  The kernel handles the basic functions
17e114
of the operating system: memory allocation, process allocation, device
17e114
input and output, etc.
17e114
17e114
Pablo Greco a72f47
%package kernel%{?ksuffix}-devel
17e114
Group:          System Environment/Kernel
17e114
Summary:        Development package for building kernel modules to match the kernel
17e114
Provides:       kernel-devel = %{version}-%{release}
d7e7dd
Provides:       kernel-devel-uname-r = %{version}-%{release}
079705
Autoreq:        no
079705
Requires(pre):  findutils
079705
Requires:       findutils
079705
Requires:       perl-interpreter
17e114
Pablo Greco a72f47
%description kernel%{?ksuffix}-devel
17e114
This package provides kernel headers and makefiles sufficient to build modules
17e114
against the kernel package.
17e114
17e114
17e114
#%package kernel-firmware
17e114
#Group:          Development/System
17e114
#Summary:        Firmware files used by the Linux kernel
17e114
#Provides:       kernel-firmware = %{version}-%{release}
17e114
17e114
#%description kernel-firmware
17e114
#Kernel-firmware includes firmware files required for some devices to
17e114
#operate.
17e114
17e114
17e114
%package firmware
17e114
Summary:        GPU firmware for the Raspberry Pi computer
17e114
License:        Redistributable, with restrictions; see LICENSE.broadcom
17e114
Obsoletes:      grub, grubby, efibootmgr
17e114
17e114
%description firmware
17e114
This package contains the GPU firmware for the Raspberry Pi BCM2835 SOC
17e114
including the kernel bootloader.
17e114
17e114
17e114
%prep
d3adfb
%setup -q -n linux-%{commit_linux_long}
17e114
%patch0 -p1
Pablo Greco a72f47
%patch1 -p1
efb53c
Pablo Greco 7d1daf
%patch61 -p1
7ada2b
17e114
perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}/" Makefile
Pablo Greco a72f47
perl -p -i -e "s/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=/" arch/%{Arch}/configs/bcm%{bcmmodel}_defconfig
17e114
17e114
%build
17e114
export KERNEL=kernel7
Pablo Greco a72f47
make bcm%{bcmmodel}_defconfig
d3adfb
make %{?_smp_mflags} zImage modules dtbs
17e114
17e114
%install
17e114
# kernel
17e114
mkdir -p %{buildroot}/boot/overlays/
17e114
mkdir -p %{buildroot}/usr/share/%{name}-kernel/%{version}-%{release}/boot/overlays
d3adfb
cp -p -v COPYING %{buildroot}/boot/COPYING.linux-4.19
17e114
cp -p -v arch/%{Arch}/boot/dts/*.dtb %{buildroot}/usr/share/%{name}-kernel/%{version}-%{release}/boot
17e114
cp -p -v arch/%{Arch}/boot/dts/overlays/*.dtb* %{buildroot}/usr/share/%{name}-kernel/%{version}-%{release}/boot/overlays
17e114
cp -p -v arch/%{Arch}/boot/dts/overlays/README %{buildroot}/usr/share/%{name}-kernel/%{version}-%{release}/boot/overlays
d3adfb
#scripts/mkknlimg arch/%{Arch}/boot/zImage %{buildroot}/boot/kernel-%{version}-%{release}.img
d3adfb
cp -p -v arch/%{Arch}/boot/zImage %{buildroot}/boot/kernel-%{version}-%{release}.img
17e114
make INSTALL_MOD_PATH=%{buildroot} modules_install
17e114
17e114
# kernel-devel
17e114
DevelDir=/usr/src/kernels/%{version}-%{release}
17e114
mkdir -p %{buildroot}$DevelDir
17e114
# first copy everything
17e114
cp -p -v Module.symvers System.map %{buildroot}$DevelDir
17e114
cp --parents `find  -type f -name "Makefile*" -o -name "Kconfig*"` %{buildroot}$DevelDir
17e114
# then drop all but the needed Makefiles/Kconfig files
17e114
rm -rf %{buildroot}$DevelDir/Documentation
17e114
rm -rf %{buildroot}$DevelDir/scripts
17e114
rm -rf %{buildroot}$DevelDir/include
17e114
cp .config %{buildroot}$DevelDir
17e114
cp -a scripts %{buildroot}$DevelDir
17e114
cp -a include %{buildroot}$DevelDir
17e114
17e114
if [ -d arch/%{Arch}/scripts ]; then
17e114
  cp -a arch/%{Arch}/scripts %{buildroot}$DevelDir/arch/%{_arch} || :
17e114
fi
17e114
if [ -f arch/%{Arch}/*lds ]; then
17e114
  cp -a arch/%{Arch}/*lds %{buildroot}$DevelDir/arch/%{_arch}/ || :
17e114
fi
17e114
rm -f %{buildroot}$DevelDir/scripts/*.o
17e114
rm -f %{buildroot}$DevelDir/scripts/*/*.o
17e114
cp -a --parents arch/%{Arch}/include %{buildroot}$DevelDir
17e114
# include the machine specific headers for ARM variants, if available.
Pablo Greco a72f47
if [ -d arch/%{Arch}/mach-bcm%{bcmmodel}/include ]; then
Pablo Greco a72f47
  cp -a --parents arch/%{Arch}/mach-bcm%{bcmmodel}/include %{buildroot}$DevelDir
17e114
fi
17e114
cp include/generated/uapi/linux/version.h %{buildroot}$DevelDir/include/linux
17e114
touch -r %{buildroot}$DevelDir/Makefile %{buildroot}$DevelDir/include/linux/version.h
17e114
ln -T -s $DevelDir %{buildroot}/lib/modules/%{version}-%{release}/build --force
17e114
ln -T -s build %{buildroot}/lib/modules/%{version}-%{release}/source --force
17e114
17e114
# kernel-firmware
17e114
#rm .config
17e114
#make INSTALL_FW_PATH=%{buildroot}/lib/firmware firmware_install
17e114
17e114
# firmware
17e114
#   precompiled GPU firmware and bootloader
17e114
pushd %{buildroot}
d3adfb
tar -xf %{_sourcedir}/%{commit_firmware_long}.tar.gz \
d3adfb
    firmware-%{commit_firmware_long}/boot/start* \
d3adfb
    firmware-%{commit_firmware_long}/boot/fixup* \
d3adfb
    firmware-%{commit_firmware_long}/boot/LICENCE.broadcom \
d3adfb
    firmware-%{commit_firmware_long}/boot/bootcode.bin \
17e114
    --strip-components=1
17e114
popd
17e114
Pablo Greco a72f47
%files kernel%{?ksuffix}
17e114
%defattr(-,root,root,-)
17e114
/lib/modules/%{version}-%{release}
17e114
/usr/share/%{name}-kernel/%{version}-%{release}
17e114
/usr/share/%{name}-kernel/%{version}-%{release}/boot
17e114
/usr/share/%{name}-kernel/%{version}-%{release}/boot/*.dtb
17e114
/boot/overlays/
17e114
/usr/share/%{name}-kernel/%{version}-%{release}/boot/overlays/*
17e114
%attr(0755,root,root) /boot/kernel-%{version}-%{release}.img
d3adfb
%doc /boot/COPYING.linux-4.19
17e114
17e114
Pablo Greco a72f47
%posttrans kernel%{?ksuffix}
17e114
cp /boot/kernel-%{version}-%{release}.img /boot/kernel7.img
17e114
cp /usr/share/%{name}-kernel/%{version}-%{release}/boot/*.dtb /boot/
17e114
cp /usr/share/%{name}-kernel/%{version}-%{release}/boot/overlays/*.dtb* /boot/overlays/
17e114
cp /usr/share/%{name}-kernel/%{version}-%{release}/boot/overlays/README /boot/overlays/
17e114
#/usr/sbin/dracut /boot/initramfs-%{version}-%{release}.img %{version}-%{release}
17e114
Pablo Greco a72f47
%postun kernel%{?ksuffix}
94eb3c
cp $(ls -1 /boot/kernel-*-*|sort -V|tail -1) /boot/kernel7.img
94eb3c
cp $(ls -1d /usr/share/%{name}-kernel/*-*/|sort -V|tail -1)/boot/*.dtb /boot/
94eb3c
cp $(ls -1d /usr/share/%{name}-kernel/*-*/|sort -V|tail -1)/boot/overlays/*.dtb* /boot/overlays/
94eb3c
cp $(ls -1d /usr/share/%{name}-kernel/*-*/|sort -V|tail -1)/boot/overlays/README /boot/overlays/
17e114
d3adfb
Pablo Greco a72f47
%files kernel%{?ksuffix}-devel
17e114
%defattr(-,root,root)
17e114
/usr/src/kernels/%{version}-%{release}
17e114
17e114
17e114
#%files kernel-firmware
17e114
#%defattr(-,root,root)
17e114
#/lib/firmware/*
17e114
17e114
17e114
%files firmware
17e114
%defattr(-,root,root,-)
17e114
/boot/bootcode.bin
17e114
/boot/fixup*
17e114
/boot/start*
17e114
%doc /boot/LICENCE.broadcom
17e114
17e114
%changelog
Pablo Greco 7d1daf
* Sat Jul 27 2019 Pablo Greco <pgreco@centosproject.org> - 4.19.61-v7.1.el7
Pablo Greco a72f47
- Conditional to build kernel for rpi4
Pablo Greco 7d1daf
- Update to version v4.19.61
Pablo Greco a72f47
Pablo Greco fe11e4
* Tue Jun 25 2019 Pablo Greco <pgreco@centosproject.org> - 4.19.56-v7.1.el7
Pablo Greco fe11e4
- Update to version v4.19.56
Pablo Greco fe11e4
Pablo Greco 1bbdc0
* Mon Jun 17 2019 Pablo Greco <pgreco@centosproject.org> - 4.19.52-v7.1.el7
Pablo Greco 1bbdc0
- Update to version v4.19.52
Pablo Greco 1bbdc0
Pablo Greco 9bd237
* Sat Jun 15 2019 Pablo Greco <pgreco@centosproject.org> - 4.19.51-v7.1.el7
Pablo Greco 9bd237
- Update to version v4.19.51
Pablo Greco 9bd237
498b2c
* Thu May 16 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.19.43-v7.1.el7
498b2c
- Update to version v4.19.43
498b2c
419821
* Mon May  6 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.19.40-v7.1.el7
419821
- Update to version v4.19.40
419821
606dbd
* Sat May  4 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.19.39-v7.1.el7
606dbd
- Update to version 4.19.39
606dbd
7ada2b
* Fri May  3 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.19.38-v7.1.el7
7ada2b
- Update to version 4.19.38
7ada2b
f8f50e
* Sat Apr 13 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.19.34-v7.1.el7
f8f50e
- Update to version 4.19.34
f8f50e
- Avoid devel subpkg from pulling unnecessary deps
f8f50e
1a1d89
* Fri Mar 29 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.19.32-v7.1.el7
1a1d89
- Update to version 4.19.32
1a1d89
7cb696
* Sat Mar 16 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.19.29-v7.1.el7
7cb696
- Update to version 4.19.29
7cb696
40bfa9
* Wed Mar 13 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.19.28-v7.1.el7
d7e7dd
- readded kernel-devel-uname-r, fixed back in 4.14.58
b1eb58
- Update to version 4.19.28
d7e7dd
d3adfb
* Sat Mar 09 2019 Jacco Ligthart <jacco@redsleeve.org> - 4.19.27-v7.1.el7
d3adfb
- update to version 4.19.27
d3adfb
- added 'sort -V' to the scripts
d3adfb
- changed download location from 'tarball' to 'archive'
d3adfb
- moves from 'post' script to 'posttrans'
d3adfb
- moved 'COPYING.linux' to 'COPYING.linux-4.19'
d3adfb
- added 'README' to the overlays dir
17e114
d3adfb
* Thu Dec 20 2018 Jacco Ligthart <jacco@redsleeve.org> - 4.14.89-v7.1.el7
d3adfb
- update to version 4.14.89
17e114
d3adfb
* Wed Oct 10 2018 Jacco Ligthart <jacco@redsleeve.org> - 4.14.74-v7.1.el7
d3adfb
- update to version 4.14.74
17e114
d3adfb
* Fri Aug 10 2018 Jacco Ligthart <jacco@redsleeve.org> - 4.14.61-v7.1.el7
d3adfb
- update to version 4.14.61
17e114
d3adfb
* Fri Jun 15 2018 Jacco Ligthart <jacco@redsleeve.org> - 4.14.49-v7.1.el7
d3adfb
- update to version 4.14.49
17e114
d3adfb
* Thu May 24 2018 Jacco Ligthart <jacco@redsleeve.org> - 4.14.42-v7.1.el7
d3adfb
- update to version 4.14.42
d3adfb
- stop makeing the kernel-firmware subpackage
17e114
d3adfb
* Fri Mar 16 2018 Jacco Ligthart <jacco@redsleeve.org> - 4.9.80-v7.2.el7
d3adfb
- update to latest git for raspberry pi 3 B+ support
17e114
d3adfb
* Wed Feb 28 2018 Jacco Ligthart <jacco@redsleeve.org> - 4.9.80-v7.1.el7
e0ef85
- update to version 4.9.80, probably the last in the 4.9 series
17e114
d3adfb
* Sat Jan 27 2018 Jacco Ligthart <jacco@redsleeve.org> - 4.9.78-v7.1.el7
d3adfb
- update to version 4.9.78
17e114
d3adfb
* Sun Dec 17 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.69-v7.1.el7
d3adfb
- update to version 4.9.69
17e114
d3adfb
* Mon Nov 27 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.65-v7.1.el7
d3adfb
- update to version 4.9.65
17e114
d3adfb
* Sun Oct 29 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.59-v7.1.el7
d3adfb
- update to version 4.9.59
17e114
d3adfb
* Mon Oct 02 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.52-v7.1.el7
d3adfb
- update to version 4.9.52
17e114
d3adfb
* Thu Aug 17 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.43-v7.1.el7
d3adfb
- update to version 4.9.43
17e114
d3adfb
* Sat Jul 22 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.39-v7.1.el7
d3adfb
- update to version 4.9.39
17e114
d3adfb
* Sat Jul 01 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.35-v7.1.el7
d3adfb
- update to version 4.9.35
17e114
d3adfb
* Mon Jun 19 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.33-v7.1.el7
d3adfb
- update to version 4.9.33
17e114
d3adfb
* Mon Jun 05 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.30-v7.1.el7
d3adfb
- update to version 4.9.30
17e114
d3adfb
* Fri May 12 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.27-v7.1.el7
d3adfb
- update to version 4.9.27
17e114
d3adfb
* Wed Apr 19 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.23-v7.1.el7
d3adfb
- update to version 4.9.23
17e114
d3adfb
* Thu Mar 30 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.19-v7.1.el7
d3adfb
- update to version 4.9.19
17e114
d3adfb
* Wed Mar 15 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.14-v7.1.el7
d3adfb
- update tp version 4.9.14
17e114
d3adfb
* Mon Feb 27 2017 Jacco Ligthart <jacco@redsleeve.org> - 4.9.13-v7.1.el7
d3adfb
- update to version 4.9.13
17e114
d3adfb
* Sat Dec 24 2016 Jacco Ligthart <jacco@redsleeve.org> - 4.4.39-v7.1.el7
d3adfb
- update to version 4.4.39
17e114
d3adfb
* Wed Nov 16 2016 Jacco Ligthart <jacco@redsleeve.org> - 4.4.32-v7.1.el7
d3adfb
- update to version 4.4.32
17e114
17e114
* Fri Oct 21 2016 Jacco Ligthart <jacco@redsleeve.org> - 4.4.26-v7.1.el7
17e114
- update to version 4.4.26 which includes a fix for CVE-2016-5195
17e114
17e114
* Tue Sep 27 2016 Jacco Ligthart <jacco@redsleeve.org> - 4.4.21-v7.3.el7
17e114
- changed versioning scheme, added EXTRAVERSION to makefile
17e114
- lost dificult linking in /lib/modules
17e114
- added all dirs under /usr/share/%{name}-kernel/ to the %files
17e114
17e114
* Sat Sep 24 2016 Jacco Ligthart <jacco@redsleeve.org> - 4.4.21-2
17e114
- removed dracut I don't see why we need a initramfs
17e114
- fixed the preun scripts. they blocked uninstall
17e114
- removed -b0 from %setup, the source was extracted twice
17e114
17e114
* Sat Sep 24 2016 Jacco Ligthart <jacco@redsleeve.org> - 4.4.21-1
17e114
- updated to 4.4.21
17e114
- moved the Requires: to the kernel subpackage
17e114
- added /boot/overlays to the %files
17e114
17e114
* Mon Jul 11 2016 Fabian Arrotin <arrfab@centos.org> - 4.4.14-2
17e114
- Fixed the dracut call for %{release}
17e114
17e114
* Thu Jul 7 2016 Fabian Arrotin <arrfab@centos.org>
17e114
- upgrade to kernel 4.4.14
e0ef85
- Moved some *dtb* files to /usr/share/raspberrypi2-kernel/boot/
17e114
- Using %post to put those in /boot/*
17e114
- generating initramfs in %post
17e114
17e114
* Fri Jun 17 2016 Johnny Hughes <johnny@centos.org>
17e114
- upgrade to kernel 4.4.13
17e114
- modified to copy *.dtb* to /boot/overlays/
17e114
17e114
* Sun Mar 13 2016 Fabian Arrotin <arrfab@centos.org>
17e114
- Added kmod/libselinux as BuildRequires (for the depmod part)
17e114
- Added audit support in the bcm2709_selinux_config.patch
17e114
17e114
* Fri Mar 11 2016 Henrik Andersson <henrik.4e@gmail.com>
17e114
- updated to 4.1.19
17e114
- build kernel from source instead of using binaries from firmware
17e114
- use only GPU firmware and bootloader from firmware
17e114
17e114
* Mon Jan 25 2016 Fabian Arrotin <arrfab@centos.org>
17e114
- updated to 4.1.16
17e114
- contains the patch fro CVE-2016-0728
17e114
17e114
* Thu Jan 21 2016 Fabian Arrotin <arrfab@centos.org>
17e114
- updated to 4.1.15
17e114
e0ef85
* Thu Nov 26 2015 Fabian Arrotin <arrfab@centos.org>
17e114
- Added %{?dist} rpm macro in the name
17e114
17e114
* Sat Oct 24 2015 Jacco Ligthart <jacco@redsleeve.org>
17e114
- updated to 4.1.11
17e114
17e114
* Fri Sep 04 2015 Jacco Ligthart <jacco@redsleeve.org>
17e114
- updated to 4.1.6
17e114
17e114
* Fri Jun 26 2015 Jacco Ligthart <jacco@redsleeve.org>
17e114
- updated to 4.0.6
17e114
17e114
* Sun May 10 2015 Jacco Ligthart <jacco@redsleeve.org>
17e114
- updated to 3.18.13
17e114
17e114
* Sun Mar 29 2015 Jacco Ligthart <jacco@redsleeve.org>
17e114
- updated to 3.18.10
17e114
- fixed a bcm2708 vs. bcm2709 issue with include dirs
17e114
17e114
* Sat Mar 14 2015 Jacco Ligthart <jacco@redsleeve.org>
17e114
- updated to 3.18.9
17e114
17e114
* Fri Feb 20 2015 Jacco Ligthart <jacco@redsleeve.org>
17e114
- converted for raspberrypi model2 (kernel7 / version *-v7+ )
17e114
17e114
* Fri Feb 20 2015 Jacco Ligthart <jacco@redsleeve.org>
17e114
- update to version 3.18 (coming from 3.12)
17e114
- require coreutils