# Ignore double dash in version for rpmbuild %define _wrong_version_format_terminate_build 0 %define config_name tizen_bcm2711_defconfig %ifarch aarch64 %define buildarch arm64 %else %define buildarch arm %endif %define target_board rpi4 %define variant %{buildarch}-%{target_board} Name: rpi4-linux-kernel Summary: The Linux Kernel for Raspberry Pi4 Version: 5.10.95 Release: 0 License: GPL-2.0 ExclusiveArch: %{arm} aarch64 Group: System/Kernel Vendor: The Linux Community URL: https://www.kernel.org Source0: linux-kernel-%{version}.tar.xz BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root %define fullVersion %{version}-%{variant} BuildRequires: bc BuildRequires: module-init-tools BuildRequires: bison BuildRequires: flex BuildRequires: libopenssl1.1-devel BuildRequires: rsync %description The Linux Kernel, the operating system core itself %package -n %{variant}-linux-kernel License: GPL-2.0 Summary: Tizen kernel for %{target_board} Group: System/Kernel Provides: %{variant}-kernel-uname-r = %{fullVersion} Provides: linux-kernel = %{version}-%{release} %description -n %{variant}-linux-kernel This package contains the Linux kernel for Tizen (arch %{buildarch}, target board %{target_board}) %package -n %{variant}-linux-kernel-modules Summary: Kernel modules for %{target_board} Group: System/Kernel Provides: %{variant}-kernel-modules = %{fullVersion} Provides: %{variant}-kernel-modules-uname-r = %{fullVersion} %description -n %{variant}-linux-kernel-modules Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board} %package -n %{variant}-linux-kernel-devel License: GPL-2.0 Summary: Linux support kernel map and etc for other packages Group: System/Kernel Provides: %{variant}-kernel-devel = %{fullVersion} Provides: %{variant}-kernel-devel-uname-r = %{fullVersion} %description -n %{variant}-linux-kernel-devel This package provides kernel map and etc information. %package -n %{variant}-linux-kernel-headers License: GPL-2.0 Summary: Linux support headers for userspace development Group: System/Kernel Provides: kernel-headers-tizen-dev %description -n %{variant}-linux-kernel-headers This package provides userspaces headers from the Linux kernel. These headers are used by the installed headers for GNU glibc and other system libraries. %prep %setup -q %build %{?asan:/usr/bin/gcc-unforce-options} %{?ubsan:/usr/bin/gcc-unforce-options} # 0. extract uapi headers make headers_check %{?_smp_mflags} make headers_install %{?_smp_mflags} # 1-1. Set config file make %{config_name} %{?_smp_mflags} if ! grep -q "^CONFIG_LOCALVERSION=\"-%{variant}" .config; then ./scripts/config --set-str CONFIG_LOCALVERSION "-%{variant}$(eval $(grep ^CONFIG_LOCALVERSION= .config); echo $CONFIG_LOCALVERSION)" fi # 1-2. Build Image/Image.gz make %{?_smp_mflags} # 1-3. Build dtbs make dtbs %{?_smp_mflags} # 1-4. Build modules make modules %{?_smp_mflags} %install QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT # 2-1. Destination directories mkdir -p %{buildroot}/boot mkdir -p %{buildroot}/lib/modules # 2-2. Install kernel binary and DTB %ifarch aarch64 install -m 644 arch/%{buildarch}/boot/Image %{buildroot}/boot/ install -m 644 arch/%{buildarch}/boot/dts/broadcom/bcm*.dtb %{buildroot}/boot/ %else install -m 644 arch/%{buildarch}/boot/zImage %{buildroot}/boot/ install -m 644 arch/%{buildarch}/boot/dts/bcm*.dtb %{buildroot}/boot/ %endif # 2-3. Install modules make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install # 2-4. Install boot binary files %ifarch aarch64 install -m 644 rpi4/boot/config_64bit.txt %{buildroot}/boot/config.txt %else install -m 644 rpi4/boot/config.txt %{buildroot}/boot/ %endif install -m 644 rpi4/boot/LICENCE.broadcom %{buildroot}/boot/ install -m 644 rpi4/boot/start*.elf %{buildroot}/boot/ install -m 644 rpi4/boot/fixup*.dat %{buildroot}/boot/ # 2-5. Install kernel headers make headers_install %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr # 3. Copy files for devel package mkdir -p %{buildroot}/boot/kernel/devel/kernel-devel-%{variant} rsync -r \ --include "/scripts/**.c" \ --exclude "/debug*.list" \ --exclude "/documentation.list" \ --exclude "/*.manifest" \ --exclude "/packaging/" \ --exclude "/.gbs.conf" \ --exclude "/.git**" \ --exclude ".gitignore" \ --exclude "*\.c" \ --exclude ".tmp_vmlinux*" \ --exclude ".*dtb*tmp" \ --exclude ".*dtb" \ --exclude "*.*tmp" \ --exclude "vmlinux" \ --exclude "Image" \ --exclude "zImage" \ --exclude "Image.gz" \ --exclude "*.cmd" \ --exclude "*.ko" \ --exclude "*.o" \ --exclude "*.S" \ --exclude "*.HEX" \ %{_builddir}/%{name}-%{version}/ %{buildroot}/boot/kernel/devel/kernel-devel-%{variant} %clean rm -rf %{buildroot} %files -n %{variant}-linux-kernel-modules /lib/modules/* %files -n %{variant}-linux-kernel-devel /boot/kernel/devel/* %files -n %{variant}-linux-kernel %license COPYING %ifarch aarch64 /boot/Image %else /boot/zImage %endif /boot/bcm*.dtb /boot/config.txt /boot/LICENCE.broadcom /boot/start*.elf /boot/fixup*.dat %files -n %{variant}-linux-kernel-headers /usr/include/*