17e114
%global commit_firmware_long  83977fe3b6ef54c1d29c83b0a778d330f523441f
c7d360
#%global commit_firmware_short  %(c=%{commit_firmware_long}; echo ${c:0:7})
Pablo Greco 4c110f
%global commit_linux_long  caa653325d58e5062907ec378269e77e6018f2ee
c7d360
#%global commit_linux_short  %(c=%{commit_linux_long}; echo ${c:0:7})
17e114
17e114
%define Arch arm
17e114
%define local_version v7
17e114
%define extra_version 1
17e114
17e114
Name:           raspberrypi2
Pablo Greco e8b4c9
Version:        4.14.127
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
c7d360
Source0:        https://github.com/raspberrypi/linux/archive/%{commit_linux_long}.tar.gz
c7d360
Source1:        https://github.com/raspberrypi/firmware/archive/%{commit_firmware_long}.tar.gz
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
17e114
17e114
# Compile with SELinux but disable per default
17e114
Patch0:         bcm2709_selinux_config.patch
70b469
Patch1115:      patch-4.14.114-115.xz
e5dcd4
Patch1116:      patch-4.14.115-116.xz
cc098c
Patch1117:      patch-4.14.116-117.xz
cc098c
Patch1118:      patch-4.14.117-118.xz
cc098c
Patch1119:      patch-4.14.118-119.xz
Pablo Greco 4c110f
Patch1120:      patch-4.14.119-120.xz
Pablo Greco 4c110f
Patch1121:      patch-4.14.120-121.xz
Pablo Greco 4c110f
Patch1122:      patch-4.14.121-122.xz
Pablo Greco 4c110f
Patch1123:      patch-4.14.122-123.xz
Pablo Greco 4c110f
Patch1124:      patch-4.14.123-124.xz
Pablo Greco 4c110f
Patch1125:      patch-4.14.124-125.xz
Pablo Greco 4c110f
Patch1126:      patch-4.14.125-126.xz
Pablo Greco e8b4c9
Patch1127:      patch-4.14.126-127.xz
17e114
17e114
%description
17e114
Specific kernel and bootcode for Raspberry Pi
17e114
17e114
%package kernel
17e114
Group:          System Environment/Kernel
17e114
Summary:        The Linux kernel
17e114
Provides:       kernel = %{version}-%{release}
17e114
Requires:	coreutils
17e114
#Requires:	dracut
17e114
17e114
%description kernel
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
17e114
%package kernel-devel
17e114
Group:          System Environment/Kernel
17e114
Summary:        Development package for building kernel modules to match the kernel
17e114
Provides:       kernel-devel = %{version}-%{release}
17e114
Provides:       kernel-devel-uname-r = %{version}-%{release}
17e114
17e114
%description kernel-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
c7d360
%setup -q -n linux-%{commit_linux_long}
17e114
%patch0 -p1
52ac0d
70b469
%patch1115 -p1
e5dcd4
%patch1116 -p1
cc098c
%patch1117 -p1
cc098c
%patch1118 -p1
cc098c
%patch1119 -p1
Pablo Greco 4c110f
%patch1120 -p1
Pablo Greco 4c110f
%patch1121 -p1
Pablo Greco 4c110f
%patch1122 -p1
Pablo Greco 4c110f
%patch1123 -p1
Pablo Greco 4c110f
%patch1124 -p1
Pablo Greco 4c110f
%patch1125 -p1
Pablo Greco 4c110f
%patch1126 -p1
Pablo Greco e8b4c9
%patch1127 -p1
94eb3c
17e114
perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}/" Makefile
17e114
perl -p -i -e "s/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=/" arch/%{Arch}/configs/bcm2709_defconfig
17e114
17e114
%build
17e114
export KERNEL=kernel7
17e114
make bcm2709_defconfig
c7d360
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
17e114
cp -p -v COPYING %{buildroot}/boot/COPYING.linux
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
17e114
scripts/mkknlimg 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.
17e114
if [ -d arch/%{Arch}/mach-bcm2709/include ]; then
17e114
  cp -a --parents arch/%{Arch}/mach-bcm2709/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}
c7d360
tar -xf %{_sourcedir}/%{commit_firmware_long}.tar.gz \
c7d360
    firmware-%{commit_firmware_long}/boot/start* \
c7d360
    firmware-%{commit_firmware_long}/boot/fixup* \
c7d360
    firmware-%{commit_firmware_long}/boot/LICENCE.broadcom \
c7d360
    firmware-%{commit_firmware_long}/boot/bootcode.bin \
17e114
    --strip-components=1
