1 # Ignore double dash in version for rpmbuild
2 %define _wrong_version_format_terminate_build 0
4 %define config_name tizen_bcm2711_defconfig
6 %define target_board rpi4
7 %define variant %{buildarch}-%{target_board}
9 Name: rpi4-linux-kernel
10 Summary: The Linux Kernel for Raspberry Pi4
16 Vendor: The Linux Community
17 URL: https://www.kernel.org
18 Source0: linux-kernel-%{version}.tar.xz
19 BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root
21 %define fullVersion %{version}-%{variant}
24 BuildRequires: module-init-tools
27 BuildRequires: libopenssl1.1-devel
30 The Linux Kernel, the operating system core itself
32 %package -n %{variant}-linux-kernel
34 Summary: Tizen kernel for %{target_board}
36 Provides: %{variant}-kernel-uname-r = %{fullVersion}
37 Provides: linux-kernel = %{version}-%{release}
39 %description -n %{variant}-linux-kernel
40 This package contains the Linux kernel for Tizen (arch %{buildarch}, target board %{target_board})
42 %package -n %{variant}-linux-kernel-modules
43 Summary: Kernel modules for %{target_board}
45 Provides: %{variant}-kernel-modules = %{fullVersion}
46 Provides: %{variant}-kernel-modules-uname-r = %{fullVersion}
48 %description -n %{variant}-linux-kernel-modules
49 Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board}
51 %package -n %{variant}-linux-kernel-devel
53 Summary: Linux support kernel map and etc for other packages
55 Provides: %{variant}-kernel-devel = %{fullVersion}
56 Provides: %{variant}-kernel-devel-uname-r = %{fullVersion}
58 %description -n %{variant}-linux-kernel-devel
59 This package provides kernel map and etc information.
62 %setup -q -n linux-kernel-%{version}
65 %{?asan:/usr/bin/gcc-unforce-options}
66 %{?ubsan:/usr/bin/gcc-unforce-options}
68 # Make sure EXTRAVERSION says what we want it to say
69 sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -%{variant}/" Makefile
71 # 1-1. Set config file
74 # 1-2. Build Image/Image.gz
78 make dtbs %{?_smp_mflags}
81 make modules %{?_smp_mflags}
84 QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT
86 # 2-1. Destination directories
87 mkdir -p %{buildroot}/boot
88 mkdir -p %{buildroot}/lib/modules
90 # 2-2. Install kernel binary and DTB
91 install -m 644 arch/%{buildarch}/boot/zImage %{buildroot}/boot/
92 install -m 644 arch/%{buildarch}/boot/dts/bcm*.dtb %{buildroot}/boot/
94 # 2-3. Install modules
95 make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install
97 # 2-4. Install boot binary files
98 install -m 644 rpi4/boot/config.txt %{buildroot}/boot/
99 install -m 644 rpi4/boot/LICENCE.broadcom %{buildroot}/boot/
100 install -m 644 rpi4/boot/bootcode.bin %{buildroot}/boot/
101 install -m 644 rpi4/boot/start*.elf %{buildroot}/boot/
102 install -m 644 rpi4/boot/fixup*.dat %{buildroot}/boot/
104 # 3-1. remove unnecessary files to prepare for devel package
105 find %{_builddir}/linux-kernel-%{version} -name ".tmp_vmlinux*" -delete
106 find %{_builddir}/linux-kernel-%{version} -name ".gitignore" -delete
107 find %{_builddir}/linux-kernel-%{version} -name "\.*dtb*tmp" -delete
108 find %{_builddir}/linux-kernel-%{version} -name "\.*dtb" -delete
109 find %{_builddir}/linux-kernel-%{version} -name "*\.*tmp" -delete
110 find %{_builddir}/linux-kernel-%{version} -name "vmlinux" -delete
111 find %{_builddir}/linux-kernel-%{version} -name "Image" -delete
112 find %{_builddir}/linux-kernel-%{version} -name "zImage" -delete
113 find %{_builddir}/linux-kernel-%{version} -name "Image.gz" -delete
114 find %{_builddir}/linux-kernel-%{version} -name "*.cmd" -delete
115 find %{_builddir}/linux-kernel-%{version} -name "*\.ko" -delete
116 find %{_builddir}/linux-kernel-%{version} -name "*\.o" -delete
117 find %{_builddir}/linux-kernel-%{version} -name "*\.S" -delete
118 find %{_builddir}/linux-kernel-%{version} -name "*\.HEX" -type f -delete
119 find %{_builddir}/linux-kernel-%{version} -name "*\.c" -not -path "%{_builddir}/linux-kernel-%{version}/scripts/*" -delete
121 # 3-2. move files for devel package
122 cp -r %{_builddir}/linux-kernel-%{version}/ %{_builddir}/kernel-devel-%{variant}/
124 # 4. Move files for each package
125 mkdir -p %{buildroot}/boot/kernel/devel
126 mv %{_builddir}/kernel-devel-%{variant} %{buildroot}/boot/kernel/devel/
132 %files -n %{variant}-linux-kernel-modules
135 %files -n %{variant}-linux-kernel-devel
138 %files -n %{variant}-linux-kernel
143 /boot/LICENCE.broadcom