17e114
popd
17e114
17e114
%files kernel
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
17e114
%doc /boot/COPYING.linux
17e114
17e114
d61e93
%posttrans kernel
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
17e114
%postun kernel
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
17e114
%files kernel-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 e8b4c9
* Mon Jun 17 2019 Pablo Greco <pgreco@centosproject.org> - 4.14.127-v7.1.el7
Pablo Greco e8b4c9
- Rebase to LTS 4.14.127
Pablo Greco e8b4c9
Pablo Greco 4c110f
* Sat Jun 15 2019 Pablo Greco <pgreco@centosproject.org> - 4.14.126-v7.1.el7
Pablo Greco 4c110f
- Rebase to LTS 4.14.126
Pablo Greco 4c110f
cc098c
* Thu May 16 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.119-v7.1.el7
cc098c
- Rebase to LTS 4.14.119
cc098c
e5dcd4
* Sat May  4 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.116-v7.1.el7
e5dcd4
- Rebase to LTS 4.14.116
e5dcd4
70b469
* Fri May  3 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.115-v7.1.el7
70b469
- Rebase to LTS 4.14.115
70b469
11c8c1
* Sat Apr 13 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.111-v7.1.el7
11c8c1
- Rebase to LTS 4.14.111
11c8c1
52ac0d
* Fri Mar 29 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.109-v7.1.el7
52ac0d
- Rebase to LTS 4.14.109
52ac0d
c7d360
* Wed Mar 13 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.106-v1.el7
c7d360
- Rebase to LTS 4.14.106
c7d360
- Change download link from github
c7d360
c7d360
* Sat Mar  2 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.104-v1.el7
94eb3c
- Rebase to LTS 4.14.104
94eb3c
- Fix postun script (https://lists.centos.org/pipermail/arm-dev/2019-March/003748.html)
94eb3c
9d9346
* Sun Feb 24 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.103-v1.el7
9d9346
- Rebase to LTS 4.14.103
9d9346
- Add README to /boot/overlays to fix userspace tool
9d9346
17e114
* Fri Feb 15 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.101-v1.el7
17e114
- Rebase to LTS 4.14.101
17e114
17e114
* Thu Jan 17 2019 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.94-v1.el7
17e114
- Rebase to LTS 4.14.94
17e114
17e114
* Sat Dec 29 2018 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.91-v1.el7
17e114
- Rebase to LTS 4.14.91
17e114
17e114
* Wed Nov 21 2018 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.82-v1.el7
17e114
- Rebase to LTS 4.14.82
17e114
17e114
* Sat Oct 20 2018 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.78-v1.el7
17e114
- Rebase to LTS 4.14.78
17e114
17e114
* Thu Oct 18 2018 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.77-v1.el7
17e114
- Rebase to LTS 4.14.77
17e114
17e114
* Wed Sep 19 2018 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.71-v1.el7
17e114
- Rebase to LTS 4.14.71
17e114
17e114
* Mon Aug 20 2018 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.65-v1.el7
17e114
- updated to 4.14.65
17e114
17e114
* Tue Aug  7 2018 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.61-v1.el7
17e114
- updated to 4.14.61
17e114
17e114
* Mon Jul 30 2018 Pablo Greco <pablo@fliagreco.com.ar> - 4.14.58-v1.el7
17e114
- updated to 4.14.58
17e114
- added kernel-devel-uname-r
17e114
17e114
* Thu Jun 28 2018 Fabian Arrotin <arrfab@centos.org> - 4.14.52-v1.el7
17e114
- updated to 4.14.52 (fixes CVE-2018-5803)
17e114
17e114
* Sat May 26 2018 Fabian Arrotin <arrfab@centos.org> - 4.14.43-v1.el7
17e114
- updated to 4.14.43
17e114
17e114
* Sun Mar 18 2018 Fabian Arrotin <arrfab@centos.org> - 4.14.27-v1.el7
17e114
- Bumped to 4.14.x LTS branch (used now by rpi foundation too)
17e114
17e114
* Thu Mar 15 2018 Fabian Arrotin <arrfab@centos.org> - 4.9.80-v1.el7
17e114
- updated to 4.9.80 LTS
17e114
- initial DTS support for rpi3 model B 
17e114
17e114
* Tue Jan 9 2018 Fabian Arrotin <arrfab@centos.org> - 4.9.75-v1.el7
17e114
- updated to 4.9.75 LTS 
17e114
17e114
* Tue Dec 19 2017 Fabian Arrotin <arrfab@centos.org> - 4.9.70-v1.el7
17e114
- updated to 4.9.70 (fixes CVE-2017-1000407 , CVE-2017-0861) 
17e114
17e114
* Thu Nov 23 2017 Fabian Arrotin <arrfab@centos.org> - 4.9.63-v1.el7
17e114
- updated to 4.9.64
17e114
17e114
* Thu Sep 14 2017 Fabian Arrotin <arrfab@centos.org> - 4.9.50-v1.el7
17e114
- updated to 4.9.50 (fixes CVE-2017-1000250)
17e114
17e114
* Tue Aug 8 2017 Fabian Arrotin <arrfab@centos.org> - 4.9.40-v1.el7
17e114
- updated to 4.9.40
17e114
17e114
* Tue Jun 6 2017 Fabian Arrotin <arrfab@centos.org> - 4.9.30-v1.el7
17e114
- updated to 4.9.30 (LTS)
17e114
17e114
* Mon Feb 27 2017 Fabian Arrotin <arrfab@centos.org> - 4.9.13-v1.el7
17e114
- update to 4.9.13 (include dccp fix, even if not in rpi config)
17e114
17e114
* Sat Feb 25 2017 Fabian Arrotin <arrfab@centos.org> - 4.9.12-v1.el7
17e114
- rebase to LTS 4.9.x (to follow rpi foundation)
17e114
17e114
* Thu Feb 23 2017 Fabian Arrotin <arrfab@centos.org> - 4.4.50-v7.1.el7
17e114
- update to 4.4.50
17e114
17e114
* Fri Jan 13 2017 Fabian Arrotin <arrfab@centos.org> - 4.4.41-v7.1.el7
17e114
- update to upstream version 4.4.41
17e114
17e114
* Mon Nov 21 2016 Fabian Arrotin <arrfab@centos.org> - 4.4.33-v7.1.el7
17e114
- update to upstream version 4.4.33
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
17e114
- 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
17e114
* 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